all repos — dotfiles @ 5de32a513f82634a6205d004292b72f49c739da8

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 'plasticboy/vim-markdown', { 'for': ['text',  'markdown'] }
 16" }}}
 17Plug 'ervandew/supertab'
 18Plug 'zah/nim.vim'
 19Plug 'wellle/targets.vim'
 20Plug 'NerdyPepper/agila.vim'
 21call plug#end()
 22
 23" indentation
 24augroup indents
 25	autocmd!
 26	autocmd FileType less,css,html setlocal ts=2 sts=2 sw=2 expandtab
 27	autocmd FileType text,markdown setlocal expandtab
 28augroup END
 29
 30augroup restorecursor
 31	autocmd BufReadPost *
 32				\ if line("'\"") > 1 && line("'\"") <= line("$") |
 33				\   execute "normal! g`\"" |
 34				\ endif
 35augroup END
 36
 37" basic settings
 38set swapfile
 39set dir=/tmp
 40set nonumber
 41set smartcase
 42syntax on
 43filetype plugin indent on
 44set laststatus=2
 45set hlsearch
 46set incsearch
 47set ignorecase
 48set scrolloff=12
 49set rtp+=~/.fzf
 50set timeout timeoutlen=3000 ttimeoutlen=100
 51set undodir=~/.vim/undodir
 52set nowrap
 53set nocursorline
 54set conceallevel=2 
 55set mouse=a
 56set wildmenu
 57set shiftwidth=4     " indent = 4 spaces
 58set tabstop=4        " tab = 4 spaces
 59set expandtab
 60set softtabstop=4    " backspace through spaces
 61set nocompatible
 62set noshowmode
 63
 64" wildcard ignores
 65set wildignore+=.git,.hg,.svn
 66set wildignore+=*.aux,*.out,*.toc
 67set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
 68set wildignore+=*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
 69set wildignore+=*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
 70set wildignore+=*.mp3,*.oga,*.ogg,*.wav,*.flac
 71set wildignore+=*.eot,*.otf,*.ttf,*.woff
 72set wildignore+=*.doc,*.pdf,*.cbr,*.cbz
 73set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
 74set wildignore+=*.swp,.lock,.DS_Store,._*
 75
 76" colorscheme
 77colorscheme plain
 78set background=dark
 79
 80" keybindings
 81let mapleader=' '
 82nnoremap <leader>n :nohlsearch<cr>
 83nnoremap <leader>o :only<cr>
 84nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr>
 85nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr>
 86nnoremap <C-t> :tabedit
 87
 88" Not an editor command: Wqa
 89:command! WQ wq
 90:command! Wq wq
 91:command! Wqa wqa
 92:command! W w
 93:command! Q q
 94
 95" statusline
 96let g:currentmode={
 97			\ 'n'  : 'normal ',
 98			\ 'no' : 'n·operator pending ',
 99			\ 'v'  : 'visual ',
100			\ 'V'  : 'v·line ',
101			\ '' : 'v·block ',
102			\ 's'  : 'select ',
103			\ 'S'  : 's·line ',
104			\ '' : 's·block ',
105			\ 'i'  : 'insert ',
106			\ 'R'  : 'replace ',
107			\ 'Rv' : 'v·replace ',
108			\ 'c'  : 'command ',
109			\ 'cv' : 'vim ex ',
110			\ 'ce' : 'ex ',
111			\ 'r'  : 'prompt ',
112			\ 'rm' : 'more ',
113			\ 'r?' : 'confirm ',
114			\ '!'  : 'shell ',
115			\ 't'  : 'terminal '}
116
117hi PrimaryBlock   ctermfg=06 ctermbg=00
118hi SecondaryBlock ctermfg=08 ctermbg=00
119hi Blanks   ctermfg=07 ctermbg=00
120
121set statusline=
122set statusline+=%#PrimaryBlock#
123set statusline+=\ %{g:currentmode[mode()]}
124set statusline+=%#SecondaryBlock#
125set statusline+=%{StatuslineGit()}
126set statusline+=%#Blanks#
127set statusline+=\ %f\ 
128set statusline+=%m
129set statusline+=%=
130set statusline+=%#SecondaryBlock#
131set statusline+=\ %l\  
132set statusline+=%#PrimaryBlock#
133set statusline+=%{&filetype}
134
135" for git branch in statusline, from nerdypepper
136function! GitBranch()
137	return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
138endfunction
139
140
141" bunch of functions
142function! S_gitgutter()  " formatted git hunk summary for statusline
143	if exists('b:gitgutter')
144		let l:summary = b:gitgutter.summary
145		if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0
146			return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' '
147		endif
148	endif
149	return ''
150endfunction
151
152function! StatuslineGit()
153	let l:branchname = GitBranch()
154	return strlen(l:branchname) > 0?'  '.l:branchname.' ':''
155endfunction
156
157" git gutter settings
158let g:gitgutter_override_sign_column_highlight = 0
159let g:gitgutter_sign_added                     = '+'
160let g:gitgutter_sign_modified                  = '±'
161let g:gitgutter_sign_removed                   = '-'
162let g:gitgutter_sign_removed_first_line        = '^'
163let g:gitgutter_sign_modified_removed          = '#'
164
165nmap <silent> H :let g:help_in_tabs = !g:help_in_tabs<CR
166
167" only apply to .txt files
168augroup HelpInTabs
169	autocmd!
170	autocmd BufEnter  *.txt   call HelpInNewTab()
171augroup END
172
173" only apply to help files
174function! HelpInNewTab ()
175	if &buftype == 'help' && g:help_in_tabs
176		"Convert the help window to a tab...
177		execute "normal \<C-W>T"
178	endif
179endfunction
180
181" comments are italicized
182hi Comment cterm=italic
183" color overrides
184hi CursorLine ctermbg=none
185
186
187" vim-markdown 
188let g:vim_markdown_no_default_key_mappings=1
189let g:vim_markdown_toml_frontmatter=1
190let g:vim_markdown_yaml_fromtmatter=1
191let g:vim_markdown_folding_disabled=1
192let g:vim_markdown_conceal=0
193
194" vim-pencil
195let g:pencil#textwidth = 72
196let g:pencil#conceallevel = 0
197augroup pencil
198  autocmd!
199  autocmd FileType markdown,mkd call pencil#init({'wrap': 'hard', 'autoformat': 0})
200augroup END
201