vim-config/vimrc

407 lines
9.5 KiB
VimL
Raw Normal View History

2018-05-26 17:18:09 +00:00
" ===== hasufell's vimrc ))))
" no ATTENTION messages when swap file is already found
set shortmess+=A
2018-05-26 17:18:09 +00:00
" plugin stuff
filetype plugin on
filetype indent on
" vim-plug settings (Plugin declaration)
call plug#begin('~/.vim/plugged')
Plug 'mileszs/ack.vim'
Plug 'vim-scripts/cmdalias.vim'
Plug 'Raimondi/delimitMate'
Plug 'vim-scripts/genindent.vim'
2020-01-11 15:08:12 +00:00
" Plug 'sjl/gundo.vim'
" Plug 'idris-hackers/idris-vim'
"Plug 'yegappan/mru'
2018-05-26 17:18:09 +00:00
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
2020-01-11 15:08:12 +00:00
"Plug 'vim-scripts/promela.vim'
"Plug 'AndrewRadev/simple_bookmarks.vim'
"Plug 'Keithbsmiley/swift.vim'
2018-05-26 17:18:09 +00:00
Plug 'majutsushi/tagbar'
2020-01-11 15:08:12 +00:00
"Plug 'ternjs/tern_for_vim'
2018-05-26 17:18:09 +00:00
Plug 'xolox/vim-easytags'
Plug 'xolox/vim-misc'
2020-01-11 15:08:12 +00:00
Plug 'nathanaelkane/vim-indent-guides'
2018-05-26 17:18:09 +00:00
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
2018-06-15 17:39:17 +00:00
Plug 'sjbach/lusty'
2018-06-16 09:27:10 +00:00
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
2018-08-12 09:41:31 +00:00
Plug 'kien/ctrlp.vim'
2018-08-15 17:08:36 +00:00
Plug 'nixprime/cpsm', { 'do': 'PY3=ON ./install.sh' }
2018-08-14 16:57:32 +00:00
Plug 'junegunn/fzf', { 'do': './install --bin' }
2018-08-13 12:35:35 +00:00
Plug 'junegunn/fzf.vim'
2018-09-17 07:42:18 +00:00
Plug 'sbdchd/neoformat'
2019-02-25 04:28:26 +00:00
Plug 'AndrewRadev/bufferize.vim'
2019-02-25 04:28:40 +00:00
Plug 'vimwiki/vimwiki'
2020-01-14 12:05:17 +00:00
Plug 'vmchale/dhall-vim'
2020-01-25 18:22:22 +00:00
Plug 'Shougo/echodoc.vim'
Plug 'tpope/vim-scriptease'
2018-05-26 17:18:09 +00:00
2018-10-11 06:53:50 +00:00
" scm
Plug 'tpope/vim-fugitive'
2019-02-20 10:53:32 +00:00
Plug 'tpope/vim-rhubarb'
Plug 'tommcdo/vim-fubitive'
2020-01-11 15:08:12 +00:00
Plug 'airblade/vim-gitgutter'
2018-10-11 06:53:50 +00:00
2018-06-09 21:03:44 +00:00
" local_vimrc
Plug 'LucHermitte/lh-vim-lib'
Plug 'LucHermitte/local_vimrc'
2018-06-15 17:02:14 +00:00
" completion
2020-01-08 19:03:38 +00:00
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clang-completer --go-completer --rust-completer --system-boost --system-libclang',
2020-01-11 02:51:56 +00:00
\ 'for': ['c', 'go', 'clojure'],
2020-01-08 19:03:38 +00:00
\ }
2018-06-15 17:02:14 +00:00
" deoplete for haskell
if has('nvim')
2020-01-25 18:22:22 +00:00
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins',
\ }
2018-06-15 17:02:14 +00:00
else
2020-01-25 18:22:22 +00:00
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
2018-06-15 17:02:14 +00:00
endif
2018-06-15 22:47:36 +00:00
" snippets
2020-01-11 15:08:12 +00:00
"Plug 'Shougo/neosnippet.vim'
"Plug 'honza/vim-snippets'
2018-06-15 22:47:36 +00:00
2018-05-26 17:18:09 +00:00
" LSP
2018-06-12 15:46:06 +00:00
" setting this per-language breaks "let g:LanguageClient_autoStart = 1",
2020-01-08 19:03:38 +00:00
" Use release branch (Recommend)
2020-01-25 18:22:22 +00:00
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash ./install.sh'
\ }
2018-05-26 17:18:09 +00:00
" linting/compilation
2020-01-11 03:18:30 +00:00
Plug 'w0rp/ale', {
\ 'do': 'bash -c \"cp -R ~/.vim/ale_linters .\"',
2020-01-30 00:02:30 +00:00
\ 'for': ['sh', 'vim'],
2020-01-11 03:18:30 +00:00
\ }
2018-05-26 17:18:09 +00:00
" haskell
2018-06-15 17:02:14 +00:00
" if has("nvim")
" Plug 'parsonsmatt/intero-neovim'
" endif
" Plug 'eagletmt/ghcmod-vim', { 'for': 'haskell' }
2018-06-15 17:02:14 +00:00
" completion based on ghc-mod, not LSP
" Plug 'eagletmt/neco-ghc', { 'for': 'haskell' }
2018-05-26 17:18:09 +00:00
Plug 'lukerandall/haskellmode-vim', { 'for': 'haskell' }
2018-06-18 10:00:07 +00:00
Plug 'neovimhaskell/haskell-vim', { 'for': ['haskell', 'cabal'] }
2018-07-08 08:56:34 +00:00
" Plug 'ucsd-progsys/liquid-types.vim', { 'for': 'haskell' }
2018-05-26 17:18:09 +00:00
Plug 'bitc/lushtags', {
2018-08-04 11:42:09 +00:00
\ 'do': 'bash -c \"stack install\"',
2018-05-26 17:18:09 +00:00
\ 'for': 'haskell',
\ }
" Plug 'timmytofu/vim-cabal-context', { 'for': 'haskell' }
Plug 'itchyny/vim-haskell-indent', { 'for': 'haskell' }
Plug 'dan-t/vim-hsimport', { 'for': 'haskell' }
2018-07-08 08:54:57 +00:00
Plug 'Twinside/vim-hoogle', { 'for': 'haskell' }
2018-05-26 17:18:09 +00:00
2019-02-11 03:23:11 +00:00
Plug 'luochen1990/rainbow', { 'for': ['clojure', 'haskell', 'python'] }
2018-05-26 17:18:09 +00:00
" go
2020-01-11 02:51:56 +00:00
" Plug 'garyburd/go-explorer', { 'for': 'go' }
2018-05-26 17:18:09 +00:00
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries', 'for': 'go' }
" rust
2020-01-08 23:37:57 +00:00
" Plug 'rhysd/rust-doc.vim', { 'for': 'rust' }
2018-05-26 17:18:09 +00:00
Plug 'rust-lang/rust.vim', { 'for': 'rust' }
" javascript
2020-01-11 02:51:56 +00:00
" Plug 'moll/vim-node', { 'for': 'javascript' }
2018-05-26 17:18:09 +00:00
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
" python
Plug 'icedwater/vimpython', { 'for': 'python' }
2020-01-11 02:51:56 +00:00
" Plug 'zchee/deoplete-jedi', { 'for': 'python' }
" Plug 'davidhalter/jedi-vim', { 'for': 'python' }
2019-02-11 03:23:58 +00:00
Plug 'manicmaniac/coconut.vim'
Plug 'alfredodeza/pytest.vim'
Plug 'idanarye/vim-vebugger', { 'for': 'python' }
2018-05-26 17:18:09 +00:00
" scala
Plug 'derekwyatt/vim-scala', { 'for': 'scala' }
2019-05-28 09:07:12 +00:00
" typescript
Plug 'leafgarland/typescript-vim', { 'for': 'typescript' }
Plug 'Quramy/tsuquyomi', { 'for': 'typescript' }
2018-08-15 17:09:29 +00:00
" color and beauty
2020-01-11 02:51:56 +00:00
" Plug 'tomasiser/vim-code-dark'
" Plug 'romainl/Apprentice'
" Plug 'chriskempson/base16-vim'
" Plug 'fneu/breezy'
" Plug 'romainl/Disciple'
" Plug 'wimstefan/Lightning'
" Plug 'NLKNguyen/papercolor-theme'
" Plug 'flazz/vim-colorschemes'
2018-08-15 17:09:29 +00:00
Plug 'altercation/vim-colors-solarized'
2020-01-11 02:51:56 +00:00
" Plug 'reedes/vim-colors-pencil'
" Plug 'whatyouhide/vim-gotham'
2020-01-30 00:07:59 +00:00
if has('nvim')
2018-08-15 17:09:29 +00:00
Plug 'iCyMind/NeoSolarized'
endif
2020-01-11 02:51:56 +00:00
" Plug 'noahfrederick/vim-hemisu'
" Plug 'morhetz/gruvbox'
2018-05-26 17:18:09 +00:00
" unmanaged
Plug '~/.vim/unmanaged-vim-plug/bufonly'
Plug '~/.vim/unmanaged-vim-plug/colorschemedegrade'
Plug '~/.vim/unmanaged-vim-plug/fuzzyfinder'
Plug '~/.vim/unmanaged-vim-plug/L9'
Plug '~/.vim/unmanaged-vim-plug/log'
Plug '~/.vim/unmanaged-vim-plug/ScrollColor'
Plug '~/.vim/unmanaged-vim-plug/txtfmt'
2020-01-30 00:07:59 +00:00
if !has('nvim')
2018-06-13 22:39:44 +00:00
Plug '~/.vim/unmanaged-vim-plug/fontzoom'
endif
2018-05-26 17:18:09 +00:00
" Initialize plugin system
call plug#end()
2018-06-15 17:02:14 +00:00
" ===== further plugin initialization and default config =====
2018-05-26 17:18:09 +00:00
so ~/.vim/plugged/cmdalias.vim/plugin/cmdalias.vim
2018-06-15 17:39:17 +00:00
" lustyexplorer
set hidden
2018-05-26 17:18:09 +00:00
" ==== conque ====
" command aliases
call CmdAlias('t','tabnew')
" call CmdAlias('cmd','ConqueTermSplit')
" call CmdAlias('bash','ConqueTermSplit bash<CR>')
call CmdAlias('openall','tab sball')
call CmdAlias('stripw','call StripTrailingWhitespaces()<CR>')
call CmdAlias('hotkeys', 'tabnew ~/.vim/hotkeys')
call CmdAlias('TC', 'call ToggleComment()<CR>')
call CmdAlias('TF', 'call ToggleFoldText()<CR>')
call CmdAlias('ctags', '!/usr/bin/ctags -R --langmap=c:.c.h --c++-kinds=+p --c-kinds=+p+x --fields=+i+a+S+t+l+m+n --extra=+q .<CR>')
2020-01-25 18:22:22 +00:00
call CmdAlias('Nf', 'Neoformat')
call CmdAlias('NF', 'Neoformat')
call CmdAlias('nf', 'Neoformat')
call CmdAlias('LS', 'LanguageClientStart')
2018-05-26 17:18:09 +00:00
2018-06-15 17:02:14 +00:00
" global settings
set foldmethod=syntax "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=1 "this is just what i useset directory=~/.vimtmp
set mouse=a
set autoread
set number
set encoding=utf8
set guifont=Monospace\ 14
set clipboard=unnamedplus
set textwidth=0
set tabstop=4
set shiftwidth=4
set directory=~/.vimtmp
set modeline
set modelines=1
2018-05-26 17:18:09 +00:00
2020-01-30 00:07:59 +00:00
let g:nickID = 'hasufell'
2018-05-26 17:18:09 +00:00
" don't yank to buffer on deletion
" vnoremap d "_d
" nnoremap d "_d
vnoremap x "_x
nnoremap x "_x
" Syntax
2018-06-18 10:00:54 +00:00
syntax on
2018-05-26 17:18:09 +00:00
" pane navigation
" Use ctrl-[hjkl] to select the active split!
let g:C_Ctrl_j = 'off'
let g:BASH_Ctrl_j = 'off'
2018-06-15 17:02:14 +00:00
try
lang en_US
catch
endtry
2018-05-26 17:18:09 +00:00
2020-01-11 02:51:56 +00:00
2018-05-26 17:18:09 +00:00
" ==========colors===========
"set t_Co=256
"let g:solarized_termcolors=256
if has('gui_running')
2018-06-14 00:27:09 +00:00
set background=dark
colorscheme solarized
else
set background=dark
colorscheme solarized
endif
2020-01-30 00:07:59 +00:00
if has('nvim')
2018-06-14 00:27:09 +00:00
if exists('g:GtkGuiLoaded')
2020-01-30 00:07:59 +00:00
let g:neosolarized_contrast = 'normal'
let g:neosolarized_visibility = 'normal'
2018-06-13 22:39:44 +00:00
let g:neosolarized_vertSplitBgTrans = 0
let g:neosolarized_bold = 1
let g:neosolarized_underline = 1
let g:neosolarized_italic = 1
set background=dark
colorscheme NeoSolarized
else
2020-01-30 00:07:59 +00:00
let g:neosolarized_contrast = 'normal'
let g:neosolarized_visibility = 'normal'
2018-06-13 22:39:44 +00:00
let g:neosolarized_vertSplitBgTrans = 0
let g:neosolarized_bold = 1
let g:neosolarized_underline = 1
let g:neosolarized_italic = 1
set background=dark
colorscheme NeoSolarized
endif
2018-05-26 17:18:09 +00:00
endif
2018-06-14 00:27:09 +00:00
2018-05-26 17:18:09 +00:00
" ===========================
2018-06-15 17:02:14 +00:00
" Disable annoying auto line break
fu! DisableBr()
set wrap
set linebreak
set nolist " list disables linebreak
set textwidth=0
set wrapmargin=0
2020-01-30 00:07:59 +00:00
set formatoptions-=t
2018-06-15 17:02:14 +00:00
endfu
" Disable line breaks for all file types
au BufNewFile,BufRead *.* call DisableBr()
" ==========copy/paste===========
function! Paste(mode)
2020-01-30 00:07:59 +00:00
if a:mode == 'v'
2018-06-15 17:02:14 +00:00
normal gv
normal "_d
normal "+gP
normal l
2020-01-30 00:07:59 +00:00
elseif a:mode == 'i'
2018-06-15 17:02:14 +00:00
set virtualedit=all
normal `^"+gP
2020-01-30 00:07:59 +00:00
let &virtualedit = ''
2018-06-15 17:02:14 +00:00
endif
endfunction
" ======select all=======
function! Select()
set virtualedit=all
normal `^ggVG
2020-01-30 00:07:59 +00:00
let &virtualedit = ''
2018-06-15 17:02:14 +00:00
endfunction
" =======================
2018-05-26 17:18:09 +00:00
" ====== traling whitespace =====
fun! ShowTrailingWhitespace(pattern)
if &ft == 'conque_term'
call clearmatches()
return
endif
if &ft == 'diff'
call clearmatches()
return
endif
let str=a:pattern
if str == '1'
match ExtraWhitespace /\s\+$/
elseif str == '2'
call clearmatches()
" match ExtraWhitespace /\s\+\%#\@<!$/
elseif str == '3'
match ExtraWhitespace /\s\+$/
endif
endfun
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * call ShowTrailingWhitespace('1')
autocmd InsertEnter * call ShowTrailingWhitespace('2')
autocmd InsertLeave * call ShowTrailingWhitespace('3')
autocmd BufWinLeave * call clearmatches()
fun! StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
" ===========================
" comment hiding
func! IsComment( lnum )
2020-01-30 00:07:59 +00:00
return synIDattr(synID(a:lnum, match(getline(a:lnum),'\S')+1, 1),'name') =~? 'comment'
2018-05-26 17:18:09 +00:00
endfun
"set fdm=expr
set fde=IsComment(v:lnum)?1:IsComment(prevnonblank(v:lnum))?1:IsComment(nextnonblank\(v:lnum))?1:0
" light #073642 dark #002b36 grey #586e75
highlight Folded gui=NONE guifg=#586e75 guibg=#002b36
set foldtext='\ '
let g:folded = 0
function! ToggleComment()
if (g:folded == 0)
highlight Comment guifg=#002b36
let g:folded=1
else
highlight Comment guifg=#586e75
let g:folded=0
endif
endfunction
let g:myfoldtext = 0
function! ToggleFoldText()
if (g:myfoldtext == 0)
set foldtext='--'.v:folddashes.'\ '.getline(v:foldstart).'\ '
let g:myfoldtext=1
else
set foldtext='\ '
let g:myfoldtext=0
endif
endfunction
""""""""""""""""""""""""""""""
" vim macro to jump to devhelp topics.
""""""""""""""""""""""""""""""
function! DevHelpCurrentWord()
2020-01-30 00:07:59 +00:00
let word = expand('<cword>')
exe '!devhelp -s ' . word . ' &'
2018-05-26 17:18:09 +00:00
endfunction
function! ManCurrentWord()
2020-01-30 00:07:59 +00:00
let word = expand('<cword>')
exe '!man 3 ' . word
2018-05-26 17:18:09 +00:00
endfunction
" vim:foldmethod=marker:foldlevel=0