all repos — dotfiles @ fd6190ecf23ff82b793e3facd22a815cbb3a75c9

my *nix dotfiles

config/nvim/init.vim (view raw)

  1" _       _ _         _           
  2"(_)_ __ (_) |___   _(_)_ __ ___  
  3"| | '_ \| | __\ \ / / | '_ ` _ \ 
  4"| | | | | | |_ \ V /| | | | | | |
  5"|_|_| |_|_|\__(_)_/ |_|_| |_| |_|
  6
  7
  8call plug#begin()
  9Plug 'jiangmiao/auto-pairs'
 10Plug 'airblade/vim-gitgutter'
 11Plug 'NerdyPepper/vim-colors-plain', { 'branch': 'duotone' }
 12" plugins for writing {{{
 13Plug 'reedes/vim-pencil', { 'for': ['text',  'markdown'] }
 14Plug 'reedes/vim-wordy', { 'for': ['text',  'markdown'] }
 15Plug 'junegunn/goyo.vim', { 'for': ['text',  'markdown'] }
 16Plug 'plasticboy/vim-markdown', { 'for': ['text',  'markdown'] }
 17" }}}
 18Plug 'chriskempson/base16-vim'
 19Plug 'ervandew/supertab'
 20Plug 'yuttie/comfortable-motion.vim'
 21Plug 'zah/nim.vim'
 22Plug 'wellle/targets.vim'
 23Plug 'NerdyPepper/agila.vim'
 24Plug 'w0rp/ale'
 25call plug#end()
 26
 27" indentation
 28augroup indents
 29	autocmd!
 30	autocmd FileType less,css,html setlocal ts=2 sts=2 sw=2 expandtab
 31	autocmd FileType text,markdown setlocal expandtab
 32augroup END
 33
 34augroup restorecursor
 35	autocmd BufReadPost *
 36				\ if line("'\"") > 1 && line("'\"") <= line("$") |
 37				\   execute "normal! g`\"" |
 38				\ endif
 39augroup END
 40
 41" basic settings
 42set swapfile
 43set dir=/tmp
 44set nonumber
 45set smartcase
 46syntax on
 47filetype plugin indent on
 48set laststatus=2
 49set noshowmode
 50set hlsearch
 51set incsearch
 52set ignorecase
 53set scrolloff=12
 54set rtp+=~/.fzf
 55set timeout timeoutlen=3000 ttimeoutlen=100
 56set undodir=~/.vim/undodir
 57set nowrap
 58set nocursorline
 59set conceallevel=2 
 60set mouse=a
 61set wildmenu
 62set shiftwidth=4     " indent = 4 spaces
 63set tabstop=4        " tab = 4 spaces
 64set expandtab
 65set softtabstop=4    " backspace through spaces
 66set nocompatible
 67
 68" wildcard ignores
 69set wildignore+=.git,.hg,.svn
 70set wildignore+=*.aux,*.out,*.toc
 71set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
 72set wildignore+=*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
 73set wildignore+=*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
 74set wildignore+=*.mp3,*.oga,*.ogg,*.wav,*.flac
 75set wildignore+=*.eot,*.otf,*.ttf,*.woff
 76set wildignore+=*.doc,*.pdf,*.cbr,*.cbz
 77set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
 78set wildignore+=*.swp,.lock,.DS_Store,._*
 79
 80" colorscheme
 81colorscheme plain
 82set background=dark
 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
113hi PrimaryBlock   ctermfg=06 ctermbg=00
114hi SecondaryBlock ctermfg=08 ctermbg=00
115hi Blanks   ctermfg=07 ctermbg=00
116
117set statusline=
118set statusline+=%#PrimaryBlock#
119set statusline+=\ %{g:currentmode[mode()]}
120set statusline+=%#SecondaryBlock#
121set statusline+=%{StatuslineGit()}
122set statusline+=%#Blanks#
123set statusline+=\ %f\ 
124set statusline+=%m
125set statusline+=%=
126set statusline+=%#SecondaryBlock#
127set statusline+=\ %l\  
128set statusline+=%#PrimaryBlock#
129set statusline+=%{&filetype}
130
131" for git branch in statusline, from nerdypepper
132function! GitBranch()
133	return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
134endfunction
135
136
137" bunch of functions
138function! S_gitgutter()  " formatted git hunk summary for statusline
139	if exists('b:gitgutter')
140		let l:summary = b:gitgutter.summary
141		if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0
142			return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' '
143		endif
144	endif
145	return ''
146endfunction
147
148function! StatuslineGit()
149	let l:branchname = GitBranch()
150	return strlen(l:branchname) > 0?'  '.l:branchname.' ':''
151endfunction
152
153" git gutter settings
154let g:gitgutter_override_sign_column_highlight = 0
155let g:gitgutter_sign_added                     = '+'
156let g:gitgutter_sign_modified                  = '±'
157let g:gitgutter_sign_removed                   = '-'
158let g:gitgutter_sign_removed_first_line        = '^'
159let g:gitgutter_sign_modified_removed          = '#'
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
181
182
183" vim-markdown 
184let g:vim_markdown_no_default_key_mappings=1
185let g:vim_markdown_toml_frontmatter=1
186let g:vim_markdown_yaml_fromtmatter=1
187let g:vim_markdown_folding_disabled=1
188let g:vim_markdown_conceal=0
189
190" vim-pencil
191let g:pencil#textwidth = 72
192let g:pencil#conceallevel = 0
193augroup pencil
194  autocmd!
195  autocmd FileType markdown,mkd call pencil#init({'wrap': 'hard', 'autoformat': 0})
196augroup END
197