robin/laufey

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

zeertzjqMerge pull request #40472 from zeertzjq/vim-1f337327945732ed7

master
1.8 KiB63 linesraw
1" Vim filetype plugin file
2" Language:	occam
3" Copyright:	Christian Jacobsen <clj3@kent.ac.uk>, Mario Schweigler <ms44@kent.ac.uk>
4" Maintainer:	Mario Schweigler <ms44@kent.ac.uk>
5" Last Change:	23 April 2003
6" 2024 Jan 14 by Vim Project (browsefilter)
7" 2025 Jun 08 by Riley Bruins <ribru17@gmail.com> ('commentstring')
8" 2026 Jun 27 by Vim Project (add recommended style guard)
9
10" Only do this when not done yet for this buffer
11if exists("b:did_ftplugin")
12  finish
13endif
14let b:did_ftplugin = 1
15let s:keepcpo= &cpo
16set cpo&vim
17
18"{{{  Indent settings
19if get(g:, 'occam_recommended_style',
20      \ get(g:, 'filetype_recommended_style', 1))
21  " Set shift width for indent
22  setlocal shiftwidth=2
23  " Set the tab key size to two spaces
24  setlocal softtabstop=2
25  " Let tab keys always be expanded to spaces
26  setlocal expandtab
27endif
28"}}}
29
30"{{{  Formatting
31" Break comment lines and insert comment leader in this case
32setlocal formatoptions-=t formatoptions+=cql
33setlocal comments+=:--
34setlocal commentstring=--\ %s
35if get(g:, 'occam_recommended_style',
36      \ get(g:, 'filetype_recommended_style', 1))
37  " Maximum length of comments is 78
38  setlocal textwidth=78
39endif
40"}}}
41
42"{{{  File browsing filters
43" Win32 and GTK can filter files in the browse dialog
44if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
45  let b:browsefilter = "All Occam Files (*.occ, *.inc)\t*.occ;*.inc\n" .
46	\ "Occam Include Files (*.inc)\t*.inc\n" .
47	\ "Occam Source Files (*.occ)\t*.occ\n"
48  if has("win32")
49    let b:browsefilter .= "All Files (*.*)\t*\n"
50  else
51    let b:browsefilter .= "All Files (*)\t*\n"
52  endif
53endif
54"}}}
55
56"{{{  Undo settings
57let b:undo_ftplugin = "setlocal shiftwidth< softtabstop< expandtab<"
58	\ . " formatoptions< comments< commentstring< textwidth<"
59	\ . "| unlet! b:browsefilter"
60"}}}
61
62let &cpo = s:keepcpo
63unlet s:keepcpo