nvim/keybindings.vim
2023-08-13 21:39:44 -07:00

154 lines
6.4 KiB
VimL

nmap <C-d> <C-d>zz
nmap <C-u> <C-u>zz
nmap n nzzzv
nmap N Nzzzv
nmap <silent> <leader>x <cmd>!chmod +x %<CR>
xnoremap <leader>p "_dP
nnoremap <F4> :set paste!<Bar>set paste?<CR>
nnoremap <F5> :set spell!<Bar>set spell?<CR>
" reselect visual selection after indent
vnoremap < <gv
vnoremap > >gv
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
" for toggling/hiding the split-term
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>
nnoremap <C-J> :bnext<CR>
nnoremap <C-K> :bprev<CR>
nnoremap <C-T> :wa<CR>:FloatermToggle floatterm<CR>
" open file under cursor, create if necessary
nnoremap // :Telescope current_buffer_fuzzy_find<CR>
nnoremap ?? :BLines<CR>
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 Q !!$SHELL<CR>
nnoremap rn :lua vim.lsp.buf.rename()<CR>
nnoremap <leader>as :FloatermNew --title=aniwrapper aniwrapper -qtdoomone -D144<CR>
nnoremap <leader>ad :FloatermNew --title=aniwrapper ani-cli -q720p -cd/home/sudacode/Videos/sauce -D144<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>
nnoremap <leader>cd :Telescope diagnostics<CR>
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>
nnoremap <silent> <leader>Ce :ChatGPTRun explain<CR>
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>
xnoremap <silent> <leader>Ce :ChatGPTRun explain<CR>
nnoremap <leader>fb :Telescope file_browser<cr>
nnoremap <leader>ff :Telescope find_files<cr>
nnoremap <leader>fg :Telescope live_grep<cr>
nnoremap <leader>fh :Telescope oldfiles<cr>
nnoremap <leader>fd :e ~/.config/nvim/init.vim<cr>
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>
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>
nnoremap <leader>hc :Telescope commands<CR>
nnoremap <leader>hv :Telescope help_tags<cr>
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>
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>
nnoremap <leader>ob :Telescope file_browser<CR>
nnoremap <leader>oc :ChatGPT<CR>
nnoremap <leader>oB :FloatermNew --title=bpytop --opener=vsplit bpytop<CR>
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>r :NvimTreeRefresh<CR>
nnoremap <Leader>sl :<C-u>SessionLoad<CR>
nnoremap <Leader>ss :<C-u>SessionSave<CR>
nnoremap <leader>sc :nohls<Cr>
nnoremap <leader>sC :Telescope commands<Cr>
nnoremap <leader>sf :Telescope find_files<Cr>
nnoremap <leader>sh :Telescope command_history<CR>
nnoremap <leader>sm :Telescope man_pages<CR>
nnoremap <leader>s/ :Telescope search_history<CR>
nnoremap <silent> <Leader>tc :Telescope colorscheme<CR>
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>
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>
nnoremap <leader>y "+
vmap <leader>y "+