nvim/keybindings.vim

192 lines
8.4 KiB
VimL
Raw Normal View History

2023-08-13 21:39:44 -07:00
nmap <C-u> <C-u>zz
nmap n nzzzv
nmap N Nzzzv
2023-08-15 17:07:20 -07:00
" paste visually without yanking to clipboard
2023-08-13 21:39:44 -07:00
xnoremap <leader>p "_dP
2022-11-02 22:50:13 -07:00
" reselect visual selection after indent
vnoremap < <gv
vnoremap > >gv
2023-08-15 17:07:20 -07:00
" move selected line(s) up or down and respect indent
2023-08-13 21:39:44 -07:00
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
2023-08-15 17:07:20 -07:00
" search
nnoremap // :Telescope current_buffer_fuzzy_find<CR>
nnoremap ?? :Telescope lsp_document_symbols<CR>
" nnoremap Q !!$SHELL<CR>
" nnoremap rn :lua vim.lsp.buf.rename()<CR>
nnoremap <C-J> :bnext<CR>
nnoremap <C-K> :bprev<CR>
nnoremap <C-T> :wa<CR>:FloatermToggle floatterm<CR>
2022-11-02 22:50:13 -07:00
tnoremap <C-T> <C-\><C-n>:FloatermToggle floatterm<CR>
tnoremap <Esc> <C-\><C-n>
tnoremap <leader>tt <C-\><C-N>:FloatermToggle split-term<CR>
tnoremap <leader>tf <C-\><C-N>:FloatermToggle floatterm<CR>
tnoremap <leader>tp <C-\><C-N>:FloatermToggle ipython<CR>
tnoremap <leader>tP <C-\><C-N>:FloatermToggle ipython-full<CR>
2023-08-13 02:12:02 -07:00
nnoremap gA :lua vim.lsp.buf.code_actions()<CR>
nnoremap gd :Telescope lsp_definitions<CR>
nnoremap gDc :Telescope lsp_implementations<CR>
nnoremap gDf :Telescope lsp_definitions<CR>
nnoremap gF :edit <cfile><cr>
nnoremap gT :Telescope lsp_type_definitions<CR>
nnoremap gb :Gitsigns blame_line<CR>
nnoremap gi :Telescope lsp_implementations<CR>
nnoremap gj :Telescope jumplist<CR>
nnoremap gl :lua vim.lsp.buf.code_lens()<CR>
nnoremap gr :Telescope lsp_references<CR>
nnoremap gs :lua vim.lsp.buf.signature_help()<CR>
nnoremap <leader>bb :Telescope buffers<CR>
nnoremap <leader>bk :bdelete<CR>
nnoremap <leader>bn :bnext<CR>
nnoremap <leader>bp :bprev<CR>
nnoremap <leader>ca :lua vim.lsp.buf.code_action()<CR>
2023-08-15 17:07:20 -07:00
nnoremap <leader>cA :lua vim.lsp.buf.code_action()<CR>
2023-08-13 02:12:02 -07:00
nnoremap <leader>cd :Telescope diagnostics<CR>
2023-08-15 11:11:38 -07:00
nnoremap <leader>cDn :lua vim.diagnostic.goto_next()<CR>
nnoremap <leader>cDp :lua vim.diagnostic.goto_prev()<CR>
nnoremap <leader>cl :lua vim.diagnostic.setloclist()<CR>
2023-08-13 02:12:02 -07:00
nnoremap <silent> <leader>cp :vert Copilot panel<CR>
nnoremap <silent> <leader>Ci :lua require('chatgpt').edit_with_instructions()<CR>
nnoremap <silent> <leader>Cd :ChatGPTRun docstring<CR>
nnoremap <silent> <leader>Ct :ChatGPTRun add_tests<CR>
nnoremap <silent> <leader>Co :ChatGPTRun optimize_code<CR>
nnoremap <silent> <leader>Cs :ChatGPTRun summarize<CR>
nnoremap <silent> <leader>Cf :ChatGPTRun fix_bugs<CR>
2023-08-15 17:07:20 -07:00
nnoremap <silent> <leader>Ce :ChatGPTRun explain_code<CR>
2023-08-13 21:39:44 -07:00
xnoremap <silent> <leader>Ci :lua require('chatgpt').edit_with_instructions()<CR>
xnoremap <silent> <leader>Cd :ChatGPTRun docstring<CR>
xnoremap <silent> <leader>Ct :ChatGPTRun add_tests<CR>
xnoremap <silent> <leader>Co :ChatGPTRun optimize_code<CR>
xnoremap <silent> <leader>Cs :ChatGPTRun summarize<CR>
xnoremap <silent> <leader>Cf :ChatGPTRun fix_bugs<CR>
2023-08-15 17:07:20 -07:00
xnoremap <silent> <leader>Ce :ChatGPTRun explain_code<CR>
2022-11-02 22:50:13 -07:00
2023-08-15 11:11:38 -07:00
nnoremap <leader>db :lua require("dap").toggle_breakpoint()<CR>
nnoremap <leader>dc :lua require("dap").continue()<CR>
nnoremap <leader>di :lua require("dap").step_into()<CR>
nnoremap <leader>do :lua require("dap").step_over()<CR>
nnoremap <leader>dO :lua require("dap").step_out()<CR>
nnoremap <leader>dr :lua require("dap").repl.open()<CR>
nnoremap <leader>dl :lua require("dap").run_last()<CR>
nnoremap <leader>dh :lua require("dap.ui.widgets").hover()<CR>
nnoremap <leader>dp :lua require("dap.ui.widgets").preview()<CR>
nnoremap <leader>df :lua require('dap.ui.widgets').centered_float(require('dap.ui.widgets').frames)<CR>
nnoremap <leader>ds :lua require('dap.ui.widgets').centered_float(require('dap.ui.widgets').scopes)<CR>
nnoremap <leader>dut :lua require("dapui").toggle()<CR>
nnoremap <leader>duo :lua require("dapui").open()<CR>
nnoremap <leader>duc :lua require("dapui").close()<CR>
nnoremap <leader>dPm :lua require("dap-python").test_method()<CR>
nnoremap <leader>dPc :lua require("dap-python").test_class()<CR>
nnoremap <leader>dPs :lua require("dap-python").debug_selection()<CR>
vnoremap <leader>dh :lua require("dap.ui.widgets").hover()<CR>
vnoremap <leader>dp :lua require("dap.ui.widgets").preview()<CR>
vnoremap <leader>dpe :lua require("dapui").eval()<CR>
nnoremap <F10> :lua require('dap').step_over()<CR>
nnoremap <F11> :lua require('dap').step_into()<CR>
nnoremap <F12> :lua require('dap').step_out()<CR>
2023-08-15 23:31:31 -07:00
nnoremap <leader>D :Dotenv .env<CR>
nnoremap <leader>ec :e ~/.config/nvim/init.vim<CR>
nnoremap <leader>ek :e ~/.config/nvim/keybindings.vim<CR>
nnoremap <leader>ep :e ~/.config/nvim/lua/plugins.lua<CR>
nnoremap <leader>es :e ~/.config/nvim/lua/settings.lua<CR>
2023-02-16 10:26:53 -08:00
nnoremap <leader>fb :Telescope file_browser<cr>
2022-11-02 22:50:13 -07:00
nnoremap <leader>ff :Telescope find_files<cr>
nnoremap <leader>fg :Telescope live_grep<cr>
2023-08-15 23:31:31 -07:00
nnoremap <leader>fr :Telescope oldfiles<cr>
2022-11-02 22:50:13 -07:00
2023-08-13 02:12:02 -07:00
nnoremap <leader>gb :Gitsigns blame_line<CR>
nnoremap <leader>gc :Telescope git_commits<CR>
nnoremap <leader>gf :Telescope git_files<CR>
nnoremap <leader>gg :FloatermNew --title=lazygit --width=1.0 --height=1.0 --opener=vsplit lazygit<CR>
2022-11-02 22:50:13 -07:00
nnoremap gP <cmd>lua require('goto-preview').close_all_win()<CR>
nnoremap gR <cmd>Telescope lsp_references<cr>
nnoremap gpc <cmd>lua require('goto-preview').close_all_win()<CR>
nnoremap gpd <cmd>lua require('goto-preview').goto_preview_definition()<CR>
nnoremap gpi <cmd>lua require('goto-preview').goto_preview_implementation()<CR>
2023-08-13 02:12:02 -07:00
nnoremap <leader>hc :Telescope commands<CR>
2023-08-15 11:11:38 -07:00
nnoremap <leader>hdc :Telescope dap commands<CR>
nnoremap <leader>hdC :Telescope dap configurations<CR>
nnoremap <leader>hdb :Telescope dap list_breakpoints<CR>
nnoremap <leader>hdv :Telescope dap variables<CR>
nnoremap <leader>hdf :Telescope dap frames<CR>
nnoremap <leader>hv :Telescope vim_options<cr>
2023-08-13 02:12:02 -07:00
nnoremap <leader>hk :Telescope keymaps<CR>
nnoremap <leader>hs :Telescope spell_suggest<CR>
nnoremap <leader>isp :-1read $HOME/Templates/python.py<CR>4jw
nnoremap <leader>j :AnyJump<CR>
nnoremap K :lua vim.lsp.buf.hover()<CR>
nnoremap <leader>ld :Telescope lsp_definitions<CR>
2023-08-15 11:11:38 -07:00
nnoremap <leader>lD :Telescope diagnostics<CR>
2023-08-13 02:12:02 -07:00
nnoremap <leader>la :lua vim.lsp.buf.code_action()<CR>
nnoremap <leader>lci :Telescope lsp_incoming_calls<CR>
nnoremap <leader>lco :Telescope lsp_outgoing_calls<CR>
nnoremap <leader>lh :lua vim.lsp.buf.signature_help()<CR>
nnoremap <leader>li :Telescope lsp_implementations<CR>
nnoremap <leader>lr :Telescope lsp_references<CR>
nnoremap <leader>lR :lua vim.lsp.buf.rename()<CR>
nnoremap <leader>ls :Telescope lsp_document_symbols<CR>
nnoremap <leader>lt :Telescope lsp_type_definitions<CR>
nnoremap <leader>lw :Telescope lsp_dynamic_workspace_symbols<CR>
nnoremap <leader>n :NvimTreeToggle<CR>
2023-08-15 11:11:38 -07:00
" nnoremap <leader>r :NvimTreeRefresh<CR>
2023-08-13 02:12:02 -07:00
nnoremap <leader>ob :Telescope file_browser<CR>
nnoremap <leader>oc :ChatGPT<CR>
2023-08-15 11:11:38 -07:00
nnoremap <leader>oC :e ~/.config/nvim/init.vim<CR>
nnoremap <leader>oB :FloatermNew --title=btop --opener=vsplit btop<CR>
2023-08-13 02:12:02 -07:00
nnoremap <leader>od :FloatermNew --title=lazydocker --opener=vsplit lazydocker<CR>
nnoremap <leader>of :wa<CR>:FloatermToggle floatterm<CR>
nnoremap <leader>oh :FloatermNew --title=floaterm --name=split-term --opener=edit --wintype=split --position=botright --height=0.45<CR>
nnoremap <leader>on :FloatermNew --title=ncmpcpp --opener=vsplit ncmpcpp<CR>
nnoremap <leader>op :FloatermNew --title=ipython --name=ipython --opener=split --wintype=vsplit --position=botright --width=0.5 ipython<CR>
nnoremap <leader>oP :FloatermNew --title=ipython-full --name=ipython-full --opener=edit --width=1.0 --height=1.0 ipython<CR>
nnoremap <leader>or :FloatermNew --title=ranger --opener=vsplit ranger --cmd="cd $PWD"<CR>
nnoremap <leader>ot :FloatermNew --title=floaterm --name=split-term --opener=edit --wintype=vsplit --position=botright --width=0.5<CR>
nnoremap <leader>sc :nohls<Cr>
nnoremap <leader>sC :Telescope commands<Cr>
nnoremap <leader>sf :Telescope find_files<Cr>
2023-08-15 11:11:38 -07:00
nnoremap <leader>sg :Telescope glyph<Cr>
2023-08-13 02:12:02 -07:00
nnoremap <leader>sh :Telescope command_history<CR>
nnoremap <leader>sm :Telescope man_pages<CR>
nnoremap <leader>s/ :Telescope search_history<CR>
2022-11-02 22:50:13 -07:00
nnoremap <silent> <Leader>tc :Telescope colorscheme<CR>
2023-08-13 02:12:02 -07:00
nnoremap <silent> <leader>tf :wa<CR>:FloatermToggle floatterm<CR>
nnoremap <silent> <leader>tp :FloatermToggle ipython<CR>
nnoremap <silent> <leader>tP :FloatermToggle ipython-full<CR>
nnoremap <silent> <leader>tt :FloatermToggle split-term<CR>
2023-08-15 23:31:31 -07:00
nnoremap <silent> <leader>td :DBUIToggle<CR>
2022-11-02 22:50:13 -07:00
2023-08-13 02:12:02 -07:00
nnoremap <leader>wa :lua vim.lsp.buf.add_workspace_folder()<CR>
nnoremap <leader>wl :lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>
nnoremap <leader>wr :lua vim.lsp.buf.remove_workspace_folder()<CR>
2022-11-02 22:50:13 -07:00
2023-08-15 11:11:38 -07:00
nmap <silent> <leader>x <cmd>!chmod +x %<CR>
2023-08-13 02:12:02 -07:00
nnoremap <leader>y "+
2022-11-02 22:50:13 -07:00
vmap <leader>y "+