Configuring Vim -.vimrc - key mapping

Configure Vim -

I added these lines to my .vimrc

inoremap / * / ** / <Left>

  • what do I mean when comments open in the press / * - it should automatically print the final comment.
  • when in the comments that I add to .vimrc, so when in the comments block with each input, "*" is printed on the next line.

    / *

      • /

if I need to add some lines automatically at the top of each created file (in a specific folder), for example, as license headers. how to do it. - I could think of creating a template file by running cp temp.c abc.c and then vi abc.c. Is there another way.

+3
source share
5 answers

.

inoremap <buffer> /*          /**/<Left><Left>
inoremap <buffer> /*<Space>   /*<Space><Space>*/<Left><Left><Left>
inoremap <buffer> /*<CR>      /*<CR>*/<Esc>O
inoremap <buffer> <Leader>/*  /*
+5
+2

NerdCommenter? ", ", C ++.

+2

thegeekstuff , . , .vimrc( ), "*" c.

:autocmd FileType c,cpp
\     comments=sr:/*,mb:*,ex:*/,://
+1

, , "" "|",

:help 'guicursor'
0

Source: https://habr.com/ru/post/1712436/