vim-config/vimrc
2020-10-11 13:57:04 +02:00

446 lines
11 KiB
VimL

" ===== hasufell's vimrc ))))
" no ATTENTION messages when swap file is already found
set shortmess+=A
" plugin stuff
filetype plugin on
filetype indent on
set backspace=indent,eol,start " backspace through everything in insert mode
set cmdheight=1
set wildmenu
" set wildmode=longest,list,full
" 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'
" Plug 'sjl/gundo.vim'
" Plug 'idris-hackers/idris-vim'
"Plug 'yegappan/mru'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } |
\ Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' }
"Plug 'vim-scripts/promela.vim'
"Plug 'AndrewRadev/simple_bookmarks.vim'
"Plug 'Keithbsmiley/swift.vim'
" Plug 'majutsushi/tagbar'
"Plug 'ternjs/tern_for_vim'
Plug 'xolox/vim-easytags'
Plug 'xolox/vim-misc'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
Plug 'sjbach/lusty'
" Plug 'vim-airline/vim-airline'
" Plug 'vim-airline/vim-airline-themes'
Plug 'nixprime/cpsm', { 'do': 'PY3=ON ./install.sh' }
Plug 'liuchengxu/vista.vim'
Plug 'sbdchd/neoformat'
Plug 'AndrewRadev/bufferize.vim'
" Plug 'vimwiki/vimwiki'
Plug 'vmchale/dhall-vim'
Plug 'Shougo/echodoc.vim'
Plug 'tpope/vim-scriptease'
Plug 'Konfekt/FastFold'
" Plug 'lambdalisue/vim-fullscreen'
Plug 'editorconfig/editorconfig-vim'
" Plug 'iberianpig/tig-explorer.vim'
Plug 'hasufell/ghcup.vim'
Plug 'junegunn/vim-easy-align'
Plug 'dominikduda/vim_current_word'
" finder
Plug 'liuchengxu/vim-clap', { 'do': { -> clap#installer#force_download() } }
" scm
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'tommcdo/vim-fubitive'
Plug 'airblade/vim-gitgutter'
" local_vimrc
Plug 'LucHermitte/lh-vim-lib'
Plug 'LucHermitte/local_vimrc'
" completion
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clang-completer --go-completer --rust-completer --system-boost --system-libclang',
\ 'for': ['c', 'go', 'clojure'],
\ }
" deoplete for haskell
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins',
\ }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
" snippets
"Plug 'Shougo/neosnippet.vim'
"Plug 'honza/vim-snippets'
" LSP
" setting this per-language breaks "let g:LanguageClient_autoStart = 1",
" Use release branch (Recommend)
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash ./install.sh'
\ }
" linting/compilation
Plug 'w0rp/ale', {
\ 'do': 'bash -c \"cp -R ~/.vim/ale_linters .\"',
\ 'for': ['sh', 'vim'],
\ }
" haskell
" if has("nvim")
" Plug 'parsonsmatt/intero-neovim'
" endif
" Plug 'eagletmt/ghcmod-vim', { 'for': 'haskell' }
" completion based on ghc-mod, not LSP
" Plug 'eagletmt/neco-ghc', { 'for': 'haskell' }
" Plug 'lukerandall/haskellmode-vim', { 'for': 'haskell' }
" Plug 'axelf4/vim-haskell'
Plug 'neovimhaskell/haskell-vim', { 'for': ['haskell', 'cabal']}
" Plug 'ucsd-progsys/liquid-types.vim', { 'for': 'haskell' }
Plug 'bitc/lushtags', {
\ 'do': 'bash -c \"stack install\"',
\ 'for': 'haskell',
\ }
" Plug 'timmytofu/vim-cabal-context', { 'for': 'haskell' }
" Plug 'itchyny/vim-haskell-indent', { 'for': 'haskell' }
" Plug 'dan-t/vim-hsimport', { 'for': 'haskell' }
Plug 'Twinside/vim-hoogle', { 'for': 'haskell' }
" Plug 'alx741/vim-hindent', { 'for': 'haskell' }
Plug 'alx741/vim-stylishask', { 'for': 'haskell' }
Plug 'luochen1990/rainbow', { 'for': ['clojure', 'haskell', 'python'] }
" go
" Plug 'garyburd/go-explorer', { 'for': 'go' }
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries', 'for': 'go' }
" rust
" Plug 'rhysd/rust-doc.vim', { 'for': 'rust' }
Plug 'rust-lang/rust.vim', { 'for': 'rust' }
" javascript
" Plug 'moll/vim-node', { 'for': 'javascript' }
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
" python
Plug 'icedwater/vimpython', { 'for': 'python' }
" Plug 'zchee/deoplete-jedi', { 'for': 'python' }
" Plug 'davidhalter/jedi-vim', { 'for': 'python' }
Plug 'manicmaniac/coconut.vim'
Plug 'alfredodeza/pytest.vim'
Plug 'idanarye/vim-vebugger', { 'for': 'python' }
" scala
Plug 'derekwyatt/vim-scala', { 'for': 'scala' }
" typescript
Plug 'leafgarland/typescript-vim', { 'for': 'typescript' }
Plug 'Quramy/tsuquyomi', { 'for': 'typescript' }
" color and beauty
" 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'
Plug 'altercation/vim-colors-solarized'
" Plug 'reedes/vim-colors-pencil'
" Plug 'whatyouhide/vim-gotham'
if has('nvim')
Plug 'iCyMind/NeoSolarized'
endif
" Plug 'noahfrederick/vim-hemisu'
" Plug 'morhetz/gruvbox'
" coc
" Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile', 'for': ['haskell', 'rust', 'sh', 'python', 'vim']}
" Plug 'neoclide/coc-tsserver', {'do': 'yarn install --frozen-lockfile', 'for': ['typescript']}
" "Plug 'neoclide/coc-git', {'do': 'yarn install --frozen-lockfile'}
" " Plug 'neoclide/coc-rls', {'do': 'yarn install --frozen-lockfile', 'for': ['rust']}
" Plug 'fannheyward/coc-rust-analyzer', {'do': 'yarn install --frozen-lockfile', 'for': ['rust']}
" Plug 'neoclide/coc-prettier', {'do': 'yarn install --frozen-lockfile', 'for': ['haskell', 'rust', 'sh']}
" " Plug 'neoclide/coc-python', {'do': 'yarn install --frozen-lockfile', 'for': ['python']}
" "Plug 'neoclide/coc-vetur', {'do': 'yarn install --frozen-lockfile', 'for': ['haskell']}
" Plug 'neoclide/coc-json', {'do': 'yarn install --frozen-lockfile', 'for': ['json']}
" " Plug 'neoclide/coc-eslint', {'do': 'yarn install --frozen-lockfile', 'for': ['']}
" Plug 'neoclide/coc-yaml', {'do': 'yarn install --frozen-lockfile', 'for': ['yaml']}
" " Plug 'neoclide/coc-highlight', {'do': 'yarn install --frozen-lockfile', 'for': ['']}
" Plug 'josa42/coc-sh', {'do': 'yarn install --frozen-lockfile', 'for': ['']}
" 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'
Plug '~/.vim/unmanaged-vim-plug/exheres-syntax-20160115'
if !has('nvim')
Plug '~/.vim/unmanaged-vim-plug/fontzoom'
endif
" Initialize plugin system
call plug#end()
" ===== further plugin initialization and default config =====
so ~/.vim/plugged/cmdalias.vim/plugin/cmdalias.vim
" lustyexplorer
set hidden
" ==== 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>')
call CmdAlias('Nf', 'Neoformat')
call CmdAlias('NF', 'Neoformat')
call CmdAlias('nf', 'Neoformat')
call CmdAlias('LS', 'LanguageClientStart')
" global settings
if has('gui_running')
set guioptions -=T
set winaltkeys=no
set guiheadroom=0
else
set termguicolors
endif
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
set autoindent
let g:nickID = 'hasufell'
" don't yank to buffer on deletion
" vnoremap d "_d
" nnoremap d "_d
vnoremap x "_x
nnoremap x "_x
" Syntax
syntax on
" pane navigation
" Use ctrl-[hjkl] to select the active split!
let g:C_Ctrl_j = 'off'
let g:BASH_Ctrl_j = 'off'
try
lang en_US
catch
endtry
" git-gutter workaround
" https://github.com/airblade/vim-gitgutter/issues/696
autocmd ColorScheme * highlight! link SignColumn LineNr
" ==========colors===========
" set t_Co=256
let g:solarized_termcolors=256
set background=dark
colorscheme solarized
if has('nvim')
if exists('g:GtkGuiLoaded')
let g:neosolarized_contrast = 'normal'
let g:neosolarized_visibility = 'normal'
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
let g:neosolarized_contrast = 'normal'
let g:neosolarized_visibility = 'normal'
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
endif
" ===========================
" Disable annoying auto line break
fu! DisableBr()
set wrap
set linebreak
set nolist " list disables linebreak
set textwidth=0
set wrapmargin=0
set formatoptions-=t
endfu
" Disable line breaks for all file types
au BufNewFile,BufRead *.* call DisableBr()
" ==========copy/paste===========
function! Paste(mode)
if a:mode == 'v'
normal gv
normal "_d
normal "+gP
normal l
elseif a:mode == 'i'
set virtualedit=all
normal `^"+gP
let &virtualedit = ''
endif
endfunction
" ======select all=======
function! Select()
set virtualedit=all
normal `^ggVG
let &virtualedit = ''
endfunction
" =======================
" ====== 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 )
return synIDattr(synID(a:lnum, match(getline(a:lnum),'\S')+1, 1),'name') =~? 'comment'
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()
let word = expand('<cword>')
exe '!devhelp -s ' . word . ' &'
endfunction
function! ManCurrentWord()
let word = expand('<cword>')
exe '!man 3 ' . word
endfunction
" vim:foldmethod=marker:foldlevel=0