all repos — dotfiles @ 44f96edc415648eda61c1eebc89d7f30d2efe093

my *nix dotfiles

config/nvim/init.vim (view raw)

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