Skip to content

Instantly share code, notes, and snippets.

@herko
Created April 30, 2019 22:09
Show Gist options
  • Save herko/25eb1e4f2d6b044209f26702b0959173 to your computer and use it in GitHub Desktop.
Save herko/25eb1e4f2d6b044209f26702b0959173 to your computer and use it in GitHub Desktop.
VIM Configuration
set encoding=utf-8
let mapleader=","
set autowrite
set backspace=2
set cursorline
set history=60
set incsearch
set laststatus=2
set nobackup
set noerrorbells
set noswapfile
set nowritebackup
set ruler
set showcmd
set showmatch
set showmode
set title
set visualbell
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
syntax on
endif
if has('gui_running')
set guifont=Operator\ Mono\ Light:h12
set guioptions-=T
set guioptions-=L
set guioptions-=r
set guioptions-=b
set guioptions-=h
set guioptions-=m
set shortmess=atI
endif
if &compatible
set nocompatible
end
let g:has_async = v:version >= 800 || has('nvim')
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree'
Plug 'scrooloose/nerdcommenter'
Plug 'tpope/vim-surround'
Plug 'airblade/vim-gitgutter'
Plug 'vim-airline/vim-airline'
Plug 'kien/ctrlp.vim'
Plug 'vim-airline/vim-airline-themes'
Plug 'mattn/emmet-vim'
Plug 'tpope/vim-rails'
Plug 'mileszs/ack.vim'
Plug 'vim-ruby/vim-ruby'
Plug 'christoomey/vim-tmux-navigator'
Plug 'yggdroot/indentline'
Plug 'raimondi/delimitmate'
Plug 'morhetz/gruvbox'
Plug 'jlanzarotta/bufexplorer'
if g:has_async
Plug 'w0rp/ale'
endif
call plug#end()
filetype plugin indent on
set background=dark
colorscheme gruvbox
" Softtabs, 2 spaces
set tabstop=2
set shiftwidth=2
set shiftround
set expandtab
" Display extra whitespace
set list listchars=tab:»·,trail:·,nbsp:·
" Use one space, not two, after punctuation.
set nojoinspaces
" Make it obvious where 80 characters is
set textwidth=100
set colorcolumn=+1
" Numbers
set number
set relativenumber
set numberwidth=5
" Tab completion
" will insert tab at beginning of line,
" will use completion if not at beginning
set wildmode=list:longest,list:full
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<Tab>"
else
return "\<C-p>"
endif
endfunction
inoremap <Tab> <C-r>=InsertTabWrapper()<CR>
inoremap <S-Tab> <C-n>
" Get off my lawn
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
" Treat <li> and <p> tags like the block tags they are
let g:html_indent_tags = 'li\|p'
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Plugins
" NERDTREE
let NERDTreeShowBookmarks=0
let NERDTreeHighlightCursorLine=1
let NERDTreeShowLineNumbers=0
let NERDTreeMinimalUI=1
noremap <leader>k :NERDTreeToggle<CR>
noremap <leader>K :NERDTreeFocus<CR>
" INDENTLINE
let g:indentLine_char='|'
nmap <silent> <leader>ev :e $MYVIMRC<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment