From: Hiroshi Shirosaki Date: Thu, 3 Apr 2014 04:30:06 +0000 (+0900) Subject: Merge branch 'mapping' X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/893e8d81388f1c27368e963b61d34285d05f5a4b?hp=81a417ffbe1fc1a67ed28e9322690888e2f49160 Merge branch 'mapping' Conflicts: ftplugin/mkd.vim --- diff --git a/README.md b/README.md index 843405f..b004bbc 100644 --- a/README.md +++ b/README.md @@ -48,16 +48,24 @@ Add the following line to your `.vimrc` to set the initial foldlevel. This optio let g:vim_markdown_initial_foldlevel=1 ``` +**Disable Default Key Mappings** + +Add the following line to your `.vimrc` to disable default key mappings. You can map them by yourself with `` mappings + +```vim +let g:markdown_no_default_key_mappings=1 +``` + ## Mappings The following work on normal and visual modes: -- `]]`: go to next header. -- `[[`: go to previous header. Contrast with `]c`. -- `][`: go to next sibling header if any. -- `[]`: go to previous sibling header if any. -- `]c`: go to Current header. -- `]u`: go to parent header (Up). +- `]]`: go to next header. `(Markdown_MoveToNextHeader)` +- `[[`: go to previous header. Contrast with `]c`. `(Markdown_MoveToPreviousHeader)` +- `][`: go to next sibling header if any. `(Markdown_MoveToNextSiblingHeader)` +- `[]`: go to previous sibling header if any. `(Markdown_MoveToPreviousSiblingHeader)` +- `]c`: go to Current header. `(Markdown_MoveToCurHeader)` +- `]u`: go to parent header (Up). `(Markdown_MoveToParentHeader)` ## Commands diff --git a/ftplugin/mkd.vim b/ftplugin/mkd.vim index 27fd855..c7bac4e 100644 --- a/ftplugin/mkd.vim +++ b/ftplugin/mkd.vim @@ -341,14 +341,32 @@ function! s:MapNormVis(rhs,lhs) execute 'vn ' . a:rhs . ' :call VisMove(''' . a:lhs . ''')' endfunction -call MapNormVis(']]', 'b:Markdown_MoveToNextHeader') -call MapNormVis('[[', 'b:Markdown_MoveToPreviousHeader') -call MapNormVis('][', 'b:Markdown_MoveToNextSiblingHeader') -call MapNormVis('[]', 'b:Markdown_MoveToPreviousSiblingHeader') + +call MapNormVis('(Markdown_MoveToNextHeader)', 'b:Markdown_MoveToNextHeader') +call MapNormVis('(Markdown_MoveToPreviousHeader)', 'b:Markdown_MoveToPreviousHeader') +call MapNormVis('(Markdown_MoveToNextSiblingHeader)', 'b:Markdown_MoveToNextSiblingHeader') +call MapNormVis('(Markdown_MoveToPreviousSiblingHeader)', 'b:Markdown_MoveToPreviousSiblingHeader') " Menmonic: Up -call MapNormVis(']u', 'b:Markdown_MoveToParentHeader') +call MapNormVis('(Markdown_MoveToParentHeader)', 'b:Markdown_MoveToParentHeader') " Menmonic: Current -call MapNormVis(']c', 'b:Markdown_MoveToCurHeader') +call MapNormVis('(Markdown_MoveToCurHeader)', 'b:Markdown_MoveToCurHeader') + +if ! exists('g:markdown_no_default_key_mappings') +\ || !g:markdown_no_default_key_mappings + nmap ]] (Markdown_MoveToNextHeader) + nmap [[ (Markdown_MoveToPreviousHeader) + nmap ][ (Markdown_MoveToNextSiblingHeader) + nmap [] (Markdown_MoveToPreviousSiblingHeader) + nmap ]u (Markdown_MoveToParentHeader) + nmap ]c (Markdown_MoveToCurHeader) + + vmap ]] (Markdown_MoveToNextHeader) + vmap [[ (Markdown_MoveToPreviousHeader) + vmap ][ (Markdown_MoveToNextSiblingHeader) + vmap [] (Markdown_MoveToPreviousSiblingHeader) + vmap ]u (Markdown_MoveToParentHeader) + vmap ]c (Markdown_MoveToCurHeader) +endif command! -buffer Toc call b:Markdown_Toc() command! -buffer Toch call b:Markdown_Toc('horizontal')