Skip to content

Latest commit

 

History

History
113 lines (91 loc) · 8.59 KB

README.md

File metadata and controls

113 lines (91 loc) · 8.59 KB

My living Vim stack

Subject to constant change, the goal of this repository is to store a polyglot coding environment setup for Vim.

Plugins

See /plugged.

Dependencies

  1. Vim 8.2 (or newer) with Python 3.3 support. Install with sudo port install vim +python33 (MacPorts)
  2. ctags for tagbar. Install with sudo port install ctags (MacPorts).
  3. powerline-fonts for vim-airline advanced status bar and tabline.
  4. JSCS. Install with npm install -g jscs.
  5. pwgen. Install with Homebrew or MacPorts.
  6. Nord-ain.terminal profile (at the root of this repo)

Installation

  1. Clone

     $ git clone https://github.com/ain/.vim.git
    
  2. Symlink Vim configuration to home folder

     $ ln -s <clone path>/.vimrc ~/.vimrc
    
  3. Install vim-plug, see installation guide

  4. Install plugins by running :PlugInstall in Vim

  5. Install language servers, e.g. :CocInstall coc-json coc-tsserver for JavaScript

  6. Install Nord-ain.terminal as new Terminal.app profile and activate

  7. Install the downloaded Powerline font, e.g. Cousine for Powerline

  8. Select font in the added Nord-ain.terminal profile to match the downloaded Powerline font

Updates

Run PlugUpdate in Vim.

Cheatsheet

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

Tips

  1. Disabling PressAndHold feature on Mac OS X Yosemite (or greater) to restore key repeat: defaults write com.apple.Terminal ApplePressAndHoldEnabled -bool false

GPG-signed commits on GitHub

  1. Install GPG Suite

  2. Create key in GPG Keychain

  3. Export newly created key without secret

  4. Copy key content to GitHub (Settings > SSH and GPG keys > New GPG key)

  5. Configure signature locally, see Telling Git about your GPG key

  6. Let all commits be signed

     $ git config --global commit.gpgsign true
    

Useful resources