- Install Vagrant
- Run
vagrant up
- Run
vagrant ssh
- Type
cd tutorial
- Type
vim vim.md
Last active
January 3, 2019 15:33
-
-
Save mattjmorrison/69329b96217b384eb5a8 to your computer and use it in GitHub Desktop.
Tool Instructions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.vagrant/ | |
*.swp |
tmux
~/.tmux.conf
- Default is
<C-b>
- I recommend using
<C-Space>
<C-">
- split the window horizontally
<C-%>
- split the window vertically
<Leader>-c
- open a new window
<Leader>-n
- move to the next window
<Leader>-#
- move to window number # (where # is a number)
<C-b>:set -g prefix C-Space
or addset -g prefix C-Space
in~/.tmux.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" | |
config.vm.box = "ubuntu-14.04" | |
config.vm.synced_folder ".", "/home/vagrant/tutorial" | |
config.vm.provision "shell", | |
inline: "sudo apt-get install git -y" | |
end |
vim
vim name_of_file_to_open
vim **/*.py
open all python files- in bash this may require
shopt -s globstar
- in bash this may require
vimdiff
first secondm- run this command passing it 2 files to see a diff of the 2 files
:e name_of_file_to_open
:x
- save the current file and exit
:w
- save the current file
:wa
- save all open files
:wq
- save current file and quit
:waq
- save all files and quit
:q!
- quit without saving any files
:qa!
- quit and do not save or prompt to save any open files
hjkl
- left,down,up,right
w
orb
- move (forward/backward) to the beginning of a word (delimited by blanks & special characters)
W
orB
- move (forward/backward) to the beginning of a word (delimited by blanks)
e
orge
- move (forward/backward) to the end of a word (delimited by blanks & special characters)
ge
orE
- move (forward/backward) to the end of a word (delimited by blanks)
<C-u>
or<C-d>
- page up/down by a half screen
<C-f>
or<C-b>
- page up/down a screen
gg
orG
- go to beginning/end of document
f
orF
- jump to a character (forward/backward from the cursor) on current line
t
orT
- jump until a character (forward/backward from the cursor) on current line
;
or,
- replay last
T
,t
,F
, orf
- replay last
%
- move to matching '{', '[', '(', closing html/xml tags
*
or#
- move cursor to next/previous occurance of word under cursor
(
or)
- move cursor forward/backward a sentence
{
or}
- move cursor forward/backward a paragraph
zt
- scrolls the document so your cursor is at the top of the screen
zb
- scrolls the document so your cursor is at the bottom of the screen
zz
- scrolls the document so your cursor is in the middle of the screen
<C-o>
- move cursor to older cursor position
<C-i>
- move cursor to newer cursor position
:q/MATCH_THIS/
- Show everything in the current buffer that matches the given regex
:v/MATCH_THIS/
- Show everything in the current buffer that does NOT match the given regex
vimgrep
:vimgrep /something/g **/*.*
findsomething
in all files:vimgrep /something/g ##
findsomething
in all opened files
/
or?
- search document (forward/backward) for given regex
- n/N will go (forward/backward) to next search result
q/
- show search history for searches done using
/
or?
- show search history for searches done using
:set hlsearch
/:set nohlsearch
- highlight search matches in file
:set incsearch
/:set noincsearch
- highlight search maches as you type
V
- select a line
<C-v>
- visual block
V{/}
- select expanding blocks up/down
p
- paragraph
u
- undo last change
<C-r>
- redo last undo
i
- 1 character before the cursor
I
- at the first character of the current line
o
- 1 line after the cursor
O
- 1 line above the cursor
a
- 1 character after the cursor
A
s- after the last character of the current line
y
- 'yank' (or copy) the selected text
yy
- 'yank' (or copy) the current line
p
- 'paste' the last yanked text one character after the cursor
"?y
- 'yank' into '?' register ( do not use numbers for ? )
"?p
- 'paste' from '?' register ( do not use numbers for ? )
<C-v>(select column)I(enter text)<ESC>
- prepend some text to all columns
<C-v>$(select column)A(enter text)<ESC>
- append some text to the end of each line
yiw
- 'yank inner word'
- ie: with your cursor on a 'word' yiw will copy that word
- 'yank inner word'
ciw
- 'change inner word'
- ie: with your cursor on a 'word' ciw will replace that word and put your into insert mode
- 'change inner word'
diw
- 'delete inner word'
caw
- 'change around word'
- ie: with your cursor on a 'word' caw will replace the word (including surrouding whitespace)
- 'change around word'
yaw
- 'yank around word'
daw
- 'delete around word'
ci?
- 'change inner ?'
- ie: where '?' is a character like (
- 'change inner ?'
:help
- documentation
<C-]>
- jump in tags (used in help docs)
<C-r>=
(in insert mode)- will allow you to evaluate math expressions
:arg
- show or set the current argument list
:arg
will show it:arg **/*.py
will set it to all python files
- show or set the current argument list
:argdo
- perform an operation on each file in the argument list
:argdo %g/something/d
will delete all lines containing the wordsomething
in all files in the arugment list
:bufdo
- perform an operation on each open buffer
:bufdo g/something/d
will delete all lines containing the wordsomething
in all open buffers
:tabdo
- perform an operation on each open tab
##
- is the arglist
%
- is the current file
:copen
- open quickfix
:cnext
- go to next quickfix result
:cprev
- go to previous quickfix result
:cold
- go to previous quickfix buffer
:cnew
- go to next quickfix buffer
:cclose
- close quickfix
.
- replay last normal mode command
i
- inner
a
- around
c
- change
:set showcmd
/:set noshowcmd
- shows commands as they are being typed
:set number
/:set nonumber
- shows line numbers
:set relativenumber
/:set norelativenumber
- shows line numbers relative to your cursor
:set wrap
/:set nowrap
- turn on line wrapping
:set spell
/:set nospell
- turn on spell checking
q:
- show command history
:vs
- vertial split
:split
- horizonal split
<C-w>hjkl
- move cursor to pane to left,below,above,right
<C-w><>
- resize pane to the left or right
<C-w>+-
- resize pane to the top or bottom
<C-w>J
- switch from vertical to horizonal split
<C-w>L
- switch from horizonal to vertical split
<C-w><C-r>
- swap pane positions
:! external_command
:reg
- show all registers
:ls
- show all current buffers
:bn
- go to next buffer
:bp
- go to previous buffer
:b#
- go to buffer
#
where#
is the number of the buffer from:ls
- go to buffer
:bf
- go to the first buffer
:bl
- go to the last buffer
m{a-z}
- will set a mark called whatever you typed after the
m
which can be jumped to from within the file
- will set a mark called whatever you typed after the
m{A-Z}
- will set a mark called whatever you typed after the
m
which can be jumped to from another file
- will set a mark called whatever you typed after the
'{a-zA-Z}
- will jump to a mark called whatever you typed after the
'
(lower case within the file upper case across files)
- will jump to a mark called whatever you typed after the
:marks
- will show all current marks
q?
- begin recording a macro into register named
?
- begin recording a macro into register named
q
- stop recording a macro (must have been previously recording)
@?
- play a recorded macro from register
?
- play a recorded macro from register
x@?
- play a recorded macro from register
?
x number of times
- play a recorded macro from register
zf
- with text selected in visual mode
- followed by x{direction} where x is the number of lines you want folded
zc
orzC
- close a fold (one level/recursive)
zo
orzO
- open a fold (one level/recursive)
za
orzA
- toggle a fold (one level/recursive)
zR
- open all folds
zM
- close all folds
vim -p file1 file2 file3
- open each file in a separate tab
:tabnew
- create a new tab
:tabe
- open a file in a new tab
:tabn
- go to next tab
:tabfirst
- go to first tab
:tabc
- close current tab
- Set the argument list to all modified files
- ":arg
git diff --name-only
"
- ":arg
- Example: Easier quickfix keys
:map <F1> :copen<CR>
:map <F2> :cnext<CR>
:map <F3> :cprev<CR>
:map <F12> :cclose<CR>
- Example: Basic Emacs Navigation (in insert mode)
:imap <C-e> <End>
:imap <C-a> <C-o>0
:imap <C-f> <Right>
:imap <C-b> <Left>
:imap <C-p> <Up>
:imap <C-n> <Down>
:imap <Esc>f <C-o>W
:imap <Esc>b <C-o>B
]c
- Jump forwards to the next start of a change.
[c
- Jump backwards to the previous start of a change.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment