annotate runtime/ftplugin/systemd.vim @ 20115:bd021eb62e73

Update runtime files Commit: https://github.com/vim/vim/commit/2c7f8c574f1f8723d59adca3fec8fb89c41cf8c9 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 20 19:52:53 2020 +0200 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Mon, 20 Apr 2020 20:00:05 +0200
parents 30042ddff503
children d23645a0aca8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7176
30042ddff503 commit https://github.com/vim/vim/commit/60cce2fb736c8ff6fdb9603f502d3c15f1f7a25d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Vim filetype plugin file
20115
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
2 " Language: systemd.unit(5)
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
3 " Keyword Lookup Support: Enno Nagel <enno.nagel+vim@gmail.com>
7176
30042ddff503 commit https://github.com/vim/vim/commit/60cce2fb736c8ff6fdb9603f502d3c15f1f7a25d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4
30042ddff503 commit https://github.com/vim/vim/commit/60cce2fb736c8ff6fdb9603f502d3c15f1f7a25d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 if !exists('b:did_ftplugin')
30042ddff503 commit https://github.com/vim/vim/commit/60cce2fb736c8ff6fdb9603f502d3c15f1f7a25d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 " Looks a lot like dosini files.
30042ddff503 commit https://github.com/vim/vim/commit/60cce2fb736c8ff6fdb9603f502d3c15f1f7a25d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 runtime! ftplugin/dosini.vim
30042ddff503 commit https://github.com/vim/vim/commit/60cce2fb736c8ff6fdb9603f502d3c15f1f7a25d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 endif
20115
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
9
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
10 if !has('unix')
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
11 finish
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
12 endif
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
13
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
14 if !has('gui_running')
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
15 command! -buffer -nargs=1 Sman silent exe '!' . KeywordLookup_systemd(<q-args>) | redraw!
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
16 elseif has('terminal')
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
17 command! -buffer -nargs=1 Sman silent exe 'term ' . KeywordLookup_systemd(<q-args>)
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
18 else
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
19 finish
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
20 endif
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
21
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
22 if !exists('*KeywordLookup_systemd')
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
23 function KeywordLookup_systemd(keyword) abort
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
24 let matches = matchlist(getline(search('\v^\s*\[\s*.+\s*\]\s*$', 'nbWz')), '\v^\s*\[\s*(\k+).*\]\s*$')
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
25 if len(matches) > 1
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
26 let section = matches[1]
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
27 return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd.' . section
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
28 else
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
29 return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd'
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
30 endif
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
31 endfunction
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
32 endif
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
33
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
34 setlocal iskeyword+=-
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
35 setlocal keywordprg=:Sman
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
36
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
37 if !exists('b:undo_ftplugin') || empty(b:undo_ftplugin)
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
38 let b:undo_ftplugin = 'setlocal keywordprg< iskeyword<'
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
39 else
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
40 let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword<'
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
41 endif