Vim Learning vimscript hardway


  • echom and echoe - print message and error message, later can use :message to show all previous printed message.

  • se[t] number se[t] nonumber se[t] number! se[t] number? – check which option is on
  • se[t] numberwidth=2 (default is 4)

  • map <c-d> ddp – this map ctrl-d to dd and then p map _ ddkkp – this map _ to delete line and then go up 2 line and then paste

    nmap: (nnoremap) map in normal mode vmap: (vnoremap) in visual mode imap: (inoremap) map in insert mode: this could be use for intellij live template imap soul System.out.println(“”); imap ddi : need to escape the insert mode then delete line

    VERY USEFUL: imap viwU : convert a just finished type word to all upper case.

    nunmap U - unmap U in normal mode

    use *noremap!!!!!

  • repeat insertion:
    1. i - insert mode
    2. Ctrl+o issue normal command without leaving insert mode
    3. 80 - number of repetition
    4. i - insert
    5. type the charactors you want to repetition insert
    6. Esc - leave the insert mode