all repos — dotfiles @ 67fcd4cc85b392cbe4bad7c140d260f23862497f

my *nix dotfiles

config/nvim/init.vim (view raw)

  1" _       _ _         _           
  2"(_)_ __ (_) |___   _(_)_ __ ___  
  3"| | '_ \| | __\ \ / / | '_ ` _ \ 
  4"| | | | | | |_ \ V /| | | | | | |
  5"|_|_| |_|_|\__(_)_/ |_|_| |_| |_|
  6
  7
  8call plug#begin()
  9Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
 10Plug 'jiangmiao/auto-pairs'
 11Plug 'airblade/vim-gitgutter'
 12" plugins for writing {{{
 13Plug 'reedes/vim-pencil', { 'for': ['text',  'markdown'] }
 14Plug 'reedes/vim-wordy', { 'for': ['text',  'markdown'] }
 15Plug 'reedes/vim-litecorrect', { 'for': ['text',  'markdown'] }
 16Plug 'junegunn/goyo.vim', { 'for': ['text',  'markdown'] }
 17Plug 'plasticboy/vim-markdown', { 'for': ['text',  'markdown'] }
 18" }}}
 19Plug 'chriskempson/base16-vim'
 20Plug 'ervandew/supertab'
 21Plug 'yuttie/comfortable-motion.vim'
 22Plug 'zchee/deoplete-jedi'
 23Plug 'zah/nim.vim'
 24Plug 'wellle/targets.vim'
 25Plug 'NerdyPepper/agila.vim'
 26Plug 'w0rp/ale'
 27call plug#end()
 28
 29" indentation
 30augroup indents
 31	autocmd!
 32	autocmd FileType less,css,html setlocal ts=2 sts=2 sw=2 expandtab
 33	autocmd FileType text,markdown setlocal expandtab
 34augroup END
 35
 36augroup restorecursor
 37	autocmd BufReadPost *
 38				\ if line("'\"") > 1 && line("'\"") <= line("$") |
 39				\   execute "normal! g`\"" |
 40				\ endif
 41augroup END
 42
 43" basic settings
 44set swapfile
 45set dir=/tmp
 46set number
 47set smartcase
 48syntax on
 49filetype plugin indent on
 50set laststatus=2
 51set noshowmode
 52set hlsearch
 53set incsearch
 54set ignorecase
 55set scrolloff=12
 56set rtp+=~/.fzf
 57set timeout timeoutlen=3000 ttimeoutlen=100
 58set undodir=~/.vim/undodir
 59set nowrap
 60set cursorline
 61set conceallevel=2 
 62set mouse=a
 63set wildmenu
 64set shiftwidth=4     " indent = 4 spaces
 65set noexpandtab      " tabs are tabs
 66set tabstop=4        " tab = 4 spaces
 67set softtabstop=4    " backspace through spaces
 68
 69" wildcard ignores
 70set wildignore+=.git,.hg,.svn
 71set wildignore+=*.aux,*.out,*.toc
 72set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
 73set wildignore+=*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
 74set wildignore+=*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
 75set wildignore+=*.mp3,*.oga,*.ogg,*.wav,*.flac
 76set wildignore+=*.eot,*.otf,*.ttf,*.woff
 77set wildignore+=*.doc,*.pdf,*.cbr,*.cbz
 78set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
 79set wildignore+=*.swp,.lock,.DS_Store,._*
 80
 81" colorscheme
 82colorscheme agila
 83
 84" keybindings
 85let mapleader=' '
 86nnoremap <leader>n :nohlsearch<cr>
 87nnoremap <leader>o :only<cr>
 88nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr>
 89nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr>
 90
 91" statusline
 92let g:currentmode={
 93			\ 'n'  : 'NORMAL ',
 94			\ 'no' : 'N·Operator Pending ',
 95			\ 'v'  : 'VISUAL ',
 96			\ 'V'  : 'V·Line ',
 97			\ '' : 'V·Block',
 98			\ 's'  : 'Select ',
 99			\ 'S'  : 'S·Line ',
100			\ '' : 'S·Block',
101			\ 'i'  : 'INSERT ',
102			\ 'R'  : 'REPLACE ',
103			\ 'Rv' : 'V·Replace ',
104			\ 'c'  : 'Command ',
105			\ 'cv' : 'Vim Ex ',
106			\ 'ce' : 'Ex ',
107			\ 'r'  : 'Prompt ',
108			\ 'rm' : 'MORE ',
109			\ 'r?' : 'CONFIRM ',
110			\ '!'  : 'SHELL ',
111			\ 't'  : 'TERMINAL '}
112
113set statusline=
114set statusline+=%#PrimaryBlock#
115set statusline+=\ %{g:currentmode[mode()]}
116set statusline+=%#TabLineSel#
117set statusline+=%{StatuslineGit()}
118set statusline+=%#TabLineFill#
119set statusline+=\ %f\ 
120set statusline+=%m
121set statusline+=%=
122set statusline+=%#TabLineSel#
123set statusline+=\ %l\  
124set statusline+=%#PrimaryBlock#
125set statusline+=\ %y\ 
126
127" for git branch in statusline, from nerdypepper
128function! GitBranch()
129	return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
130endfunction
131
132
133" bunch of functions
134function! S_gitgutter()  " formatted git hunk summary for statusline
135	if exists('b:gitgutter')
136		let l:summary = b:gitgutter.summary
137		if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0
138			return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' '
139		endif
140	endif
141	return ''
142endfunction
143
144function! StatuslineGit()
145	let l:branchname = GitBranch()
146	return strlen(l:branchname) > 0?'  '.l:branchname.' ':''
147endfunction
148
149" git gutter settings
150let g:gitgutter_override_sign_column_highlight = 0
151let g:gitgutter_sign_added                     = '+'
152let g:gitgutter_sign_modified                  = '±'
153let g:gitgutter_sign_removed                   = '-'
154let g:gitgutter_sign_removed_first_line        = '^'
155let g:gitgutter_sign_modified_removed          = '#'
156
157" deoplete 
158let g:help_in_tabs = 1
159let g:deoplete#enable_at_startup = 1
160
161nmap <silent> H :let g:help_in_tabs = !g:help_in_tabs<CR
162
163" only apply to .txt files
164augroup HelpInTabs
165	autocmd!
166	autocmd BufEnter  *.txt   call HelpInNewTab()
167augroup END
168
169" only apply to help files
170function! HelpInNewTab ()
171	if &buftype == 'help' && g:help_in_tabs
172		"Convert the help window to a tab...
173		execute "normal \<C-W>T"
174	endif
175endfunction
176
177" comments are italicized
178hi Comment cterm=italic
179" color overrides
180hi CursorLine ctermbg=none
181hi Visual ctermfg=white cterm=bold ctermbg=none
182
183
184" vim-markdown 
185let g:vim_markdown_no_default_key_mappings=1
186let g:vim_markdown_toml_frontmatter=1
187let g:vim_markdown_yaml_fromtmatter=1
188let g:vim_markdown_folding_disabled=1
189
190" deoplete-jedi
191let g:python_host_prog = '/home/icy/.pynvim2/bin/python'
192let g:python3_host_prog = '/home/icy/.pynvim3/bin/python'