neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

obse.vim (1723B)


      1 " Vim filetype plugin file
      2 " Language:    Oblivion Language (obl)
      3 " Original Creator: Kat <katisntgood@gmail.com>
      4 " Maintainer:  Kat <katisntgood@gmail.com>
      5 " Created:     2021 Aug 08
      6 " Last Change: 2022 Nov 13
      7 "              2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
      8 
      9 if exists("b:did_ftplugin")
     10  finish
     11 endif
     12 
     13 let s:cpo_save = &cpo
     14 set cpo&vim
     15 
     16 let b:undo_ftplugin = "setl com< cms<"
     17 
     18 noremap <script> <buffer> <silent> [[ <nop>
     19 noremap <script> <buffer> <silent> ]] <nop>
     20 
     21 noremap <script> <buffer> <silent> [] <nop>
     22 noremap <script> <buffer> <silent> ][ <nop>
     23 
     24 setlocal commentstring=;\ %s
     25 setlocal comments=:;
     26 
     27 function s:NextSection(type, backwards, visual)
     28    if a:visual
     29        normal! gv
     30    endif
     31 
     32  if a:type == 1
     33    let pattern = '\v(\n\n^\S|%^)'
     34    let flags = 'e'
     35  elseif a:type == 2
     36    let pattern = '\v^\S.*'
     37    let flags = ''
     38  endif
     39 
     40  if a:backwards
     41    let dir = '?'
     42  else
     43    let dir = '/'
     44  endif
     45 
     46  execute 'silent normal! ' . dir . pattern . dir . flags . "\r"
     47 endfunction
     48 
     49 noremap <script> <buffer> <silent> ]]
     50  \ :call <SID>NextSection(1, 0, 0)<cr>
     51 
     52 noremap <script> <buffer> <silent> [[
     53  \ :call <SID>NextSection(1, 1, 0)<cr>
     54 
     55 noremap <script> <buffer> <silent> ][
     56  \ :call <SID>NextSection(2, 0, 0)<cr>
     57 
     58 noremap <script> <buffer> <silent> []
     59  \ :call <SID>NextSection(2, 1, 0)<cr>
     60 
     61 vnoremap <script> <buffer> <silent> ]]
     62  \ :<c-u>call <SID>NextSection(1, 0, 1)<cr>
     63 vnoremap <script> <buffer> <silent> [[
     64  \ :<c-u>call <SID>NextSection(1, 1, 1)<cr>
     65 vnoremap <script> <buffer> <silent> ][
     66  \ :<c-u>call <SID>NextSection(2, 0, 1)<cr>
     67 vnoremap <script> <buffer> <silent> []
     68  \ :<c-u>call <SID>NextSection(2, 1, 1)<cr>
     69 
     70 let &cpo = s:cpo_save
     71 unlet s:cpo_save