initial commit
This commit is contained in:
		
							parent
							
								
									e45df1e6c3
								
							
						
					
					
						commit
						3f1f70a71e
					
				| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
" markdown : jump to next heading
 | 
			
		||||
" https://gist.github.com/romainl/ac63e108c3d11084be62b3c04156c263
 | 
			
		||||
function! s:JumpToNextHeading(direction, count)
 | 
			
		||||
    let col = col(".")
 | 
			
		||||
 | 
			
		||||
    silent execute a:direction == "up" ? '?^#' : '/^#'
 | 
			
		||||
 | 
			
		||||
    if a:count > 1
 | 
			
		||||
        silent execute "normal! " . repeat("n", a:direction == "up" && col != 1 ? a:count : a:count - 1)
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    silent execute "normal! " . col . "|"
 | 
			
		||||
 | 
			
		||||
    unlet col
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
nnoremap <buffer> <silent> ]] :<C-u>call <SID>JumpToNextHeading("down", v:count1)<CR>
 | 
			
		||||
nnoremap <buffer> <silent> [[ :<C-u>call <SID>JumpToNextHeading("up", v:count1)<CR>
 | 
			
		||||
		Loading…
	
		Reference in New Issue