From 138ccc7e5136b54904ff40cf6c58cfb5e55bfe1b Mon Sep 17 00:00:00 2001 From: Shaun Reed Date: Thu, 11 Jun 2020 13:23:03 -0400 Subject: [PATCH] Make path to libclang universal, update vimrc Added Ale plugin for running linters + Changed unicode error and warning symbols + Added keybind for moving to next / previous errors Update vimrc to use environment variable /usr/lib/llvm-10/lib/libclang.so.1 for clang path + This is automatically adjusted to the system clang path via output of 'find / -name libclang.so.1' + Requires some derivative of libclang to be installed, along with clang Add whitespace check function to vimrc + Removes whitespaces from every relative file saved with vim + list of files found within ~/.vimrc Add Colorizer plugin keybind for toggling color highlights within vim Add environment variables $EDITOR and $VISUAL and set both to point to vim Add a script to fix a common issue in vbox displays + running fix-vbox.sh corrects unclickable portion of the screen --- .bash_aliases | 4 +++- .gitmodules | 3 +++ .vim/bundle/ale | 1 + .vimrc | 56 ++++++++++++++++++++++++++++++------------------- README.md | 2 +- fix-vbox.sh | 5 +++++ 6 files changed, 48 insertions(+), 23 deletions(-) create mode 160000 .vim/bundle/ale create mode 100755 fix-vbox.sh diff --git a/.bash_aliases b/.bash_aliases index c6fea10..9eb1c1c 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -15,6 +15,8 @@ alias l='ls -CF' # Add an "alert" alias for long running commands. Use like so: # sleep 10; alert alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' - +export EDITOR="vim" +export VISUAL="vim" export LS_COLORS="di=1;34:ln=31;47:so=32:pi=33:ex=1;32:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43" +export LIBCLANG=$(sudo find / -name libclang.so.1) diff --git a/.gitmodules b/.gitmodules index 0704fe5..56f3bd7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -20,3 +20,6 @@ path = .vim/bundle/vim-signify url = https://github.com/mhinz/vim-signify +[submodule ".vim/bundle/ale"] + path = .vim/bundle/ale + url = https://github.com/dense-analysis/ale diff --git a/.vim/bundle/ale b/.vim/bundle/ale new file mode 160000 index 0000000..7265ceb --- /dev/null +++ b/.vim/bundle/ale @@ -0,0 +1 @@ +Subproject commit 7265ceb6d050d1a4642741d248f11e4f2abd37e1 diff --git a/.vimrc b/.vimrc index a8f92d1..5af9fda 100644 --- a/.vimrc +++ b/.vimrc @@ -3,6 +3,21 @@ " General Vim Settings + + +" Define function in vim to remove whitespace +fun! TrimWhitespace() + let l:save = winsaveview() + keeppatterns %s/\s\+$//e + call winrestview(l:save) +endfun +"Call this on every attempt to save a file of types defined below.. +autocmd BufWritePre *.cpp,*.h,*.c,*.php :call TrimWhitespace() +""autocmd BufWritePre *.cpp,*.h,*.c,*.php :%s/\s\+$//ge +" Set terminal title when opening file +"" autocmd BufEnter * let &titlestring = ' ' . expand("%:t") +"" set title + " Set tabwidth=2, adjust Vim shiftwidth to the same set tabstop=2 shiftwidth=2 @@ -57,35 +72,34 @@ let g:airline_theme='kalisi' " Gitgutter installed for + - diffs in gutters within repo files -" Syntastic syntax checker settings -" See :help syntastic -set statusline+=%#warningmsg# -set statusline+=%{SyntasticStatuslineFlag()} -set statusline+=%* -let g:syntastic_always_populate_loc_list = 1 -let g:syntastic_auto_loc_list = 1 -let g:syntastic_check_on_open = 1 -let g:syntastic_check_on_wq = 0 +" Ale linter settings +" Hover detail info in preview window +let g:ale_hover_to_preview = 1 +" Hover detail info in balloons +""let g:ale_set_balloons = 1 +let g:ale_sign_error = '🗙' +let g:ale_sign_warning = '⚠' +highlight ALEWarningSign ctermbg=Yellow +highlight ALEWarningSign ctermfg=Black +highlight ALEWarning ctermbg=DarkYellow +highlight ALEWarning ctermfg=White +highlight ALEErrorSign ctermbg=DarkRed +highlight ALEErrorSign ctermfg=White +highlight ALEError ctermfg=DarkRed +nmap (ale_previous_wrap) +nmap (ale_next_wrap) " Clang_complete settings -let g:clang_library_path='/usr/lib/llvm-8/lib/' +let g:clang_library_path = $LIBCLANG + -" Understand how the plugin works: :h signify-modus-operandi -" Spare the plugin some work and read: :h g:signify_vcs_list -" Signify plugin settings -" Diff gutter within Vim -" let g:signify_vcs_list = ['git', 'hg'] -" let g:signify_cursorhold_insert = 1 -" let g:signify_cursorhold_normal = 1 -" let g:signify_update_on_bufenter = 0 -" let g:signify_update_on_focusgained = 1 -" " Colorizer plugin settings " See :h colorizer in Vim for more info "let g:colorizer_colornames = 0 " Don't color literal names, like red, green, etc -"let g:colorizer_auto_color = 1 +let g:colorizer_auto_color = 1 "let g:colorizer_skip_comments = 1 "let g:colorizer_auto_filetype ='css,html,vim' +nnoremap :ColorToggle " Symbols important to vim / terminal layouts diff --git a/README.md b/README.md index c3db332..06c6e18 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ cd /path/to/dot/ stow -t ~ . ``` -Note that the `dot/packages/` directory is for reference and is the only directory included not meant to be used with stow. If this directory is stowed there will be no real change to the system - you will still need to install the package lists manually. +I use the `libclang-10-dev` package for clang completion. You can use whichever version you want, as the `.vimrc` configuration hosted here uses an environment variable `$LIBCLANG` which is set using the output of `sudo find / -name libclang.so.1`. To use the same version as I do, simply run `sudo apt install libclang-10-dev` `stow --adopt .` can be used to install conflicting files, but doing so will result in the loss of your local configurations. If you want to keep them, back up the conflicting files output in the error message before running this command. diff --git a/fix-vbox.sh b/fix-vbox.sh new file mode 100755 index 0000000..832dd0c --- /dev/null +++ b/fix-vbox.sh @@ -0,0 +1,5 @@ +# A fix for a common issue found in virtual box +# https://forums.linuxmint.com/viewtopic.php?t=247850 +# https://askubuntu.com/questions/1014172/virtualbox-unresponsive-area-on-desktop +################################################################################# +ps aux www |grep 'VBoxClient --draganddrop' | awk '{print $2}' | xargs kill