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?ds=inline Merge branch 'mapping' Conflicts: ftplugin/mkd.vim --- 893e8d81388f1c27368e963b61d34285d05f5a4b diff --cc README.md index 843405f,cc1f7ef..b004bbc --- a/README.md +++ b/README.md @@@ -52,25 -60,13 +60,25 @@@ let g:markdown_no_default_key_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 + +The following commands currently only work for atx style headers (`#`). Pull request are welcome to extend them to Setext style headers (`===`). + +- `:Toc`: create a quickfix vertical window navigable table of contents with the headers. + + Hit `` on a line to jump to the corresponding line of the markdown file. + +- `:Toch`: Same as `:Toc` but in an horizontal window. +- `:Toct`: Same as `:Toc` but in a new tab. +- `:Tocv`: Same as `:Toc` for symmetry with `:Toch` and `Tocv`. + ## Credits The main contributors of vim-markdown are: diff --cc ftplugin/mkd.vim index 27fd855,0627cc5..c7bac4e --- a/ftplugin/mkd.vim +++ b/ftplugin/mkd.vim @@@ -341,16 -308,29 +341,34 @@@ 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') +command! -buffer Tocv call b:Markdown_Toc('vertical') +command! -buffer Toct call b:Markdown_Toc('tab')