Skip to content

Commit

Permalink
feat: add key mappings to move current line up and down
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreytse committed Aug 14, 2024
1 parent 3ea6376 commit 370c340
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions nvim/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ nnoremap <C-w>u :source ~/session.vim<cr>
inoremap <C-a> <C-o>^
inoremap <C-e> <C-o>$
" Move lines up and down
nnoremap <A-j> :m .+1<CR>==
nnoremap <A-k> :m .-2<CR>==
inoremap <A-j> <Esc>:m .+1<CR>==gi
inoremap <A-k> <Esc>:m .-2<CR>==gi
vnoremap <A-j> :m '>+1<CR>gv=gv
vnoremap <A-k> :m '<-2<CR>gv=gv
" Convert unicode escape sequences (i.e. \uXXXX) to a single character
nnoremap <silent> <leader>fnc :%s/\\u\(\x\{4\}\)/\=nr2char('0x'.submatch(1),1)/g<CR>
" Format file to utf-8[unix] style
Expand Down Expand Up @@ -477,6 +485,9 @@ nmap <leader>fa :CocSearch -S -e<space>
nmap <leader>fg <Cmd>CocList -I grep -i<cr>
nmap <leader>fG <Cmd>CocList -I grep -regex<cr>
" Diagnostics
nmap <leader>dd :CocDiagnostics<cr>
" ctrl-p
nmap <C-p> :CocList files<cr>
Expand Down

0 comments on commit 370c340

Please sign in to comment.