all repos — dotfiles @ 347dafd63c45173b4cae692d47286bf80513d7d3

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