From 94fd34a31b9228d20c66fbf6815b81354b5091a4 Mon Sep 17 00:00:00 2001 From: Bryan Richter Date: Fri, 20 Apr 2018 10:39:58 -0400 Subject: [PATCH 1/2] vim: idiomatic nix filetype plugin * Never modify tabstop. This causes incompatibilities with other utilities that expect tabs to always be 8 spaces. * Add standard boilerplate for system-level filetype plugins. --- pkgs/applications/editors/vim/ft-nix-support.patch | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/editors/vim/ft-nix-support.patch b/pkgs/applications/editors/vim/ft-nix-support.patch index 416ec18cf2c..25fd4b6ad9f 100644 --- a/pkgs/applications/editors/vim/ft-nix-support.patch +++ b/pkgs/applications/editors/vim/ft-nix-support.patch @@ -85,5 +85,12 @@ new file mode 100644 --- /dev/null +++ b/runtime/ftplugin/nix.vim @@ -0,0 +1,2 @@ ++" Only do this when not done yet for this buffer ++if exists("b:did_ftplugin") ++ finish ++endif ++let b:did_ftplugin = 1 ++ +" coding conventions -+setlocal sw=2 ts=2 expandtab ++setlocal shiftwidth=2 expandtab ++let b:undo_ftplugin = "setlocal sw< et<" From 16bfd5a2be51c0b42d0cb5691c41dd8f1913e15b Mon Sep 17 00:00:00 2001 From: Bryan Richter Date: Fri, 20 Apr 2018 11:46:40 -0400 Subject: [PATCH 2/2] vim: Set softtabstop in nix filetype plugin --- pkgs/applications/editors/vim/ft-nix-support.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/editors/vim/ft-nix-support.patch b/pkgs/applications/editors/vim/ft-nix-support.patch index 25fd4b6ad9f..5feb9c87951 100644 --- a/pkgs/applications/editors/vim/ft-nix-support.patch +++ b/pkgs/applications/editors/vim/ft-nix-support.patch @@ -92,5 +92,5 @@ new file mode 100644 +let b:did_ftplugin = 1 + +" coding conventions -+setlocal shiftwidth=2 expandtab -+let b:undo_ftplugin = "setlocal sw< et<" ++setlocal shiftwidth=2 expandtab softtabstop=2 ++let b:undo_ftplugin = "setlocal sw< et< sts<"