diff options
| author | srdusr <trevorgray@srdusr.com> | 2023-02-01 23:53:42 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2023-02-01 23:53:42 +0200 |
| commit | b794a3a524567e0597c8565f043f3156720c318b (patch) | |
| tree | f0f6130c0e38317c541feceabcb00a793b3c0249 | |
| parent | 4ba9ff24fcf6fdd881901e94792c27db707c13a8 (diff) | |
| download | dotfiles-b794a3a524567e0597c8565f043f3156720c318b.tar.gz dotfiles-b794a3a524567e0597c8565f043f3156720c318b.zip | |
Commented out 'last search pattern'
| -rw-r--r-- | lua/user/keys.lua | 81 |
1 files changed, 60 insertions, 21 deletions
diff --git a/lua/user/keys.lua b/lua/user/keys.lua index f01a0c5..46333e1 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -91,8 +91,8 @@ map("n", "<leader>[", ":tabprev<CR>") map("n", "<leader>]", ":tabnext<CR>") -- "Zoom" a split window into a tab and/or close it ---map("n", "<Leader>,", ":tabnew %<CR>") ---map("n", "<Leader>.", ":tabclose<CR>") +map("n", "<Leader>,", ":tabnew %<CR>") +map("n", "<Leader>.", ":tabclose<CR>") -- Vim TABs map("n", "<leader>1", "1gt<CR>") @@ -152,7 +152,7 @@ map("n", "<leader>cd", ":cd %:p:h<CR>:pwd<CR>") map('n', '<leader>o', ':!xdg-open %<cr><cr>') -- Unsets the 'last search pattern' register by hitting return -map("n", "<CR>", "!silent :noh<CR><CR>") +--map("n", "<CR>", "!silent :noh<CR><CR>") -- Toggle completion map("n", "<Leader>tc", ":lua require('user.utils').toggle_completion()<CR>") @@ -263,6 +263,45 @@ vim.cmd([[ ]]) map("n", "<C-t>", ":call OpenLastClosed() <CR>") +-- Function to quickly open/hide terminal window inside vim +-- Terminal operation when +-- 1. terminal is open in split window, it closes the window (terminal still +-- running) +-- 2. terminal open in buffer, it moves window into split window +-- 3. no termial instance running then it opens new terminal instance in split +-- window +local function Term() + local terminal_buffer_number = vim.fn.bufnr("term://") + local terminal_window_number = vim.fn.bufwinnr("term://") + local window_count = vim.fn.winnr("$") + + if terminal_window_number > 0 and window_count > 1 then + vim.fn.execute(terminal_window_number .. "wincmd c") + elseif terminal_buffer_number > 0 and terminal_buffer_number ~= vim.fn.bufnr("%") then + vim.fn.execute("sb " .. terminal_buffer_number) + elseif terminal_buffer_number == vim.fn.bufnr("%") then + vim.fn.execute("bprevious | sb " .. terminal_buffer_number .. " | wincmd p") + else + vim.fn.execute("sp term://zsh") + end +end + +vim.api.nvim_create_user_command("Term", Term, { + desc = "Open terminal window", +}) + +map("n", "<C-w>g", vim.cmd.Term) +map("t", "<C-w>g", "<C-\\><C-n>") + +--map("n", "<M-b>",function +----local window_id = +-- local Toggle_float = vim.api.nvim_win_get_config() +--if vim.api.nvim_win_get_config(window_id).relative ~= '' then +-- vim.api.nvim_command("nvim_win_close()") +-- -- window with this window_id is floating +--end +--end +--) ---------------- Plugin Operations ---------------- -- Packer @@ -358,23 +397,23 @@ end map("n", "<leader>ww", ":lua Toggle_autopairs()<CR>", term_opts) -- Tabularize -vim.cmd([[ - vnoremap <expr> <Leader>mm ':Tabularize /^\s*\S.*\zs' . split(&commentstring, '%s')[0] . "<CR>" - nnoremap <expr> <Leader>mm ':Tabularize /^\s*\S.*\zs' . split(&commentstring, '%s')[0] . "<CR>" - "nnoremap <leader>i mc40A <esc>080lDgelD`cP - "vnoremap <leader>ii mc0f-20i<Space><Esc>`cdt=j -]]) +--vim.cmd([[ +-- vnoremap <expr> <Leader>mm ':Tabularize /^\s*\S.*\zs' . split(&commentstring, '%s')[0] . "<CR>" +-- nnoremap <expr> <Leader>mm ':Tabularize /^\s*\S.*\zs' . split(&commentstring, '%s')[0] . "<CR>" +-- "nnoremap <leader>i mc40A <esc>080lDgelD`cP +-- "vnoremap <leader>ii mc0f-20i<Space><Esc>`cdt=j +--]]) -- EasyAlign -vim.cmd([[ - " Start interactive EasyAlign in visual mode (e.g. vipga) - xmap ga <Plug>(EasyAlign) - " Start interactive EasyAlign for a motion/text object (e.g. gaip) - nmap ga <Plug>(EasyAlign) - if !exists('g:easy_align_delimiters') - let g:easy_align_delimiters = {} - endif - let g:easy_align_delimiters['--'] = { 'pattern': '--', 'ignore_groups': ['String'] } - nnoremap <F1> 21A <Esc>d21\| - imap <F1> <Esc><F1>a -]]) +--vim.cmd([[ +-- " Start interactive EasyAlign in visual mode (e.g. vipga) +-- xmap ga <Plug>(EasyAlign) +-- " Start interactive EasyAlign for a motion/text object (e.g. gaip) +-- nmap ga <Plug>(EasyAlign) +-- if !exists('g:easy_align_delimiters') +-- let g:easy_align_delimiters = {} +-- endif +-- let g:easy_align_delimiters['--'] = { 'pattern': '--', 'ignore_groups': ['String'] } +-- nnoremap <F1> 21A <Esc>d21\| +-- imap <F1> <Esc><F1>a +--]]) |
