Add more to file management

- Tabs, Buffers, Windows
master
Nathan Steel 5 years ago
parent d48fa3e3eb
commit 9b5b1e7752

@ -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 `.` - 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. 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
Buffers are used as file proxies. These are to keep the files accessable.
`:r` `:r`
`:e filenam` `:e filenam`
`:bn` `:bn`
`:bp` `:bp`
`:bd` `:bd`
`:ls` - Shows the buffers `:ls` - Shows the buffers
`:b1..9` - Switch to buffer number
`Ctrl+6` - Switches between the buffers `Ctrl+6` - Switches between the buffers
`#Ctrl+6` - Switches to the buffer number `#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 Windows are used to compare files, or work on one file while referencing another.
:vs
Ctrl + ww `:split <file>` - Horizontally split the window
Ctrl + wr Switch the splits around `: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 # 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 `:syntax on` - Turns syntax highlighting on
`:set hidden` - Allows you to switch between buffers without writing.
These variables can be added into a file called ~/.vimrc to automatically run These variables can be added into a file called ~/.vimrc to automatically run
every time vim opens. every time vim opens.

Loading…
Cancel
Save