diff --git a/vim/.vim/after/plugin/mappings/fugitive.vim b/vim/.vim/after/plugin/mappings/fugitive.vim new file mode 100644 index 0000000..4e4c9a9 --- /dev/null +++ b/vim/.vim/after/plugin/mappings/fugitive.vim @@ -0,0 +1,16 @@ +" Visual bindings for merging diffs as in normal mode +xnoremap dp :diffput +xnoremap do :diffget + +" Git add current file +nnoremap ga :Git add %:p +" Open status window +nnoremap gs :Gstatus +" Open diff view of current buffer: the up/left window is the current index +nnoremap gd :Gdiffsplit! +" Open current file log in new tab, populate its location list with history +nnoremap gl :spT:Gllog --follow -- %:p +" Open a buffer to the left with blame information +nnoremap gb :Gblame +" Commit staged changes, open a new tab just for it +nnoremap gc :Gcommit -v -q diff --git a/vim/.vim/after/plugin/mappings/fzf.vim b/vim/.vim/after/plugin/mappings/fzf.vim new file mode 100644 index 0000000..9060390 --- /dev/null +++ b/vim/.vim/after/plugin/mappings/fzf.vim @@ -0,0 +1,20 @@ +" Only git-tracked files, Vim needs to be in a Git repository +nnoremap fg :GFiles +" All files +nnoremap ff :Files +" Currently open buffers +nnoremap fb :Buffers +" Buffer history +nnoremap fh :History +" Tags in buffer +nnoremap ft :BTags +" Tags in all project files +nnoremap fT :Tags +" Snippets for the current fileytpe (using Ultisnips) +nnoremap fs :Snippets +" All available commands +nnoremap f: :Commands +" All commits (using fugitive) +nnoremap fc :Commits +" All commits for the current buffer (using fugitive) +nnoremap fC :BCommits diff --git a/vim/.vim/after/plugin/mappings/misc.vim b/vim/.vim/after/plugin/mappings/misc.vim new file mode 100644 index 0000000..5222b8e --- /dev/null +++ b/vim/.vim/after/plugin/mappings/misc.vim @@ -0,0 +1,15 @@ +" Yank until the end of line with Y, to be more consistent with D and C +nnoremap Y y$ + +" Mappings for working with vimrc +nnoremap ev :edit $MYVIMRC +nnoremap es :source $MYVIMRC + +" Run make silently, then skip the 'Press ENTER to continue' +noremap m :silent! :make! \| :redraw! + +" Remove search-highlighting +noremap :nohls + +" Explicit map for vim-cheat40 which seems to fail because of my map +map ? :Cheat40 diff --git a/vim/.vim/after/plugin/mappings/qf.vim b/vim/.vim/after/plugin/mappings/qf.vim new file mode 100644 index 0000000..c5e353b --- /dev/null +++ b/vim/.vim/after/plugin/mappings/qf.vim @@ -0,0 +1,11 @@ +" Next and previous in quick-fix list +nmap fn (qf_qf_next) +nmap fp (qf_qf_previous) + +" Next and previous in location list +nmap ln (qf_loc_next) +nmap lp (qf_loc_previous) + +" Toggle quick-fix and location lists +nmap tf (qf_qf_toggle) +nmap tl (qf_loc_toggle) diff --git a/vim/.vim/after/plugin/mappings/unimpaired.vim b/vim/.vim/after/plugin/mappings/unimpaired.vim new file mode 100644 index 0000000..53457bd --- /dev/null +++ b/vim/.vim/after/plugin/mappings/unimpaired.vim @@ -0,0 +1,7 @@ +" Better fr layout mappings for vim-unimpaired and other '[' and ']' commands +nmap ( [ +nmap ) ] +omap ( [ +omap ) ] +xmap ( [ +xmap ) ] diff --git a/vim/.vim/plugin/mappings/leader.vim b/vim/.vim/plugin/mappings/leader.vim new file mode 100644 index 0000000..0aba0b2 --- /dev/null +++ b/vim/.vim/plugin/mappings/leader.vim @@ -0,0 +1,6 @@ +" Map leader to space (needs the noremap trick to avoid moving the cursor) +nnoremap +let mapleader=" " + +" Map localleader to '!' (if I want to filter text, I use visual mode) +let maplocalleader="!" diff --git a/vim/.vimrc b/vim/.vimrc index 9e32684..c795e74 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -324,98 +324,6 @@ let g:fastfold_fold_command_suffixes=[ " }}} " }}} -" Mappings {{{ -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Miscellaneous mappings {{{ -"""""""""""""""""""""""" -" Yank until the end of line with Y, to be more consistent with D and C -nnoremap Y y$ - -" Map leader to space (needs the noremap trick) -nnoremap -let mapleader=" " -" Map localleader to '!' (if I want to filter text, I use visual mode) -let maplocalleader="!" - -" Mappings for working with this file. -map ev :edit $MYVIMRC -map es :source $MYVIMRC - -" Run make silently, then skip the 'Press ENTER to continue' -noremap m :silent! :make! \| :redraw! - -" Remove search-highlighting -noremap :nohls - -" Better fr layout mappings for vim-unimpaired and other '[' and ']' commands -nmap ( [ -nmap ) ] -omap ( [ -omap ) ] -xmap ( [ -xmap ) ] - -" Map for vim-cheat40 which seems to fail because of my to map -map ? :Cheat40 -" }}} - -" Mapping for quickfix bindings {{{ -""""""""""""""""""""""""""""""" -" Next and previous in quick-fix list -nmap fn (qf_qf_next) -nmap fp (qf_qf_previous) -" Next and previous in location list -nmap ln (qf_loc_next) -nmap lp (qf_loc_previous) -" Toggle quick-fix and location lists -nmap tf (qf_qf_toggle) -nmap tl (qf_loc_toggle) -" }}} - -" Fuzzy file finder bindings {{{ -"""""""""""""""""""""""""""" -" Only git-tracked files, Vim needs to be in a Git repository -nmap fg :GFiles -" All files -nmap ff :Files -" Currently open buffers -nmap fb :Buffers -" Buffer history -nmap fh :History -" Tags in buffer -nmap ft :BTags -" Tags in all project files -nmap fT :Tags -" Snippets for the current fileytpe (using Ultisnips) -nmap fs :Snippets -" All available commands -nmap f: :Commands -" All commits (using fugitive) -nmap fc :Commits -" All commits for the current buffer (using fugitive) -nmap fC :BCommits -" }}} - -" Git and diff mappings {{{ -""""""""""""""""""""""" -" Visual bindings for merging diffs as in normal mode -xnoremap dp :diffput -xnoremap do :diffget -" Git add current file -nnoremap ga :Git add %:p -" Open status window -nnoremap gs :Gstatus -" Open diff view of current buffer: the up/left window is the current index -nnoremap gd :Gdiffsplit! -" Open current file log in new tab, populate its location list with history -nnoremap gl :spT:Gllog --follow -- %:p -" Open a buffer to the left with blame information -nnoremap gb :Gblame -" Commit staged changes, open a new tab just for it -nnoremap gc :Gcommit -v -q -" }}} -" }}} - " Import settings when inside a git repository {{{ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let git_settings=system("git config --get vim.settings")