Subject to constant change, the goal of this repository is to store a polyglot coding environment setup for Vim.
See /plugged.
- Vim 8.2 (or newer) with Python 3.3 support. Install with
sudo port install vim +python33
(MacPorts) - ctags for tagbar. Install with
sudo port install ctags
(MacPorts). - powerline-fonts for vim-airline advanced status bar and tabline.
- JSCS. Install with
npm install -g jscs
. - pwgen. Install with Homebrew or MacPorts.
Nord-ain.terminal
profile (at the root of this repo)
-
Clone
$ git clone https://github.com/ain/.vim.git
-
Symlink Vim configuration to home folder
$ ln -s <clone path>/.vimrc ~/.vimrc
-
Install
vim-plug
, see installation guide -
Install plugins by running
:PlugInstall
in Vim -
Install language servers, e.g.
:CocInstall coc-json coc-tsserver
for JavaScript -
Install
Nord-ain.terminal
as newTerminal.app
profile and activate -
Install the downloaded Powerline font, e.g. Cousine for Powerline
-
Select font in the added
Nord-ain.terminal
profile to match the downloaded Powerline font
Run PlugUpdate
in Vim.
Vim command | Description |
---|---|
gg=G |
Fix indentation |
dG |
Delete till EOF |
:w !pbcopy |
Copy entire buffer to pasteboard |
"ay |
Copy to a register |
"ap |
Paste from a register |
F8 |
Launch tagbar |
za |
Fold block |
z<Shift>r |
Unfold all blocks |
tabular | |
:Tabularize /<regex> |
Tabularise data by regular expression |
Surroundings | |
ds" |
Remove double quotes on word under cursor |
cs"' |
Replace double quotes with single quotes on word under cursor |
ysiw' |
Add single quotes on word under cursor |
NERDCommenter | |
,cn |
Comment line or block |
,ci |
Toggle comment on line or block |
vim-fugitive + Git | |
ce |
In git status (:Git ), amend staged files to last commit |
:Gread <branch>:<file> |
Read file fom another branch into current buffer, e.g. :Gread master:% for the same file in master |
:Gbranches |
Display Git branches with their tracked remotes, incl. current Git branch |
:Grmbranches |
Remove all local branches exc. master |
:Grmrbranches |
Remove all remote branches exc. master |
:Git |
Display Git status |
:Greset |
Hard reset back to HEAD |
:Gurl |
Display remote origin URL |
:Gpusho |
Push current branch to origin autosetting upstream |
:Gpushu |
Push current branch to origin autosetting upstream |
:Gpushf |
Force-push current branch to origin |
:Gpushfu |
Force-push current branch to upstream |
:Gpullo |
Pull current branch from origin with rebase |
:Gpullu |
Pull current branch from upstream with rebase |
:Gglog |
Global log with stat |
:Gdlog |
Global decorated log with stat highlighting branches |
:Gflog |
Detailed log of file in buffer |
:Gblog |
Current branch log |
:Gclean |
Remove newly created files |
:Grebuild |
Empty commit with message Rebuild , e.g. for CI systems |
:Gtags |
List all tags with description (git tag -l -n1 ) |
:Gcotag |
Display tag that is currently checked out (git name-rev --tags --name-only $(git rev-parse HEAD) ) |
:Gpr <remote> <ID> |
Fetch and checkout Pull Request from remote by ID |
:Gbranchd <branch> |
Delete branch locally and at origin |
Utilities | |
:Md5 |
MD5 checksum of file in active buffer |
:Tstamp |
Insert UNIX timestamp at cursor |
:Pwd |
Insert 12-char alphanumeric password at cursor |
coc.nvim | |
:CocInstall <extension> |
Install coc extension for code completion |
vim-plug | |
:PlugInstall |
Install all plugins described in .vimrc |
:PlugUpdate |
Update all plugins described in .vimrc . See complete list of commands |
- Disabling PressAndHold feature on Mac OS X Yosemite (or greater) to restore key repeat:
defaults write com.apple.Terminal ApplePressAndHoldEnabled -bool false
-
Install GPG Suite
-
Create key in GPG Keychain
-
Export newly created key without secret
-
Copy key content to GitHub (Settings > SSH and GPG keys > New GPG key)
-
Configure signature locally, see Telling Git about your GPG key
-
Let all commits be signed
$ git config --global commit.gpgsign true