all repos — dotfiles @ be8783c4b7d3b7392c0e2f25003916d91735e578

my *nix dotfiles

config/nvim/init.vim (view raw)

  1"          _                    
  2"   _   __(_)___ ___  __________
  3"  | | / / / __ `__ \/ ___/ ___/
  4" _| |/ / / / / / / / /  / /__  
  5"(_)___/_/_/ /_/ /_/_/   \___/  
  6"
  7
  8"autocmd FileType html setlocal ts=2 sts=2 sw=2 expandtab autocmd FileType css setlocal ts=2 sts=2 sw=2 expandtab
  9
 10set shiftwidth=4     " indent = 4 spaces
 11set noexpandtab      " tabs are tabs
 12set tabstop=4        " tab = 4 spaces
 13set softtabstop=4    " backspace through spaces
 14
 15call plug#begin()
 16Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
 17Plug 'jiangmiao/auto-pairs'
 18Plug 'junegunn/fzf.vim'
 19Plug 'airblade/vim-gitgutter'
 20Plug 'reedes/vim-pencil'
 21Plug 'chriskempson/base16-vim'
 22Plug 'godlygeek/tabular'
 23Plug 'tpope/vim-fugitive'
 24Plug 'leafgarland/typescript-vim'
 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
 38"set cursorline
 39set ignorecase
 40set scrolloff=12
 41set rtp+=~/.fzf
 42set timeout timeoutlen=3000 ttimeoutlen=100
 43set undodir=~/.vim/undodir
 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
150hi TabLine ctermbg=black
151hi TabLineFill ctermbg=black
152hi TabLineSel ctermbg=magenta