Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
markdown.vim94 linesDownload Raw Back to ftplugin
1" Vim filetype plugin2" Language:     Markdown3" Maintainer:   Tim Pope <https://github.com/tpope/vim-markdown>4" Last Change:  2023 Dec 285"               2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')6 7if exists("b:did_ftplugin")8  finish9endif10 11runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim12 13let s:keepcpo= &cpo14set cpo&vim15 16setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=<!--\ %s\ -->17setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o18setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:\\&^.\\{4\\}19 20if exists('b:undo_ftplugin')21  let b:undo_ftplugin .= "|setl cms< com< fo< flp< et< ts< sts< sw<"22else23  let b:undo_ftplugin = "setl cms< com< fo< flp< et< ts< sts< sw<"24endif25 26if get(g:, 'markdown_recommended_style', 1)27  setlocal expandtab tabstop=4 softtabstop=4 shiftwidth=428endif29 30if !exists("g:no_plugin_maps") && !exists("g:no_markdown_maps")31  nnoremap <silent><buffer> [[ :<C-U>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "bsW")<CR>32  nnoremap <silent><buffer> ]] :<C-U>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "sW")<CR>33  xnoremap <silent><buffer> [[ :<C-U>exe "normal! gv"<Bar>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "bsW")<CR>34  xnoremap <silent><buffer> ]] :<C-U>exe "normal! gv"<Bar>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "sW")<CR>35  let b:undo_ftplugin .= '|sil! nunmap <buffer> [[|sil! nunmap <buffer> ]]|sil! xunmap <buffer> [[|sil! xunmap <buffer> ]]'36endif37 38function! s:NotCodeBlock(lnum) abort39  return synIDattr(synID(a:lnum, 1, 1), 'name') !=# 'markdownCodeBlock'40endfunction41 42function! MarkdownFold() abort43  let line = getline(v:lnum)44 45  if line =~# '^#\+ ' && s:NotCodeBlock(v:lnum)46    return ">" . match(line, ' ')47  endif48 49  let nextline = getline(v:lnum + 1)50  if (line =~ '^.\+$') && (nextline =~ '^=\+$') && s:NotCodeBlock(v:lnum + 1)51    return ">1"52  endif53 54  if (line =~ '^.\+$') && (nextline =~ '^-\+$') && s:NotCodeBlock(v:lnum + 1)55    return ">2"56  endif57 58  return "="59endfunction60 61function! s:HashIndent(lnum) abort62  let hash_header = matchstr(getline(a:lnum), '^#\{1,6}')63  if len(hash_header)64    return hash_header65  else66    let nextline = getline(a:lnum + 1)67    if nextline =~# '^=\+\s*$'68      return '#'69    elseif nextline =~# '^-\+\s*$'70      return '##'71    endif72  endif73endfunction74 75function! MarkdownFoldText() abort76  let hash_indent = s:HashIndent(v:foldstart)77  let title = substitute(getline(v:foldstart), '^#\+\s*', '', '')78  let foldsize = (v:foldend - v:foldstart + 1)79  let linecount = '['.foldsize.' lines]'80  return hash_indent.' '.title.' '.linecount81endfunction82 83if has("folding") && get(g:, "markdown_folding", 0)84  setlocal foldexpr=MarkdownFold()85  setlocal foldmethod=expr86  setlocal foldtext=MarkdownFoldText()87  let b:undo_ftplugin .= "|setl foldexpr< foldmethod< foldtext<"88endif89 90let &cpo = s:keepcpo91unlet s:keepcpo92 93" vim:set sw=2:94 
codekingpro/portable-devtools · Team Ai