aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2018-11-27 21:10:47 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2018-11-30 01:19:10 +0200
commit80bdc71c0ed44f63e0f2f45f8e264e2022cc6658 (patch)
tree8f0153eefd9eaae7841bad486c82b8fbce500b15 /data
parent0c23e6545711802be279566946983310ca11c1d8 (diff)
downloadmeson-80bdc71c0ed44f63e0f2f45f8e264e2022cc6658.zip
meson-80bdc71c0ed44f63e0f2f45f8e264e2022cc6658.tar.gz
meson-80bdc71c0ed44f63e0f2f45f8e264e2022cc6658.tar.bz2
syntax-highlighting: vim: Allow overriding shiftwidth and softtabstop
The vim syntax indentation rules stored in indent/meson.vim set the local shiftwidth and softtabstop variables. As the file is loaded last, after ~/.vim/after/ftplugin/meson.vim (when present), this prevents overriding the default values for shiftwidth and softtabstop in a local configuration. Fix this by setting shiftwidth and softtabstop in ftplugin/meson.vim instead (as done by the python indentiation rules in upstream vim for instance) to allow local overrides. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'data')
-rw-r--r--data/syntax-highlighting/vim/README3
-rw-r--r--data/syntax-highlighting/vim/ftplugin/meson.vim15
-rw-r--r--data/syntax-highlighting/vim/indent/meson.vim4
3 files changed, 17 insertions, 5 deletions
diff --git a/data/syntax-highlighting/vim/README b/data/syntax-highlighting/vim/README
index 1afa243..95188fc 100644
--- a/data/syntax-highlighting/vim/README
+++ b/data/syntax-highlighting/vim/README
@@ -1,3 +1,4 @@
ftdetect sets the filetype
+ftplugin sets Meson indentation rules
+indent does Meson indentation
syntax does Meson syntax highlighting
-plugin does Meson indentation
diff --git a/data/syntax-highlighting/vim/ftplugin/meson.vim b/data/syntax-highlighting/vim/ftplugin/meson.vim
new file mode 100644
index 0000000..e21b61f
--- /dev/null
+++ b/data/syntax-highlighting/vim/ftplugin/meson.vim
@@ -0,0 +1,15 @@
+" Vim filetype plugin file
+" Language: meson
+" Original Author: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+" Last Change: 2018 Nov 27
+
+if exists("b:did_ftplugin") | finish | endif
+let b:did_ftplugin = 1
+let s:keepcpo= &cpo
+set cpo&vim
+
+setlocal shiftwidth=2
+setlocal softtabstop=2
+
+let &cpo = s:keepcpo
+unlet s:keepcpo
diff --git a/data/syntax-highlighting/vim/indent/meson.vim b/data/syntax-highlighting/vim/indent/meson.vim
index 8553ec0..a6444dc 100644
--- a/data/syntax-highlighting/vim/indent/meson.vim
+++ b/data/syntax-highlighting/vim/indent/meson.vim
@@ -29,10 +29,6 @@ setlocal cpo&vim
let s:maxoff = 50 " maximum number of lines to look backwards for ()
-" Force sw=2 sts=2 because that's required by convention
-setlocal shiftwidth=2
-setlocal softtabstop=2
-
function GetMesonIndent(lnum)
echom getline(line("."))