all repos — dotfiles @ 7a9101a52391dbd559f128b4f25d4c489f33721e

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