robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Christian Clasonvim-patch:9.1.0464: no whitespace padding in commentstring option in ftplugins2f5b8a0092

master
1.7 KiB71 linesraw
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
9if exists("b:did_ftplugin")
10  finish
11endif
12
13let s:cpo_save = &cpo
14set cpo&vim
15
16let b:undo_ftplugin = "setl com< cms<"
17
18noremap <script> <buffer> <silent> [[ <nop>
19noremap <script> <buffer> <silent> ]] <nop>
20
21noremap <script> <buffer> <silent> [] <nop>
22noremap <script> <buffer> <silent> ][ <nop>
23
24setlocal commentstring=;\ %s
25setlocal comments=:;
26
27function 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"
47endfunction
48
49noremap <script> <buffer> <silent> ]]
50  \ :call <SID>NextSection(1, 0, 0)<cr>
51
52noremap <script> <buffer> <silent> [[
53  \ :call <SID>NextSection(1, 1, 0)<cr>
54
55noremap <script> <buffer> <silent> ][
56  \ :call <SID>NextSection(2, 0, 0)<cr>
57
58noremap <script> <buffer> <silent> []
59  \ :call <SID>NextSection(2, 1, 0)<cr>
60
61vnoremap <script> <buffer> <silent> ]]
62  \ :<c-u>call <SID>NextSection(1, 0, 1)<cr>
63vnoremap <script> <buffer> <silent> [[
64  \ :<c-u>call <SID>NextSection(1, 1, 1)<cr>
65vnoremap <script> <buffer> <silent> ][
66  \ :<c-u>call <SID>NextSection(2, 0, 1)<cr>
67vnoremap <script> <buffer> <silent> []
68  \ :<c-u>call <SID>NextSection(2, 1, 1)<cr>
69
70let &cpo = s:cpo_save
71unlet s:cpo_save