all repos — dotfiles @ eb9e08d0e892d6960293a5aa9545b315a8d1b10f

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