Tuesday, August 18, 2015

aligning comments; struggle with determination whether quote is part of command or not

Hello,

i want to align all those vim comments, which are not the first
non-whitespace character on the line and also not part of an command,
etc.

Example:

" aligns all quotes which are not the first character at the
beginning of the line
nnoremap <Leader>a1 :Tabularize /^\@<!" <CR>
nnoremap <Leader>a2 :Tabularize /\(^\s*\)\@<!" <CR>


=> should not match, because the comment is alone on the first line and
the second and third quote are part of the command


Plug 'flazz/vim-colorschemes' " Vim colorschemes

=> should match, the comment has non-whitespace characters before it.


trying
====
:Tabularize /\(^\s*\)\@<! "

Orginal: http://ur1.ca/nh1ac
result: http://ur1.ca/nh1as


Orginal: (first example)
result: http://ur1.ca/nh1c2


in short:
======
how can i "parse" vim scripts in a regex, to determine, if the actual
matched quote is part of a command or a comment?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: