2018年3月8日 星期四

Linux Vim editor

  • 將部分字串替換

範例:將12~26行中,所有 *.html 替換為 /*
:12,26s/\([a-z]\{1,\}\.html/\/\1/ 
  • .vimrc sample of 1 

    set tabstop=4
    set softtabstop=4
    set shiftwidth=4
    set textwidth=0
    set expandtab
    set autoindent
    set fileformat=unix
    set cursorline
    set showmatch
    set backspace=indent,eol,start
    set ruler       " show line and column number
    set wrap
    set linebreak
    set nolist
    filetype plugin on
    filetype indent on

    "au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
    au BufRead,BufNewFile *.py
                \ set syntax=python |
                \ let python_highlight_all=1 |
                \ let g:pymode_python='python' |
                \ let g:pymode_virtualenv=1 |
                \ let g:pymode_breakpoint=1 |
                \ let g:pymode_syntax=1 |
                \ let g:syntastic_python_python_exec='python' |
                \ inoremap :     |

    au BufRead,BufNewFile [D|d]ockerfile* set syntax=Dockerfile
    au BufRead,BufNewFile [M|m]akefile* set syntax=Makefile
    au BufRead,BufNewFile *.sh set syntax=sh
    au BufRead,BufNewFile *.html,*.php
                \ set syntax=php |
                \ set tabstop=2 |
                \ set softtabstop=2 |
                \ set shiftwidth=2 |
                \ set smarttab |


    set encoding=utf-8
    set fileencoding=utf-8
    set t_Co=256
    colo koehler
    "colorscheme wombat256mod

    inoremap ( ()
    inoremap [ []
    inoremap { {}

    syntax on
    set showcmd
    set nu
    set clipboard=unnamed