From cd28d34f221eb48e15af051175500c7eb6dadeb4 Mon Sep 17 00:00:00 2001 From: Stefan Imhoff Date: Sat, 11 Dec 2021 14:14:19 +0100 Subject: [PATCH] chore(vim): add more mappings and custom text objects --- nvim/mappings.vim | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/nvim/mappings.vim b/nvim/mappings.vim index a93ff56..86d82d0 100644 --- a/nvim/mappings.vim +++ b/nvim/mappings.vim @@ -46,7 +46,7 @@ nnoremap h :nohlsearch nnoremap l :set list! " Indent the whole source code -nnoremap ff gg=G'' +nnoremap pf gg=G'' " Reverse the mark mapping nnoremap ' ` @@ -102,3 +102,29 @@ nnoremap nnoremap nnoremap nnoremap + +" Remap Jump to Tag +nnoremap ü +nnoremap Ü + +" Open for Markdown in iA Writer +nnoremap ia :silent !open -a iA\ Writer.app '%:p' + +" Custom Text Objects +let pairs = { ":" : ":", + \ "." : ".", + \ "" : "", + \ "*" : "*", + \ "-" : "-", + \ "_" : "_" } + +for [key, value] in items(pairs) + exe "nnoremap ci".key." T".key."ct".value + exe "nnoremap ca".key." F".key."cf".value + exe "nnoremap vi".key." T".key."vt".value + exe "nnoremap va".key." F".key."vf".value + exe "nnoremap di".key." T".key."dt".value + exe "nnoremap da".key." F".key."df".value + exe "nnoremap yi".key." T".key."yt".value + exe "nnoremap ya".key." F".key."yf".value +endfor