diff --git a/.config/X11/xinitrc b/.config/X11/xinitrc index 541f91e..56ff112 100644 --- a/.config/X11/xinitrc +++ b/.config/X11/xinitrc @@ -3,6 +3,7 @@ xsetroot -cursor_name left_ptr & xcompmgr & fcitx & +xset r rate 200 30 xrdb -merge "$XDG_CONFIG_HOME/X11/xresources" exec runsvdir -P ~/.local/service.x diff --git a/.config/alacritty.yml b/.config/alacritty.yml index ccadc0b..6eb72ba 100644 --- a/.config/alacritty.yml +++ b/.config/alacritty.yml @@ -15,15 +15,15 @@ scrolling: # Font configuration font: normal: - family: Harmonia Sans Medium + family: PragmataPro Mono Liga style: Regular italic: - family: Harmonia Sans Medium + family: PragmataPro Mono Liga style: Italic bold: - family: Harmonia Sans Medium + family: PragmataPro Mono Liga style: Bold # Point size diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc index 037309f..ec15615 100644 --- a/.config/dunst/dunstrc +++ b/.config/dunst/dunstrc @@ -62,7 +62,7 @@ max_icon_size = 24 # Paths to default icons. - icon_path = /home/deadguy/.local/share/icons/BeOS/scalable/actions:/home/deadguy/.local/share/icons/BeOS/scalable/animations:/home/deadguy/.local/share/icons/BeOS/scalable/apps:/home/deadguy/.local/share/icons/BeOS/scalable/categories:/home/deadguy/.local/share/icons/BeOS/scalable/devices:/home/deadguy/.local/share/icons/BeOS/scalable/emblems:/home/deadguy/.local/share/icons/BeOS/scalable/emotes:/home/deadguy/.local/share/icons/BeOS/scalable/mimetypes:/home/deadguy/.local/share/icons/BeOS/scalable/places:/home/deadguy/.local/share/icons/BeOS/scalable/status:/home/deadguy/.local/share/icons/BeOS/scalable/stock + icon_path = /home/corpse/.local/share/icons/BeOS/scalable/actions:/home/corpse/.local/share/icons/BeOS/scalable/animations:/home/corpse/.local/share/icons/BeOS/scalable/apps:/home/corpse/.local/share/icons/BeOS/scalable/categories:/home/corpse/.local/share/icons/BeOS/scalable/devices:/home/corpse/.local/share/icons/BeOS/scalable/emblems:/home/corpse/.local/share/icons/BeOS/scalable/emotes:/home/corpse/.local/share/icons/BeOS/scalable/mimetypes:/home/corpse/.local/share/icons/BeOS/scalable/places:/home/corpse/.local/share/icons/BeOS/scalable/status:/home/corpse/.local/share/icons/BeOS/scalable/stock # Always run rule-defined scripts, even if the notification is suppressed always_run_script = true diff --git a/.config/fzf-marks b/.config/fzf-marks index 31af5bf..c5c43a2 100644 --- a/.config/fzf-marks +++ b/.config/fzf-marks @@ -4,18 +4,18 @@ git : /home/corpse/.config/git/config gtk3 : /home/corpse/.config/gtk-3.0/settings.ini lfview : /home/corpse/.local/bin/lfview gtk2 : /home/corpse/.config/gtk-2.0/gtkrc-2.0 -mpv : /home/corpse/.config/mpv/mpv.conf nvim : /home/corpse/.config/nvim -xinit : /home/corpse/.config/X11/xinitrc dunst : /home/corpse/.config/dunst/dunstrc xresources : /home/corpse/.config/X11/xresources -lf : /home/corpse/.config/lf/lfrc alias : /home/corpse/.config/zsh/conf/03_aliases.zsh -tmux : /home/corpse/.config/tmux/tmux.conf polybar : /home/corpse/.config/polybar/config correo : /home/corpse/.config/neomutt -terminal : /home/corpse/.config/alacritty.yml -zsh : /home/corpse/.config/zsh -bspwm : /home/corpse/.config/bspwm/bspwmrc keys : /home/corpse/.config/sxhkd/sxhkdrc +terminal : /home/corpse/.config/alacritty.yml +bspwm : /home/corpse/.config/bspwm/bspwmrc +tmux : /home/corpse/.config/tmux/tmux.conf +mpv : /home/corpse/.config/mpv/mpv.conf +xinit : /home/corpse/.config/X11/xinitrc zshenv : /home/corpse/.zshenv +lf : /home/corpse/.config/lf/lfrc +zsh : /home/corpse/.config/zsh diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 4738835..f0b936d 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -1,7 +1,9 @@ # Basic Settings set shell zsh -set shellopts '-eu:--shwordsplit' +set shellopts '-euy:--shwordsplit' set ifs "\n" +set errorfmt "\033[1;31m%s\033[0m" +set promptfmt "\033[34;1m%d\033[0m\033[1m%f\033[0m" set scrolloff 5 set wrapscroll set sortby time @@ -13,6 +15,8 @@ set hidden set preview set previewer lfview +%[ $LF_LEVEL -eq 1 ] || echo "Warning: You're in a nested lf instance!" + %{{ w=$(tput cols) if [ $w -le 80 ]; then @@ -38,68 +42,69 @@ cmd open ${{ esac }} -cmd bulkrename ${{ - old=$(mktemp) - new=$(mktemp) - [ -n $fs ] && fs=$(ls) - printf "$fs\n" > $old - printf "$fs\n" > $new - $EDITOR $new - [ $(cat $new | wc -l) -ne $(cat $old | wc -l) ] && exit - paste $old $new | while read names; do - src=$(printf $names | cut -f1) - dst=$(printf $names | cut -f2) - [ $src = $dst ] && continue - [ -e $dst ] && continue - mv $src $dst +cmd bulk-rename ${{ + old="$(mktemp)" + new="$(mktemp)" + [ -n "$fs" ] && fs="$(ls)" + printf '%s\n' "$fs" >"$old" + printf '%s\n' "$fs" >"$new" + $EDITOR "$new" + [ "$(wc -l < "$new")" -ne "$(wc -l < "$old")" ] && exit + paste "$old" "$new" | while IFS= read -r names; do + src="$(printf '%s' "$names" | cut -f1)" + dst="$(printf '%s' "$names" | cut -f2)" + if [ "$src" = "$dst" ] || [ -e "$dst" ]; then + continue + fi + mv -- "$src" "$dst" done - rm $old $new + rm -- "$old" "$new" lf -remote "send $id unselect" }} # insert cmd rename-insert &{{ - if [ "$(echo "$fx" | wc -l)" -gt 1 ]; then - lf -remote "send $id echo You can't change more than one file name" - lf -remote "send $id unselect" - else - len="$(basename "$f" | wc -m)" # length of selected file/directory - for i in $(seq "$len"); do - pos="${pos}" # how many times do I have to press in order to get first char - done - lf -remote "send $id rename" - lf -remote "send $id push $pos" - fi + if [ "$(echo "$fx" | wc -l)" -gt 1 ]; then + lf -remote "send $id echo You can't change more than one file name" + lf -remote "send $id unselect" + else + len="$(basename "$f" | wc -m)" # length of selected file/directory + for i in $(seq "$len"); do + pos="${pos}" # how many times do I have to press in order to get first char + done + lf -remote "send $id rename" + lf -remote "send $id push $pos" + fi }} # append before ext cmd rename-before-ext &{{ - if [ "$(echo "$fx" | wc -l)" -gt 1 ]; then - lf -remote "send $id echo You can't change more than one file name" - lf -remote "send $id unselect" - else - if [ -d "$f" ]; then - lf -remote "send $id rename" - else - ext_len="$(echo ${f##*.} | wc -m)" # extention length - for i in $(seq "$ext_len"); do - pos="${pos}" - done - lf -remote "send $id rename" - lf -remote "send $id push "$pos"" - fi - fi + if [ "$(echo "$fx" | wc -l)" -gt 1 ]; then + lf -remote "send $id echo You can't change more than one file name" + lf -remote "send $id unselect" + else + if [ -d "$f" ]; then + lf -remote "send $id rename" + else + ext_len="$(echo ${f##*.} | wc -m)" # extention length + for i in $(seq "$ext_len"); do + pos="${pos}" + done + lf -remote "send $id rename" + lf -remote "send $id push "$pos"" + fi + fi }} # change its name entirely cmd rename-new &{{ - if [ "$(echo "$fx" | wc -l)" -gt 1 ]; then - lf -remote "send $id echo You can't change more than one file name" - lf -remote "send $id unselect" - else - lf -remote "send $id rename" - lf -remote "send $id push " - fi + if [ "$(echo "$fx" | wc -l)" -gt 1 ]; then + lf -remote "send $id echo You can't change more than one file name" + lf -remote "send $id unselect" + else + lf -remote "send $id rename" + lf -remote "send $id push " + fi }} cmd paste-rsync &{{ @@ -121,19 +126,6 @@ cmd paste-rsync &{{ lf -remote 'send clear' }} -cmd paste-append &{{ - load=$(lf -remote 'load') - mode=$(echo "$load" | sed -n '1p') - list=$(echo "$load" | sed '1d') - if [ $mode = 'copy' ]; then - cp -rn $list . - elif [ $mode = 'move' ]; then - mv -n $list . - fi - lf -remote 'send load' - lf -remote 'send clear' -}} - cmd paste-overwrite %{{ load=$(lf -remote 'load') mode=$(echo "$load" | sed -n '1p') @@ -147,27 +139,13 @@ cmd paste-overwrite %{{ lf -remote 'send clear' }} -cmd paste-interactive %{{ - load=$(lf -remote 'load') - mode=$(echo "$load" | sed -n '1p') - list=$(echo "$load" | sed '1d') - if [ $mode = 'copy' ]; then - cp -r $list . - elif [ $mode = 'move' ]; then - mv $list . - fi - lf -remote 'send load' - lf -remote 'send clear' -}} - cmd fzf_jump ${{ - res="$(find . -maxdepth 3 -printf '%P\n' | fzf --reverse --header='Jump to location')" - if [ -f "$res" ]; then - cmd="select" - elif [ -d "$res" ]; then + res="$(find . -maxdepth 3 | fzf --reverse --header='Jump to location' | sed 's/\\/\\\\/g;s/"/\\"/g')" + if [ -d "$res" ]; then cmd="cd" + else + cmd="select" fi - lf -remote "send $id $cmd \"$res\"" }} @@ -210,8 +188,32 @@ cmd yes_preview :{{ cmd newfold ${{ set -f read newd - mkdir $newd - mv $fx $newd + mkdir -- "$newd" + mv -- $fx "$newd" +}} + +cmd yank-dirname $dirname -- "$f" | head -c-1 | xclip -i -selection clipboard +cmd yank-path $printf '%s' "$fx" | xclip -i -selection clipboard +cmd yank-basename $basename -a -- $fx | head -c-1 | xclip -i -selection clipboard + +cmd yank-basename-without-extension ${{ + echo "$fx" | + xargs -r -d '\n' basename -a | + awk -e '{ + for (i=length($0); i > 0; i--) { + if (substr($0, i, 1) == ".") { + if (i == 1) print $0 + else print substr($0, 0, i-1) + + break + } + } + + if (i == 0) + print $0 + }' | + if [ -n "$fs" ]; then cat; else tr -d '\n'; fi | + xclip -i -selection clipboard }} cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')" @@ -250,13 +252,12 @@ map ¿ bottom map x clear map dd cut map yy copy -map yn ${{echo -n $(dirname $f) | xclip -selection clipboard}} -map yp ${{echo -n $f | xclip -selection clipboard}} -map yn ${{echo -n $(basename $f) | xclip -selection clipboard}} +map yn yank-dirname +map yp yank-path +map yn yank-basename +map yw yank-basename-without-extension map pp paste -map pa paste-append map po paste-overwrite -map pi paste-interactive map pr paste-rsync map o &mimeopen $f map O $mimeopen --ask $f @@ -269,13 +270,11 @@ map zf $file-roller "$f" map zc $zip -9 -r "$f".cbz $f map zx $zu "$f" map zn newfold - -map i push A # at the very beginning +map I push A # at the very beginning map A rename # at the very end -map I push A. # before extension -map a push A # after extension +map i push A # at the very beginning +map a push A # after extention map B bulkrename - map L :Link map f fzf_jump map / $lf -remote "send $id select \"$(FZF_DEFAULT_COMMAND='fd --max-depth=1' fzf)\"" diff --git a/.config/mpv/mpv.conf b/.config/mpv/mpv.conf index ac7a4d1..ea52cab 100644 --- a/.config/mpv/mpv.conf +++ b/.config/mpv/mpv.conf @@ -12,6 +12,8 @@ autofit-larger=90%x90% stop-playback-on-init-failure=yes idle=once osc=yes +cache=yes +cache-pause=no ytdl-format=bestvideo[height<=?1080]+bestaudio/best ytdl-raw-options=youtube-skip-dash-manifest=,no-call-home=,no-cache-dir=,geo-bypass= screenshot-format=png diff --git a/.config/nvim/after/ftplugin/css.vim b/.config/nvim/after/ftplugin/css.vim index 4ed06a9..43334cc 100644 --- a/.config/nvim/after/ftplugin/css.vim +++ b/.config/nvim/after/ftplugin/css.vim @@ -2,3 +2,11 @@ setlocal expandtab setlocal shiftwidth=2 setlocal softtabstop=2 setlocal smartindent + +lua require'cmp'.setup.buffer { +\ sources = { +\ { name = 'nvim_lsp' }, +\ { name = 'vsnip' }, +\ { name = 'buffer' }, +\ }, +\ } diff --git a/.config/nvim/after/ftplugin/go.vim b/.config/nvim/after/ftplugin/go.vim new file mode 100644 index 0000000..905651c --- /dev/null +++ b/.config/nvim/after/ftplugin/go.vim @@ -0,0 +1,44 @@ +setlocal noexpandtab +setlocal shiftwidth=4 +setlocal tabstop=4 +setlocal foldmethod=syntax + +let g:go_textobj_include_function_doc = 1 +let g:go_auto_type_info = 1 +let g:go_auto_sameids = 1 +let g:go_autodetect_gopath = 1 +let g:go_imports_autosave = 1 +let g:go_doc_popup_window = 1 +let g:go_gopls_enabled = 1 +let g:go_metalinter_autosave = 1 +let g:go_fmt_command = "goimports" +let g:go_list_type = "quickfix" + +" Go syntax highlighting +let g:go_highlight_build_constraints = 1 +let g:go_highlight_fields = 1 +let g:go_highlight_function_calls = 1 +let g:go_highlight_functions = 1 +let g:go_highlight_methods = 1 +let g:go_highlight_operators = 1 +let g:go_highlight_structs = 1 +let g:go_highlight_types = 1 +let g:go_highlight_extra_types = 1 +let g:go_play_browser_command = 'tmux new-window elinks %URL%' + +" Status line types/signatures +let g:go_auto_type_info = 1 + +" Add the failing test name to the output of :GoTest +let g:go_test_show_name = 1 + +inoremap . . +nmap d :(go-def) +nmap t :GoTest! +nmap b :GoBuild! +nmap i :GoInstall! +nmap R :GoRun % +nmap x :GoDebugStart! +nmap r :GoRun! +nmap m :GoDoc +nmap D :GoDocBrowser diff --git a/.config/nvim/after/ftplugin/html.vim b/.config/nvim/after/ftplugin/html.vim index cc04294..ff34247 100644 --- a/.config/nvim/after/ftplugin/html.vim +++ b/.config/nvim/after/ftplugin/html.vim @@ -13,3 +13,11 @@ if &completeopt =~# '.*noselect.*' else iabbrev endif + +lua require'cmp'.setup.buffer { +\ sources = { +\ { name = 'nvim_lsp' }, +\ { name = 'vsnip' }, +\ { name = 'buffer' }, +\ }, +\ } diff --git a/.config/nvim/after/ftplugin/lua.vim b/.config/nvim/after/ftplugin/lua.vim new file mode 100644 index 0000000..0dc18a2 --- /dev/null +++ b/.config/nvim/after/ftplugin/lua.vim @@ -0,0 +1,11 @@ +lua require'cmp'.setup.buffer { +\ sources = { +\ { name = 'nvim_lsp' }, +\ { name = 'nvim_lua' }, +\ { name = 'vsnip' }, +\ { name = 'buffer' }, +\ }, +\ } + +set shiftwidth=2 +set tabstop=2 diff --git a/.config/nvim/after/ftplugin/make.vim b/.config/nvim/after/ftplugin/make.vim new file mode 100644 index 0000000..bbd8967 --- /dev/null +++ b/.config/nvim/after/ftplugin/make.vim @@ -0,0 +1 @@ +setlocal noexpandtab diff --git a/.config/nvim/after/ftplugin/text.vim b/.config/nvim/after/ftplugin/text.vim index 71fc50c..8a1e324 100644 --- a/.config/nvim/after/ftplugin/text.vim +++ b/.config/nvim/after/ftplugin/text.vim @@ -15,3 +15,11 @@ nnoremap z= nnoremap z=1 nnoremap zg inoremap u[s1z=`]au + +lua require'cmp'.setup.buffer { +\ sources = { +\ { name = 'buffer' }, +\ { name = 'spell' } +\ { name = 'look', keyword_length=3 }, +\ }, +\ } diff --git a/.config/nvim/after/ftplugin/vim.vim b/.config/nvim/after/ftplugin/vim.vim new file mode 100644 index 0000000..9414d4a --- /dev/null +++ b/.config/nvim/after/ftplugin/vim.vim @@ -0,0 +1,10 @@ +lua require'cmp'.setup.buffer { +\ sources = { +\ { name = 'nvim_lsp' }, +\ { name = 'vsnip' }, +\ { name = 'buffer' }, +\ }, +\ } + +set shiftwidth=2 +set tabstop=2 diff --git a/.config/nvim/after/plugin/fugitive.vim b/.config/nvim/after/plugin/fugitive.vim new file mode 100644 index 0000000..81a73e3 --- /dev/null +++ b/.config/nvim/after/plugin/fugitive.vim @@ -0,0 +1,4 @@ +augroup Profugo + autocmd! + autocmd BufReadPost fugitive:///*//2/*,fugitive:///*//3/* setlocal nomodifiable readonly +augroup END diff --git a/.config/nvim/colors/srcery_new.vim b/.config/nvim/colors/srcery_new.vim new file mode 100644 index 0000000..972bd53 --- /dev/null +++ b/.config/nvim/colors/srcery_new.vim @@ -0,0 +1,1301 @@ +" 'srcery.vim' -- Vim color scheme. +" Maintainer: Roosta (mail@roosta.sh) +" Description: Colorscheme that focus ease of use and clearly defined contrasting colors with a slightly earthy tone. +" Original Source: https://github.com/morhetz/gruvbox + +scriptencoding utf-8 + +set background=dark + +if v:version > 580 + hi clear + if exists('syntax_on') + syntax reset + endif +endif + +let g:colors_name='srcery' + +if !has('gui_running') && &t_Co != 256 + finish +endif + +" Setup Variables: {{{1 +" Colors {{{2 + +if !exists('g:srcery_black') + let g:srcery_black='#1C1B19' +endif + +if !exists('g:srcery_red') + let g:srcery_red='#EF2F27' +endif + +if !exists('g:srcery_green') + let g:srcery_green='#519F50' +endif + +if !exists('g:srcery_yellow') + let g:srcery_yellow='#FBB829' +endif + +if !exists('g:srcery_blue') + let g:srcery_blue='#2C78BF' +endif + +if !exists('g:srcery_magenta') + let g:srcery_magenta='#E02C6D' +endif + +if !exists('g:srcery_cyan') + let g:srcery_cyan='#0AAEB3' +endif + +if !exists('g:srcery_white') + let g:srcery_white='#BAA67F' +endif + +if !exists('g:srcery_bright_black') + let g:srcery_bright_black='#918175' +endif + +if !exists('g:srcery_bright_red') + let g:srcery_bright_red='#F75341' +endif + +if !exists('g:srcery_bright_green') + let g:srcery_bright_green='#98BC37' +endif + +if !exists('g:srcery_bright_yellow') + let g:srcery_bright_yellow='#FED06E' +endif + +if !exists('g:srcery_bright_blue') + let g:srcery_bright_blue='#68A8E4' +endif + +if !exists('g:srcery_bright_magenta') + let g:srcery_bright_magenta='#FF5C8F' +endif + +if !exists('g:srcery_bright_cyan') + let g:srcery_bright_cyan='#2BE4D0' +endif + +if !exists('g:srcery_bright_white') + let g:srcery_bright_white='#FCE8C3' +endif + +if !exists('g:srcery_orange') + let g:srcery_orange='#FF5F00' +endif + +if !exists('g:srcery_bright_orange') + let g:srcery_bright_orange='#FF8700' +endif + +if !exists('g:srcery_hard_black') + let g:srcery_hard_black='#121212' +endif + +if !exists('g:srcery_xgray1') + let g:srcery_xgray1='#262626' +endif + +if !exists('g:srcery_xgray2') + let g:srcery_xgray2='#303030' +endif + +if !exists('g:srcery_xgray3') + let g:srcery_xgray3='#3A3A3A' +endif + +if !exists('g:srcery_xgray4') + let g:srcery_xgray4='#444444' +endif + +if !exists('g:srcery_xgray5') + let g:srcery_xgray5='#4E4E4E' +endif + +if !exists('g:srcery_xgray6') + let g:srcery_xgray6='#585858' +endif + +" }}} +" Options {{{2 + +if !exists('g:srcery_bold') + let g:srcery_bold=1 +endif + +if !exists('g:srcery_italic') + if has('gui_running') || $TERM_ITALICS ==? 'true' + let g:srcery_italic=1 + else + let g:srcery_italic=0 + endif +endif + +if !exists('g:srcery_bg_passthrough') + let g:srcery_bg_passthrough=0 +endif + +if !exists('g:srcery_undercurl') + let g:srcery_undercurl=1 +endif + +if !exists('g:srcery_underline') + let g:srcery_underline=1 +endif + +if !exists('g:srcery_inverse') + let g:srcery_inverse=1 +endif + +if !exists('g:srcery_inverse_matches') + let g:srcery_inverse_matches=0 +endif + +if !exists('g:srcery_inverse_match_paren') + let g:srcery_inverse_match_paren=0 +endif + +if !exists('g:srcery_dim_lisp_paren') + let g:srcery_dim_lisp_paren=0 +endif + +if !exists('g:srcery_guisp_fallback') || index(['fg', 'bg'], g:srcery_guisp_fallback) == -1 + let g:srcery_guisp_fallback='NONE' +endif + +if !exists('g:srcery_italic_types') + let g:srcery_italic_types=0 +endif + +if !exists('g:srcery_hard_black_terminal_bg') + let g:srcery_hard_black_terminal_bg=1 +endif + +" }}} +" }}} +" Palette {{{ + +let s:none = ['NONE', 'NONE'] + +" 16 base colors +let s:black = [g:srcery_black, 0] +let s:red = [g:srcery_red, 1] +let s:green = [g:srcery_green, 2] +let s:yellow = [g:srcery_yellow, 3] +let s:blue = [g:srcery_blue, 4] +let s:magenta = [g:srcery_magenta, 5] +let s:cyan = [g:srcery_cyan, 6] +let s:white = [g:srcery_white, 7] +let s:bright_black = [g:srcery_bright_black, 8] +let s:bright_red = [g:srcery_bright_red, 9] +let s:bright_green = [g:srcery_bright_green, 10] +let s:bright_yellow = [g:srcery_bright_yellow, 11] +let s:bright_blue = [g:srcery_bright_blue, 12] +let s:bright_magenta = [g:srcery_bright_magenta, 13] +let s:bright_cyan = [g:srcery_bright_cyan, 14] +let s:bright_white = [g:srcery_bright_white, 15] + +" xterm colors. +let s:orange = [g:srcery_orange, 202] +let s:bright_orange = [g:srcery_bright_orange, 208] +let s:hard_black = [g:srcery_hard_black, 233] +let s:xgray1 = [g:srcery_xgray1, 235] +let s:xgray2 = [g:srcery_xgray2, 236] +let s:xgray3 = [g:srcery_xgray3, 237] +let s:xgray4 = [g:srcery_xgray4, 238] +let s:xgray5 = [g:srcery_xgray5, 239] +let s:xgray6 = [g:srcery_xgray6, 240] + +"}}} +" Setup Emphasis: {{{ + +let s:bold = 'bold,' +if g:srcery_bold == 0 + let s:bold = '' +endif + +let s:italic = 'italic,' +if g:srcery_italic == 0 + let s:italic = '' +endif + +let s:underline = 'underline,' +if g:srcery_underline == 0 + let s:underline = '' +endif + +let s:undercurl = 'undercurl,' +if g:srcery_undercurl == 0 + let s:undercurl = '' +endif + +let s:inverse = 'inverse,' +if g:srcery_inverse == 0 + let s:inverse = '' +endif + +" }}} +" Highlighting Function: {{{ + +function! s:HL(group, fg, ...) + " Arguments: group, guifg, guibg, gui, guisp + + " foreground + let l:fg = a:fg + + " background + if a:0 >= 1 + let l:bg = a:1 + else + let l:bg = s:none + endif + + " emphasis + if a:0 >= 2 && strlen(a:2) + let l:emstr = a:2 + else + let l:emstr = 'NONE,' + endif + + " special fallback + if a:0 >= 3 + if g:srcery_guisp_fallback !=# 'NONE' + let fg = a:3 + endif + + " bg fallback mode should invert higlighting + if g:srcery_guisp_fallback ==# 'bg' + let emstr .= 'inverse,' + endif + endif + + let l:histring = [ 'hi', a:group, + \ 'guifg=' . l:fg[0], 'ctermfg=' . l:fg[1], + \ 'guibg=' . l:bg[0], 'ctermbg=' . l:bg[1], + \ 'gui=' . l:emstr[:-2], 'cterm=' . l:emstr[:-2] + \ ] + + " special + if a:0 >= 3 + call add(l:histring, 'guisp=' . a:3[0]) + endif + + execute join(l:histring, ' ') +endfunction + +"}}} +" Srcery Hi Groups: {{{ + +" memoize common hi groups +call s:HL('SrceryWhite', s:white) +call s:HL('SrceryRed', s:red) +call s:HL('SrceryGreen', s:green) +call s:HL('SrceryYellow', s:yellow) +call s:HL('SrceryBlue', s:blue) +call s:HL('SrceryMagenta', s:magenta) +call s:HL('SrceryCyan', s:cyan) +call s:HL('SrceryBlack', s:black) + +call s:HL('SrceryRedBold', s:red, s:none, s:bold) +call s:HL('SrceryGreenBold', s:green, s:none, s:bold) +call s:HL('SrceryYellowBold', s:yellow, s:none, s:bold) +call s:HL('SrceryBlueBold', s:blue, s:none, s:bold) +call s:HL('SrceryMagentaBold', s:magenta, s:none, s:bold) +call s:HL('SrceryCyanBold', s:cyan, s:none, s:bold) + +call s:HL('SrceryBrightRed', s:bright_red, s:none) +call s:HL('SrceryBrightGreen', s:bright_green, s:none) +call s:HL('SrceryBrightYellow', s:bright_yellow, s:none) +call s:HL('SrceryBrightBlue', s:bright_blue, s:none) +call s:HL('SrceryBrightMagenta', s:bright_magenta, s:none) +call s:HL('SrceryBrightCyan', s:bright_cyan, s:none) +call s:HL('SrceryBrightBlack', s:bright_black, s:none) +call s:HL('SrceryBrightWhite', s:bright_white) + +call s:HL('SrceryBrightBlueBold', s:bright_blue, s:none, s:bold) +call s:HL('SrceryBrightYellowBold', s:bright_yellow, s:none, s:bold) + +" special +call s:HL('SrceryOrange', s:orange) +call s:HL('SrceryBrightOrange', s:bright_orange) +call s:HL('SrceryOrangeBold', s:orange, s:none, s:bold) +call s:HL('SrceryHardBlack', s:hard_black) +call s:HL('SrceryXgray1', s:xgray1) +call s:HL('SrceryXgray2', s:xgray2) +call s:HL('SrceryXgray3', s:xgray3) +call s:HL('SrceryXgray4', s:xgray4) +call s:HL('SrceryXgray5', s:xgray5) +call s:HL('SrceryXgray6', s:xgray6) + +" }}} +" Setup Terminal Colors For Neovim: {{{ + +if has('nvim') + let g:terminal_color_0 = s:black[0] + let g:terminal_color_8 = s:bright_black[0] + + let g:terminal_color_1 = s:red[0] + let g:terminal_color_9 = s:bright_red[0] + + let g:terminal_color_2 = s:green[0] + let g:terminal_color_10 = s:bright_green[0] + + let g:terminal_color_3 = s:yellow[0] + let g:terminal_color_11 = s:bright_yellow[0] + + let g:terminal_color_4 = s:blue[0] + let g:terminal_color_12 = s:bright_blue[0] + + let g:terminal_color_5 = s:magenta[0] + let g:terminal_color_13 = s:bright_magenta[0] + + let g:terminal_color_6 = s:cyan[0] + let g:terminal_color_14 = s:bright_cyan[0] + + let g:terminal_color_7 = s:white[0] + let g:terminal_color_15 = s:bright_white[0] +endif + +" }}} +" Setup Terminal Colors For Vim with termguicolors: {{{ + +if exists('*term_setansicolors') + let g:terminal_ansi_colors = repeat([0], 16) + + let g:terminal_ansi_colors[0] = s:black[0] + let g:terminal_ansi_colors[8] = s:bright_black[0] + + let g:terminal_ansi_colors[1] = s:red[0] + let g:terminal_ansi_colors[9] = s:bright_red[0] + + let g:terminal_ansi_colors[2] = s:green[0] + let g:terminal_ansi_colors[10] = s:bright_green[0] + + let g:terminal_ansi_colors[3] = s:yellow[0] + let g:terminal_ansi_colors[11] = s:bright_yellow[0] + + let g:terminal_ansi_colors[4] = s:blue[0] + let g:terminal_ansi_colors[12] = s:bright_blue[0] + + let g:terminal_ansi_colors[5] = s:magenta[0] + let g:terminal_ansi_colors[13] = s:bright_magenta[0] + + let g:terminal_ansi_colors[6] = s:cyan[0] + let g:terminal_ansi_colors[14] = s:bright_cyan[0] + + let g:terminal_ansi_colors[7] = s:white[0] + let g:terminal_ansi_colors[15] = s:bright_white[0] +endif + +" }}} + +" Vanilla colorscheme --------------------------------------------------------- +" General UI: {{{ + +" Normal text +" +if g:srcery_bg_passthrough == 1 && !has('gui_running') + call s:HL('Normal', s:bright_white, s:none) + else + call s:HL('Normal', s:bright_white, s:black) +endif + +if v:version >= 700 + " Screen line that the cursor is + call s:HL('CursorLine', s:none, s:xgray2) + " Screen column that the cursor is + hi! link CursorColumn CursorLine + + call s:HL('TabLineFill', s:bright_black, s:xgray2) + call s:HL('TabLineSel', s:bright_white, s:xgray5) + + " Not active tab page label + hi! link TabLine TabLineFill + + " Match paired bracket under the cursor + " + if g:srcery_inverse_match_paren == 1 + call s:HL('MatchParen', s:bright_magenta, s:none, s:inverse . s:bold) + else + call s:HL('MatchParen', s:bright_magenta, s:none, s:bold) + endif +endif + +if v:version >= 703 + " Highlighted screen columns + call s:HL('ColorColumn', s:none, s:xgray2) + + " Concealed element: \lambda → λ + call s:HL('Conceal', s:blue, s:none) + + " Line number of CursorLine + if g:srcery_bg_passthrough == 1 && !has('gui_running') + call s:HL('CursorLineNr', s:yellow, s:none) + else + call s:HL('CursorLineNr', s:yellow, s:black) + endif + +endif + +hi! link NonText SrceryXgray4 +hi! link SpecialKey SrceryBlue + +if g:srcery_inverse == 1 + call s:HL('Visual', s:none, s:none, s:inverse) +else + call s:HL('Visual', s:none, s:xgray2, s:bold) +endif + +hi! link VisualNOS Visual + +if g:srcery_inverse == 1 && g:srcery_inverse_matches == 1 + call s:HL('Search', s:none, s:none, s:inverse) + call s:HL('IncSearch', s:none, s:none, s:inverse) +else + call s:HL('Search', s:none, s:xgray5, s:bold) + call s:HL('IncSearch', s:none, s:xgray5, s:underline . s:bold) +endif + +call s:HL('Underlined', s:blue, s:none, s:underline) + +call s:HL('StatusLine', s:bright_white, s:xgray2) + +if g:srcery_bg_passthrough == 1 && !has('gui_running') + call s:HL('StatusLineNC', s:bright_black, s:none, s:underline) + + " The column separating vertically split windows + call s:HL('VertSplit', s:bright_white, s:none) + + " Current match in wildmenu completion + call s:HL('WildMenu', s:blue, s:none, s:bold) +else + call s:HL('StatusLineNC', s:bright_black, s:black, s:underline) + call s:HL('VertSplit', s:bright_white, s:black) + call s:HL('WildMenu', s:blue, s:black, s:bold) +endif + +" Directory names, special names in listing +hi! link Directory SrceryGreenBold + +" Titles for output from :set all, :autocmd, etc. +hi! link Title SrceryGreenBold + +" Error messages on the command line +call s:HL('ErrorMsg', s:bright_white, s:red) +" More prompt: -- More -- +hi! link MoreMsg SrceryYellowBold +" Current mode message: -- INSERT -- +hi! link ModeMsg SrceryYellowBold +" 'Press enter' prompt and yes/no questions +hi! link Question SrceryOrangeBold +" Warning messages +hi! link WarningMsg SrceryRedBold + +" }}} +" Gutter: {{{ + +" Line number for :number and :# commands +call s:HL('LineNr', s:bright_black) + +if g:srcery_bg_passthrough == 1 && !has('gui_running') + " Column where signs are displayed + " TODO Possibly need to fix SignColumn + call s:HL('SignColumn', s:none, s:none) + " Line used for closed folds + call s:HL('Folded', s:bright_black, s:none, s:italic) + " Column where folds are displayed + call s:HL('FoldColumn', s:bright_black, s:none) +else + call s:HL('SignColumn', s:none, s:black) + call s:HL('Folded', s:bright_black, s:black, s:italic) + call s:HL('FoldColumn', s:bright_black, s:black) +endif + +" }}} +" Cursor: {{{ + +" Character under cursor +call s:HL('Cursor', s:black, s:yellow) +" Visual mode cursor, selection +hi! link vCursor Cursor +" Input moder cursor +hi! link iCursor Cursor +" Language mapping cursor +hi! link lCursor Cursor + +" }}} +" Syntax Highlighting: {{{ + +hi! link Special SrceryOrange + +call s:HL('Comment', s:bright_black, s:none, s:italic) + +if g:srcery_bg_passthrough == 1 && !has('gui_running') + call s:HL('Todo', s:bright_white, s:none, s:bold . s:italic) +else + call s:HL('Todo', s:bright_white, s:black, s:bold . s:italic) +endif + +call s:HL('Error', s:bright_white, s:red, s:bold) + +" String constant: "this is a string" +call s:HL('String', s:bright_green) + +" Generic statement +hi! link Statement SrceryRed +" if, then, else, endif, swicth, etc. +hi! link Conditional SrceryRed +" for, do, while, etc. +hi! link Repeat SrceryRed +" case, default, etc. +hi! link Label SrceryRed +" try, catch, throw +hi! link Exception SrceryRed +" sizeof, "+", "*", etc. +hi! link Operator Normal +" Any other keyword +hi! link Keyword SrceryRed + +" Variable name +hi! link Identifier SrceryCyan +" Function name +hi! link Function SrceryYellow + +" Generic preprocessor +hi! link PreProc SrceryCyan +" Preprocessor #include +hi! link Include SrceryCyan +" Preprocessor #define +hi! link Define SrceryCyan +" Same as Define +hi! link Macro SrceryOrange +" Preprocessor #if, #else, #endif, etc. +hi! link PreCondit SrceryCyan + +" Generic constant +hi! link Constant SrceryBrightMagenta +" Character constant: 'c', '/n' +hi! link Character SrceryBrightMagenta +" Boolean constant: TRUE, false +hi! link Boolean SrceryBrightMagenta +" Number constant: 234, 0xff +hi! link Number SrceryBrightMagenta +" Floating point constant: 2.3e10 +hi! link Float SrceryBrightMagenta + +" Generic type +if g:srcery_italic_types == 1 && g:srcery_italic == 1 + call s:HL('Type', s:bright_blue, s:none, s:italic) +else + hi! link Type SrceryBrightBlue +end +" static, register, volatile, etc +hi! link StorageClass SrceryOrange +" struct, union, enum, etc. +hi! link Structure SrceryCyan +" typedef +hi! link Typedef SrceryMagenta + +if g:srcery_dim_lisp_paren == 1 + hi! link Delimiter SrceryXgray6 +else + hi! link Delimiter SrceryBrightBlack +endif + +" }}} +" Completion Menu: {{{ + +if v:version >= 700 + " Popup menu: normal item + call s:HL('Pmenu', s:bright_white, s:xgray2) + " Popup menu: selected item + call s:HL('PmenuSel', s:bright_white, s:blue, s:bold) + + if g:srcery_bg_passthrough == 1 && !has('gui_running') + " Popup menu: scrollbar + call s:HL('PmenuSbar', s:none, s:none) + " Popup menu: scrollbar thumb + call s:HL('PmenuThumb', s:none, s:none) + else + call s:HL('PmenuSbar', s:none, s:black) + call s:HL('PmenuThumb', s:none, s:black) + endif +endif + +" }}} +" Diffs: {{{ + +if g:srcery_bg_passthrough == 1 && !has('gui_running') + call s:HL('DiffDelete', s:red, s:none) + call s:HL('DiffAdd', s:green, s:none) + call s:HL('DiffChange', s:cyan, s:none) + call s:HL('DiffText', s:yellow, s:none) +else + call s:HL('DiffDelete', s:red, s:black) + call s:HL('DiffAdd', s:green, s:black) + call s:HL('DiffChange', s:cyan, s:black) + call s:HL('DiffText', s:yellow, s:black) +endif + +" }}} +" Spelling: {{{ + +if has('spell') + " Not capitalised word, or compile warnings + call s:HL('SpellCap', s:green, s:none, s:bold . s:italic) + " Not recognized word + call s:HL('SpellBad', s:none, s:none, s:undercurl, s:blue) + " Wrong spelling for selected region + call s:HL('SpellLocal', s:none, s:none, s:undercurl, s:cyan) + " Rare word + call s:HL('SpellRare', s:none, s:none, s:undercurl, s:magenta) +endif + +" }}} +" Terminal: {{{ + +if g:srcery_hard_black_terminal_bg == 1 && has('terminal') + " Must set an explicit background as NONE won't work + " Therefore not useful with transparent background option + call s:HL('Terminal', s:bright_white, s:hard_black) +endif + +" }}} +" Neovim's builtin LSP: {{{ + +hi! link LspDiagnosticsDefaultError SrceryBrightRed +hi! link LspDiagnosticsDefaultWarning SrceryBrightYellow +hi! link LspDiagnosticsDefaultInformation SrceryBrightGreen +hi! link LspDiagnosticsDefaultHint SrceryBrightCyan +call s:HL('LspDiagnosticsUnderlineError', s:bright_red, s:none, s:underline) +call s:HL('LspDiagnosticsUnderlineWarning', s:bright_yellow, s:none, s:underline) +call s:HL('LspDiagnosticsUnderlineInformation', s:bright_green, s:none, s:underline) +call s:HL('LspDiagnosticsUnderlineHint', s:bright_cyan, s:none, s:underline) + +" }}} + +" Plugin specific ------------------------------------------------------------- +" Sneak: {{{ + +hi! link Sneak Search +call s:HL('SneakScope', s:none, s:hard_black) +hi! link SneakLabel Search + +" }}} +" Rainbow Parentheses: {{{ + +if !exists('g:rbpt_colorpairs') + let g:rbpt_colorpairs = + \ [ + \ ['blue', '#2C78BF'], ['202', '#FF5F00'], + \ ['red', '#EF2F27'], ['magenta', '#E02C6D'] + \ ] +endif + +let g:rainbow_guifgs = [ '#E02C6D', '#EF2F27', '#D75F00', '#2C78BF'] +let g:rainbow_ctermfgs = [ 'magenta', 'red', '202', 'blue' ] + +if !exists('g:rainbow_conf') + let g:rainbow_conf = {} +endif +if !has_key(g:rainbow_conf, 'guifgs') + let g:rainbow_conf['guifgs'] = g:rainbow_guifgs +endif +if !has_key(g:rainbow_conf, 'ctermfgs') + let g:rainbow_conf['ctermfgs'] = g:rainbow_ctermfgs +endif + +let g:niji_dark_colours = g:rbpt_colorpairs +let g:niji_light_colours = g:rbpt_colorpairs + +"}}} +" GitGutter: {{{ + +hi! link GitGutterAdd SrceryGreen +hi! link GitGutterChange SrceryYellow +hi! link GitGutterDelete SrceryRed +hi! link GitGutterChangeDelete SrceryYellow + +" }}} +" GitCommit: "{{{ + +hi! link gitcommitSelectedFile SrceryGreen +hi! link gitcommitDiscardedFile SrceryRed + +" }}} +" Asynchronous Lint Engine: {{{ + +call s:HL('ALEError', s:none, s:none, s:undercurl, s:red) +call s:HL('ALEWarning', s:none, s:none, s:undercurl, s:yellow) +call s:HL('ALEInfo', s:none, s:none, s:undercurl, s:blue) + +hi! link ALEErrorSign SrceryRed +hi! link ALEWarningSign SrceryYellow +hi! link ALEInfoSign SrceryBlue + +" }}} +" vim-indent-guides: {{{ + +call s:HL('IndentGuidesEven', s:none, s:xgray3) +call s:HL('IndentGuidesOdd', s:none, s:xgray4) + +" }}} +" vim-startify {{{ + +hi! link StartifyNumber Statement +hi! link StartifyFile Normal +hi! link StartifyPath String +hi! link StartifySlash Normal +hi! link StartifyBracket Comment +hi! link StartifyHeader Type +hi! link StartifyFooter Normal +hi! link StartifySpecial Comment +hi! link StartifySection Identifier + +" }}} +" fzf: {{{ + +call s:HL('fzf1', s:magenta, s:xgray2) +call s:HL('fzf2', s:bright_green, s:xgray2) +call s:HL('fzf3', s:bright_white, s:xgray2) + +"}}} +" Netrw: {{{ + +hi! link netrwDir SrceryBlue +hi! link netrwClassify SrceryCyan +hi! link netrwLink SrceryBrightBlack +hi! link netrwSymLink SrceryCyan +hi! link netrwExe SrceryYellow +hi! link netrwComment SrceryBrightBlack +hi! link netrwList SrceryBrightBlue +hi! link netrwTreeBar SrceryBrightBlack +hi! link netrwHelpCmd SrceryCyan +hi! link netrwVersion SrceryGreen +hi! link netrwCmdSep SrceryBrightBlack + +"}}} +" coc.nvim: {{{ + +hi! link CocErrorSign SrceryRed +hi! link CocWarningSign SrceryBrightOrange +hi! link CocInfoSign SrceryYellow +hi! link CocHintSign SrceryBlue +hi! link CocErrorFloat SrceryRed +hi! link CocWarningFloat SrceryOrange +hi! link CocInfoFloat SrceryYellow +hi! link CocHintFloat SrceryBlue +hi! link CocDiagnosticsError SrceryRed +hi! link CocDiagnosticsWarning SrceryOrange +hi! link CocDiagnosticsInfo SrceryYellow +hi! link CocDiagnosticsHint SrceryBlue + +hi! link CocSelectedText SrceryRed +hi! link CocCodeLens SrceryWhite + +call s:HL('CocErrorHighlight', s:none, s:none, s:undercurl, s:red) +call s:HL('CocWarningHighlight', s:none, s:none, s:undercurl, s:bright_orange) +call s:HL('CocInfoHighlight', s:none, s:none, s:undercurl, s:yellow) +call s:HL('CocHintHighlight', s:none, s:none, s:undercurl, s:blue) + +" }}} +" CtrlP: "{{{ +" +hi! link CtrlPMatch SrceryMagenta +hi! link CtrlPLinePre SrceryBrightGreen +call s:HL('CtrlPMode1', s:bright_white, s:xgray3) +call s:HL('CtrlPMode2', s:bright_white, s:xgray5) +call s:HL('CtrlPStats', s:yellow, s:xgray2) + +" }}} +" NERDTree: "{{{ + +hi! link NERDTreeDir SrceryBlue +hi! link NERDTreeDirSlash SrceryCyan +hi! link NERDTreeOpenable SrceryBlue +hi! link NERDTreeClosable SrceryBlue +hi! link NERDTreeFile SrceryWhite +hi! link NERDTreeExecFile SrceryYellow +hi! link NERDTreeUp SrceryOrange +hi! link NERDTreeCWD SrceryGreen +hi! link NERDTreeHelp SrceryCyan +hi! link NERDTreeFlags SrceryCyan +hi! link NERDTreeLinkFile SrceryBrightBlack +hi! link NERDTreeLinkTarget SrceryBrightBlack + +" }}} +" Telescope: "{{{ + +call s:HL('TelescopeNormal', s:white, s:none) +call s:HL('TelescopeSelection', s:green, s:none, s:bold) +call s:HL('TelescopeMatching', s:magenta) +call s:HL('TelescopeSelectionCaret', s:magenta) +call s:HL('TelescopePromptPrefix', s:bright_yellow) + +" }}} +" nvim-treesitter {{{ + +call s:HL('TSStrong', s:none, s:none, s:bold) +call s:HL('TSEmphasis', s:none, s:none, s:bold) +call s:HL('TSUnderline', s:none, s:none, s:underline) + +highlight! link TSWarning SrceryOrangeBold +highlight! link TSDanger SrceryRedBold +highlight! link TSConstBuiltin SrceryCyan +highlight! link TSField SrceryGreen +highlight! link TSFuncBuiltin SrceryYellow +highlight! link TSFuncMacro SrceryOrange +highlight! link TSFunction SrceryYellow +call s:HL('TSNamespace', s:white, s:none, s:italic) +call s:HL('TSParameter', s:cyan, s:none, s:italic) +highlight! link TSProperty SrceryBrightBlue +highlight! link TSSymbol SrceryBlue +highlight! link TSTag SrceryBlue +highlight! link TSTagAttribute SrceryYellow +highlight! link TSVariableBuiltin SrceryCyan +highlight! link TSType SrceryWhite +highlight! link TSDelimiter SrceryWhite +highlight! link TSURI SrceryGreen +highlight! link TSVariable SrceryBrightWhite +" }}} + + +" Filetype specific ----------------------------------------------------------- +" Diff: {{{ + +hi! link diffAdded SrceryGreen +hi! link diffRemoved SrceryRed +hi! link diffChanged SrceryCyan + +hi! link diffFile SrceryOrange +hi! link diffNewFile SrceryYellow + +hi! link diffLine SrceryBlue + +" }}} +" Html: {{{ + +hi! link htmlTag SrceryBlue +hi! link htmlEndTag SrceryBlue + +hi! link htmlTagName SrceryBlue +hi! link htmlTag SrceryBrightBlack +hi! link htmlArg SrceryYellow + +hi! link htmlScriptTag SrceryRed +hi! link htmlTagN SrceryBlue +hi! link htmlSpecialTagName SrceryBlue + +call s:HL('htmlLink', s:bright_white, s:none, s:underline) + +hi! link htmlSpecialChar SrceryYellow + +if g:srcery_bg_passthrough == 1 && !has('gui_running') + call s:HL('htmlBold', s:bright_white, s:none, s:bold) + call s:HL('htmlBoldUnderline', s:bright_white, s:none, s:bold . s:underline) + call s:HL('htmlBoldItalic', s:bright_white, s:none, s:bold . s:italic) + call s:HL('htmlBoldUnderlineItalic', s:bright_white, s:none, s:bold . s:underline . s:italic) + call s:HL('htmlUnderline', s:bright_white, s:none, s:underline) + call s:HL('htmlUnderlineItalic', s:bright_white, s:none, s:underline . s:italic) + call s:HL('htmlItalic', s:bright_white, s:none, s:italic) +else + call s:HL('htmlBold', s:bright_white, s:black, s:bold) + call s:HL('htmlBoldUnderline', s:bright_white, s:black, s:bold . s:underline) + call s:HL('htmlBoldItalic', s:bright_white, s:black, s:bold . s:italic) + call s:HL('htmlBoldUnderlineItalic', s:bright_white, s:black, s:bold . s:underline . s:italic) + call s:HL('htmlUnderline', s:bright_white, s:black, s:underline) + call s:HL('htmlUnderlineItalic', s:bright_white, s:black, s:underline . s:italic) + call s:HL('htmlItalic', s:bright_white, s:black, s:italic) +endif + +" }}} +" Xml: {{{ + +hi! link xmlTag SrceryBlue +hi! link xmlEndTag SrceryBlue +hi! link xmlTagName SrceryBlue +hi! link xmlEqual SrceryBlue +hi! link docbkKeyword SrceryCyanBold + +hi! link xmlDocTypeDecl SrceryBrightBlack +hi! link xmlDocTypeKeyword SrceryMagenta +hi! link xmlCdataStart SrceryBrightBlack +hi! link xmlCdataCdata SrceryMagenta +hi! link dtdFunction SrceryBrightBlack +hi! link dtdTagName SrceryMagenta + +hi! link xmlAttrib SrceryCyan +hi! link xmlProcessingDelim SrceryBrightBlack +hi! link dtdParamEntityPunct SrceryBrightBlack +hi! link dtdParamEntityDPunct SrceryBrightBlack +hi! link xmlAttribPunct SrceryBrightBlack + +hi! link xmlEntity SrceryYellow +hi! link xmlEntityPunct SrceryYellow + +" }}} +" Vim: {{{ + +call s:HL('vimCommentTitle', s:bright_white, s:none, s:bold . s:italic) + +hi! link vimNotation SrceryYellow +hi! link vimBracket SrceryYellow +hi! link vimMapModKey SrceryYellow +hi! link vimFuncSID SrceryBrightWhite +hi! link vimSetSep SrceryBrightWhite +hi! link vimSep SrceryBrightWhite +hi! link vimContinue SrceryBrightWhite + +" }}} +" Lisp dialects: {{{ + +if g:srcery_dim_lisp_paren == 1 + hi! link schemeParentheses SrceryXgray6 + hi! link clojureParen SrceryXgray6 +else + hi! link schemeParentheses SrceryWhite + hi! link clojureParen SrceryWhite +endif + +hi! link clojureKeyword SrceryBlue +hi! link clojureCond SrceryRed +hi! link clojureSpecial SrceryRed +hi! link clojureDefine SrceryRed + +hi! link clojureFunc SrceryYellow +hi! link clojureRepeat SrceryYellow +hi! link clojureCharacter SrceryCyan +hi! link clojureStringEscape SrceryCyan +hi! link clojureException SrceryRed + +hi! link clojureRegexp SrceryCyan +hi! link clojureRegexpEscape SrceryCyan +call s:HL('clojureRegexpCharClass', s:bright_white, s:none, s:bold) +hi! link clojureRegexpMod clojureRegexpCharClass +hi! link clojureRegexpQuantifier clojureRegexpCharClass + +hi! link clojureAnonArg SrceryYellow +hi! link clojureVariable SrceryBlue +hi! link clojureMacro SrceryOrangeBold + +hi! link clojureMeta SrceryYellow +hi! link clojureDeref SrceryYellow +hi! link clojureQuote SrceryYellow +hi! link clojureUnquote SrceryYellow + +" }}} +" C: {{{ + +hi! link cOperator SrceryMagenta +hi! link cStructure SrceryYellow + +" }}} +" Python: {{{ + +hi! link pythonBuiltin SrceryYellow +hi! link pythonBuiltinObj SrceryYellow +hi! link pythonBuiltinFunc SrceryYellow +hi! link pythonFunction SrceryCyan +hi! link pythonDecorator SrceryRed +hi! link pythonInclude SrceryBlue +hi! link pythonImport SrceryBlue +hi! link pythonRun SrceryBlue +hi! link pythonCoding SrceryBlue +hi! link pythonOperator SrceryRed +hi! link pythonExceptions SrceryMagenta +hi! link pythonBoolean SrceryMagenta +hi! link pythonDot SrceryBrightWhite + +" }}} +" CSS/SASS: {{{ + +hi! link cssBraces SrceryBrightWhite +hi! link cssFunctionName SrceryYellow +hi! link cssIdentifier SrceryBlue +hi! link cssClassName SrceryBlue +hi! link cssClassNameDot SrceryBlue +hi! link cssColor SrceryBrightMagenta +hi! link cssSelectorOp SrceryBlue +hi! link cssSelectorOp2 SrceryBlue +hi! link cssImportant SrceryGreen +hi! link cssVendor SrceryBlue +hi! link cssMediaProp SrceryYellow +hi! link cssBorderProp SrceryYellow +hi! link cssAttrComma SrceryBrightWhite + +hi! link cssTextProp SrceryYellow +hi! link cssAnimationProp SrceryYellow +hi! link cssUIProp SrceryYellow +hi! link cssTransformProp SrceryYellow +hi! link cssTransitionProp SrceryYellow +hi! link cssPrintProp SrceryYellow +hi! link cssPositioningProp SrceryYellow +hi! link cssBoxProp SrceryYellow +hi! link cssFontDescriptorProp SrceryYellow +hi! link cssFlexibleBoxProp SrceryYellow +hi! link cssBorderOutlineProp SrceryYellow +hi! link cssBackgroundProp SrceryYellow +hi! link cssMarginProp SrceryYellow +hi! link cssListProp SrceryYellow +hi! link cssTableProp SrceryYellow +hi! link cssFontProp SrceryYellow +hi! link cssPaddingProp SrceryYellow +hi! link cssDimensionProp SrceryYellow +hi! link cssRenderProp SrceryYellow +hi! link cssColorProp SrceryYellow +hi! link cssGeneratedContentProp SrceryYellow +hi! link cssTagName SrceryBrightBlue + +" SASS +hi! link sassClass SrceryBlue +hi! link sassClassChar SrceryBlue +hi! link sassVariable SrceryCyan +hi! link sassIdChar SrceryBrightBlue +hi! link sassId SrceryBrightBlue + +" }}} +" JavaScript: {{{ + +hi! link javascriptMember SrceryBlue +hi! link javascriptNull SrceryMagenta + +hi! link javascriptParens SrceryWhite +hi! link javascriptBraces SrceryWhite +hi! link javascriptReserved SrceryOrange +hi! link javascriptIdentifier SrceryRed + +hi! link javascriptFuncArg Normal +hi! link javascriptDocComment SrceryGreen +hi! link javascriptArrayMethod Function +hi! link javascriptReflectMethod Function +hi! link javascriptStringMethod Function +hi! link javascriptObjectMethod Function +hi! link javascriptObjectStaticMethod Function +hi! link javascriptObjectLabel SrceryBlue +hi! link javascriptFunction SrceryRed + +hi! link javascriptProp SrceryBlue + +hi! link javascriptVariable SrceryBrightBlue +hi! link javascriptOperator SrceryBrightCyan +hi! link javascriptFuncKeyword SrceryBrightRed +hi! link javascriptFunctionMethod SrceryYellow +hi! link javascriptReturn SrceryBrightRed +hi! link javascriptEndColons SrceryWhite + +" vim-javascript +hi! link jsFunction SrceryRed +hi! link jsImport SrceryRed +hi! link jsObjectSeparator SrceryWhite +hi! link jsParens SrceryWhite +hi! link jsFuncParens SrceryWhite +hi! link jsNoise SrceryWhite +hi! link jsEnvComment SrceryBrightBlack +hi! link jsOperator SrceryBrightCyan + +" }}} +" CoffeeScript: {{{ + +hi! link coffeeExtendedOp SrceryBrightWhite +hi! link coffeeSpecialOp SrceryBrightWhite +hi! link coffeeCurly SrceryYellow +hi! link coffeeParen SrceryBrightWhite +hi! link coffeeBracket SrceryYellow + +" }}} +" Ruby: {{{ + +hi! link rubyStringDelimiter SrceryGreen +hi! link rubyInterpolationDelimiter SrceryCyan +hi! link rubyDefine Keyword + +" }}} +" ObjectiveC: {{{ + +hi! link objcTypeModifier SrceryRed +hi! link objcDirective SrceryBlue + +" }}} +" Go: {{{ + +hi! link goDirective SrceryCyan +hi! link goConstants SrceryMagenta +hi! link goDeclaration SrceryRed +hi! link goDeclType SrceryBlue +hi! link goBuiltins SrceryYellow + +" }}} +" Lua: {{{ + +hi! link luaIn SrceryRed +hi! link luaFunction SrceryCyan +hi! link luaTable SrceryYellow + +" }}} +" MoonScript: {{{ + +hi! link moonSpecialOp SrceryBrightWhite +hi! link moonExtendedOp SrceryBrightWhite +hi! link moonFunction SrceryBrightWhite +hi! link moonObject SrceryYellow + +" }}} +" Java: {{{ + +hi! link javaAnnotation SrceryBlue +hi! link javaDocTags SrceryCyan +hi! link javaCommentTitle vimCommentTitle +hi! link javaParen SrceryBrightWhite +hi! link javaParen1 SrceryBrightWhite +hi! link javaParen2 SrceryBrightWhite +hi! link javaParen3 SrceryBrightWhite +hi! link javaParen4 SrceryBrightWhite +hi! link javaParen5 SrceryBrightWhite +hi! link javaOperator SrceryYellow + +hi! link javaVarArg SrceryGreen + +" }}} +" Elixir: {{{ + +hi! link elixirDocString Comment + +hi! link elixirStringDelimiter SrceryGreen +hi! link elixirInterpolationDelimiter SrceryCyan + +" }}} +" Scala: {{{ + +" NB: scala vim syntax file is kinda horrible +hi! link scalaNameDefinition SrceryBlue +hi! link scalaCaseFollowing SrceryBlue +hi! link scalaCapitalWord SrceryBlue +hi! link scalaTypeExtension SrceryBlue + +hi! link scalaKeyword SrceryRed +hi! link scalaKeywordModifier SrceryRed + +hi! link scalaSpecial SrceryCyan +hi! link scalaOperator SrceryBlue + +hi! link scalaTypeDeclaration SrceryYellow +hi! link scalaTypeTypePostDeclaration SrceryYellow + +hi! link scalaInstanceDeclaration SrceryBlue +hi! link scalaInterpolation SrceryCyan + +" }}} +" Markdown: {{{ + +call s:HL('markdownItalic', s:bright_white, s:none, s:italic) + +hi! link markdownH1 SrceryBrightBlueBold +hi! link markdownH2 SrceryBrightBlueBold +hi! link markdownH3 SrceryBrightYellowBold +hi! link markdownH4 SrceryBrightYellowBold +hi! link markdownH5 SrceryYellowBold +hi! link markdownH6 SrceryYellowBold + +hi! link markdownCode SrceryWhite +hi! link markdownCodeBlock SrceryWhite +hi! link markdownCodeDelimiter SrceryWhite + +hi! link markdownBlockquote SrceryBrightBlack +hi! link markdownListMarker SrceryBrightBlack +hi! link markdownOrderedListMarker SrceryBrightBlack +hi! link markdownRule SrceryBrightBlack +hi! link markdownHeadingRule SrceryBrightBlack + +hi! link markdownUrlDelimiter SrceryBrightBlack +hi! link markdownLinkDelimiter SrceryBrightBlack +hi! link markdownLinkTextDelimiter SrceryBrightBlack + +hi! link markdownHeadingDelimiter SrceryBrightBlack +hi! link markdownUrl SrceryBrightGreen +hi! link markdownUrlTitleDelimiter SrceryGreen + +call s:HL('markdownLinkText', s:bright_white, s:none, s:underline) +hi! link markdownIdDeclaration markdownLinkText + +" }}} +" Haskell: {{{ + +" hi! link haskellType SrceryYellow +" hi! link haskellOperators SrceryYellow +" hi! link haskellConditional SrceryCyan +" hi! link haskellLet SrceryYellow + +hi! link haskellType SrceryBlue +hi! link haskellIdentifier SrceryBlue +hi! link haskellSeparator SrceryBlue +hi! link haskellDelimiter SrceryBrightWhite +hi! link haskellOperators SrceryBlue + +hi! link haskellBacktick SrceryYellow +hi! link haskellStatement SrceryYellow +hi! link haskellConditional SrceryYellow + +hi! link haskellLet SrceryCyan +hi! link haskellDefault SrceryCyan +hi! link haskellWhere SrceryCyan +hi! link haskellBottom SrceryCyan +hi! link haskellBlockKeywords SrceryCyan +hi! link haskellImportKeywords SrceryCyan +hi! link haskellDeclKeyword SrceryCyan +hi! link haskellDeriving SrceryCyan +hi! link haskellAssocType SrceryCyan + +hi! link haskellNumber SrceryMagenta +hi! link haskellPragma SrceryMagenta + +hi! link haskellString SrceryGreen +hi! link haskellChar SrceryGreen + +" }}} +" Json: {{{ + +hi! link jsonKeyword SrceryGreen +hi! link jsonQuote SrceryGreen +hi! link jsonBraces SrceryBlue +hi! link jsonString SrceryBlue + +" }}} +" Rust: {{{ + +"https://github.com/rust-lang/rust.vim/blob/master/syntax/rust.vim +hi! link rustCommentLineDoc SrceryGreen +hi! link rustModPathSep SrceryBrightBlack + +" }}} +" Make: {{{ + +hi! link makePreCondit SrceryRed +hi! link makeCommands SrceryBrightWhite +hi! link makeTarget SrceryYellow + +" }}} +" shell script: {{{ + +call s:HL('shParenError', s:bright_white, s:bright_red) +hi! link shCmdSubRegion SrceryWhite +hi! link shArithRegion SrceryWhite +hi! link shArithRegion SrceryWhite +hi! link shQuote SrceryWhite +hi! link shRedir SrceryMagenta +hi! link shOption SrceryBrightYellow +hi! link shCommandSub SrceryBrightRed + +" }}} +" Misc: {{{ + +call s:HL('ExtraWhitespace', s:none, s:red) +" }}} + +" vim: set sw=2 ts=2 sts=2 et tw=80 ft=vim fdm=marker : diff --git a/.config/nvim/ftdetect/groff.vim b/.config/nvim/ftdetect/groff.vim deleted file mode 100644 index 5b296b6..0000000 --- a/.config/nvim/ftdetect/groff.vim +++ /dev/null @@ -1,2 +0,0 @@ -" Last Change: 2019 Nov 14 -au BufRead,BufNewFile *.m{s,m} set filetype=groff diff --git a/.config/nvim/after/ftplugin/help.vim b/.config/nvim/ftplugin/help.vim similarity index 100% rename from .config/nvim/after/ftplugin/help.vim rename to .config/nvim/ftplugin/help.vim diff --git a/.config/nvim/ftplugin/sh.vim b/.config/nvim/ftplugin/sh.vim new file mode 100644 index 0000000..f8cff87 --- /dev/null +++ b/.config/nvim/ftplugin/sh.vim @@ -0,0 +1,14 @@ +if !exists("b:sh_indent_options") + let b:sh_indent_options = {} +endif + +let b:sh_indent_options['continuation-line'] = 2 + +if executable('shfmt') + let &l:formatprg='shfmt -i ' . &l:shiftwidth . ' -ln posix -sr -ci -s' +endif + +nnoremap D :Man + +" allow for commands with - in the name +set iskeyword+=- diff --git a/.config/nvim/ftplugin/zsh.vim b/.config/nvim/ftplugin/zsh.vim new file mode 100644 index 0000000..9cdbe22 --- /dev/null +++ b/.config/nvim/ftplugin/zsh.vim @@ -0,0 +1,9 @@ +setlocal shiftwidth=2 + +command! -buffer -bang Compile compiler zsh | make + +augroup linty + au! * + au BufWritePost Compile + au QuickFixCmdPost make cwindow +augroup END diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index d106dde..1696dab 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -1,31 +1,44 @@ -let g:loaded_ruby_provider = 0 -let g:loaded_node_provider = 0 -let g:loaded_python_provider = 0 -let g:loaded_gzip = 1 -let g:loaded_tarPlugin = 1 -let g:loaded_zipPlugin = 1 -let g:loaded_2html_plugin = 1 - -if filereadable('bin/python3') - let g:python3_host_prog = '/bin/python3' -endif - -if executable('rg') - set grepprg=rg\ --vimgrep - set grepformat=%f:%l:%c:%m -else - set grepprg=grep\ -R\ -n\ --exclude-dir=.git,.cache -endif - +set grepprg=rg\ --vimgrep +set grepformat=%f:%l:%c:%m let mapleader="\" let maplocalleader=',' -set termguicolors -let g:srcery_transparent_background = 1 -let g:srcery_italic = 1 -let g:srcery_inverse_matches = 1 -let g:srcery_underline = 1 -let g:srcery_undercurl = 1 -let g:srcery_underline_match_paren = 1 -colorscheme srcery +if empty(glob('~/.local/share/nvim/site/autoload/plug.vim')) + silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + aug Plugins + au! + au VimEnter * PlugInstall --sync | source $MYVIMRC + aug END +endif +if filereadable(expand('~/.local/share/nvim/site/autoload/plug.vim')) + call plug#begin(stdpath('data') . '/plugged') + Plug 'fatih/vim-go', {'for': 'go', 'do': ':GoInstallBinaries'} + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} + Plug 'p00f/nvim-ts-rainbow' + Plug 'windwp/nvim-autopairs' + Plug 'nvim-lua/plenary.nvim' + Plug 'nvim-telescope/telescope.nvim' + Plug 'nvim-telescope/telescope-fzf-native.nvim', {'do': 'make'} + Plug 'neovim/nvim-lspconfig' + Plug 'hrsh7th/cmp-nvim-lsp' + Plug 'hrsh7th/cmp-nvim-lua' + Plug 'hrsh7th/cmp-buffer' + Plug 'hrsh7th/nvim-cmp' + Plug 'hrsh7th/cmp-vsnip' + Plug 'hrsh7th/vim-vsnip' + Plug 'octaltree/cmp-look' + Plug 'f3fora/cmp-spell' + Plug 'tpope/vim-fugitive' + Plug 'lewis6991/gitsigns.nvim' + Plug 'rktjmp/lush.nvim' + Plug 'ellisonleao/gruvbox.nvim' + Plug 'kyazdani42/nvim-web-devicons' + Plug 'onsails/lspkind-nvim' + call plug#end() +endif +set termguicolors +colorscheme gruvbox +hi! Normal ctermbg=NONE guibg=NONE +hi! NonText ctermbg=NONE guibg=NONE guifg=NONE ctermfg=NONE diff --git a/.config/nvim/plugin/autocmds.vim b/.config/nvim/plugin/autocmds.vim index ac943b5..36ef453 100644 --- a/.config/nvim/plugin/autocmds.vim +++ b/.config/nvim/plugin/autocmds.vim @@ -10,7 +10,7 @@ if !exists('autocommands_loaded') && has('autocmd') aug END aug Miscs - au TextYankPost * silent! lua vim.highlight.on_yank{higroup="IncSearch", timeout=700} + au TextYankPost * silent! lua vim.highlight.on_yank{higroup="IncSearch", timeout=500} au BufEnter * set fo-=c fo-=r fo-=o aug END diff --git a/.config/nvim/plugin/completar.lua b/.config/nvim/plugin/completar.lua new file mode 100644 index 0000000..0c01172 --- /dev/null +++ b/.config/nvim/plugin/completar.lua @@ -0,0 +1,75 @@ +local has_words_before = function() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil +end + +local feedkey = function(key, mode) + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true) +end + +local cmp = require'cmp' + +cmp.setup({ + formatting = { + format = require('lspkind').cmp_format({with_text=true, menu = ({ + buffer = " [Buff]", + nvim_lsp = " [LSP]", + vsnip = " [Snip]", + nvim_lua = " [Lua]", + look = " [Dict]", + spell = " [Spell]" + }), + }), + -- format = require('lspkind').cmp_format({with_text = true, maxwidth = 50}) + -- format = function(entry, vim_item) + -- -- fancy icons and a name of kind + -- vim_item.kind = require('lspkind').presets.default[vim_item.kind] + + -- -- set a name for each source + -- vim_item.menu = ({ + -- buffer = " [Buff]", + -- nvim_lsp = " [LSP]", + -- vsnip = " [Snip]", + -- nvim_lua = " [Lua]", + -- look = " [Dict]", + -- spell = " [Spell]" + -- })[entry.source.name] + -- return vim_item + -- end, + }, + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + mapping = { + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif vim.fn["vsnip#available"]() == 1 then + feedkey("(vsnip-expand-or-jump)", "") + elseif has_words_before() then + cmp.complete() + else + fallback() -- The fallback function sends a already mapped key. In this case, it's probably ``. + end + end, { "i", "s" }), + + [""] = cmp.mapping(function() + if cmp.visible() then + cmp.select_prev_item() + elseif vim.fn["vsnip#jumpable"](-1) == 1 then + feedkey("(vsnip-jump-prev)", "") + end + end, { "i", "s" }), + }, + sources = { + { name = 'buffer' }, + } +}) + diff --git a/.config/nvim/plugin/disabled.lua b/.config/nvim/plugin/disabled.lua new file mode 100644 index 0000000..a03d16d --- /dev/null +++ b/.config/nvim/plugin/disabled.lua @@ -0,0 +1,33 @@ +local disabled_builtin_plugins = { + 'gzip', + 'zip', + 'zipPlugin', + 'tar', + 'tarPlugin', + 'getscript', + "getscriptPlugin", + "vimball", + "vimballPlugin", + "2html_plugin", + "logipat", + "rrhelper", + "matchit", + 'remote_plugins' +} + +for _, plugin in pairs(disabled_builtin_plugins) do + vim.g["loaded_" .. plugin] = 1 +end + +local disabled_providers = { + "ruby", + "node", + "python", + "perl" +} + +for _, provider in pairs(disabled_providers) do + vim.g["loaded_" .. provider .. "_provider"] = 0 +end + +vim.g.python3_host_prog = '/bin/python3' diff --git a/.config/nvim/plugin/gitgutter.lua b/.config/nvim/plugin/gitgutter.lua new file mode 100644 index 0000000..7af3c13 --- /dev/null +++ b/.config/nvim/plugin/gitgutter.lua @@ -0,0 +1,33 @@ +require('gitsigns').setup { + numhl = true, + current_line_blame = true, + current_line_blame_opts = { virt_text_pos = 'right_align', delay= 1000 }, + current_line_blame_formatter_opts = { relative_time = false }, + signs = { + add = {hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, + change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + }, + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, + preview_config = { + -- Options passed to nvim_open_win + border = 'single', + style = 'minimal', + relative = 'cursor', + row = 0, + col = 1 + }, + diff_opts = { + internal = true, + }, -- If vim.diff or luajit is present + yadm = { + enable = false + }, +} + +vim.g.fugitive_summary_format = "%an\t%s" diff --git a/.config/nvim/plugin/lspkind.lua b/.config/nvim/plugin/lspkind.lua new file mode 100644 index 0000000..5f52c55 --- /dev/null +++ b/.config/nvim/plugin/lspkind.lua @@ -0,0 +1,4 @@ +require('lspkind').init({ + with_text = true, + preset = 'default', +}) diff --git a/.config/nvim/plugin/lsps.lua b/.config/nvim/plugin/lsps.lua new file mode 100644 index 0000000..e294bbe --- /dev/null +++ b/.config/nvim/plugin/lsps.lua @@ -0,0 +1,119 @@ +local nvim_lsp = require 'lspconfig' +local configs = require'lspconfig/configs' +local on_attach = function(_, bufnr) + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + + local opts = { noremap = true, silent = true } + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'lua vim.lsp.buf.definition()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'lua vim.lsp.buf.implementation()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '', 'lua vim.lsp.buf.signature_help()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'D', 'lua vim.lsp.buf.type_definition()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'lua vim.lsp.buf.references()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'qq', 'lua vim.lsp.diagnostic.set_loclist()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'so', [[lua require('telescope.builtin').lsp_document_symbols()]], opts) + vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]] +end + +vim.cmd [[ + highlight LspDiagnosticsLineNrError guibg=#51202A guifg=#FF0000 gui=bold + highlight LspDiagnosticsLineNrWarning guibg=#51412A guifg=#FFA500 gui=bold + highlight LspDiagnosticsLineNrInformation guibg=#1E535D guifg=#00FFFF gui=bold + highlight LspDiagnosticsLineNrHint guibg=#1E205D guifg=#0000FF gui=bold + + sign define LspDiagnosticsSignError text= texthl=LspDiagnosticsSignError linehl= numhl=LspDiagnosticsLineNrError + sign define LspDiagnosticsSignWarning text= texthl=LspDiagnosticsSignWarning linehl= numhl=LspDiagnosticsLineNrWarning + sign define LspDiagnosticsSignInformation text= texthl=LspDiagnosticsSignInformation linehl= numhl=LspDiagnosticsLineNrInformation + sign define LspDiagnosticsSignHint text= texthl=LspDiagnosticsSignHint linehl= numhl=LspDiagnosticsLineNrHint +]] + +vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + underline = true, + virtual_text = false, + update_in_insert = true +}) + +require'lspconfig'.jsonls.setup { + commands = { + Format = { + function() + vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0}) + end + } + } +} + +configs.ls_emmet = { + default_config = { + cmd = { 'ls_emmet', '--stdio' }; + filetypes = { 'html', 'css', 'scss' }; -- Add the languages you use, see language support + root_dir = function(_) + return vim.loop.cwd() + end; + settings = {}; + }; +} + +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.completion.completionItem.documentationFormat = { 'markdown', 'plaintext' } +capabilities.textDocument.completion.completionItem.snippetSupport = true +capabilities.textDocument.completion.completionItem.preselectSupport = true +capabilities.textDocument.completion.completionItem.insertReplaceSupport = true +capabilities.textDocument.completion.completionItem.labelDetailsSupport = true +capabilities.textDocument.completion.completionItem.deprecatedSupport = true +capabilities.textDocument.completion.completionItem.commitCharactersSupport = true +capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } } +capabilities.textDocument.completion.completionItem.resolveSupport = { + properties = { + 'documentation', + 'detail', + 'additionalTextEdits', + }, +} + +local servers = { 'html', 'cssls', 'jsonls', 'tailwindcss', 'vimls', 'ls_emmet' } +for _, lsp in ipairs(servers) do + nvim_lsp[lsp].setup { + on_attach = on_attach, + capabilities = capabilities, + } +end + +local sumneko_root_path ='/mnt/wd1tb/catacombs/code/lua-language-server' +local sumneko_binary = sumneko_root_path .. '/bin/Linux/lua-language-server' + +local runtime_path = vim.split(package.path, ';') +table.insert(runtime_path, 'lua/?.lua') +table.insert(runtime_path, 'lua/?/init.lua') + +require('lspconfig').sumneko_lua.setup { + cmd = { sumneko_binary, '-E', sumneko_root_path .. '/main.lua' }, + on_attach = on_attach, + capabilities = capabilities, + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + path = runtime_path, + }, + diagnostics = { + globals = { 'vim' }, + }, + workspace = { + library = vim.api.nvim_get_runtime_file('', true), + }, + telemetry = { + enable = false, + }, + }, + }, +} diff --git a/.config/nvim/plugin/mappings/fzf.vim b/.config/nvim/plugin/mappings/fzf.vim new file mode 100644 index 0000000..8e7c502 --- /dev/null +++ b/.config/nvim/plugin/mappings/fzf.vim @@ -0,0 +1,7 @@ +nnoremap Telescope help_tags +nnoremap Telescope find_files +nnoremap Telescope file_browser +nnoremap Telescope buffers +nnoremap Telescope live_grep +nnoremap Telescope git_commits +nnoremap Telescope resume diff --git a/.config/nvim/plugin/mappings/git.vim b/.config/nvim/plugin/mappings/git.vim new file mode 100644 index 0000000..ed9c166 --- /dev/null +++ b/.config/nvim/plugin/mappings/git.vim @@ -0,0 +1,12 @@ +nnoremap ff :G +nnoremap fc :GCheckout +nnoremap fd :Gvdiffsplit! +nnoremap fh :diffget //2 +nnoremap fl :diffget //3 + +nmap tt :Gitsigns toggle_signs +nmap }g :lua require 'gitsigns'.next_hunk() +nmap {g :lua require 'gitsigns'.prev_hunk() +nmap + :lua require'gitsigns'.stage_hunk() +nmap - :lua require'gitsigns'.undo_stage_hunk(): +nmap p :lua require'gitsigns'.stage_hunk({vim.fn.line('.'), vim.fn.line('v')}) diff --git a/.config/nvim/plugin/netrw.vim b/.config/nvim/plugin/netrw.vim deleted file mode 100644 index 65e8fe2..0000000 --- a/.config/nvim/plugin/netrw.vim +++ /dev/null @@ -1,6 +0,0 @@ -let g:netrw_browse_split = 0 -let g:netrw_banner = 0 -let g:netrw_winsize = 25 -let g:netrw_liststyle = 3 -let g:netrw_localrmdir='rm -r' -nnoremap :Vex! diff --git a/.config/nvim/plugin/pares.lua b/.config/nvim/plugin/pares.lua new file mode 100644 index 0000000..4c75c5b --- /dev/null +++ b/.config/nvim/plugin/pares.lua @@ -0,0 +1,53 @@ +require('nvim-autopairs').setup{ + check_ts = true, + ts_config = { + lua = {'string'},-- it will not add pair on that treesitter node + javascript = {'template_string'}, + } +} + +local Rule = require('nvim-autopairs.rule') + +require('nvim-autopairs').add_rules({ + Rule("%", "%", "lua") + :with_pair(require('nvim-autopairs.ts-conds').is_ts_node({'string','comment'})), + Rule("$", "$", "lua") + :with_pair(require('nvim-autopairs.ts-conds').is_not_ts_node({'function'})), + Rule(' ', ' ') + :with_pair(function (opts) + local pair = opts.line:sub(opts.col - 1, opts.col) + return vim.tbl_contains({ '()', '[]', '{}' }, pair) + end), + Rule('( ', ' )') + :with_pair(function() return false end) + :with_move(function(opts) + return opts.prev_char:match('.%)') ~= nil + end) + :use_key(')'), + Rule('{ ', ' }') + :with_pair(function() return false end) + :with_move(function(opts) + return opts.prev_char:match('.%}') ~= nil + end) + :use_key('}'), + Rule('[ ', ' ]') + :with_pair(function() return false end) + :with_move(function(opts) + return opts.prev_char:match('.%]') ~= nil + end) + :use_key(']'), + Rule('%(.*%)%s*%=>$', ' { }', { 'typescript', 'typescriptreact', 'javascript' }) + :use_regex(true) + :set_end_pair_length(2), +}) + +require("nvim-autopairs.completion.cmp").setup({ + map_cr = true, -- map on insert mode + map_complete = true, -- it will auto insert `(` (map_char) after select function or method item + auto_select = true, -- automatically select the first item + insert = false, -- use insert confirm behavior instead of replace + map_char = { -- modifies the function or method delimiter by filetypes + all = '(', + tex = '{' + } +}) diff --git a/.config/nvim/plugin/settings.vim b/.config/nvim/plugin/settings.vim index 14020a6..629d940 100644 --- a/.config/nvim/plugin/settings.vim +++ b/.config/nvim/plugin/settings.vim @@ -1,10 +1,7 @@ -" Settings -scriptencoding utf-8 - set inccommand=nosplit set clipboard^=unnamedplus set number -set signcolumn=auto:1 +set signcolumn="yes" set noswapfile set hidden set lazyredraw @@ -13,6 +10,7 @@ set updatetime=100 set splitbelow set splitright set notimeout +set cursorline set ignorecase set scrolloff=5 set sidescroll=5 @@ -30,5 +28,13 @@ set diffopt+=foldcolumn:0 set diffopt+=vertical set fillchars=diff:\ ,eob:\ ,stlnc:\ ,stl:\ ,vert:\│ set formatoptions=tnqj +set completeopt=menu,menuone,noselect,noinsert let formatlistpat='^\s*\(\d\+[\]:.)}\t ]\|[*-][\t ]\)\s*' match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' + +let g:netrw_browse_split = 0 +let g:netrw_banner = 0 +let g:netrw_winsize = 25 +let g:netrw_liststyle = 3 +let g:netrw_localrmdir='rm -r' +nnoremap :Vex! diff --git a/.config/nvim/plugin/statusline.lua b/.config/nvim/plugin/statusline.lua new file mode 100644 index 0000000..ed3f8a6 --- /dev/null +++ b/.config/nvim/plugin/statusline.lua @@ -0,0 +1,40 @@ +-- luacheck: globals vim dotfiles +dotfiles = _G.dotfiles or {} +function dotfiles.sl_wc() + return vim.tbl_contains({ + "markdown", + "txt", + "vimwiki" + }, vim.opt.filetype:get()) and " W:" .. vim.fn.wordcount().words or "" +end +function dotfiles.sl_dg() + local d = '' + if vim.diagnostic ~= nil then -- Neovim 0.6 + for marker,kind in pairs({ + [" E:"] = vim.diagnostic.severity.ERROR, + [" W:"] = vim.diagnostic.severity.WARN, + [" I:"] = vim.diagnostic.severity.INFO, + [" H:"] = vim.diagnostic.severity.HINT + }) do + local c = #vim.diagnostic.get(0, { severity = kind }) + if c ~= 0 then + d = d .. marker .. tostring(c) + end + end + else -- Neovim 0.5 + for kind,marker in pairs({ Error = " E:", Warning = " W:", Information = " I:", Hint = " H:" }) do + local c = vim.lsp.diagnostic.get_count(0, kind) + if c ~= 0 then + d = d .. marker .. tostring(c) + end + end + end + return d +end +local statusline = " %0.45f%m%h%w%r%= %y%{v:lua.dotfiles.sl_wc()} %l:%c %p%%%{v:lua.dotfiles.sl_dg()} " +local statusline_nc = " %0.45f%m%h%w%r%=" +function dotfiles.sl_stl() + return vim.g.statusline_winid == vim.fn.win_getid() and statusline or statusline_nc +end +vim.opt.statusline="%!v:lua.dotfiles.sl_stl()" + diff --git a/.config/nvim/plugin/telescopio.lua b/.config/nvim/plugin/telescopio.lua new file mode 100644 index 0000000..32c9f46 --- /dev/null +++ b/.config/nvim/plugin/telescopio.lua @@ -0,0 +1,37 @@ +local actions = require('telescope.actions') +require('telescope').setup { + defaults = { + vimgrep_arguments = { + 'rg', + '--no-heading', + '--with-filename', + '--line-number', + '--column', + '--smart-case' + }, + sorting_strategy = "ascending", + layout_config = { + width = 0.75, + prompt_position = "top", + preview_cutoff = 120, + }, + find_command = {'fd', '-t f', '-c always', '-H'}, + -- find_command = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'}, + selection_caret = "→", + color_devicons = true, + set_env = {['COLORTERM'] = 'truecolor'}, + mappings = { + i = { + [""] = actions.smart_send_to_qflist + actions.open_qflist, + [""] = false, + [""] = actions.select_horizontal, + [""] = actions.select_default + actions.center + }, + n = { + [""] = actions.smart_send_to_qflist + actions.open_qflist, + } + }, + } +} + +require('telescope').load_extension('fzf') diff --git a/.config/nvim/plugin/trees.lua b/.config/nvim/plugin/trees.lua new file mode 100644 index 0000000..c10c329 --- /dev/null +++ b/.config/nvim/plugin/trees.lua @@ -0,0 +1,44 @@ +vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, + { + underline = true, + virtual_text = { + spacing = 5, + severity_limit = 'Hint', + }, + update_in_insert = true, + } +) + +require'nvim-treesitter.configs'.setup { + ensure_installed = { "bash", "css", "go", "gomod", "html", "json", "json5", "jsonc", "latex", "lua", "scss", "toml", "vim", "yaml" }, -- one of "all", "maintained" (parsers with maintainers), or a list of languages + use_languagetree = true, + highlight = { + enable = true, -- false will disable the whole extension + additional_vim_regex_highlighting = false, + }, + indent = { + enable = true, + }, + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, + }, + rainbow = { + enable = true, + extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean + max_file_lines = nil, -- Do not enable for files with more than n lines, int + }, + autopairs = { + enable = true, + }, +} +} diff --git a/.config/nvim/templates/go b/.config/nvim/templates/go new file mode 100644 index 0000000..0d22042 --- /dev/null +++ b/.config/nvim/templates/go @@ -0,0 +1,8 @@ +package main + +import "fmt" + +func main() { + {{++}} + fmt.Println("vim-go") +} diff --git a/.config/rofi/lnch.rasi b/.config/rofi/lnch.rasi index ddba8ff..bcde4f4 100644 --- a/.config/rofi/lnch.rasi +++ b/.config/rofi/lnch.rasi @@ -17,7 +17,7 @@ window { height: 0px; anchor: northwest; location: northwest; - padding: 0px 5px; + padding: 0px 5px 0px 0px; transparency: "real"; children: [ horibox ]; background-color: @trans; diff --git a/.config/rofi/menoo.rasi b/.config/rofi/menoo.rasi index 6ce7018..b1e9209 100644 --- a/.config/rofi/menoo.rasi +++ b/.config/rofi/menoo.rasi @@ -17,7 +17,7 @@ window { text-color: @foreground; location: northwest; anchor: northwest; - padding: 0px 5px; + padding: 0px 5px 0px 0px; } prompt { diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index 44e2a1e..480922a 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -40,7 +40,7 @@ super + e rofi -show emoji -modi emoji -theme dprompt3 super + {shift + b,b,q,s,n,p,r,d} - {firefox -P streams,$BROWSER,powermenu,rofi -show window,escribir,postear,ref,leer} + {firefox -no-remote -P streams,$BROWSER,powermenu,rofi -show window,escribir,postear,ref,leer} super + {_,shift} + g {grabar,corte} diff --git a/.config/zsh/conf/05_zmarks.zsh b/.config/zsh/conf/05_zmarks.zsh index 1e36d8e..9fd2110 100644 --- a/.config/zsh/conf/05_zmarks.zsh +++ b/.config/zsh/conf/05_zmarks.zsh @@ -12,4 +12,5 @@ hash -d gv=$HOME/vid hash -d ge=$HOME/etc hash -d gi=$HOME/img hash -d gc=/mnt/cell +hash -d gs=/mnt/vb/graveyard hash -d gr=/mnt