-
Notifications
You must be signed in to change notification settings - Fork 0
Vim
alex [dot] kramer [at] g_m_a_i_l [dot] com edited this page Jun 8, 2022
·
10 revisions
⏣SUPERIOR ULTRABEST™⏣ Vim config. Provides fancy-pants aliases, sane default settings, and other useful miscellanea:
https://github.com/mitochondrion/dotfiles/blob/master/.vimrc
# Install vim config
wget https://raw.githubusercontent.com/mitochondrion/dotfiles/master/.vimrc -O ~/.vimrc
# Install Pathogen vim plugin loader
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
# Install vim plugins
git clone https://github.com/scrooloose/nerdcommenter.git ~/.vim/bundle/nerdcommenter
git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree
git clone https://github.com/airblade/vim-gitgutter ~/.vim/bundle/vim-gitgutter
git clone https://github.com/mileszs/ack.vim.git ~/.vim/bundle/ack.vim
git clone https://github.com/bronson/vim-trailing-whitespace ~/.vim/bundle/vim-trailing-whitespace
git clone https://github.com/ctrlpvim/ctrlp.vim.git ~/.vim/bundle/ctrlp.vim
git clone https://github.com/ervandew/supertab ~/.vim/bundle/supertab
git clone https://github.com/ntpeters/vim-better-whitespace.git ~/.vim/bundle/vim-better-whitespace
git clone https://github.com/sheerun/vim-polyglot.git ~/.vim/bundle/vim-polyglot
# git clone https://github.com/scrooloose/syntastic ~/.vim/bundle/syntastic # 🐌Removed because Syntastic can make vim unuseably slow
# Install best vim colors
mkdir ~/.vim/colors
git clone https://github.com/chriskempson/tomorrow-theme.git ~/.vim/colors/tomorrow-theme
cp ~/.vim/colors/tomorrow-theme/vim/colors/*.vim ~/.vim/colors/
vim [file] --startuptime ~/vim.log
vim -V20vimlog [file]
# In another terminal
less -NM vimlog # Press F to start tailing
# OR
tail -f vimlog
Run from vim command-line mode
:![COMMAND] # e.g.: :!mv ./thing1 ./thing2
Run from shell
Ctrl-z # Stop (pause) currently exec'd process (vim)
[RUN COMMANDS]
fg # Resume (un-pause) vim
:[COMMAND1] | [COMMAND2] | ...
Executable
:w | !./%
Interpretable (e.g. python)
:w | !python ./%
Full path (in case not editing from same dir)
:w | !python %:p
- Position cursor over word to copy:
y
,i
,w
- Position cursor over word to replace:
c
,i
,w
,Ctrl
+r
,0
- Position cursor over next word to replace:
.
(repeat this step for subsequent words)
[BYTE INDEX]
, g
, o
(e.g.: 1234go
)
Define block
- Position cursor at beginning of block:
Ctrl
+v
- Move cursor to end of block
Insert
- From buffer:
Shift
+i
,Ctrl
+r
,0
,Esc
- New text:
Shift
+i
,[NEW TEXT]
,Esc
Delete
d
Replace block
- With new text:
c
,[NEW TEXT]
,Esc
- From buffer:
p