2010/8/13 Joan Miquel Torres Rigo <[email protected]>:
>
> set foldmethod=marker
> " Lets me to group code by functionality and abstraction
> level. (see example below).
Finally I forginven the example...
(I also add below a few extraction of the ~/.vimrc in my personal
machine (out of my job and less elaborated)
This is a small example of my personal coding style. Maybe you can
find something useful for you:
-8<----------------------------------------------------
// Some grouped functions (or class methods): {{{
// ==================================
function MyFunc ( // Brief description: {{{
// Optional (if needed) verbose explanation {{{
// in multiple lines.
// Folding marks are also optional, but useful in
// wide explanations. }}}
$prm1, // Parameter 1 comment (if needed).
$prm2 = false, // Optional parameter with default value.
$prm3 // You can imagine that you also can enclose this block
// in folding markers block takes too long.
) {
// Initializations (for example): {{{
// ------------------------------------
$foo = 'bar';
// ------------------------------------ }}}
// Do some complex operation: {{{
// --------------------------------------
// Do first piece of the complex operation: {{{
<Some code here>
// }}}
// Do second piece of the complex operation: {{{
<Some code here>
// }}}
// ------------------------------------ }}}
[...]
}
// }}}
[...]
// ================================== }}}
-8<----------------------------------------------------
...you can introduce as much indentation levels as you need. This way,
when fully folded, my scripts looks like true pseudo-code in which you
can navigate and unfold only the blocks you need to inspection or to
work on.
Other things for .vimrc:
-8<----------------------------------------------------
" Auto quoting-return:
:imap <bs><del> \n<esc>?'\\|"<cr>vyg;lpo. <esc>pa
" Auto quoting-return without cr:
:imap <bs><del><cr> <esc>?'\\|"<cr>vyg;po. <esc>pa
" Original and more elaborated version written while my past
holidays (the other one was improvised at job when I haven't access to
my home machine) but with poor key mapping selection. I must to unify
them (basically this version lets you to use double or single quotes
indistinctly.
" Fold selection:
noremap <f6> di//<space>{{{<enter>//<space>}}}<esc>PkddpkJzo$%kJzc
I think also not exactly the same version.
-8<----------------------------------------------------
NOTE: There is also other interesting trick (which I read in this list
few days ago) which consists on mapping something like this seqüence:
'yyp0lllv$r'.
This way, when positioned on a row with a title, you can underline it
pressing your mapped key followed by the character that you want to
use for underlining, but I think that is quite simple to do it
manually when needed and don't have any map for that.
Regards.
--
Joan Miquel Torres__________________________________
Linux Registered User #164872
http://www.mallorcaweb.net/joanmiquel
BULMA: http://bulma.net http://breu.bulma.net/?l2301
--
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