|
|
|
|
@ -159,29 +159,51 @@ This is the "change and replace" of vim. It makes use of regex.
|
|
|
|
|
|
|
|
|
|
`.` - Repeats the last command. Eg. ci( will occur again
|
|
|
|
|
|
|
|
|
|
# Buffers Splits Multitasking
|
|
|
|
|
# Tabs, Buffers, Splits Multitasking
|
|
|
|
|
|
|
|
|
|
Vim can open numerous files/buffers at the same time.
|
|
|
|
|
These can be in tab like buffers, or in a splitscreen view.
|
|
|
|
|
These can be in tabs, buffers, or in a splitscreen view.
|
|
|
|
|
|
|
|
|
|
## Tabs
|
|
|
|
|
|
|
|
|
|
Tabs are used like workspaces. To keep tasks associated, from there you have multiple buffers.
|
|
|
|
|
|
|
|
|
|
`:tabedit <file>` - Open a file in a new tab
|
|
|
|
|
`:tabe new` - Open a blank tab
|
|
|
|
|
`gt` - Switch to next tab
|
|
|
|
|
`gT` - Switch to previous tab
|
|
|
|
|
`<x>gt` - Switch to tab x
|
|
|
|
|
|
|
|
|
|
`CTRL+W T` - Breakout current window/split into a new tab
|
|
|
|
|
`CTRL+w gf` - Open new tab to file under cursor
|
|
|
|
|
|
|
|
|
|
## Buffers
|
|
|
|
|
|
|
|
|
|
Buffers are used as file proxies. These are to keep the files accessable.
|
|
|
|
|
|
|
|
|
|
`:r`
|
|
|
|
|
`:e filenam`
|
|
|
|
|
`:bn`
|
|
|
|
|
`:bp`
|
|
|
|
|
`:bd`
|
|
|
|
|
`:ls` - Shows the buffers
|
|
|
|
|
`:b1..9` - Switch to buffer number
|
|
|
|
|
`Ctrl+6` - Switches between the buffers
|
|
|
|
|
`#Ctrl+6` - Switches to the buffer number
|
|
|
|
|
|
|
|
|
|
## Splits
|
|
|
|
|
`bd` - Delete current buffer, fails if there are any changes
|
|
|
|
|
`bd!` - Delete current buffer, discarding changes
|
|
|
|
|
|
|
|
|
|
## Splits/Windows
|
|
|
|
|
|
|
|
|
|
:split
|
|
|
|
|
:vs
|
|
|
|
|
Windows are used to compare files, or work on one file while referencing another.
|
|
|
|
|
|
|
|
|
|
Ctrl + ww
|
|
|
|
|
Ctrl + wr Switch the splits around
|
|
|
|
|
`:split <file>` - Horizontally split the window
|
|
|
|
|
`:vs` - Vertically split the window
|
|
|
|
|
|
|
|
|
|
`Ctrl + ww` - Cycle between active splits
|
|
|
|
|
`Ctrl+W hjkl` - Cycle between active splits with vimkeys
|
|
|
|
|
`Ctrl + wr` - Switch the splits around
|
|
|
|
|
|
|
|
|
|
# Setting variables in Vim
|
|
|
|
|
|
|
|
|
|
@ -191,5 +213,7 @@ Vim has extra features disabled by default, that can be very useful!
|
|
|
|
|
|
|
|
|
|
`:syntax on` - Turns syntax highlighting on
|
|
|
|
|
|
|
|
|
|
These variables can be added into a file called ~/.vimrc to automatically run
|
|
|
|
|
`:set hidden` - Allows you to switch between buffers without writing.
|
|
|
|
|
|
|
|
|
|
These variables can be added into a file called ~/.vimrc to automatically run
|
|
|
|
|
every time vim opens.
|
|
|
|
|
|