all repos — dotfiles @ 1dd901a63affceef49c050e8ba1ea0cc7d15410d

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