blob: d40fe43ebc1d18faff74fd600187b7dadb3c672c [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim filetype plugin file
Bram Moolenaar63f32602022-06-09 20:45:54 +01002" Language: C#
3" Maintainer: Nick Jensen <nickspoon@gmail.com>
4" Former Maintainer: Johannes Zellner <johannes@zellner.org>
Nick Jensen96395e12025-03-15 09:49:13 +01005" Last Change: 2025-03-14
Bram Moolenaar63f32602022-06-09 20:45:54 +01006" License: Vim (see :h license)
7" Repository: https://github.com/nickspoons/vim-cs
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
Bram Moolenaar63f32602022-06-09 20:45:54 +01009if exists('b:did_ftplugin')
Bram Moolenaar071d4272004-06-13 20:20:40 +000010 finish
11endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000012let b:did_ftplugin = 1
Bram Moolenaar63f32602022-06-09 20:45:54 +010013
14let s:save_cpo = &cpoptions
15set cpoptions&vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000016
Bram Moolenaar071d4272004-06-13 20:20:40 +000017" Set 'formatoptions' to break comment lines but not other lines,
18" and insert the comment leader when hitting <CR> or using "o".
Bram Moolenaar63f32602022-06-09 20:45:54 +010019setlocal formatoptions-=t formatoptions+=croql
Bram Moolenaar071d4272004-06-13 20:20:40 +000020
21" Set 'comments' to format dashed lists in comments.
22setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://
Nick Jensen96395e12025-03-15 09:49:13 +010023setlocal commentstring=//\ %s
Bram Moolenaar071d4272004-06-13 20:20:40 +000024
Nick Jensen96395e12025-03-15 09:49:13 +010025setlocal cinoptions=J1
26
27let b:undo_ftplugin = 'setl com< fo< cino<'
Bram Moolenaar63f32602022-06-09 20:45:54 +010028
29if exists('loaded_matchit') && !exists('b:match_words')
30 " #if/#endif support included by default
Bram Moolenaar86b48162022-12-06 18:20:10 +000031 let b:match_ignorecase = 0
Bram Moolenaar63f32602022-06-09 20:45:54 +010032 let b:match_words = '\%(^\s*\)\@<=#\s*region\>:\%(^\s*\)\@<=#\s*endregion\>,'
Bram Moolenaar86b48162022-12-06 18:20:10 +000033 let b:undo_ftplugin .= ' | unlet! b:match_ignorecase b:match_words'
Bram Moolenaar071d4272004-06-13 20:20:40 +000034endif
Bram Moolenaar8e52a592012-05-18 21:49:28 +020035
Bram Moolenaar63f32602022-06-09 20:45:54 +010036if (has('gui_win32') || has('gui_gtk')) && !exists('b:browsefilter')
Doug Kearns93197fd2024-01-14 20:59:02 +010037 let b:browsefilter = "C# Source Files (*.cs, *.csx)\t*.cs;*.csx\n" .
Bram Moolenaar63f32602022-06-09 20:45:54 +010038 \ "C# Project Files (*.csproj)\t*.csproj\n" .
Doug Kearns93197fd2024-01-14 20:59:02 +010039 \ "Visual Studio Solution Files (*.sln)\t*.sln\n"
40 if has("win32")
41 let b:browsefilter ..= "All Files (*.*)\t*\n"
42 else
43 let b:browsefilter ..= "All Files (*)\t*\n"
44 endif
Bram Moolenaar63f32602022-06-09 20:45:54 +010045 let b:undo_ftplugin .= ' | unlet! b:browsefilter'
46endif
47
48let &cpoptions = s:save_cpo
49unlet s:save_cpo
50
51" vim:et:sw=2:sts=2