1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

add <C-U> in mappings that use command where appropriate

This commit is contained in:
jdhao 2020-10-19 22:59:27 +08:00
parent bb242b7699
commit d06770efef
4 changed files with 33 additions and 33 deletions

View File

@ -1 +1 @@
nnoremap <F9> :w <CR> :!g++ -Wall -std=c++11 % -o %<&&./%<<CR>
nnoremap <F9> :<C-U>w <CR> :!g++ -Wall -std=c++11 % -o %<&&./%<<CR>

View File

@ -1,5 +1,5 @@
if exists(':AsyncRun')
nnoremap <silent> <F9> :AsyncRun python -u "%"<CR>
nnoremap <silent> <F9> :<C-U>AsyncRun python -u "%"<CR>
endif
" Do not wrap Python source code.

View File

@ -23,29 +23,29 @@ nnoremap <leader>p m`o<ESC>p``
nnoremap <leader>P m`O<ESC>p``
" Shortcut for faster save and quit
nnoremap <silent> <leader>w :update<CR>
nnoremap <silent> <leader>w :<C-U>update<CR>
" Saves the file if modified and quit
nnoremap <silent> <leader>q :x<CR>
nnoremap <silent> <leader>q :<C-U>x<CR>
" Quit all opened buffers
nnoremap <silent> <leader>Q :qa<CR>
nnoremap <silent> <leader>Q :<C-U>qa<CR>
" Navigation in the location and quickfix list
nnoremap <silent> [l :lprevious<CR>zv
nnoremap <silent> ]l :lnext<CR>zv
nnoremap <silent> [L :lfirst<CR>zv
nnoremap <silent> ]L :llast<CR>zv
nnoremap <silent> [q :cprevious<CR>zv
nnoremap <silent> ]q :cnext<CR>zv
nnoremap <silent> [Q :cfirst<CR>zv
nnoremap <silent> ]Q :clast<CR>zv
nnoremap <silent> [l :<C-U>lprevious<CR>zv
nnoremap <silent> ]l :<C-U>lnext<CR>zv
nnoremap <silent> [L :<C-U>lfirst<CR>zv
nnoremap <silent> ]L :<C-U>llast<CR>zv
nnoremap <silent> [q :<C-U>cprevious<CR>zv
nnoremap <silent> ]q :<C-U>cnext<CR>zv
nnoremap <silent> [Q :<C-U>cfirst<CR>zv
nnoremap <silent> ]Q :<C-U>clast<CR>zv
" Close location list or quickfix list if they are present,
" see https://superuser.com/q/355325/736190
nnoremap<silent> \x :windo lclose <bar> cclose<CR>
nnoremap<silent> \x :<C-U>windo lclose <bar> cclose<CR>
" Close a buffer and switching to another buffer, do not close the
" window, see https://stackoverflow.com/q/4465095/6064933
nnoremap <silent> \d :bprevious <bar> bdelete #<CR>
nnoremap <silent> \d :<C-U>bprevious <bar> bdelete #<CR>
" 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 <expr> <C-d> pumvisible() ? "\<PageDown>" : "\<C-d>"
inoremap <expr> <C-u> pumvisible() ? "\<PageUp>" : "\<C-u>"
" Edit and reload init.vim quickly
nnoremap <silent> <leader>ev :tabnew $MYVIMRC <bar> tcd %:h<cr>
nnoremap <silent> <leader>sv :silent update $MYVIMRC <bar> source $MYVIMRC <bar>
nnoremap <silent> <leader>ev :<C-U>tabnew $MYVIMRC <bar> tcd %:h<cr>
nnoremap <silent> <leader>sv :<C-U>silent update $MYVIMRC <bar> source $MYVIMRC <bar>
\ echomsg "Nvim config successfully reloaded!"<cr>
" Reselect the text that has just been pasted, see also https://stackoverflow.com/a/4317090/6064933.
@ -131,15 +131,15 @@ xnoremap <C-H> :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 <silent> <leader>cd :lcd %:p:h<CR>:pwd<CR>
nnoremap <silent> <leader>cd :<C-U>lcd %:p:h<CR>:pwd<CR>
" Use Esc to quit builtin terminal
tnoremap <ESC> <C-\><C-n>
" Toggle spell checking (autosave does not play well with z=, so we disable it
" when we are doing spell checking)
nnoremap <silent> <F11> :set spell! <bar> :AutoSaveToggle<cr>
inoremap <silent> <F11> <C-O>:set spell! <bar> :AutoSaveToggle<cr>
nnoremap <silent> <F11> :<C-U>set spell! <bar> :AutoSaveToggle<cr>
inoremap <silent> <F11> <C-O>:<C-U>set spell! <bar> :AutoSaveToggle<cr>
" Decrease indent level in insert mode with shift+tab
inoremap <S-Tab> <ESC><<i
@ -152,21 +152,21 @@ nnoremap cc "_cc
xnoremap c "_c
" Remove trailing whitespace characters
nnoremap <silent> <leader><Space> :call utils#StripTrailingWhitespaces()<CR>
nnoremap <silent> <leader><Space> :<C-U>call utils#StripTrailingWhitespaces()<CR>
" check the syntax group of current cursor position
nnoremap <silent> <leader>st :call utils#SynGroup()<CR>
nnoremap <silent> <leader>st :<C-U>call utils#SynGroup()<CR>
" Clear highlighting
if maparg('<C-L>', 'n') ==# ''
nnoremap <silent> <C-L> :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
nnoremap <silent> <C-L> :<C-U>nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
endif
" Copy entire buffer.
nnoremap <silent> <leader>y :%y<CR>
nnoremap <silent> <leader>y :<C-U>%y<CR>
" Toggle cursor column
nnoremap <silent> <leader>cl :call utils#ToggleCursorCol()<CR>
nnoremap <silent> <leader>cl :<C-U>call utils#ToggleCursorCol()<CR>
" Move current line up and down
nnoremap <silent> <A-k> <Cmd>call utils#SwitchLine(line('.'), 'up')<CR>

View File

@ -469,11 +469,11 @@ let g:Lf_ShortcutF = ''
let g:Lf_ShortcutB = ''
" Search files in popup window
nnoremap <silent> <leader>f :Leaderf file --popup<CR>
nnoremap <silent> <leader>f :<C-U>Leaderf file --popup<CR>
" Search vim help files
nnoremap <silent> <leader>h :Leaderf help --popup<CR>
nnoremap <silent> <leader>h :<C-U>Leaderf help --popup<CR>
" Search tags in current buffer
nnoremap <silent> <leader>t :Leaderf bufTag --popup<CR>
nnoremap <silent> <leader>t :<C-U>Leaderf bufTag --popup<CR>
"}}
"{{ URL related
@ -491,7 +491,7 @@ endif
"{{ Navigation and tags
""""""""""""""""""""""""""" tagbar settings """"""""""""""""""""""""""""""""""
" Shortcut to toggle tagbar window
" nnoremap <silent> <Space>t :TagbarToggle<CR>
" nnoremap <silent> <Space>t :<C-U>TagbarToggle<CR>
" Add support for markdown files in tagbar.
if g:is_win
@ -528,7 +528,7 @@ let g:vista_echo_cursor = 0
" Stay in current window when vista window is opened
let g:vista_stay_on_open = 0
nnoremap <silent> <Space>t :Vista!!<CR>
nnoremap <silent> <Space>t :<C-U>Vista!!<CR>
function! s:close_vista_win() abort
if winnr('$') == 1 && getbufvar(bufnr(), '&filetype') ==# 'vista'
@ -659,8 +659,8 @@ if g:is_win || g:is_mac
let g:mkdp_auto_close = 0
" Shortcuts to start and stop markdown previewing
nnoremap <silent> <M-m> :MarkdownPreview<CR>
nnoremap <silent> <M-S-m> :MarkdownPreviewStop<CR>
nnoremap <silent> <M-m> :<C-U>MarkdownPreview<CR>
nnoremap <silent> <M-S-m> :<C-U>MarkdownPreviewStop<CR>
endif
""""""""""""""""""""""""vim-markdownfootnotes settings""""""""""""""""""""""""
@ -876,6 +876,6 @@ if exists('g:started_by_firenvim') && g:started_by_firenvim
endif
""""""""""""""""""""""""""""""nvim-gdb settings""""""""""""""""""""""""""""""
nnoremap <leader>dp :GdbStartPDB python -m pdb %<CR>
nnoremap <leader>dp :<C-U>GdbStartPDB python -m pdb %<CR>
"}}
"}