All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add project-wide .vimrc configuration
@ 2020-12-09  0:26 Felipe Contreras
  2020-12-09  1:08 ` Junio C Hamano
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Felipe Contreras @ 2020-12-09  0:26 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Jeff King, Emily Shaffer, Felipe Contreras

It's not efficient that everyone must set specific configurations in all
their ~/.vimrc files; we can have a project-wide .vimrc that everyone
can use.

By default it's ignored, you need the following in your ~/.vimrc

  set exrc
  set secure

Then the project-wide configuration is loaded, which sets the correct
filetype for the documentation and tests, and also the default
indentation of c, sh, and asciidoc files.

If you have the shareness syntax file it will be used for the tests, but
if not the sh syntax will still be used.

These default configurations can be overriden in the typical way (by
adding the corresponding file in ~/.vim/after/ftplugin).

We could add the vim modelines at the bottom of every file, like other
projects do, but this seems more sensible.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 .vimrc | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 .vimrc

diff --git a/.vimrc b/.vimrc
new file mode 100644
index 0000000000..d250ab26e0
--- /dev/null
+++ b/.vimrc
@@ -0,0 +1,9 @@
+augroup git
+  au!
+  au BufRead,BufNewFile */t/*.sh set ft=sharness.sh
+  au BufRead,BufNewFile */Documentation/*.txt set ft=asciidoc
+
+  au FileType c setl noet ts=8 sw=0 cino=(s,:0,l1,t0
+  au FileType sh setl noet ts=8 sw=0
+  au FileType asciidoc setl noet ts=8 sw=0 autoindent
+augroup END
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-12-09 16:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09  0:26 [PATCH] Add project-wide .vimrc configuration Felipe Contreras
2020-12-09  1:08 ` Junio C Hamano
2020-12-09  2:32   ` Felipe Contreras
2020-12-09  1:18 ` Aaron Schrab
2020-12-09  3:15   ` Junio C Hamano
2020-12-09  6:28   ` Felipe Contreras
2020-12-09  1:32 ` Denton Liu
2020-12-09  6:20   ` Felipe Contreras
2020-12-09  2:23 ` brian m. carlson
2020-12-09  6:36   ` Felipe Contreras
2020-12-09  6:54     ` Junio C Hamano
2020-12-09  7:16       ` Felipe Contreras
2020-12-09  8:13         ` Junio C Hamano
2020-12-09  8:52           ` Felipe Contreras
2020-12-09 16:18           ` Randall S. Becker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.