tags:

views:

805

answers:

5
+5  A: 

Use this.

inoremap <buffer> /*          /**/<Left><Left>
inoremap <buffer> /*<Space>   /*<Space><Space>*/<Left><Left><Left>
inoremap <buffer> /*<CR>      /*<CR>*/<Esc>O
inoremap <buffer> <Leader>/*  /*
Artem Barger
what does this do >> inoremap <Leader>/*  /*
Vivek Sharma
it will map the sequence \/* to the /*. leader means the "\" character.
Artem Barger
By default, anyhow. `<Leader>` can be changed via `:let mapleader` or other methods.
ephemient
+2  A: 

Have you looked on vim.org?

AutoClose

template file loader

templates.vim

Tim Sylvester
Thanks, i didnt know if anything like was available, i thought people might be using some work around like the one i mentioned. thanks though
Vivek Sharma
+1  A: 

thegeekstuff has a good guide to how to use autocommand to do most of this. For example add the following to .vimrc (or equivalent) to add the "*" to new lines in multi-line c-style comments.

:autocmd FileType c,cpp
\     comments=sr:/*,mb:*,ex:*/,://
beggs
autocmd FileType c,cpp,h comments=sr:/*,mb:*,ex:*/,:// > not working
Vivek Sharma
Hum... I'm using vim and the line in my .vimrc is: autocmd FileType c,cpp,h,java set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,://I also have: set nocompatibleAs the first command which could be causing the problem for you.
beggs
A: 

to address the question from the comments

and also if it possible i make my cursor "block" from a simple plain "|", it would be easy to locate

:help 'guicursor'
Blixtor
+1  A: 

Have you tried NerdCommenter? It's "a plugin that allows for easy commenting of code for many filetypes", including C and C++ comments.

Doug