homebrewã§macvimãã¤ã³ã¹ãã¼ã« & åæè¨å®ãããã
Macã§ããã©ã«ãã§å ¥ã£ã¦ããvimã¯ãã¼ã¸ã§ã³ãä½ãluaãæå¹ã«ãªã£ã¦ããªãããä¸é¨ã®ãã©ã°ã¤ã³ã使ãã¾ãããããã§luaãæå¹ãªvimãHomebrewã使ã£ã¦ã¤ã³ã¹ãã¼ã«ãã¾ããã
è¨å®ãã¡ã¤ã«ä¿åå ´æ
dotfilesããã¼ã ãã£ã¬ã¯ããªã«ã¤ããã¨ããæ £ç¿ãããããã§ãã
mkdir ~/dotfiles cd ~/dotfiles dotfileså ã«.vimrcãæ¸ã "ãã¼ã¸ã§ã³ç®¡çã½ããã§ç®¡çããã®ããã git init . && git add .vimrc && git commit -m "first commit" ln -s .vimrc ~/
macã§ã¤ã³ã¹ãã¼ã«
brew install macvim --with-cscope --with-lua --override-system-vim brew linkapps
ãã¼ãããã®æ¸å¼
" Qã¨ãããã¼ãæ¼ãã¨gqãæ¼ãããã¨ã«ãªã map Q gq " <C-U>ãæ¼ãã¨<Ctrl+g> + u + <C-U>ãæ¼ãããã¨ã«ãªã inoremap <C-U> <C-G>u<C-U>
ãããã³ã°ã³ãã³ã | ãããã³ã°ããã¢ã¼ã |
---|---|
map | ãã¼ãã«ã»ãã¸ã¥ã¢ã«ã»ã¢ã¼ã·ã§ã³å¾ ã¡ |
imap | æ¿å ¥ |
nmap | ãã¼ãã« |
vmap | ãã¸ã¥ã¢ã« |
cmap | ã³ãã³ãã©ã¤ã³ |
omap | ã¢ã¼ã·ã§ã³å¾ ã¡ |
- ã¢ã¼ã·ã§ã³å¾ ã¡ : dãyãªã©ã®ãªãã¬ã¼ã¿ç´ä¿ã®ç¯å²æå®ç¨ãããã³ã°
æ®éã«ä¸è¨ã³ãã³ãã§ãããã³ã°ããã¨ä¾ãã°
nmap w ww
ã§ãããã³ã°ããã¨wã§ãããã³ã°ããwwã®wãããã«wwã«ãããã³ã°â¦ãªã©å帰çã«ãããã³ã°ããã¦ãã¾ãã¾ãã
ããã§noremap
ã§nnoremap w ww
ã¨ããã¨wã2ååã ãç½®æããã¾ãã
auto commandã®æ¸å¼
ããç¹å®ã®ã¿ã¤ãã³ã°ã«å¯¾ãã¦å®è¡ãããã¤ãã³ãã«å¯¾ãã¦ä»»æã®ã³ã¼ã«ããã¯ãçºç
autocmd File Type text setlocal textwidth=78
ãã©ã°ã¤ã³ç®¡çãã©ã°ã¤ã³
neobundleã¤ã³ã¹ãã¼ã«ãã
mkdir -p ~/.vim/bundle cd ~/.vim/bundle git clone https://github.com/Shougo/neobundle.vim.git
vim å°æé
æ°´å¹³ç·ãæ¸ã
5i-<ESC>x
ãå
¥å
Vimã®æ£è¦è¡¨ç¾
Vimç¹æã®æ£è¦è¡¨ç¾
æ©è½ | Vim |
---|---|
1å以ä¸ã®ç¹°ãè¿ã | \+ |
0 or 1åã®ããã | \? ã¾ã㯠\= |
nåã®ç¹°ãè¿ã | \{n} |
èªå¢ç | \<(åèªå§ã¾ã), \>(åèªçµãã) |
ã°ã«ã¼ãå | \(...\) |
ãã£ããã£ãªãã°ã«ã¼ãå | \%(...\) |
:%s/foo_\zsbar/hoge/g
ã¨å
¥åããã¨ãfoo_barãã®ãbarãããhogeãã«ç½®ãæãã¾ãã
Vim ãã¯ã
q + ä»»æã®ä¸æå
ã§è¨é²éå§ > ããä¸åº¦q
ãæ¼ãã¨è¨é²çµäºã§ãã
ç»é²ãããã¯ãã®ä½¿ç¨@ + ä»»æã®ä¸æå
ã§ãã¯ã使ç¨å¯è½ã@@
ã§æå¾ã«ä½¿ç¨ãããã¯ããå度使ç¨ããã
é¸æé¨åã®æåæ°ã«ã¦ã³ã
ç©å½¢é¸æ<ctrl+v>
ã§æåé¸æãããããã¦g <ctrl>-g
ãæ¼ãã¨ã¦ã£ã³ãã¦ã®ä¸é¨ã«ãä½è¡ä¸ä½è¡ãç·åèªæ°ã®ãã¡ã®åèªæ°ãç·ãã¤ãã®ãã¡ã®ãã¤ãã表示ããã