'vim 단축키 만들기'에 해당되는 글 1건

  1. 2013.01.16 Vim Key mapping

Vim Key mapping

Vim/Tutorial 2013. 1. 16. 17:10 |

I want to map <Ctrl + S> as Save command in Vim.

Becuase <Ctrl+s> stops the output in the terminal, it's important to change the shortcut first using stty command. 



># stty stop ^K        // vim에서 Ctrl+s를 쓰기위하여 리눅스의 stty중 stop부분을 Ctrl+K로 바꿨다.


In the terminal, <Ctrl+S> command is stop printing inputs 


># vim .vimrc

map <C-S> :w<CR>                 'command mode

map! <C-S> <Esc>:w<CR>       'insert mode        // map에 !를 붙여서 insert모드에서도 가능하게끔 하였다.




위에 처럼 셋팅하면 vim 에디터에서 ctrl+s로 저장을 할 수 있다. 

하지만 그 순간뿐이다. 재부팅하거나 터미널을 다시 시작하면 위에 했던 일련의 셋팅들이 모두 초기화된다. 

그래서 자신의 shell 환경설정 파일을 수정해야 한다. 

내 shell은 bash shell 이므로 $HOME ./bashrc 를 수정하였다. 




References

1. How to map keys in vim, http://how-to.wikia.com/wiki/How_to_map_keys_in_vim

2. Mapping keys in Vim - Tutorial, http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_%28Part_1%29

3. Mapping Keys, http://newbiedoc.sourceforge.net/tutorials/vim/mapping-vim.html.en


'Vim > Tutorial' 카테고리의 다른 글

vim 에러 처리  (0) 2013.02.02
명령어 표기법에 대해서  (0) 2013.02.02
유용한 명령어들 몇가지  (0) 2013.01.15
vim Tutorial (PDF파일)  (0) 2012.05.09
vi editor  (0) 2012.05.02
Posted by scii
: