|
@@ -0,0 +1,134 @@
|
|
|
+" -----------------------------------------------------------------------------
|
|
|
+" Status line
|
|
|
+" -----------------------------------------------------------------------------
|
|
|
+
|
|
|
+" Heavily inspired by: https://github.com/junegunn/dotfiles/blob/master/vimrc
|
|
|
+function! s:statusline_expr()
|
|
|
+ let mod = "%{&modified ? '[+] ' : !&modifiable ? '[x] ' : ''}"
|
|
|
+ let ro = "%{&readonly ? '[RO] ' : ''}"
|
|
|
+ let ft = "%{len(&filetype) ? '['.&filetype.'] ' : ''}"
|
|
|
+ let fug = "%{exists('g:loaded_fugitive') ? fugitive#statusline() : ''}"
|
|
|
+ let sep = ' %= '
|
|
|
+ let pos = ' %-12(%l : %c%V%) '
|
|
|
+ let pct = ' %P'
|
|
|
+
|
|
|
+ return '[%n] %f %<'.mod.ro.ft.fug.sep.pos.'%*'.pct
|
|
|
+endfunction
|
|
|
+
|
|
|
+let &statusline = s:statusline_expr()
|
|
|
+
|
|
|
+" Use a line cursor within insert mode and a block cursor everywhere else.
|
|
|
+"
|
|
|
+" Using iTerm2? Go-to preferences / profile / colors and disable the smart bar
|
|
|
+" cursor color. Then pick a cursor and highlight color that matches your theme.
|
|
|
+" That will ensure your cursor is always visible within insert mode.
|
|
|
+"
|
|
|
+" Reference chart of values:
|
|
|
+" Ps = 0 -> blinking block.
|
|
|
+" Ps = 1 -> blinking block (default).
|
|
|
+" Ps = 2 -> steady block.
|
|
|
+" Ps = 3 -> blinking underline.
|
|
|
+" Ps = 4 -> steady underline.
|
|
|
+" Ps = 5 -> blinking bar (xterm).
|
|
|
+" Ps = 6 -> steady bar (xterm).
|
|
|
+let &t_SI = "\e[6 q"
|
|
|
+let &t_EI = "\e[2 q"
|
|
|
+
|
|
|
+set rtp+=/usr/share/vim/addons/plugin/powerline.vim
|
|
|
+set t_Co=256
|
|
|
+
|
|
|
+syntax on
|
|
|
+
|
|
|
+set autoindent
|
|
|
+set smartindent
|
|
|
+set autoread
|
|
|
+set backspace=indent,eol,start
|
|
|
+set backupdir=/tmp//,.
|
|
|
+set clipboard=unnamedplus,unnamed
|
|
|
+set complete+=kspell
|
|
|
+set completeopt=menuone,longest
|
|
|
+set cursorline
|
|
|
+set directory=/tmp//,.
|
|
|
+set encoding=utf-8
|
|
|
+set expandtab
|
|
|
+set smarttab
|
|
|
+set formatoptions=tcqrn1
|
|
|
+set hidden
|
|
|
+set hlsearch
|
|
|
+set ignorecase
|
|
|
+set incsearch
|
|
|
+set laststatus=2
|
|
|
+set matchpairs+=<:> " Use % to jump between pairs
|
|
|
+set mmp=5000
|
|
|
+set modelines=2
|
|
|
+set mouse=a
|
|
|
+set nocompatible
|
|
|
+set noerrorbells visualbell t_vb=
|
|
|
+set noshiftround
|
|
|
+set nospell
|
|
|
+set nostartofline
|
|
|
+set number relativenumber
|
|
|
+set regexpengine=1
|
|
|
+set ruler
|
|
|
+set scrolloff=0
|
|
|
+set shiftwidth=2
|
|
|
+set showcmd
|
|
|
+set showmatch
|
|
|
+set shortmess+=c
|
|
|
+set showmode
|
|
|
+set smartcase
|
|
|
+set softtabstop=2
|
|
|
+set spelllang=en_us
|
|
|
+set splitbelow
|
|
|
+set splitright
|
|
|
+set tabstop=2
|
|
|
+
|
|
|
+color desert
|
|
|
+
|
|
|
+" WSL yank support
|
|
|
+" Ref: https://superuser.com/questions/1291425/windows-subsystem-linux-make-vim-use-the-clipboard
|
|
|
+let s:clip = '/mnt/c/Windows/System32/clip.exe' " change this path according to your mount point
|
|
|
+if executable(s:clip)
|
|
|
+ augroup WSLYank
|
|
|
+ autocmd!
|
|
|
+ autocmd TextYankPost * if v:event.operator ==# 'y' | call system(s:clip, @0) | endif
|
|
|
+ augroup END
|
|
|
+endif
|
|
|
+
|
|
|
+" Plug-vim
|
|
|
+let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
|
|
|
+if empty(glob(data_dir . '/autoload/plug.vim'))
|
|
|
+ silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
|
|
+ autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
|
|
+endif
|
|
|
+
|
|
|
+call plug#begin()
|
|
|
+" Syntastic is a syntax checking plugin for Vim
|
|
|
+Plug 'vim-syntastic/syntastic'
|
|
|
+" Fugitive is the premier Vim plugin for Git.
|
|
|
+Plug 'tpope/vim-fugitive'
|
|
|
+" Lean & mean status/tabline for vim that's light as air.
|
|
|
+Plug 'vim-airline/vim-airline'
|
|
|
+Plug 'vim-airline/vim-airline-themes'
|
|
|
+" Sometimes, it's useful to line up text.
|
|
|
+Plug 'https://github.com/godlygeek/tabular'
|
|
|
+" Go plug in
|
|
|
+Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
|
|
|
+" If you've ever tried using the . command after a plugin map
|
|
|
+Plug 'tpope/vim-repeat'
|
|
|
+" EasyClip is a plugin for Vim which contains a collection of clipboard related functionality
|
|
|
+"Plug 'svermeulen/vim-easyclip'
|
|
|
+" Powerlien for vim
|
|
|
+Plug 'powerline/powerline'
|
|
|
+" Terraform
|
|
|
+Plug 'hashivim/vim-terraform'
|
|
|
+" Comment lines
|
|
|
+Plug 'tpope/vim-commentary'
|
|
|
+" Completion
|
|
|
+Plug 'ervandew/supertab'
|
|
|
+" Markdown TOC
|
|
|
+Plug 'mzlogin/vim-markdown-toc'
|
|
|
+call plug#end()
|
|
|
+
|
|
|
+" Integrate Powerline fonts
|
|
|
+let g:airline_powerline_fonts = 1
|