--- tags: computer science, vim --- # How to Use **vim** and **tmux**? ![](https://i.imgur.com/JX3p83r.png =500x) ## Powerful Text Editor: **vim** - Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient. It is included as "vi" with most UNIX systems and with Apple OS X. ![](https://i.imgur.com/4xS3zf3.png) ### Installation ```bash= sudo apt install vim ``` ### Common Commands | Hot Key | Description | | ------------ | ----------- | | *i* | edit mode | | *esc* | enter command mode | | *:q* | quit vim | | *:q!* | force to quit if not saving | | *:wq* | save and quit vim | | *d-w* | delete one word | | *d-d* | delete one line | | *v* | highlight text | | *y* | yank the highlighted text | | *y-y* | copy the line | | *d* | delete the highlighted text | | *p* | paste after | | *shift + p* | paste before | | *u* | undo | | *ctrl + r* | redo | | *w* | skip ahead one word | | *b* | skip back one word | | *0* | move to the beginning of line | | *$* | move to the end of line | | *(* | move backward one sentence | | *)* | move to one sentence | | *g* | move to the top of text | | *shift + g* | move to the bottom of text | | *z-z* | center the screen | | */ + word* | search the word location | | *? + word* | search the word location by pattern | --- ```bash :sp[lit] [/path/to/file] # splits the window horizontally [and opens the file] :vs[plit] [/path/to/file] # splits the window vertically [and opens the file] :tabs :set mouse=a ``` ### Configuration ![](https://i.imgur.com/FiLbIXb.png) ### References - https://www.vim.org/ - http://www.cs.cmu.edu/~15131/f17/topics/vim/vim-cheatsheet.pdf - https://danielmiessler.com/study/vim/ - https://linuxize.com/post/vim-search/ - https://blog.confirm.ch/mastering-vim-working-with-multiple-files/ ## Terminal Multiplexer: **tmux** - tmux is an open-source terminal multiplexer for Unix-like operating systems. - It allows multiple terminal sessions to be accessed simultaneously in a single window. - It is useful for running more than one command-line program at the same time. - It can also be used to detach processes from their controlling terminals, allowing remote sessions to remain active without being visible. ![](https://i.imgur.com/xHvZM4h.png) ### Installation ```bash= sudo apt install tmux ``` ### Common Hot Keys - First press *ctrl + b* and then press the following possible hot keys: | Hot Key | Description | | ---------- | ----------- | | *+ %* | split a vertical window | | *+ "* | split a horizontal window | | *+ o* | switch among the windows | | *+ arrows* | switch by selecting some direction | | *+ space* | change the layout | | *+ d* | temporarily leaving tmux | | *+ x* | kill the current window | ### Configuration ![](https://i.imgur.com/FiLbIXb.png) ### References - https://blog.gtwang.org/linux/linux-tmux-terminal-multiplexer-tutorial/