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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29996
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim filetype plugin
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: Racket
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com>
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Previous Maintainer: Will Langstroth <will@langstroth.com>
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
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
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 if exists("b:did_ftplugin")
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 finish
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 endif
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 let b:did_ftplugin = 1
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 let s:cpo_save = &cpo
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 set cpo&vim
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 " quick hack to allow adding values
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 setlocal iskeyword=@,!,#-',*-:,<-Z,a-z,~,_,94
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 " Enable auto begin new comment line when continuing from an old comment line
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 setlocal comments=:;;;;,:;;;,:;;,:;
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 setlocal formatoptions+=r
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
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
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 setlocal commentstring=#\|\ %s\ \|#
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 setlocal formatprg=raco\ fmt
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 " Undo our settings when the filetype changes away from Racket
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 " (this should be amended if settings/mappings are added above!)
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 let b:undo_ftplugin =
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 \ "setlocal iskeyword< lispwords< lisp< comments< formatoptions< formatprg<"
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 \. " | setlocal commentstring<"
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 if !exists("no_plugin_maps") && !exists("no_racket_maps")
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 " Simply setting keywordprg like this works:
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 " setlocal keywordprg=raco\ docs
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 " but then vim says:
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 " "press ENTER or type a command to continue"
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 " We avoid the annoyance of having to hit enter by remapping K directly.
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 function s:RacketDoc(word) abort
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 execute 'silent !raco docs --' shellescape(a:word)
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 redraw!
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 endfunction
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 nnoremap <buffer> <Plug>RacketDoc :call <SID>RacketDoc(expand('<cword>'))<CR>
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 nmap <buffer> K <Plug>RacketDoc
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 " For the visual mode K mapping, it's slightly more convoluted to get the
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 " selected text:
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 function! s:Racket_visual_doc()
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 try
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 let l:old_a = @a
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 normal! gv"ay
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 call system("raco docs '". @a . "'")
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 redraw!
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 return @a
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 finally
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 let @a = l:old_a
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 endtry
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 endfunction
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 xnoremap <buffer> <Plug>RacketDoc :call <SID>Racket_visual_doc()<cr>
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 xmap <buffer> K <Plug>RacketDoc
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 let b:undo_ftplugin .=
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 \ " | silent! execute 'nunmap <buffer> K'"
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 \. " | silent! execute 'xunmap <buffer> K'"
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 endif
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
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
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 let b:undo_ftplugin .= " | unlet! b:browsefilter"
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 endif
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 if exists("loaded_matchit") && !exists("b:match_words")
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 let b:match_words = '#|:|#'
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 let b:undo_ftplugin .= " | unlet! b:match_words"
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 endif
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 let &cpo = s:cpo_save
e37754a13778 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 unlet s:cpo_save