git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Add project-wide .vimrc configuration

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Dec 9, 2020, 00:26 UTC
Message-ID
<20201209002619.25468-1-felipe.contreras@gmail.com>

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
Next: Junio C Hamano
Message 1 of 15 in “Add project-wide .vimrc configuration”
  1. Add project-wide .vimrc configurationFelipe Contreras, Dec 9, 2020
  2. Junio C HamanoDec 9, 2020
  3. Felipe ContrerasDec 9, 2020
  4. Aaron SchrabDec 9, 2020
  5. Junio C HamanoDec 9, 2020
  6. Felipe ContrerasDec 9, 2020
  7. Denton LiuDec 9, 2020
  8. Felipe ContrerasDec 9, 2020
  9. brian m. carlsonDec 9, 2020
  10. Felipe ContrerasDec 9, 2020
  11. Junio C HamanoDec 9, 2020
  12. Felipe ContrerasDec 9, 2020
  13. Junio C HamanoDec 9, 2020
  14. Felipe ContrerasDec 9, 2020
  15. Randall S. BeckerDec 9, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.