annotate runtime/ftplugin/systemd.vim @ 34219:a0a4a774117b v9.1.0058

patch 9.1.0058: Cannot map Super Keys in GTK UI Commit: https://github.com/vim/vim/commit/92e90a1e102825aa9149262cacfc991264db05df Author: Casey Tucker <dctucker@hotmail.com> Date: Thu Jan 25 22:44:00 2024 +0100 patch 9.1.0058: Cannot map Super Keys in GTK UI Problem: Cannot map Super Keys in GTK UI (Casey Tucker) Solution: Enable Super Key mappings in GTK using <D-Key> (Casey Tucker) As a developer who works in both Mac and Linux using the same keyboard, it can be frustrating having to remember different key combinations or having to rely on system utilities to remap keys. This change allows `<D-z>` `<D-x>` `<D-c>` `<D-v>` etc. to be recognized by the `map` commands, along with the `<D-S-...>` shifted variants. ```vimrc if has('gui_gtk') nnoremap <D-z> u nnoremap <D-S-Z> <C-r> vnoremap <D-x> "+d vnoremap <D-c> "+y cnoremap <D-v> <C-R>+ inoremap <D-v> <C-o>"+gP nnoremap <D-v> "+P vnoremap <D-v> "-d"+P nnoremap <D-s> :w<CR> inoremap <D-s> <C-o>:w<CR> nnoremap <D-w> :q<CR> nnoremap <D-q> :qa<CR> nnoremap <D-t> :tabe<CR> nnoremap <D-S-T> :vs#<CR><C-w>T nnoremap <D-a> ggVG vnoremap <D-a> <ESC>ggVG inoremap <D-a> <ESC>ggVG nnoremap <D-f> / nnoremap <D-g> n nnoremap <D-S-G> N vnoremap <D-x> "+x endif ``` closes: #12698 Signed-off-by: Casey Tucker <dctucker@hotmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 25 Jan 2024 23:00:03 +0100
parents b59496c2797b
children 89b487b08b2a
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>
33508
c252fbfde41d runtime: make command name for &iskeywordprg more unique (#13297)
Christian Brabandt <cb@256bit.org>
parents: 33074
diff changeset
4 " Latest Revision: 2023-10-07
7176
30042ddff503 commit https://github.com/vim/vim/commit/60cce2fb736c8ff6fdb9603f502d3c15f1f7a25d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
33600
b59496c2797b runtime(systemd): allow for overriding systemd ftplugin settings (#13373)
Christian Brabandt <cb@256bit.org>
parents: 33508
diff changeset
6 if exists("b:did_ftplugin")
b59496c2797b runtime(systemd): allow for overriding systemd ftplugin settings (#13373)
Christian Brabandt <cb@256bit.org>
parents: 33508
diff changeset
7 finish
7176
30042ddff503 commit https://github.com/vim/vim/commit/60cce2fb736c8ff6fdb9603f502d3c15f1f7a25d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 endif
33600
b59496c2797b runtime(systemd): allow for overriding systemd ftplugin settings (#13373)
Christian Brabandt <cb@256bit.org>
parents: 33508
diff changeset
9 " Looks a lot like dosini files.
b59496c2797b runtime(systemd): allow for overriding systemd ftplugin settings (#13373)
Christian Brabandt <cb@256bit.org>
parents: 33508
diff changeset
10 runtime! ftplugin/dosini.vim
20115
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
11
32976
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
12 if has('unix') && executable('less')
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
13 if !has('gui_running')
33508
c252fbfde41d runtime: make command name for &iskeywordprg more unique (#13297)
Christian Brabandt <cb@256bit.org>
parents: 33074
diff changeset
14 command -buffer -nargs=1 SystemdKeywordPrg silent exe '!' . KeywordLookup_systemd(<q-args>) | redraw!
32976
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
15 elseif has('terminal')
33508
c252fbfde41d runtime: make command name for &iskeywordprg more unique (#13297)
Christian Brabandt <cb@256bit.org>
parents: 33074
diff changeset
16 command -buffer -nargs=1 SystemdKeywordPrg silent exe 'term ' . KeywordLookup_systemd(<q-args>)
32976
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
17 endif
33508
c252fbfde41d runtime: make command name for &iskeywordprg more unique (#13297)
Christian Brabandt <cb@256bit.org>
parents: 33074
diff changeset
18 if exists(':SystemdKeywordPrg') == 2
32976
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
19 if !exists('*KeywordLookup_systemd')
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
20 function KeywordLookup_systemd(keyword) abort
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
21 let matches = matchlist(getline(search('\v^\s*\[\s*.+\s*\]\s*$', 'nbWz')), '\v^\s*\[\s*(\k+).*\]\s*$')
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
22 if len(matches) > 1
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
23 let section = matches[1]
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
24 return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd.' . section
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
25 else
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
26 return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd'
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
27 endif
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
28 endfunction
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
29 endif
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
30 setlocal iskeyword+=-
33508
c252fbfde41d runtime: make command name for &iskeywordprg more unique (#13297)
Christian Brabandt <cb@256bit.org>
parents: 33074
diff changeset
31 setlocal keywordprg=:SystemdKeywordPrg
32976
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
32 if !exists('b:undo_ftplugin') || empty(b:undo_ftplugin)
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
33 let b:undo_ftplugin = 'setlocal keywordprg< iskeyword<'
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
34 else
33508
c252fbfde41d runtime: make command name for &iskeywordprg more unique (#13297)
Christian Brabandt <cb@256bit.org>
parents: 33074
diff changeset
35 let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg'
32976
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
36 endif
d23645a0aca8 runtime: configure keywordpg for some file types (#5566)
Christian Brabandt <cb@256bit.org>
parents: 20115
diff changeset
37 endif
20115
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 7176
diff changeset
38 endif