From d06770efeff8b9e35d74895fa978fa7de1348eb3 Mon Sep 17 00:00:00 2001 From: jdhao Date: Mon, 19 Oct 2020 22:59:27 +0800 Subject: add in mappings that use command where appropriate --- mappings.vim | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'mappings.vim') diff --git a/mappings.vim b/mappings.vim index fda96b9..b777216 100644 --- a/mappings.vim +++ b/mappings.vim @@ -23,29 +23,29 @@ nnoremap p m`op`` nnoremap P m`Op`` " Shortcut for faster save and quit -nnoremap w :update +nnoremap w :update " Saves the file if modified and quit -nnoremap q :x +nnoremap q :x " Quit all opened buffers -nnoremap Q :qa +nnoremap Q :qa " Navigation in the location and quickfix list -nnoremap [l :lpreviouszv -nnoremap ]l :lnextzv -nnoremap [L :lfirstzv -nnoremap ]L :llastzv -nnoremap [q :cpreviouszv -nnoremap ]q :cnextzv -nnoremap [Q :cfirstzv -nnoremap ]Q :clastzv +nnoremap [l :lpreviouszv +nnoremap ]l :lnextzv +nnoremap [L :lfirstzv +nnoremap ]L :llastzv +nnoremap [q :cpreviouszv +nnoremap ]q :cnextzv +nnoremap [Q :cfirstzv +nnoremap ]Q :clastzv " Close location list or quickfix list if they are present, " see https://superuser.com/q/355325/736190 -nnoremap \x :windo lclose cclose +nnoremap \x :windo lclose cclose " Close a buffer and switching to another buffer, do not close the " window, see https://stackoverflow.com/q/4465095/6064933 -nnoremap \d :bprevious bdelete # +nnoremap \d :bprevious bdelete # " Insert a blank line below or above current line (do not move the cursor), " see https://stackoverflow.com/a/16136133/6064933 @@ -115,8 +115,8 @@ inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" " Edit and reload init.vim quickly -nnoremap ev :tabnew $MYVIMRC tcd %:h -nnoremap sv :silent update $MYVIMRC source $MYVIMRC +nnoremap ev :tabnew $MYVIMRC tcd %:h +nnoremap sv :silent update $MYVIMRC source $MYVIMRC \ echomsg "Nvim config successfully reloaded!" " Reselect the text that has just been pasted, see also https://stackoverflow.com/a/4317090/6064933. @@ -131,15 +131,15 @@ xnoremap :s/ " Change current working directory locally and print cwd after that, " see https://vim.fandom.com/wiki/Set_working_directory_to_the_current_file -nnoremap cd :lcd %:p:h:pwd +nnoremap cd :lcd %:p:h:pwd " Use Esc to quit builtin terminal tnoremap " Toggle spell checking (autosave does not play well with z=, so we disable it " when we are doing spell checking) -nnoremap :set spell! :AutoSaveToggle -inoremap :set spell! :AutoSaveToggle +nnoremap :set spell! :AutoSaveToggle +inoremap :set spell! :AutoSaveToggle " Decrease indent level in insert mode with shift+tab inoremap < :call utils#StripTrailingWhitespaces() +nnoremap :call utils#StripTrailingWhitespaces() " check the syntax group of current cursor position -nnoremap st :call utils#SynGroup() +nnoremap st :call utils#SynGroup() " Clear highlighting if maparg('', 'n') ==# '' - nnoremap :nohlsearch=has('diff')?'diffupdate':'' + nnoremap :nohlsearch=has('diff')?'diffupdate':'' endif " Copy entire buffer. -nnoremap y :%y +nnoremap y :%y " Toggle cursor column -nnoremap cl :call utils#ToggleCursorCol() +nnoremap cl :call utils#ToggleCursorCol() " Move current line up and down nnoremap call utils#SwitchLine(line('.'), 'up') -- cgit v1.2.3