Mercurial > vim
annotate runtime/ftplugin/racket.vim @ 35324:7c7432a53a6c v9.1.0464
patch 9.1.0464: no whitespace padding in commentstring option in ftplugins
Commit: https://github.com/vim/vim/commit/0a0830624a260660c7fa692ecb7e6e5de09114ba
Author: Riley Bruins <ribru17@hotmail.com>
Date: Mon Jun 3 20:40:45 2024 +0200
patch 9.1.0464: no whitespace padding in commentstring option in ftplugins
Problem: no whitespace padding in commentstring option in ftplugins
Solution: Change default to include whitespace padding, update
existing filetype plugins with the new default value
(Riley Bruins)
closes: #14843
Signed-off-by: Riley Bruins <ribru17@hotmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 03 Jun 2024 21:00:04 +0200 |
parents | 8ae680be2a51 |
children | 3bae991a240b |
rev | line source |
---|---|
29996 | 1 " Vim filetype plugin |
2 " Language: Racket | |
3 " Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com> | |
4 " Previous Maintainer: Will Langstroth <will@langstroth.com> | |
5 " URL: https://github.com/benknoble/vim-racket | |
35324
7c7432a53a6c
patch 9.1.0464: no whitespace padding in commentstring option in ftplugins
Christian Brabandt <cb@256bit.org>
parents:
34134
diff
changeset
|
6 " Last Change: 2024 May 28 |
29996 | 7 |
8 if exists("b:did_ftplugin") | |
9 finish | |
10 endif | |
11 let b:did_ftplugin = 1 | |
12 | |
13 let s:cpo_save = &cpo | |
14 set cpo&vim | |
15 | |
16 " quick hack to allow adding values | |
17 setlocal iskeyword=@,!,#-',*-:,<-Z,a-z,~,_,94 | |
18 | |
19 " Enable auto begin new comment line when continuing from an old comment line | |
20 setlocal comments=:;;;;,:;;;,:;;,:; | |
21 setlocal formatoptions+=r | |
22 | |
35324
7c7432a53a6c
patch 9.1.0464: no whitespace padding in commentstring option in ftplugins
Christian Brabandt <cb@256bit.org>
parents:
34134
diff
changeset
|
23 "setlocal commentstring=;;\ %s |
29996 | 24 setlocal commentstring=#\|\ %s\ \|# |
25 | |
26 setlocal formatprg=raco\ fmt | |
27 | |
28 " Undo our settings when the filetype changes away from Racket | |
29 " (this should be amended if settings/mappings are added above!) | |
30 let b:undo_ftplugin = | |
31 \ "setlocal iskeyword< lispwords< lisp< comments< formatoptions< formatprg<" | |
32 \. " | setlocal commentstring<" | |
33 | |
34 if !exists("no_plugin_maps") && !exists("no_racket_maps") | |
35 " Simply setting keywordprg like this works: | |
36 " setlocal keywordprg=raco\ docs | |
37 " but then vim says: | |
38 " "press ENTER or type a command to continue" | |
39 " We avoid the annoyance of having to hit enter by remapping K directly. | |
40 function s:RacketDoc(word) abort | |
41 execute 'silent !raco docs --' shellescape(a:word) | |
42 redraw! | |
43 endfunction | |
44 nnoremap <buffer> <Plug>RacketDoc :call <SID>RacketDoc(expand('<cword>'))<CR> | |
45 nmap <buffer> K <Plug>RacketDoc | |
46 | |
47 " For the visual mode K mapping, it's slightly more convoluted to get the | |
48 " selected text: | |
49 function! s:Racket_visual_doc() | |
50 try | |
51 let l:old_a = @a | |
52 normal! gv"ay | |
53 call system("raco docs '". @a . "'") | |
54 redraw! | |
55 return @a | |
56 finally | |
57 let @a = l:old_a | |
58 endtry | |
59 endfunction | |
60 | |
61 xnoremap <buffer> <Plug>RacketDoc :call <SID>Racket_visual_doc()<cr> | |
62 xmap <buffer> K <Plug>RacketDoc | |
63 | |
64 let b:undo_ftplugin .= | |
65 \ " | silent! execute 'nunmap <buffer> K'" | |
66 \. " | silent! execute 'xunmap <buffer> K'" | |
67 endif | |
68 | |
69 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") | |
70 let b:browsefilter = | |
34134
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
29996
diff
changeset
|
71 \ "Racket Source Files (*.rkt, *.rktl)\t*.rkt;*.rktl\n" |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
29996
diff
changeset
|
72 if has("win32") |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
29996
diff
changeset
|
73 let b:browsefilter .= "All Files (*.*)\t*\n" |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
29996
diff
changeset
|
74 else |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
29996
diff
changeset
|
75 let b:browsefilter .= "All Files (*)\t*\n" |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
29996
diff
changeset
|
76 endif |
29996 | 77 let b:undo_ftplugin .= " | unlet! b:browsefilter" |
78 endif | |
79 | |
80 if exists("loaded_matchit") && !exists("b:match_words") | |
81 let b:match_words = '#|:|#' | |
82 let b:undo_ftplugin .= " | unlet! b:match_words" | |
83 endif | |
84 | |
85 let &cpo = s:cpo_save | |
86 unlet s:cpo_save |