Skip to content

Instantly share code, notes, and snippets.

@0atman 0atman/init.vim
Created May 15, 2018

What would you like to do?
current vim config
" Install vim-plug first
" curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs \
" vim-plug {{{
call plug#begin()
" Visual marks
Plug 'kshenoy/vim-signature'
" split nativation
Plug 'christoomey/vim-tmux-navigator'
" Session
Plug 'mhinz/vim-startify'
" tag navigation for souce files
Plug 'majutsushi/tagbar'
Plug 'ludovicchabant/vim-gutentags'
" sensible defaults
" Plug ''
" parinfer
Plug 'bhurlow/vim-parinfer'
" ack integration
Plug 'mileszs/ack.vim'
" auto complete
Plug 'fatih/vim-go'
Plug 'nvie/vim-flake8'
Plug 'davidhalter/jedi-vim'
Plug 'ervandew/supertab'
Plug 'honza/vim-snippets'
Plug 'scrooloose/syntastic'
" fireplace
Plug 'tpope/vim-fireplace'
" navigation/search file
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'rking/ag.vim'
Plug 'dkprice/vim-easygrep'
Plug 'jeffkreeftmeijer/vim-numbertoggle'
" note
Plug 'xolox/vim-misc'
Plug 'xolox/vim-notes'
" editing
Plug 'scrooloose/nerdcommenter'
Plug 'tpope/vim-surround'
Plug 'godlygeek/tabular'
Plug 'tpope/vim-repeat'
" better statusline
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" git management plugin
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
" color scheme
"Plug 'Lokaltog/vim-distinguished'
Plug 'joshdick/onedark.vim'
Plug 'daveyarwood/vim-alda'
call plug#end()
" }}} vim-plug
" Enable viminfo, for saivng metadata (marks etc)
set viminfo='100,f1
" Colors {{{
syntax enable " enable syntax processing
set background=dark
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
"(see < > for more information.)
if (empty($TMUX))
if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4 < >
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < >
"Based on Vim patch 7.4.1770 (`guicolors` option) < >
" < >
if (has("termguicolors"))
set termguicolors
colorscheme onedark
" }}} Colors
" Mouse
set mouse=a
" Spaces & Tabs {{{
set tabstop=4 " number of visual spaces per TAB
set softtabstop=4 " number of spaces in tab when editing
set shiftwidth=4 " number of spaces to use for autoindent
set expandtab " tabs are space
set autoindent
set copyindent " copy indent from the previous line
" }}} Spaces & Tabs
" Clipboard {{{
set clipboard+=unnamedplus
" }}} Clipboard
" UI Config {{{
set hidden
set number " show line number
set showcmd " show command in bottom bar
set cursorline " highlight current line
set wildmenu " visual autocomplete for command menu
set showmatch " highlight matching brace
set laststatus=2 " window will always have a status line
set nobackup
set noswapfile
let &colorcolumn="80"
" }}} UI Config
" Search {{{
set incsearch " search as characters are entered
set hlsearch " highlight matche
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is lower case
" case-sensitive otherwise
" set Ag as the grep command
if executable('ag')
" Note we extract the column as well as the file and line number
set grepprg=ag\ --nogroup\ --nocolor\ --column
set grepformat=%f:%l:%c%m
" }}} Search
" Leader & Mappings {{{
let mapleader="," " leader is comma
" edit/reload vimrc
nmap <leader>ev :e $MYVIMRC<CR>
nmap <leader>sv :so $MYVIMRC<CR>
" easy splits nav
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" better ESC
inoremap jj <esc>
" Make escape work in the Neovim terminal.
tnoremap <Esc> <C-\><C-n>
" Prefer Neovim terminal insert mode to normal mode.
autocmd BufEnter term://* startinsert
" fast save and close
nmap <leader>w :w<CR>
nmap <leader>x :x<CR>
nmap <leader>q :q<CR>
" insert blank line before current line without leaving insert mode
imap <leader>o <c-o><s-o>
" move up/down consider wrapped lines
nnoremap j gj
nnoremap k gk
" fix indentation
nnoremap <leader>i mzgg=G`z<CR>
" turn off search highlights
nnoremap <leader><space> :nohlsearch<CR>
" move through grep results
nmap <silent> <right> :cnext<CR>
nmap <silent> <left> :cprev<CR>
" buffers
nnoremap <tab> :bn<CR>
nnoremap <s-tab> :bp<CR>
nnoremap <leader>bd :bd<CR>
" split navigation
nnoremap <c-j> <c-w><c-j>
nnoremap <c-k> <c-w><c-k>
nnoremap <c-l> <c-w><c-l>
nnoremap <c-h> <c-w><c-h>
" fast header source switch
map <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
" fzf
nnoremap <c-p> :FZF<CR>
" NERDTree mappings {{{
map <C-n> :NERDTreeToggle<CR>
" }}}
" }}}
" NERDTree {{{
let NERDTreeShowHidden=1
let NERDTreeIgnore = ['\.pyc$', '__pycache__']
" }}}
" Airline {{{
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
" }}}
" JS Standard
let g:syntastic_javascript_checkers = ['standard']
" Python Flake8
let g:syntastic_python_checkers = ['flake8', 'mypy']
" Syntactic
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_aggregate_errors = 1
autocmd BufRead,BufNewFile *.{hy} setlocal filetype=clojure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.