all repos — dotfiles @ ab676c9c1db4ed7bc1db6d1fc5762ca12e716787

my *nix dotfiles

config/nvim/init.vim (view raw)

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