all repos — dotfiles @ c3402fa58aab52c2cf78cefe021870e5ddd5cc44

my *nix dotfiles

config/nvim/init.vim (view raw)

  1" _       _ _         _           
  2"(_)_ __ (_) |___   _(_)_ __ ___  
  3"| | '_ \| | __\ \ / / | '_ ` _ \ 
  4"| | | | | | |_ \ V /| | | | | | |
  5"|_|_| |_|_|\__(_)_/ |_|_| |_| |_|
  6
  7"autocmd FileType html setlocal ts=2 sts=2 sw=2 expandtab autocmd FileType css setlocal ts=2 sts=2 sw=2 expandtab
  8
  9set shiftwidth=4     " indent = 4 spaces
 10set noexpandtab      " tabs are tabs
 11set tabstop=4        " tab = 4 spaces
 12set softtabstop=4    " backspace through spaces
 13
 14call plug#begin()
 15Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
 16Plug 'jiangmiao/auto-pairs'
 17Plug 'airblade/vim-gitgutter'
 18Plug 'reedes/vim-pencil'
 19Plug 'chriskempson/base16-vim'
 20Plug 'godlygeek/tabular'
 21Plug 'tpope/vim-fugitive'
 22Plug 'leafgarland/typescript-vim'
 23Plug 'mxw/vim-jsx'
 24Plug 'ervandew/supertab'
 25call plug#end()
 26
 27
 28set swapfile
 29set dir=/tmp
 30set number
 31set smartcase
 32syntax on
 33filetype plugin indent on
 34set laststatus=2
 35set noshowmode
 36set hlsearch
 37set incsearch
 38set ignorecase
 39set scrolloff=12
 40set rtp+=~/.fzf
 41set timeout timeoutlen=3000 ttimeoutlen=100
 42set undodir=~/.vim/undodir
 43set nowrap
 44
 45colorscheme agila
 46
 47let mapleader=' '
 48nnoremap <leader>n :nohlsearch<cr>
 49nnoremap <leader>b :Buffers<cr>
 50nnoremap <leader>o :only<cr>
 51nnoremap <leader>t :call GetTabber()<cr>
 52
 53let g:currentmode={
 54    \ 'n'  : 'NORMAL ',
 55    \ 'no' : 'N·Operator Pending ',
 56    \ 'v'  : 'VISUAL ',
 57    \ 'V'  : 'V·Line ',
 58    \ '' : 'V·Block',
 59    \ 's'  : 'Select ',
 60    \ 'S'  : 'S·Line ',
 61    \ '' : 'S·Block',
 62    \ 'i'  : 'INSERT ',
 63    \ 'R'  : 'REPLACE ',
 64    \ 'Rv' : 'V·Replace ',
 65    \ 'c'  : 'Command ',
 66    \ 'cv' : 'Vim Ex ',
 67    \ 'ce' : 'Ex ',
 68    \ 'r'  : 'Prompt ',
 69    \ 'rm' : 'MORE ',
 70    \ 'r?' : 'CONFIRM ',
 71    \ '!'  : 'SHELL ',
 72    \ 't'  : 'TERMINAL '}
 73
 74set statusline=
 75set statusline+=%#TabLineSel#
 76set statusline+=\ %{g:currentmode[mode()]}
 77set statusline+=%#TODO#
 78set statusline+=%{StatuslineGit()}
 79set statusline+=%#TabLineFill#
 80set statusline+=\ %f\ 
 81set statusline+=%m
 82set statusline+=%#TabLineFill#
 83set statusline+=%=
 84set statusline+=%#TODO#
 85set statusline+=\ %l\  
 86set statusline+=%#TabLineSel#
 87set statusline+=\ %y\ 
 88set statusline+=%#TabLine#
 89
 90" for git branch in statusline, from nerdypepper
 91function! GitBranch()
 92	return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
 93endfunction
 94
 95
 96function! S_gitgutter()  " formatted git hunk summary for statusline
 97	if exists('b:gitgutter')
 98		let l:summary = b:gitgutter.summary
 99		if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0
100			return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' '
101		endif
102	endif
103	return ''
104endfunction
105
106function! StatuslineGit()
107	let l:branchname = GitBranch()
108	return strlen(l:branchname) > 0?'  '.l:branchname.' ':''
109endfunction
110
111
112function! GetTabber()  " a lil function that integrates well with Tabular.vim
113	let c = nr2char(getchar())
114	:execute 'Tabularize /' . c
115endfunction"
116
117" git gutter settings
118let g:gitgutter_override_sign_column_highlight = 0
119let g:gitgutter_sign_added                     = '+'
120let g:gitgutter_sign_modified                  = '±'
121let g:gitgutter_sign_removed                   = '-'
122let g:gitgutter_sign_removed_first_line        = '^'
123let g:gitgutter_sign_modified_removed          = '#'
124highlight clear SignColumn
125highlight GitGutterAdd ctermfg=red
126highlight GitGutterChange ctermfg=red
127highlight GitGutterDelete ctermfg=red
128highlight GitGutterChangeDelete ctermfg=red
129
130let g:help_in_tabs = 1
131let g:deoplete#enable_at_startup = 1
132
133nmap <silent> H :let g:help_in_tabs = !g:help_in_tabs<CR
134
135" Only apply to .txt files
136augroup HelpInTabs
137    autocmd!
138    autocmd BufEnter  *.txt   call HelpInNewTab()
139augroup END
140
141" Only apply to help files
142function! HelpInNewTab ()
143    if &buftype == 'help' && g:help_in_tabs
144        "Convert the help window to a tab...
145        execute "normal \<C-W>T"
146    endif
147endfunction
148
149highlight LineNr ctermbg=none
150highlight Comment cterm=italic
151hi TabLine ctermbg=black
152hi TabLineFill ctermbg=black
153hi TabLineSel ctermbg=magenta