all repos — dotfiles @ 3d3817c74c93c25323e853842ce136b66387db7a

my *nix dotfiles

config/nvim/init.vim (view raw)

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