vimã«ã¤ãã¦ãã ãã ã¨ã¾ã¨ãã¦ã¿ãã
表è¨ã¨ãã¦ã
% hoge ã¨æ¸ãã¦ããå ´åã¯ã·ã§ã«ã§ã®å
¥åã
:hogeã¨ããã¦ããå ´åã¯vimä¸ã§ã®ã³ãã³ãå
¥åã示ãã
vim
vimã¨ã¯ãviããæ´¾çããããã¹ãã¨ãã£ã¿ã§ãããVi IMitationããããã¯Vi IMprovedã®ç¥ã§ããã
viã¯VIsual editorã®ç¥ã§ãããUNIXã·ã¹ãã å ã§ä½¿ç¨ããã¦ããæ¨æºçãªããã¹ãã¨ãã£ã¿ã§ããã
vimã¯ã
- ãã«ããã©ãããã©ã¼ã ã§ããã
- è¨å®ã®æè»æ§ãé«ãã
- ã«ã¹ã¿ãã¤ãºãªãã§ãå¹çã®è¯ãã¨ãã£ã¿ã¨ãã¦ä½¿ããã¨ãåºæ¥ãã
ãªãvimãªã®ãï¼WEB+DB PRESS vol.52ï¼ãåç
§
ä»ã«ã¯ãemacsãtext mateããªã©ãªã©ã®ã¨ãã£ã¿ããç·åéçºç°å¢ãªã©ãåå¨ããã
viçãªæä½ãè¦ããããã«ã¯
vimã®æ¡å¼µæ§äºã 以ä¸ã«viã¨ãã¦ã®æä½ãè¦ããã¨è¯ãã
æ¹æ³ã¯2ã¤
- vimtutorã§è¦ããã
- å¹çãè½ã¡ã¦ããã¨ã«ãã使ãã¾ããã
ã©ã¡ãã§ãè¯ããèªèµ°å¼ã§å§ããã«ã¯vimtutorã触ã£ã¦ãããã¨ãæã楽ãªæ¹æ³ã§ããã
vimtutorã¨ã¯ãviã®æä½æ¹æ³ããæä½æ¹æ³ãæ¸ãã¦ããããã¹ããã¡ã¤ã«ãç¨ãã¦å®éã«ç·¨éä½æ¥ãè¡ã£ã¦ãããã¨ã§
viã®æä½ã«æ
£ããããã®ãã¼ã«ã§ããã
$ vimtutor
ã¨æã¦ã°ããã
å ãã¦ãã«ããæ´»ç¨ããã°ãããªãè¦ããããã
:help
ããã§ããã¾ãè¦ããããªãã³ãã³ããå¤ããããããªãã
è¯ã使ãã³ãã³ããã¾ã¨ãã¦ããã
- ãã¡ã¤ã«æä½
:w ä¸æ¸ãä¿å :q ç·¨éçµäº :q! å¼·å¶çã«çµäºï¼ç·¨éããã¦ãã¦ãä¿å確èªããçµäºï¼ :wq ä¿åãã¦çµäº ZZ åä¸ :e [file-name] ãã¡ã¤ã«ãã³ãã³ãã§æå®ãã¦ç·¨é :E vimä¸ã§ãã¡ã¤ã«ãªã¹ããéãã¦ãã¡ã¤ã«ãæå®ããç·¨éä½æ¥ :bd ã«ã¬ã³ãã®ãããã¡ã¼ãéãã :bn 次ã®ãããã¡ã¼ã«ç§»ã :bp åã®ãããã¡ã¼ã«ç§»ã
- æ¨æºã¢ã¼ãæ
j ä¸ã¸ï¼ã«ã¼ã½ã«ç§»åï¼ k ä¸ã¸ï¼ã«ã¼ã½ã«ç§»åï¼ h å·¦ã¸ï¼ã«ã¼ã½ã«ç§»åï¼ l å³ã¸ï¼ã«ã¼ã½ã«ç§»åï¼ x ã«ã¼ã½ã«ä½ç½®ã®æåãæ¶å» u ã¢ã³ã㥠yy ãã®è¡ãã¤ã³ã¯ dd ãã®è¡ãåé¤ãã y[num] numè¡åã¤ã³ã¯ãã d[num] numè¡ååé¤ãã y0 ã«ã¼ã½ã«ä½ç½®ãããã®è¡ã®å é ã¾ã§ d0 ã«ã¼ã½ã«ä½ç½®ãããã®è¡ã®å é ã¾ã§ y$ ã«ã¼ã½ã«ä½ç½®ãããã®è¡ã®çµããã¾ã§ d$ ã«ã¼ã½ã«ä½ç½®ãããã®è¡ã®çµããã¾ã§ yw ã«ã¼ã½ã«ä½ç½®ã®åèªãã¤ã³ã¯ yW ã«ã¼ã½ã«ä½ç½®ã®åèªãã¤ã³ã¯ï¼:ã%ãªã©ãå«ãï¼ p ã¤ã³ã¯ãåé¤ãããã®ãã«ã¼ã½ã«ã®æ¬¡ã®è¡ï¼or次ã®ä½ç½®ï¼ã«è²¼ãä»ãã P ã¤ã³ã¯ãåé¤ãããã®ãã«ã¼ã½ã«ã®åã®è¡ï¼oråã®ä½ç½®ï¼ã«è²¼ãä»ãã i ã¤ã³ãµã¼ãã¢ã¼ããå®è¡ï¼ãã®ã«ã¼ã½ã«ã®ä½ç½®ã§ï¼ a ã¤ã³ãµã¼ãã¢ã¼ããå®è¡ï¼æ¬¡ã®ã«ã¼ã½ã«ã®ä½ç½®ã§ï¼ o ã¤ã³ãµã¼ãã¢ã¼ããå®è¡ï¼æ¬¡ã®è¡ã追å ãã¦ï¼ O ã¤ã³ãµã¼ãã¢ã¼ããå®è¡ï¼åã®è¡ã追å ãã¦ï¼ v ã´ã£ã¸ã¥ã¢ã«ã¢ã¼ããå®è¡ V ã´ã£ã¸ã¥ã¢ã«ã¢ã¼ãï¼è¡é¸æï¼ãå®è¡ r ä¸æ¸ãå ¥åãªãã¬ã¤ã¹ã¢ã¼ãï¼ãã®æåã ãï¼ R ä¸æ¸ãå ¥åãªãã¬ã¤ã¹ã¢ã¼ãï¼escããã¾ã§ï¼ :s/hoge/fuga/g hogeãfugaã«ç½®æ /hoge ã§hogeãæ¬æããæ¤ç´¢ï¼æ¤ç´¢çµæã¯nãããã¯Nã§ã¸ã£ã³ãã§ããï¼ :noh æ¤ç´¢çµæã§ãã¤ã©ã¤ãããããã®ã®ãã¤ã©ã¤ãã表示ããªãããã :[num] numè¡ã¸ç§»å gg ãã¡ã¤ã«ã®å é ã¸ç§»å G ãã¡ã¤ã«ã®æ«ã¸ç§»å
- ã¤ã³ãµã¼ãã¢ã¼ãæ
åºæ¬çã«ã¯ãã®ãã®ã¨ãã£ã¿ã§å
¥åããã¨ãã¨åã
esc ã§æ¨æºã¢ã¼ãã«æ»ã
vimrcã«ä»¥ä¸ã®å 容ã追å ããã¨ãæ¨æºã¢ã¼ãã¨åããããªãã¼ãã¤ã³ãã§æä½ã§ããã
imapimap imap imap
ã«ã¹ã¿ãã¤ãº
.vimrcã®è¨å®ãç´¹ä»ï¼githubã§dotfileãªã©ã¨æ¤ç´¢ãã¦è¦ãã¨è¯ãï¼
set fileformat=unix set fileencoding=utf-8 set autoindent set wildmenu set ruler set showcmd set laststatus=2 set statusline=%<%f\ %m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l,%c%V%8P set number set title syntax on inoremap ,s:AutoComplPopDisable a inoremap ,q :AutoComplPopEnable a nnoremap ,s :AutoComplPopDisable nnoremap ,q :AutoComplPopEnable hi Pmenu guibg=#666666 hi PmenuSel guibg=#8cd0d3 guifg=#666666 hi PmenuSbar guibg=#333333 imap imap imap imap "tabæåãåºå¥ãããã«ãã¤ã©ã¤ããããã®ã§ãåºå¥ãããã¨ãã¯Tabæåã®è¡¨ç¤ºãå¥ã« "è¨å®ããå¿ è¦ãããã function! SOLSpaceHilight() syntax match SOLSpace "^\s\+" display containedin=ALL highlight SOLSpace term=underline ctermbg=darkblue endf "å ¨è§ã¹ãã¼ã¹ããã¤ã©ã¤ããããã function! JISX0208SpaceHilight() syntax match JISX0208Space "ã" display containedin=ALL highlight JISX0208Space term=underline ctermbg=darkblue endf "syntaxã®æç¡ããã§ãã¯ããæ°è¦ãããã¡ã¨æ°è¦èªã¿è¾¼ã¿æã«ãã¤ã©ã¤ãããã if has("syntax") syntax on augroup invisible autocmd! invisible autocmd BufNew,BufRead * call SOLSpaceHilight() autocmd BufNew,BufRead * call JISX0208SpaceHilight() augroup END endif
ãã©ã°ã¤ã³
ããããå ¥ãã¦ã¿ãã
ï¼å¾æ¥è¿½è¨ï¼