all repos — dotfiles @ 994ca27c6c1820761b5474858e9ec590ddc3f6ef

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