Skip to content

Instantly share code, notes, and snippets.

@nhooyr
Created January 3, 2017 11:15
Show Gist options
  • Save nhooyr/e6d844512d0e9658921b29788ba789c4 to your computer and use it in GitHub Desktop.
Save nhooyr/e6d844512d0e9658921b29788ba789c4 to your computer and use it in GitHub Desktop.
dsasadsa
" dein {{{
let s:dein_base = '~/.local/share/nvim/dein'
let s:dein_repo = s:dein_base.'/repos/github.com/Shougo/dein.vim'
if empty(glob(s:dein_repo, 1))
execute 'silent !git clone --branch vimproc https://github.com/Shougo/dein.vim' s:dein_repo
endif
execute 'set runtimepath^='.s:dein_repo
if dein#load_state(s:dein_base)
call dein#begin(s:dein_base)
call dein#load_toml('~/.config/nvim/dein.toml')
call dein#add('carlitux/deoplete-ternjs')
call dein#add('steelsojka/deoplete-flow')
" TODO setup
call dein#add('lervag/vimtex', {'merged': 0})
call dein#add('LnL7/vim-nix')
call dein#add('dag/vim-fish')
" TODO REVIEW
call dein#add('mattn/emmet-vim')
call dein#add('dag/vim-fish')
call dein#add('tpope/vim-scriptease')
call dein#add('tpope/vim-surround')
call dein#add('simnalamburt/vim-mundo')
" TODO MAPPINGS
call dein#add('justinmk/vim-sneak')
" TODO CONFIGURE
call dein#add('sbdchd/neoformat')
" TODO FIGURE THESE TWO AND FUGITIVE OUT
" http://mislav.net/2014/02/hidden-documentation/
" https://github.com/SevereOverfl0w/deoplete-github
call dein#add('jreybert/vimagit')
call dein#add('lambdalisue/vim-gita')
" TODO FIGURE OUT
call dein#add('dhruvasagar/vim-dotoo')
call dein#add('ludovicchabant/vim-gutentags')
call dein#end()
if has('vim_starting')
call map(dein#check_clean(), "delete(v:val, 'rf')")
endif
call dein#save_state()
endif
filetype plugin indent on
" TODO dein settings/notifications
let g:dein#install_progress_type = 'none'
let g:dein#install_message_type = 'none'
let g:dein#install_max_processes = 16
silent let s:need_install = dein#check_install()
if s:need_install
if has('vim_starting')
autocmd VimEnter * call dein#install()
else
call dein#install()
endif
endif
" }}}
" vim {{{
augroup vim_ft
autocmd!
" TODO if this has trouble, use BufEnter and check filetype
autocmd FileType vim setlocal expandtab shiftwidth=2 tabstop=2 foldmethod=marker
augroup END
function! s:wipeout()
let tpbl=[]
call map(range(1, tabpagenr('$')), 'extend(tpbl, tabpagebuflist(v:val))')
let wiped = 0
for buf in filter(range(1, bufnr('$')), 'bufexists(v:val) && index(tpbl, v:val)==-1 && !getbufvar(v:val,"&mod")')
" echom buf
silent execute 'bwipeout!' buf
let wiped += 1
endfor
echom wiped . ' buffers wiped'
endfunction
command! Wipeout call s:wipeout()
nnoremap <silent> <Leader>wp :call <SID>wipeout()<CR>
set tabline=%!Tabline()
function! Tabline() abort
let t = ''
for i in range(1, tabpagenr('$'))
if i == tabpagenr()
let t .= '%#TabLineSel#'
else
let t .= '%#TabLine#'
endif
let t .= ' %{Tablabel('.i.')} '
endfor
let t .= '%#TabLineFill#'
return t
endfunction
function! Tablabel(n) abort
let buflist = tabpagebuflist(a:n)
let winnr = tabpagewinnr(a:n)
let bufnr = buflist[winnr - 1]
let name = bufname(bufnr)
if empty(name)
return '[No Name]'
endif
let filetype = getbufvar(bufnr, '&filetype')
if filetype ==# "help"
return fnamemodify(name, ':t')
endif
return substitute(fnamemodify(name, ':~'), '\([^/]\)[^/]*\/', '\1/', 'g')
endfunction
function! Filename() abort
let name = expand('%')
if empty(name)
return '[No Name]'
endif
if &filetype ==# 'help'
return fnamemodify(name, ':t')
endif
return substitute(fnamemodify(name, ':~'), '\([^/]\)[^/]*\/', '\1/', 'g')
endfunction
function! Status() abort
let progress = dein#get_progress()
if progress =~# '^Updat'
return 'updating...'
elseif progress =~# '^('
return progress
endif
return substitute(fnamemodify(getcwd(), ':~'), '\([^/]\)[^/]*\/', '\1/', 'g')
endfunction
" TODO unimpaired mappings https://github.com/tpope/vim-unimpaired
noremap ; :
noremap : ;
cnoremap <C-E> <Up>
set statusline=\ %{Filename()}\ %h%m%r%=%{Status()}\
set mouse=
set noshowmode
set termguicolors
set splitright
set splitbelow
set shortmess+=Fc
set list
set listchars=tab:\ \ ,trail:-,nbsp:+
set hidden
set scrolloff=5
set wildchar=<C-N>
set wildignorecase
set showtabline=2
set laststatus=2
set showcmd
set ignorecase
set smartcase
set undofile
set undolevels=1000
set updatetime=0
set sidescroll=1
set completeopt=menuone,noselect
set inccommand=nosplit
if has("vim_starting")
set tabstop=4
set softtabstop=4
set shiftwidth=4
colorscheme elysian
endif
" }}}
" elysian {{{
augroup elysian
autocmd!
autocmd BufWritePost elysian.vim colorscheme elysian
augroup END
" }}}
" plugins {{{
" deoplete {{{
let g:deoplete#omni#input_patterns = {}
let g:deoplete#omni#input_patterns.fish = '\w+'
" https://www.reddit.com/r/neovim/comments/50678h/switched_to_neovim_asking_tips_about_javascript/
let g:deoplete#sources#flow#flow_bin = '/nix/store/sdfw43bzy56bj67vr1768cs9vpfa69gp-nodejs-7.2.1/bin/flow'
let g:deoplete#sources#ternjs#tern_bin = '/nix/store/sdfw43bzy56bj67vr1768cs9vpfa69gp-nodejs-7.2.1/bin/tern'
" }}}
" neoinclude {{{
let g:neoinclude#patterns = {}
let g:neoinclude#patterns.c = '^\s*#\s*\%(include\|import\)'
" }}}
" go {{{
let g:go_gocode_propose_builtins = 0
let g:go_fmt_command = 'goimports'
let g:go_template_autocreate = 0
let g:go_metalinter_command = 'gometalinter'
augroup go_mappings
autocmd!
autocmd FileType go nnoremap <Leader>gi :GoImport<space>
autocmd FileType go nnoremap <Leader>gn :GoInfo<CR>
augroup END
" }}}
" neosnippet {{{
" }}}
" neoformat {{{
nnoremap <silent> <Leader>nf :Neoformat<CR>
" }}}
" emmet {{{
let g:user_emmet_leader_key = "<M-e>"
" }}}
" mundo {{{
let g:mundo_verbose_graph = 0
let g:mundo_close_on_revert = 1
nnoremap <silent> <Leader>ut :MundoToggle<CR>
" }}}
" fish {{{
augroup fish_ft
autocmd!
autocmd FileType fish setlocal keywordprg=:Man
augroup END
" }}}
" gutentags {{{
let g:gutentags_cache_dir = '~/.cache/nvim/gutentags'
let g:gutentags_file_list_command = {'markers': {'.git': 'git ls-files'}}
let g:gutentags_exclude = ['*.go']
" }}}
" }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment