all repos — dotfiles @ 39693a8043d667069b20bc20294a5109880e8297

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 'ervandew/supertab'
 22Plug 'rust-lang/rust.vim'
 23Plug 'yuttie/comfortable-motion.vim'
 24Plug 'plasticboy/vim-markdown'
 25Plug 'kristijanhusak/vim-carbon-now-sh'
 26Plug 'zchee/deoplete-jedi'
 27Plug 'zah/nim.vim'
 28Plug 'wellle/targets.vim'
 29Plug 'NerdyPepper/agila.vim'
 30
 31call plug#end()
 32
 33" indentation
 34augroup indents
 35	autocmd!
 36	autocmd FileType less,css,html setlocal ts=2 sts=2 sw=2 expandtab
 37	autocmd FileType text,markdown setlocal expandtab
 38augroup END
 39
 40" basic settings
 41set swapfile
 42set dir=/tmp
 43set number
 44set smartcase
 45syntax on
 46filetype plugin indent on
 47set laststatus=2
 48set noshowmode
 49set hlsearch
 50set incsearch
 51set ignorecase
 52set scrolloff=12
 53set rtp+=~/.fzf
 54set timeout timeoutlen=3000 ttimeoutlen=100
 55set undodir=~/.vim/undodir
 56set nowrap
 57set cursorline
 58set conceallevel=2 
 59set mouse=a
 60
 61" colorscheme
 62colorscheme agila
 63
 64" keybindings
 65let mapleader=' '
 66nnoremap <leader>n :nohlsearch<cr>
 67nnoremap <leader>b :Buffers<cr>
 68nnoremap <leader>o :only<cr>
 69nnoremap <leader>t :call GetTabber()<cr>
 70nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr>
 71nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr>
 72vnoremap <F5> :CarbonNowSh<CR>
 73
 74" statusline
 75let g:currentmode={
 76			\ 'n'  : 'NORMAL ',
 77			\ 'no' : 'N·Operator Pending ',
 78			\ 'v'  : 'VISUAL ',
 79			\ 'V'  : 'V·Line ',
 80			\ '' : 'V·Block',
 81			\ 's'  : 'Select ',
 82			\ 'S'  : 'S·Line ',
 83			\ '' : 'S·Block',
 84			\ 'i'  : 'INSERT ',
 85			\ 'R'  : 'REPLACE ',
 86			\ 'Rv' : 'V·Replace ',
 87			\ 'c'  : 'Command ',
 88			\ 'cv' : 'Vim Ex ',
 89			\ 'ce' : 'Ex ',
 90			\ 'r'  : 'Prompt ',
 91			\ 'rm' : 'MORE ',
 92			\ 'r?' : 'CONFIRM ',
 93			\ '!'  : 'SHELL ',
 94			\ 't'  : 'TERMINAL '}
 95
 96set statusline=
 97set statusline+=%#PrimaryBlock#
 98set statusline+=\ %{g:currentmode[mode()]}
 99set statusline+=%#TabLineSel#
100set statusline+=%{StatuslineGit()}
101set statusline+=%#TabLineFill#
102set statusline+=\ %f\ 
103set statusline+=%m
104set statusline+=%=
105set statusline+=%#TabLineSel#
106set statusline+=\ %l\  
107set statusline+=%#PrimaryBlock#
108set statusline+=\ %y\ 
109
110" for git branch in statusline, from nerdypepper
111function! GitBranch()
112	return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
113endfunction
114
115
116" bunch of functions
117function! S_gitgutter()  " formatted git hunk summary for statusline
118	if exists('b:gitgutter')
119		let l:summary = b:gitgutter.summary
120		if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0
121			return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' '
122		endif
123	endif
124	return ''
125endfunction
126
127function! StatuslineGit()
128	let l:branchname = GitBranch()
129	return strlen(l:branchname) > 0?'  '.l:branchname.' ':''
130endfunction
131
132
133function! GetTabber()  " a lil function that integrates well with Tabular.vim
134	let c = nr2char(getchar())
135	:execute 'Tabularize /' . c
136endfunction"
137
138" git gutter settings
139let g:gitgutter_override_sign_column_highlight = 0
140let g:gitgutter_sign_added                     = '+'
141let g:gitgutter_sign_modified                  = '±'
142let g:gitgutter_sign_removed                   = '-'
143let g:gitgutter_sign_removed_first_line        = '^'
144let g:gitgutter_sign_modified_removed          = '#'
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
167"highlight LineNr ctermbg=none guibg=none
168"highlight Comment cterm=italic
169"hi TabLine ctermbg=black
170"hi TabLineFill ctermbg=black
171"hi TabLineSel ctermbg=magenta
172hi CursorLine ctermbg=none
173"hi 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
180
181" deoplete-jedi
182let g:python_host_prog = '/home/icyphox/.pynvim2/bin/python'
183let g:python3_host_prog = '/home/icyphox/.pynvim3/bin/python'