vim-config/vimrc

287 lines
6.0 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
2020-10-12 19:33:25 +00:00
let g:pymode_python = 'python3'
2018-05-26 17:18:09 +00:00
" plugin stuff
filetype plugin on
filetype indent on
2020-10-11 11:50:17 +00:00
set backspace=indent,eol,start " backspace through everything in insert mode
2020-08-22 18:37:20 +00:00
set cmdheight=1
2018-05-26 17:18:09 +00:00
2020-10-11 11:50:17 +00:00
set wildmenu
" set wildmode=longest,list,full
2018-05-26 17:18:09 +00:00
2020-10-11 15:55:02 +00:00
" plugins
if &compatible
set nocompatible " Be iMproved
2018-06-15 17:02:14 +00:00
endif
2020-10-11 15:55:02 +00:00
" Required:
set runtimepath+=/home/jule/.cache/dein/repos/github.com/Shougo/dein.vim
2018-05-26 17:18:09 +00:00
2020-10-11 15:55:02 +00:00
let s:toml = '/home/jule/.vim/plugins.toml'
" Required:
if dein#load_state('/home/jule/.cache/dein')
call dein#begin('/home/jule/.cache/dein', ['/home/jule/.vim/vimrc', '/home/jule/.vim/plugins.toml'])
call dein#load_toml(s:toml)
" Let dein manage dein
" Required:
call dein#add('/home/jule/.cache/dein/repos/github.com/Shougo/dein.vim')
" Required:
call dein#end()
call dein#save_state()
endif
2018-05-26 17:18:09 +00:00
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
2020-08-22 18:37:20 +00:00
if has('gui_running')
set guioptions -=T
2020-10-11 15:55:02 +00:00
" disable gvim tab
set guioptions-=e
2020-08-22 18:37:20 +00:00
set winaltkeys=no
set guiheadroom=0
else
set termguicolors
endif
2018-06-15 17:02:14 +00:00
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
2020-10-11 11:50:17 +00:00
set autoindent
2020-10-12 19:33:25 +00:00
set laststatus=2
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-06-14 20:42:38 +00:00
" git-gutter workaround
" https://github.com/airblade/vim-gitgutter/issues/696
autocmd ColorScheme * highlight! link SignColumn LineNr
2020-01-11 02:51:56 +00:00
2018-05-26 17:18:09 +00:00
" ==========colors===========
2020-08-22 18:37:20 +00:00
" set t_Co=256
let g:solarized_termcolors=256
set background=dark
colorscheme solarized
2018-06-14 00:27:09 +00:00
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