I often edit code where I have a general comment for a block of code and specific comment for each line. For instance, this a sample of my
"indentation set autoindent "automatically indent set shiftwidth=2 "auto-ident two blanks set tabstop=2 "tabs are two blanks set expandtab "tabs are spaces set backspace=indent,eol,start "backspaces delete auto-inserted indents ":cmdline set showcmd "show incomplete cmds set wildmenu "cmdline completion set history=1000 "store 1000 cmd from cmdline set laststatus=2 "always show the current file status set noruler "off by default, but had to reset it set shell=/bin/zsh "use zsh
For now, I am able to render that kind of formatting by using easy align. However this is quite limited because it natively only considers few delimiters. For vim (whose comments start by
") and LaTeX (whose comments start by
%) I need to tweak the
g:easy_align_delimiters variable. Which in my opinion is not right, since it is syntax dependent it should arise in a locale variable with a
I cannot use it globally either, since some comments are aligned too far from the corresponding line of code and it takes quite a bit of time to go through each block.
Tabular isn't a solution either, since it aligns everything (including those "general" block comments).
Is there a script or a plugin that, given that syntax recognition is enabled, automatically indents comments in the same fashion as in the sample