New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VimL styleguide for writing runtime code #1475
Comments
Google has a style guide here: And https://github.com/google/vim-maktaba is an excellent demonstration of those practices (I believe they even use the "docstrings" to generate their API documentation: https://github.com/google/vim-maktaba/blob/master/doc/maktaba.txt We could adapt Google's style guide as needed. Rule of thumb: study netrw, then do the opposite :) |
Yeah, the docstrings are generated by vimdoc. It's still a bit unstable:
But it's still nicer than managing your help files manually. |
@Soares @dbarnett Is there a place to file issues on the style guide? There's a small mistake here: http://google-styleguide.googlecode.com/svn/trunk/vimscriptfull.xml#Forbidden_Commands
|
https://code.google.com/p/google-styleguide/ would be the place, but for some reason they don't have issue tracking enabled there. I guess they don't want your input about what should be in the style guide. ;) I can update it. Thanks for pointing that out. |
@dbarnett They also have incomplete reasoning about why not to use |
BTW, as one of the maintainers of Google's vimscript style guide, I'd be interested in extracting the "how to not shoot yourself in the foot" parts to a set of canonical best practices to be widely shared. I'm more interested in broad adoption (by the set of plugin authors that write the plugins I use) than deep adoption (following every rule to the letter in repositories I own). I'm not sure where a good home for this would be. http://vim.wikia.com/ is a little too collaborative if we want to publish standards instead of just collecting opinions. |
FYI, I also found https://github.com/noahfrederick/vim-scripting-style-guide. Even more important than a bunch of documentation would be a lint tool to detect violations. I found several "vimlint" projects and supposedly one is supported by syntastic, but couldn't figure out how to run them and they didn't look very high-quality. |
https://github.com/Kuniwak/vint is a new vimscript linter that so far has produced good results for me. |
I think it is good idea to save my replies in gitter here:
|
Though I am wrong about Vi compatibility, vi does not have +eval. It is compatibility with previous versions that did not have v: to store such variables in. |
thanks for the link,vim-maktaba is what I need. |
For new runtime code, Don't need a Vimscript style guide because most Nvim-owned runtime files are in Lua. |
Just like what we have for C language on the wiki page I think it is important to have consistency across the
runtime
code base, like namespaces (provider#clipboard#set
) and private functions (s:get_clipboard
) should be lowercase, and so on. Inpiration: https://github.com/styleguide/rubyThe text was updated successfully, but these errors were encountered: