From 33ed56559d89ce4293e292a18eae2ff4288fad2c Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Fri, 22 Jan 2021 12:56:17 +0100 Subject: [PATCH 01/64] gitignore: ignore zsh history file --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ef09c1b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +zsh/zsh_history From f81ec0f6b3988232e630f00bc8c1a4ec097b085a Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Fri, 22 Jan 2021 13:32:53 +0100 Subject: [PATCH 02/64] config: i3: use brightnessctl --- config/i3/config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/i3/config b/config/i3/config index 774056e..8913927 100644 --- a/config/i3/config +++ b/config/i3/config @@ -172,8 +172,8 @@ bindsym XF86AudioLowerVolume exec "pactl set-sink-mute @DEFAULT_SINK@ false && p bindsym XF86AudioRaiseVolume exec "pactl set-sink-mute @DEFAULT_SINK@ false && pactl set-sink-volume @DEFAULT_SINK@ '+5%'" bindsym XF86AudioMicMute exec "pactl set-source-mute 1 toggle" -bindsym XF86MonBrightnessDown exec "xbacklight -4" -bindsym XF86MonBrightnessUp exec "xbacklight +4" +bindsym XF86MonBrightnessDown exec "brightnessctl set 4%-" +bindsym XF86MonBrightnessUp exec "brightnessctl set 4%+" # Start i3bar to display a workspace bar (plus the system information i3status # finds out, if available) From d87a5138eea0ce84b6d75ffc0a8ec8dfb9bc3e5e Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Tue, 23 Mar 2021 15:03:54 +0100 Subject: [PATCH 03/64] gitconfig: change default branch to "main" --- gitconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gitconfig b/gitconfig index 7b65888..4e04fbe 100644 --- a/gitconfig +++ b/gitconfig @@ -20,3 +20,5 @@ s = status st = status t = tag +[init] + defaultBranch = main From 635f678ecbf3a2669bc451f058e4aae86baa8dca Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Thu, 8 Apr 2021 23:42:53 +0200 Subject: [PATCH 04/64] config: i3: make call to passmenu more generic (compatibility arch <-> debian) --- config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/i3/config b/config/i3/config index 8913927..d079320 100644 --- a/config/i3/config +++ b/config/i3/config @@ -89,7 +89,7 @@ bindsym $mod+a focus parent #bindsym $mod+d focus child # custom bind for pass dmenu wrapper -bindsym $mod+p exec ~/bin/passmenu --type +bindsym $mod+p exec passmenu --type # do not focus container behind mouse focus_follows_mouse no From 479ccc33f852d4c3423c284e61b7259e495ca4ec Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Thu, 8 Apr 2021 23:43:18 +0200 Subject: [PATCH 05/64] config: i3: make microphone mute binding use default_source --- config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/i3/config b/config/i3/config index d079320..19c8489 100644 --- a/config/i3/config +++ b/config/i3/config @@ -170,7 +170,7 @@ bindsym $mod+r mode "resize" bindsym XF86AudioMute exec "pactl set-sink-mute @DEFAULT_SINK@ toggle" bindsym XF86AudioLowerVolume exec "pactl set-sink-mute @DEFAULT_SINK@ false && pactl set-sink-volume @DEFAULT_SINK@ '-5%'" bindsym XF86AudioRaiseVolume exec "pactl set-sink-mute @DEFAULT_SINK@ false && pactl set-sink-volume @DEFAULT_SINK@ '+5%'" -bindsym XF86AudioMicMute exec "pactl set-source-mute 1 toggle" +bindsym XF86AudioMicMute exec "pactl set-source-mute @DEFAULT_SOURCE@ toggle" bindsym XF86MonBrightnessDown exec "brightnessctl set 4%-" bindsym XF86MonBrightnessUp exec "brightnessctl set 4%+" From 6c05cf1a984b1ffe089377c16fc0d23cadf5b22f Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sat, 24 Apr 2021 14:33:53 +0200 Subject: [PATCH 06/64] ssh: config: externalize host configuration Even though it may not be critical to have usernames, hostnames and the respective ssh ports out in the open as they usually aren't secret, it should still be avoided. --- .gitmodules | 3 +++ ssh/conf.d | 1 + ssh/config | 40 +++------------------------------------- 3 files changed, 7 insertions(+), 37 deletions(-) create mode 100644 .gitmodules create mode 160000 ssh/conf.d diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..eb2a1aa --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ssh/conf.d"] + path = ssh/conf.d + url = git@git.preisner.eu:preisi/ssh-config.git diff --git a/ssh/conf.d b/ssh/conf.d new file mode 160000 index 0000000..0de3082 --- /dev/null +++ b/ssh/conf.d @@ -0,0 +1 @@ +Subproject commit 0de3082a12e5d60d27df8a255fc312fa3664a305 diff --git a/ssh/config b/ssh/config index 5593fa6..95548e1 100644 --- a/ssh/config +++ b/ssh/config @@ -3,44 +3,10 @@ Host * AddKeysToAgent confirm -Host 0?? 0??? - HostName faui%h.informatik.uni-erlangen.de - ForwardAgent yes +# Include external config if available +Include conf.d/* -Host faui0? faui0?? faui0??? - HostName %h.informatik.uni-erlangen.de - ForwardAgent yes - -Host man? man?? big? - HostName faui49%h.informatik.uni-erlangen.de - ProxyJump ty28wuqu@i4lab1.informatik.uni-erlangen.de - -Match Host faui* - User ty28wuqu - -Host ircbox - HostName ircbox.informatik.uni-erlangen.de - User ty28wuqu - -Host irc - HostName tpreisner.de - User weechat - -Host server - HostName tpreisner.de - User root - -Host steep - Hostname steep.cs.fau.de - User preisi - Port 17 - -Host pi - HostName wg.tpreisner.de - # dynamic ip behind hostname would cause warnings - CheckHostIP no - -# use if they havent been defined yet: +# Use if they havent been defined yet: Host * Compression yes ForwardAgent no From 30275628ff0cb163a84db307dcfd5893a7621ebe Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 22 Aug 2021 23:26:18 +0200 Subject: [PATCH 07/64] setup.sh: add symlink for external ssh config --- setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.sh b/setup.sh index 20b8438..78c8868 100755 --- a/setup.sh +++ b/setup.sh @@ -83,6 +83,7 @@ if installed ssh; then mkdir -p ~/.ssh link ssh/config ~/.ssh/config + link ssh/conf.d ~/.ssh/conf.d echo fi From b730cf54fc53e4539cf3dbf1140c4ada62067724 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 22 Aug 2021 23:19:07 +0200 Subject: [PATCH 08/64] config: i3status: add memory status --- config/i3status/config | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/i3status/config b/config/i3status/config index 93c34f4..6f1475b 100644 --- a/config/i3status/config +++ b/config/i3status/config @@ -11,11 +11,15 @@ general { interval = 5 } +order += "memory" order += "cpu_temperature 0" order += "cpu_usage" order += "battery all" order += "tztime local" +memory { + format = " %percentage_used" +} cpu_temperature 0 { format = " %degrees°C" From 2fd4278bb69d059160c6870ab5a9e8f136ca10d7 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 22 Aug 2021 23:25:22 +0200 Subject: [PATCH 09/64] gnupg: gpg-agent.conf: add pinentry-program --- gnupg/gpg-agent.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gnupg/gpg-agent.conf b/gnupg/gpg-agent.conf index 0bd0209..c26143c 100644 --- a/gnupg/gpg-agent.conf +++ b/gnupg/gpg-agent.conf @@ -4,3 +4,5 @@ default-cache-ttl 600 max-cache-ttl 3600 grab + +pinentry-program /usr/bin/pinentry-gnome3 From 76a42b6920643f6956cfac3c274f77b851bd499a Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 22 Aug 2021 23:28:07 +0200 Subject: [PATCH 10/64] zsh: prompt.zsh: make entries with excessize permissions more readable --- zsh/prompt.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index e625ee9..c53daf9 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -7,7 +7,7 @@ case "$OSTYPE" in export LSCOLORS=gxfxcxdxbxegedabagacad ;; *) - export LS_COLORS=di='36;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:' + export LS_COLORS=di='36;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;45:' ;; esac From e4f4f8baf7f895eee1f417e015f0a99dd678e87a Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 22 Aug 2021 23:31:21 +0200 Subject: [PATCH 11/64] Xresources: make blue slightly brighter --- Xresources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xresources b/Xresources index 231b600..c161a0a 100644 --- a/Xresources +++ b/Xresources @@ -49,7 +49,7 @@ Xft.rgba: rgb *.color11: #fffd00 ! blue -*.color4: #0026ff +*.color4: #0086ff *.color12: #8470ff !*.color12: #0000ff From ef82f3b11f6fd4da6c7da52b43a2c8f0c5c19c7e Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Wed, 22 Sep 2021 15:21:46 +0200 Subject: [PATCH 12/64] vimrc: transition to nvim --- config/nvim/init.vim | 143 +++++++++++++++++++++++++++++++++++++++++ setup.sh | 9 ++- vimrc | 147 ++----------------------------------------- 3 files changed, 155 insertions(+), 144 deletions(-) create mode 100644 config/nvim/init.vim diff --git a/config/nvim/init.vim b/config/nvim/init.vim new file mode 100644 index 0000000..a03ec52 --- /dev/null +++ b/config/nvim/init.vim @@ -0,0 +1,143 @@ +" .vimrc + +" only vim and not vi +set nocompatible +" disable autocmd +set secure +" use utf8 only +set encoding=utf8 + +" file/directory matching +set wildmode=list:longest,full +" ignore case when completing +if exists('+wildignorecase') + set wildignorecase +endif +" ignorelist +set wildignore=*.o,*.d,*.so,*.class,*.aux,*.log,*.out,*.toc,*.pdf,*.pyc + +" show completion menu even with only one match +if exists('+completeopt') + set completeopt+=menuone +endif + +" increase command history +set history=1000 +" increase count of possible undos +set undolevels=1000 + +" encrypt buffers when saved to files +if exists('+cryptmethod') + set cryptmethod=blowfish +endif + +" enable fast terminal for tmux but not for ssh connection +if &term =~# '^screen' && !exists('SSH_CONNECTION') + set ttyfast +endif + +" enable automatic file detection, plugin and indention support +if has('autocmd') + filetype off "for pathogen + filetype plugin indent on +endif + +" use utf8 encoding for all files and recognize latin1 +set fileencodings=utf-8,latin1 + +" use unix line-endings and recognize dos endings +set fileformats=unix,dos + +" tabs +set tabstop=4 +set shiftwidth=4 +set autoindent +set smartindent +set smarttab + +" allow backspacing over autoindent and line breaks +set backspace=indent,eol,start + +" already display matches while searching +set incsearch +" only check for case if the searched word contains a capital +set ignorecase +set smartcase +" highlight all matches. use to remove the highlights +set hlsearch + +" syntax folding +if has('folding') + set foldmethod=syntax + " only use folding when there is enough space +" if &columns > 80 +" set foldcolumn=2 +" endif + set foldlevel=99 + + " dont open fold for block movements + set foldopen-=block +endif + +" allow buffers with changes to be hidden +set hidden + +" correct splitting +if has('vertsplit') + set splitright + set splitbelow +endif + +" Visual +" set text color for dark terminal background +set background=dark + +" activate syntax highlighting +if has('syntax') + syntax enable +endif + +" set colorscheme +colorscheme ron + +" display line at which the current is positioned +if exists('+cursorline') + set cursorline + " remove line and make the line bold instead + highlight CursorLine term=bold cterm=bold + highlight CursorLineNR term=bold cterm=bold ctermbg=darkgrey +endif + +" display box from column 81 to 100 +let &colorcolumn=join(range(81, 100), ",") +highlight ColorColumn ctermbg=235 guibg=#2d2d2d + +" display line numbers +set number + +" show currently typed command +set showcmd + +" define characters to display when using 'set list' +set listchars=tab:→\ ,trail:∙,eol:¬,extends:❯,precedes:❮,nbsp:␣ + +" Disable arrow keys +"map +"map +"map +"map + +"map! +"map! +"map! +"map! + +" allow easier pane switching +nnoremap +nnoremap +nnoremap +nnoremap + +" Misc +set mouse=n +noremap m mmHmt:%s///ge'tzt'm diff --git a/setup.sh b/setup.sh index 78c8868..2aad4a9 100755 --- a/setup.sh +++ b/setup.sh @@ -44,11 +44,18 @@ link() link pam_environment ~/.pam_environment # application-specific config +if installed nvim || installed vim; then + echo "Setting up nvim:" + + mkdir -p ~/.config + link config/nvim ~/.config/nvim + + echo +fi if installed vim; then echo "Setting up vim:" link vimrc ~/.vimrc - #link vim ~/.vim echo fi diff --git a/vimrc b/vimrc index a03ec52..d2d7526 100644 --- a/vimrc +++ b/vimrc @@ -1,143 +1,4 @@ -" .vimrc - -" only vim and not vi -set nocompatible -" disable autocmd -set secure -" use utf8 only -set encoding=utf8 - -" file/directory matching -set wildmode=list:longest,full -" ignore case when completing -if exists('+wildignorecase') - set wildignorecase -endif -" ignorelist -set wildignore=*.o,*.d,*.so,*.class,*.aux,*.log,*.out,*.toc,*.pdf,*.pyc - -" show completion menu even with only one match -if exists('+completeopt') - set completeopt+=menuone -endif - -" increase command history -set history=1000 -" increase count of possible undos -set undolevels=1000 - -" encrypt buffers when saved to files -if exists('+cryptmethod') - set cryptmethod=blowfish -endif - -" enable fast terminal for tmux but not for ssh connection -if &term =~# '^screen' && !exists('SSH_CONNECTION') - set ttyfast -endif - -" enable automatic file detection, plugin and indention support -if has('autocmd') - filetype off "for pathogen - filetype plugin indent on -endif - -" use utf8 encoding for all files and recognize latin1 -set fileencodings=utf-8,latin1 - -" use unix line-endings and recognize dos endings -set fileformats=unix,dos - -" tabs -set tabstop=4 -set shiftwidth=4 -set autoindent -set smartindent -set smarttab - -" allow backspacing over autoindent and line breaks -set backspace=indent,eol,start - -" already display matches while searching -set incsearch -" only check for case if the searched word contains a capital -set ignorecase -set smartcase -" highlight all matches. use to remove the highlights -set hlsearch - -" syntax folding -if has('folding') - set foldmethod=syntax - " only use folding when there is enough space -" if &columns > 80 -" set foldcolumn=2 -" endif - set foldlevel=99 - - " dont open fold for block movements - set foldopen-=block -endif - -" allow buffers with changes to be hidden -set hidden - -" correct splitting -if has('vertsplit') - set splitright - set splitbelow -endif - -" Visual -" set text color for dark terminal background -set background=dark - -" activate syntax highlighting -if has('syntax') - syntax enable -endif - -" set colorscheme -colorscheme ron - -" display line at which the current is positioned -if exists('+cursorline') - set cursorline - " remove line and make the line bold instead - highlight CursorLine term=bold cterm=bold - highlight CursorLineNR term=bold cterm=bold ctermbg=darkgrey -endif - -" display box from column 81 to 100 -let &colorcolumn=join(range(81, 100), ",") -highlight ColorColumn ctermbg=235 guibg=#2d2d2d - -" display line numbers -set number - -" show currently typed command -set showcmd - -" define characters to display when using 'set list' -set listchars=tab:→\ ,trail:∙,eol:¬,extends:❯,precedes:❮,nbsp:␣ - -" Disable arrow keys -"map -"map -"map -"map - -"map! -"map! -"map! -"map! - -" allow easier pane switching -nnoremap -nnoremap -nnoremap -nnoremap - -" Misc -set mouse=n -noremap m mmHmt:%s///ge'tzt'm +" use existing nvim configuration for vim +set runtimepath^=~/.config/nvim runtimepath+=~/.config/nvim/after +let &packpath = &runtimepath +source ~/.config/nvim/init.vim From 846c204094efcf1bcef432ed2c8214eb5c1b3b4a Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Wed, 22 Sep 2021 15:54:42 +0200 Subject: [PATCH 13/64] config: nvim: rework basic configuration --- config/nvim/init.vim | 52 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/config/nvim/init.vim b/config/nvim/init.vim index a03ec52..30d53aa 100644 --- a/config/nvim/init.vim +++ b/config/nvim/init.vim @@ -1,6 +1,4 @@ -" .vimrc - -" only vim and not vi +" drop vi-compatibility set nocompatible " disable autocmd set secure @@ -66,6 +64,9 @@ set smartcase " highlight all matches. use to remove the highlights set hlsearch +" treat hyphenated words as a single word +set iskeyword+=- + " syntax folding if has('folding') set foldmethod=syntax @@ -115,29 +116,56 @@ highlight ColorColumn ctermbg=235 guibg=#2d2d2d " display line numbers set number +" show cursor position all the time +set ruler + +" show tabs all the time +set showtabline=2 + " show currently typed command set showcmd " define characters to display when using 'set list' set listchars=tab:→\ ,trail:∙,eol:¬,extends:❯,precedes:❮,nbsp:␣ -" Disable arrow keys -"map -"map -"map -"map +" increase completion performance and reduce time until timeout +set updatetime=300 +set timeoutlen=500 -"map! -"map! -"map! -"map! +" copy paste between vim and everything else +" TODO: check whether the 'plus' suffix works with plain vim +set clipboard=unnamedplus +" Keybindings " allow easier pane switching nnoremap nnoremap nnoremap nnoremap +" allow easier pane resizing +nnoremap :resize -2 +nnoremap :resize +2 +nnoremap :vertical resize -2 +nnoremap :vertical resize +2 + +" use TAB to switch to next buffers +nnoremap :bnext +" use Shift-TAB to switch to previous buffers +nnoremap :bprevious + +" use TAB for skipping through completion options +inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\" + " Misc set mouse=n + +" remove windows ^M when the encoding gets messed up noremap m mmHmt:%s///ge'tzt'm + +" autoreload vimrc when writing init.vim +au! BufWritePost $MYVIMRC source % + +" add convenience command for force-saving read-only files +cmap w!! w !sudo tee % From d13d72ec80aec9fe47523604acaf26228b6a3609 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Wed, 22 Sep 2021 16:01:49 +0200 Subject: [PATCH 14/64] config: nvim: split config into multiple files --- config/nvim/general.vim | 149 +++++++++++++++++++++++++++++++ config/nvim/init.vim | 173 +----------------------------------- config/nvim/keybindings.vim | 20 +++++ 3 files changed, 171 insertions(+), 171 deletions(-) create mode 100644 config/nvim/general.vim create mode 100644 config/nvim/keybindings.vim diff --git a/config/nvim/general.vim b/config/nvim/general.vim new file mode 100644 index 0000000..20f1efd --- /dev/null +++ b/config/nvim/general.vim @@ -0,0 +1,149 @@ +" drop vi-compatibility +set nocompatible +" disable autocmd +set secure +" use utf8 only +set encoding=utf8 + +" file/directory matching +set wildmode=list:longest,full +" ignore case when completing +if exists('+wildignorecase') + set wildignorecase +endif +" ignorelist +set wildignore=*.o,*.d,*.so,*.class,*.aux,*.log,*.out,*.toc,*.pdf,*.pyc + +" show completion menu even with only one match +if exists('+completeopt') + set completeopt+=menuone +endif + +" increase command history +set history=1000 +" increase count of possible undos +set undolevels=1000 + +" encrypt buffers when saved to files +if exists('+cryptmethod') + set cryptmethod=blowfish +endif + +" enable fast terminal for tmux but not for ssh connection +if &term =~# '^screen' && !exists('SSH_CONNECTION') + set ttyfast +endif + +" enable automatic file detection, plugin and indention support +if has('autocmd') + filetype off "for pathogen + filetype plugin indent on +endif + +" use utf8 encoding for all files and recognize latin1 +set fileencodings=utf-8,latin1 + +" use unix line-endings and recognize dos endings +set fileformats=unix,dos + +" tabs +set tabstop=4 +set shiftwidth=4 +set autoindent +set smartindent +set smarttab + +" allow backspacing over autoindent and line breaks +set backspace=indent,eol,start + +" already display matches while searching +set incsearch +" only check for case if the searched word contains a capital +set ignorecase +set smartcase +" highlight all matches. use to remove the highlights +set hlsearch + +" treat hyphenated words as a single word +set iskeyword+=- + +" syntax folding +if has('folding') + set foldmethod=syntax + " only use folding when there is enough space +" if &columns > 80 +" set foldcolumn=2 +" endif + set foldlevel=99 + + " dont open fold for block movements + set foldopen-=block +endif + +" allow buffers with changes to be hidden +set hidden + +" correct splitting +if has('vertsplit') + set splitright + set splitbelow +endif + +" Visual +" set text color for dark terminal background +set background=dark + +" activate syntax highlighting +if has('syntax') + syntax enable +endif + +" set colorscheme +colorscheme ron + +" display line at which the current is positioned +if exists('+cursorline') + set cursorline + " remove line and make the line bold instead + highlight CursorLine term=bold cterm=bold + highlight CursorLineNR term=bold cterm=bold ctermbg=darkgrey +endif + +" display box from column 81 to 100 +let &colorcolumn=join(range(81, 100), ",") +highlight ColorColumn ctermbg=235 guibg=#2d2d2d + +" display line numbers +set number + +" show cursor position all the time +set ruler + +" show tabs all the time +set showtabline=2 + +" show currently typed command +set showcmd + +" define characters to display when using 'set list' +set listchars=tab:→\ ,trail:∙,eol:¬,extends:❯,precedes:❮,nbsp:␣ + +" increase completion performance and reduce time until timeout +set updatetime=300 +set timeoutlen=500 + +" copy paste between vim and everything else +" TODO: check whether the 'plus' suffix works with plain vim +set clipboard=unnamedplus + +" Misc +set mouse=n + +" remove windows ^M when the encoding gets messed up +noremap m mmHmt:%s///ge'tzt'm + +" autoreload vimrc when writing init.vim +au! BufWritePost $MYVIMRC source % + +" add convenience command for force-saving read-only files +cmap w!! w !sudo tee % diff --git a/config/nvim/init.vim b/config/nvim/init.vim index 30d53aa..543cc25 100644 --- a/config/nvim/init.vim +++ b/config/nvim/init.vim @@ -1,171 +1,2 @@ -" drop vi-compatibility -set nocompatible -" disable autocmd -set secure -" use utf8 only -set encoding=utf8 - -" file/directory matching -set wildmode=list:longest,full -" ignore case when completing -if exists('+wildignorecase') - set wildignorecase -endif -" ignorelist -set wildignore=*.o,*.d,*.so,*.class,*.aux,*.log,*.out,*.toc,*.pdf,*.pyc - -" show completion menu even with only one match -if exists('+completeopt') - set completeopt+=menuone -endif - -" increase command history -set history=1000 -" increase count of possible undos -set undolevels=1000 - -" encrypt buffers when saved to files -if exists('+cryptmethod') - set cryptmethod=blowfish -endif - -" enable fast terminal for tmux but not for ssh connection -if &term =~# '^screen' && !exists('SSH_CONNECTION') - set ttyfast -endif - -" enable automatic file detection, plugin and indention support -if has('autocmd') - filetype off "for pathogen - filetype plugin indent on -endif - -" use utf8 encoding for all files and recognize latin1 -set fileencodings=utf-8,latin1 - -" use unix line-endings and recognize dos endings -set fileformats=unix,dos - -" tabs -set tabstop=4 -set shiftwidth=4 -set autoindent -set smartindent -set smarttab - -" allow backspacing over autoindent and line breaks -set backspace=indent,eol,start - -" already display matches while searching -set incsearch -" only check for case if the searched word contains a capital -set ignorecase -set smartcase -" highlight all matches. use to remove the highlights -set hlsearch - -" treat hyphenated words as a single word -set iskeyword+=- - -" syntax folding -if has('folding') - set foldmethod=syntax - " only use folding when there is enough space -" if &columns > 80 -" set foldcolumn=2 -" endif - set foldlevel=99 - - " dont open fold for block movements - set foldopen-=block -endif - -" allow buffers with changes to be hidden -set hidden - -" correct splitting -if has('vertsplit') - set splitright - set splitbelow -endif - -" Visual -" set text color for dark terminal background -set background=dark - -" activate syntax highlighting -if has('syntax') - syntax enable -endif - -" set colorscheme -colorscheme ron - -" display line at which the current is positioned -if exists('+cursorline') - set cursorline - " remove line and make the line bold instead - highlight CursorLine term=bold cterm=bold - highlight CursorLineNR term=bold cterm=bold ctermbg=darkgrey -endif - -" display box from column 81 to 100 -let &colorcolumn=join(range(81, 100), ",") -highlight ColorColumn ctermbg=235 guibg=#2d2d2d - -" display line numbers -set number - -" show cursor position all the time -set ruler - -" show tabs all the time -set showtabline=2 - -" show currently typed command -set showcmd - -" define characters to display when using 'set list' -set listchars=tab:→\ ,trail:∙,eol:¬,extends:❯,precedes:❮,nbsp:␣ - -" increase completion performance and reduce time until timeout -set updatetime=300 -set timeoutlen=500 - -" copy paste between vim and everything else -" TODO: check whether the 'plus' suffix works with plain vim -set clipboard=unnamedplus - -" Keybindings -" allow easier pane switching -nnoremap -nnoremap -nnoremap -nnoremap - -" allow easier pane resizing -nnoremap :resize -2 -nnoremap :resize +2 -nnoremap :vertical resize -2 -nnoremap :vertical resize +2 - -" use TAB to switch to next buffers -nnoremap :bnext -" use Shift-TAB to switch to previous buffers -nnoremap :bprevious - -" use TAB for skipping through completion options -inoremap pumvisible() ? "\" : "\" -inoremap pumvisible() ? "\" : "\" - -" Misc -set mouse=n - -" remove windows ^M when the encoding gets messed up -noremap m mmHmt:%s///ge'tzt'm - -" autoreload vimrc when writing init.vim -au! BufWritePost $MYVIMRC source % - -" add convenience command for force-saving read-only files -cmap w!! w !sudo tee % +source $HOME/.config/nvim/general.vim +source $HOME/.config/nvim/keybindings.vim diff --git a/config/nvim/keybindings.vim b/config/nvim/keybindings.vim new file mode 100644 index 0000000..3b2fe66 --- /dev/null +++ b/config/nvim/keybindings.vim @@ -0,0 +1,20 @@ +" allow easier pane switching +nnoremap +nnoremap +nnoremap +nnoremap + +" allow easier pane resizing +nnoremap :resize -2 +nnoremap :resize +2 +nnoremap :vertical resize -2 +nnoremap :vertical resize +2 + +" use TAB to switch to next buffers +nnoremap :bnext +" use Shift-TAB to switch to previous buffers +nnoremap :bprevious + +" use TAB for completion +inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\" From 4a7a665edb0e355a19b8cee6e921f4cf28057a8f Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Wed, 22 Sep 2021 13:06:17 +0200 Subject: [PATCH 15/64] zsh: use nvim instead of vim when available --- zsh/aliases.zsh | 5 +++++ zsh/exports.zsh | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 1ba6b2b..c4df82d 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -45,6 +45,11 @@ alias grep='grep --binary-files=without-match -H -n --color=always' alias less='less -r' alias cp='cp -i' alias mv='mv -i' +# use nvim instead of vim when available +if type nvim >/dev/null 2>&1; then +alias vi='vim' +alias vim='nvim' +fi alias automake='{ while true; do inotifywait -r -e modify . && make; done; } &' # ===== sp aliases diff --git a/zsh/exports.zsh b/zsh/exports.zsh index cc36a5f..0de31ae 100644 --- a/zsh/exports.zsh +++ b/zsh/exports.zsh @@ -1,4 +1,6 @@ # set EDITOR variable -if type vim >/dev/null 2>&1; then +if type nvim >/dev/null 2>&1; then + export EDITOR="nvim" +elif type vim >/dev/null 2>&1; then export EDITOR="vim" fi From 62a306326d86e4fd670347a5eb0e24b48d361fe2 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Fri, 18 Mar 2022 13:19:34 +0100 Subject: [PATCH 16/64] config: nvim: general: remove old config for pathogen --- config/nvim/general.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/config/nvim/general.vim b/config/nvim/general.vim index 20f1efd..d6bd247 100644 --- a/config/nvim/general.vim +++ b/config/nvim/general.vim @@ -36,7 +36,6 @@ endif " enable automatic file detection, plugin and indention support if has('autocmd') - filetype off "for pathogen filetype plugin indent on endif From 8a3be75d1f64e1cc652fc3d624845454c0c8e73a Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Fri, 18 Mar 2022 13:20:51 +0100 Subject: [PATCH 17/64] config: nvim: general: move warning columns and make them less intrusive --- config/nvim/general.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/nvim/general.vim b/config/nvim/general.vim index d6bd247..86d1ece 100644 --- a/config/nvim/general.vim +++ b/config/nvim/general.vim @@ -108,8 +108,8 @@ if exists('+cursorline') highlight CursorLineNR term=bold cterm=bold ctermbg=darkgrey endif -" display box from column 81 to 100 -let &colorcolumn=join(range(81, 100), ",") +" display warning column at 81 and 121 +let &colorcolumn="81,121" highlight ColorColumn ctermbg=235 guibg=#2d2d2d " display line numbers From 3be7d5aec45c51c80065e4fad18575fa3e0c9d8d Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Fri, 18 Mar 2022 17:45:47 +0100 Subject: [PATCH 18/64] config: nvim: add vim-plug, vim-dichromatic and nvim-colorizer --- config/nvim/general.vim | 9 ++++++++- config/nvim/init.vim | 1 + config/nvim/plugins.vim | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 config/nvim/plugins.vim diff --git a/config/nvim/general.vim b/config/nvim/general.vim index 86d1ece..8bc229f 100644 --- a/config/nvim/general.vim +++ b/config/nvim/general.vim @@ -98,7 +98,8 @@ if has('syntax') endif " set colorscheme -colorscheme ron +colorscheme dichromatic +" TODO: use `colorscheme ron` as fallback? " display line at which the current is positioned if exists('+cursorline') @@ -127,6 +128,12 @@ set showcmd " define characters to display when using 'set list' set listchars=tab:→\ ,trail:∙,eol:¬,extends:❯,precedes:❮,nbsp:␣ +" enable nvim-colorizer +if has('nvim') + set termguicolors + lua require'colorizer'.setup() +endif + " increase completion performance and reduce time until timeout set updatetime=300 set timeoutlen=500 diff --git a/config/nvim/init.vim b/config/nvim/init.vim index 543cc25..94bf774 100644 --- a/config/nvim/init.vim +++ b/config/nvim/init.vim @@ -1,2 +1,3 @@ +source $HOME/.config/nvim/plugins.vim source $HOME/.config/nvim/general.vim source $HOME/.config/nvim/keybindings.vim diff --git a/config/nvim/plugins.vim b/config/nvim/plugins.vim new file mode 100644 index 0000000..790190a --- /dev/null +++ b/config/nvim/plugins.vim @@ -0,0 +1,18 @@ +" warn if vim-plug is not available +if empty(glob('~/.config/nvim/autoload/plug.vim')) + echom "Install https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + \ to ~/.config/nvim/autoload/plug.vim" +endif + +call plug#begin('~/.config/nvim/autoload/plugged') + +" vim colortheme for colorblind +Plug 'romainl/vim-dichromatic' + +" only for nvim! +if has('nvim') + " colorizes colorcodes + Plug 'norcalli/nvim-colorizer.lua' +endif + +call plug#end() From 02d988ff04e9f69ebea4f54bf4fa4e5e2440092b Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Fri, 18 Mar 2022 17:58:36 +0100 Subject: [PATCH 19/64] gitignore: ignore (n)vim-plugins --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ef09c1b..f932fa9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ zsh/zsh_history +config/nvim/autoload From aaff09b15f65a7084dd5e620e9eedf54df755f75 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Fri, 18 Mar 2022 18:00:08 +0100 Subject: [PATCH 20/64] gitconfig: use neovim as default editor --- gitconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitconfig b/gitconfig index 4e04fbe..3d30842 100644 --- a/gitconfig +++ b/gitconfig @@ -2,7 +2,7 @@ email = mail@tpreisner.de name = Thomas Preisner [core] - editor = vim + editor = nvim [commit] verbose = true [alias] From c638a594997c614eafb28dfe80c8571dc3be7e13 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Tue, 22 Mar 2022 15:24:58 +0100 Subject: [PATCH 21/64] zsh: completion.zsh: extend vim ignored-pattern to neovim --- zsh/completion.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/completion.zsh b/zsh/completion.zsh index fc06169..91e87f6 100644 --- a/zsh/completion.zsh +++ b/zsh/completion.zsh @@ -106,7 +106,7 @@ zstyle ':completion:*' separate-sections on zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' # do not complete unwanted files with vim -zstyle ':completion:*:*:vim:*:globbed-files' ignored-patterns \ +zstyle ':completion:*:*:*vim:*:globbed-files' ignored-patterns \ '*.aux' '*.log' '*.pdf' '*.ps' '*.bbl' '*.blg' '*.out' '*-blx.bib' '*.run.xml' '*.dvi' \ '*.o' \ '*.pyc' \ From 21af73483b1bd021b0a7995ea59a1646dc1f2a3e Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Tue, 22 Mar 2022 15:29:59 +0100 Subject: [PATCH 22/64] zsh: aliases.zsh: add alias for better `ip addr`-output --- zsh/aliases.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index c4df82d..e42d262 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -51,6 +51,8 @@ alias vi='vim' alias vim='nvim' fi alias automake='{ while true; do inotifywait -r -e modify . && make; done; } &' +# less verbose and more colorful `ip addr`-output +alias ip='ip -br -color=auto' # ===== sp aliases alias xterm='xterm -fa terminus -fs 8' From b31a9fd9088ab7bc9ad66f4c357ef24b3f164e85 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Tue, 22 Mar 2022 15:34:09 +0100 Subject: [PATCH 23/64] .gitignore: ignore zsh cache --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f932fa9..ad6f6c6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ zsh/zsh_history +zsh/cache config/nvim/autoload From 3b9be5de6f931b14dc6ca589c30eb352d37c7ce6 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Tue, 22 Mar 2022 15:35:46 +0100 Subject: [PATCH 24/64] xinitrc: set solid color as background color as fallback --- xinitrc | 1 + 1 file changed, 1 insertion(+) diff --git a/xinitrc b/xinitrc index e8c0eb9..3e2ad67 100755 --- a/xinitrc +++ b/xinitrc @@ -25,6 +25,7 @@ xss-lock -- i3lock --nofork & xset s 300 # set background +xsetroot -solid '#22AA22' feh --randomize --bg-fill ~/misc/wallpapers exec i3 From 343219cfe232b23895009c07a2106f7569ab4efa Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Tue, 22 Mar 2022 15:47:18 +0100 Subject: [PATCH 25/64] config: i3: replace urxvt with alacritty Seems to be faster and triggers less graphical glitches in conjunction with gdb (examine). --- config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/i3/config b/config/i3/config index 19c8489..a3b957b 100644 --- a/config/i3/config +++ b/config/i3/config @@ -24,7 +24,7 @@ floating_modifier $mod # start a terminal #bindsym $mod+Return exec i3-sensible-terminal -bindsym $mod+Return exec urxvt +bindsym $mod+Return exec alacritty bindsym $mod+b exec chromium From 3b83281feb35d6701e40091ad3a39ef584948619 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Tue, 22 Mar 2022 15:48:30 +0100 Subject: [PATCH 26/64] config: i3: add keybinding for flameshot as screenshot tool --- config/i3/config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/i3/config b/config/i3/config index a3b957b..92009f2 100644 --- a/config/i3/config +++ b/config/i3/config @@ -91,6 +91,9 @@ bindsym $mod+a focus parent # custom bind for pass dmenu wrapper bindsym $mod+p exec passmenu --type +# custom bind for flameshot screenshot tool +bindsym $mod+Shift+s exec flameshot gui + # do not focus container behind mouse focus_follows_mouse no From a4762ca7a2796da39807c40ef18dd5497b01a7b2 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Thu, 24 Mar 2022 13:16:15 +0100 Subject: [PATCH 27/64] config: nvim: add basic language server protocol support --- config/nvim/init.vim | 1 + config/nvim/lsp.vim | 25 +++++++++++++++++++++++++ config/nvim/plugins.vim | 2 ++ 3 files changed, 28 insertions(+) create mode 100644 config/nvim/lsp.vim diff --git a/config/nvim/init.vim b/config/nvim/init.vim index 94bf774..aa92ce6 100644 --- a/config/nvim/init.vim +++ b/config/nvim/init.vim @@ -1,3 +1,4 @@ source $HOME/.config/nvim/plugins.vim source $HOME/.config/nvim/general.vim source $HOME/.config/nvim/keybindings.vim +source $HOME/.config/nvim/lsp.vim diff --git a/config/nvim/lsp.vim b/config/nvim/lsp.vim new file mode 100644 index 0000000..f91d667 --- /dev/null +++ b/config/nvim/lsp.vim @@ -0,0 +1,25 @@ +" lsp-config +if has('nvim') + nnoremap gd lua vim.lsp.buf.definition() + nnoremap gD lua vim.lsp.buf.declaration() + nnoremap gr lua vim.lsp.buf.references() + nnoremap gi lua vim.lsp.buf.implementation() + nnoremap K lua vim.lsp.buf.hover() + nnoremap lua vim.lsp.buf.signature_help() + nnoremap lua vim.lsp.buf.rename() + nnoremap lua vim.lsp.diagnostic.goto_prev() + nnoremap lua vim.lsp.diagnostic.goto_next() + + " auto-format + autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100) + autocmd BufWritePre *.jsx lua vim.lsp.buf.formatting_sync(nil, 100) + autocmd BufWritePre *.py lua vim.lsp.buf.formatting_sync(nil, 100) + + " setup lsp-providers + " (-> need to be installed manually first and then added here) + lua require'lspconfig'.ccls.setup{} + lua require'lspconfig'.clangd.setup{} + lua require'lspconfig'.pyright.setup{} + lua require'lspconfig'.bashls.setup{} + lua require'lspconfig'.gopls.setup{} +endif diff --git a/config/nvim/plugins.vim b/config/nvim/plugins.vim index 790190a..7438321 100644 --- a/config/nvim/plugins.vim +++ b/config/nvim/plugins.vim @@ -11,6 +11,8 @@ Plug 'romainl/vim-dichromatic' " only for nvim! if has('nvim') + " language server protocol support + Plug 'neovim/nvim-lspconfig' " colorizes colorcodes Plug 'norcalli/nvim-colorizer.lua' endif From d4022aecee32c9df255f005cc3c153ba996f4f99 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sat, 27 Aug 2022 20:59:41 +0200 Subject: [PATCH 28/64] remove occurences of old hostnames and replace with current hostnames warthog (old macbook) does not exist anymore and falcon has been renamed to beryllium --- Xresources | 2 +- config/barpyrus/config.py | 3 +-- config/herbstluftwm/autostart | 2 +- config/herbstluftwm/panel.sh_backup | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Xresources b/Xresources index c161a0a..438469e 100644 --- a/Xresources +++ b/Xresources @@ -15,7 +15,7 @@ URxvt.shading: 20 URxvt.iso14755: false URxvt.iso14755_52: false -#if defined(SRVR_falcon) || defined(SRVR_warthog) || defined(SRVR_cipbuero4) +#if defined(SRVR_beryllium) || defined(SRVR_cipbuero4) Xft.dpi: 192 #endif diff --git a/config/barpyrus/config.py b/config/barpyrus/config.py index 24dd93c..c2b6735 100644 --- a/config/barpyrus/config.py +++ b/config/barpyrus/config.py @@ -16,8 +16,7 @@ monitor = sys.argv[1] if len(sys.argv) >= 2 else 0 (x, y, monitor_w, monitor_h) = hc.monitor_rect(monitor) HiDPIHosts = set() -HiDPIHosts.add('falcon') -HiDPIHosts.add('warthog') +HiDPIHosts.add('beryllium') HiDPIHosts.add('cipbuero4') HiDPI = os.uname().nodename in HiDPIHosts diff --git a/config/herbstluftwm/autostart b/config/herbstluftwm/autostart index 73a1aca..50327af 100755 --- a/config/herbstluftwm/autostart +++ b/config/herbstluftwm/autostart @@ -72,7 +72,7 @@ case "$HOSTNAME" in ;; esac -if [ "$HOSTNAME" = warthog ] || [ "$HOSTNAME" = falcon ]; then +if [ "$HOSTNAME" = beryllium ]; then hc keybind $Mod-d spawn /usr/bin/dmenu_run_hlwm -fn "Monospace-9" hc keybind XF86MonBrightnessDown spawn xbacklight -4 hc keybind XF86MonBrightnessUp spawn xbacklight +4 diff --git a/config/herbstluftwm/panel.sh_backup b/config/herbstluftwm/panel.sh_backup index ff9adf5..eadf2d9 100755 --- a/config/herbstluftwm/panel.sh_backup +++ b/config/herbstluftwm/panel.sh_backup @@ -11,7 +11,7 @@ fi x=${geometry[0]} y=${geometry[1]} panel_width=${geometry[2]} -if [ "$HOSTNAME" = warthog ]; then +if [ "$HOSTNAME" = beryllium ]; then panel_height=30 font="-*-fixed-medium-*-*-*-26-*-*-*-*-*-*-*" iconpath=${HOME}/.config/herbstluftwm/icons_large @@ -90,7 +90,7 @@ function cpu() { # BATTERY function battery() { - if [ "$HOSTNAME" != warthog ]; then + if [ "$HOSTNAME" != beryllium ]; then return fi From 4b0e69c0a5d08125ddd9720dbe31379baf9222c7 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sat, 27 Aug 2022 21:04:19 +0200 Subject: [PATCH 29/64] config: i3: specify fonts to be used for window titles and bar --- config/i3/config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/i3/config b/config/i3/config index 92009f2..516e817 100644 --- a/config/i3/config +++ b/config/i3/config @@ -6,7 +6,7 @@ set $mod Mod4 # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. -font pango:monospace 8 +font pango:DejaVu Sans, FontAwesome 7 # This font is widely installed, provides lots of unicode glyphs, right-to-left # text rendering and scalability on retina/hidpi displays (thanks to pango). @@ -183,7 +183,7 @@ bindsym XF86MonBrightnessUp exec "brightnessctl set 4%+" bar { position top status_command i3status - font pango:DejaVu Sans, FontAwesome 8 + font pango:DejaVu Sans, FontAwesome 7 } exec --no-startup-id redshift From e9ca0baa3b5cfec48febd32b03a641b49ce98e15 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sat, 27 Aug 2022 21:05:28 +0200 Subject: [PATCH 30/64] gitconfig: add diff algorithm for ansible vaults --- gitconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gitconfig b/gitconfig index 3d30842..3bcdcda 100644 --- a/gitconfig +++ b/gitconfig @@ -22,3 +22,5 @@ t = tag [init] defaultBranch = main +[diff "ansible-vault"] + textconv = "ansible-vault view" From e4ada8d5cd83e4491b41c70cb09aa5547f2c783f Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sat, 27 Aug 2022 21:16:24 +0200 Subject: [PATCH 31/64] xinitrc: update regex for university hostnames --- xinitrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xinitrc b/xinitrc index 3e2ad67..d6620e3 100755 --- a/xinitrc +++ b/xinitrc @@ -1,9 +1,9 @@ #! /bin/bash case "$HOSTNAME" in - fau*) + fau*|cip*) # detects fau-machine and defines variable for Xresources - xrdb -load -DHOST_FAUCIP ~/.Xresources + xrdb -load -DHOST_FAUCIP ~/.Xresources ;; *) # other hosts cann use SRVR_host From 913e7ff72268e47c2cb1920d16a42acec71dbcfb Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sat, 27 Aug 2022 23:40:02 +0200 Subject: [PATCH 32/64] Xresources: use Source Code Pro on beryllium --- Xresources | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Xresources b/Xresources index 438469e..c2a8ea2 100644 --- a/Xresources +++ b/Xresources @@ -1,5 +1,11 @@ -URxvt.font: xft:Monospace:size=9:antialias=true -URxvt.boldFont: xft:Monospace:style=bold:size=9:antialias=true +! beryllium is arch-based with easy access to source code pro, let's use it +#if defined(SRVR_beryllium) + URxvt.font: xft:Source Code Pro:size=9:antialias=true + URxvt.boldFont: xft:Source Code Pro:style=bold:size=9:antialias=true +#else + URxvt.font: xft:Monospace:size=9:antialias=true + URxvt.boldFont: xft:Monospace:style=bold:size=9:antialias=true +#endif URxvt.foreground: white URxvt.background: black URxvt.letterSpace: -1 From 53cb41bbc539b5a88a1f78b5caccd110f6fc5227 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sat, 27 Aug 2022 23:42:26 +0200 Subject: [PATCH 33/64] config: i3: add blueman-applet and signal-desktop to "autostart" --- config/i3/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/i3/config b/config/i3/config index 516e817..a75fbfb 100644 --- a/config/i3/config +++ b/config/i3/config @@ -189,3 +189,5 @@ bar { exec --no-startup-id redshift exec --no-startup-id nm-applet exec --no-startup-id dunst +exec --no-startup-id blueman-applet +exec --no-startup-id signal-desktop --start-in-tray From 7a178f24df26bbd9e63c16b06789ea672564853c Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Tue, 6 Sep 2022 15:11:35 +0200 Subject: [PATCH 34/64] config: i3status: display actual battery percentage --- config/i3status/config | 1 + 1 file changed, 1 insertion(+) diff --git a/config/i3status/config b/config/i3status/config index 6f1475b..4498675 100644 --- a/config/i3status/config +++ b/config/i3status/config @@ -37,6 +37,7 @@ battery all { status_unk = " UNK" status_full = " FULL" low_threshold = 10 + last_full_capacity = true } tztime local { From 39fe0e50bbf25417399b7546744431ec58d459a8 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sat, 17 Sep 2022 21:14:18 +0200 Subject: [PATCH 35/64] config: i3: rename workspace '10' to 'A' Switching to workspace '1' causes to also move workspace '10'. --- config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/i3/config b/config/i3/config index a75fbfb..2c6685b 100644 --- a/config/i3/config +++ b/config/i3/config @@ -108,7 +108,7 @@ set $ws6 "6" set $ws7 "7" set $ws8 "8" set $ws9 "9" -set $ws10 "10" +set $ws10 "A" # switch to workspace bindsym $mod+1 [workspace=$ws1] move workspace to output current, workspace $ws1 From 42274c8131ac5540374081e089a1b1a0cda16ddf Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 18 Sep 2022 16:56:44 +0200 Subject: [PATCH 36/64] xinitrc: add output scaling on cipbuero4 --- xinitrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xinitrc b/xinitrc index d6620e3..30c3dd0 100755 --- a/xinitrc +++ b/xinitrc @@ -1,6 +1,11 @@ #! /bin/bash case "$HOSTNAME" in + cipbuero4) + # detects fau-machine and defines variable for Xresources + xrdb -load -DHOST_FAUCIP ~/.Xresources + xrandr --output DP-2 --scale 1.6x1.6 + ;; fau*|cip*) # detects fau-machine and defines variable for Xresources xrdb -load -DHOST_FAUCIP ~/.Xresources From 26d8a6b5b4284d3f1bcaed7e2b42b15183474ab5 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 18 Sep 2022 16:59:22 +0200 Subject: [PATCH 37/64] xinitrc: start automount-daemon udiskie if available --- xinitrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xinitrc b/xinitrc index 30c3dd0..902fd61 100755 --- a/xinitrc +++ b/xinitrc @@ -23,6 +23,11 @@ if [ -d $HOME/.fonts ]; then xset fp rehash fi +# start automount-daemon for udisks2 if available +if type "udiskie" >/dev/null 2>&1; then + udiskie & +fi + # autolock on suspend xss-lock -- i3lock --nofork & From cfa621b864bc1bda861542edf40a52ef294a4fec Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 18 Sep 2022 17:04:28 +0200 Subject: [PATCH 38/64] config: nvim: general: remove old completion menu option In preparation for neovim completion. --- config/nvim/general.vim | 5 ----- 1 file changed, 5 deletions(-) diff --git a/config/nvim/general.vim b/config/nvim/general.vim index 8bc229f..f040ce8 100644 --- a/config/nvim/general.vim +++ b/config/nvim/general.vim @@ -14,11 +14,6 @@ endif " ignorelist set wildignore=*.o,*.d,*.so,*.class,*.aux,*.log,*.out,*.toc,*.pdf,*.pyc -" show completion menu even with only one match -if exists('+completeopt') - set completeopt+=menuone -endif - " increase command history set history=1000 " increase count of possible undos From 13f5ecd846e6a891690a6fcb477d7d719020e1a4 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 18 Sep 2022 18:01:32 +0200 Subject: [PATCH 39/64] zsh: display some info about vcs in current directory --- zsh/prompt.zsh | 27 +++++++++++++++----- zsh/vcs.zsh | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ zshrc | 1 + 3 files changed, 91 insertions(+), 6 deletions(-) create mode 100644 zsh/vcs.zsh diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index c53daf9..1e9b4a7 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -18,6 +18,9 @@ setopt transient_rprompt # only show the rprompt on the current prompt # ===== set the prompt zshrc_prompt_precmd() { + # call vcs_info before every prompt + vcs_info + # regex to remove all zerospace elements. Used to calculate the width of # the top prompt. local zero='%([BSUBfksu]|([FB]|){*})' @@ -52,6 +55,14 @@ zshrc_prompt_precmd() { # username, green for normal users, red for root local user="%(!.%F{red}.%F{green})%n%f" + # information about unstaged/staged changes in VCS in current directory + local vcs="${vcs_info_msg_0_}" + local vcs_width=${#${(S%%%)vcs//$~zero/}} + if [[ $vcs_width -ne 0 ]]; then + # add brackets if vcs is non-empty + vcs="${bracket_open}${vcs}${bracket_close}" + fi + # hostname, underlined if running on a remote system through SSH local host="%F{green}%m%f" if [[ -n $SSH_CONNECTION ]]; then @@ -95,6 +106,7 @@ zshrc_prompt_precmd() { # combine them to create the prompt local top_left="" local top_right="${bracket_open}${time}${bracket_close}" + local top_middle="${vcs}" local bottom_left="${bracket_open}${user}%F{green}@%f${host}${bracket_close}${exitcode}${separator}${symbol}" local bottom_right= @@ -109,15 +121,16 @@ zshrc_prompt_precmd() { local width_top_prefix=${#${(S%%%)top_prefix//$~zero/}} local width_top_suffix=${#${(S%%%)top_suffix//$~zero/}} local width_top_left=${#${(S%%%)top_left//$~zero/}} + local width_top_middle=${#${(S%%%)top_middle//$~zero/}} local width_top_right=${#${(S%%%)top_right//$~zero/}} # calculate the maximum width of ${top_left}: - # (-4 for brackets, -1 as spacing between top_left and top_right) + # (-4 for brackets and as spacing between top_left, top_middle and top_right) local top_left_width_max=$(( COLUMNS - $width_top_prefix - - $width_top_left - 4 - - 1 - - $width_top_right + - $width_top_left - 2 + - $width_top_middle + - $width_top_right - 2 - $width_top_suffix )) @@ -129,12 +142,14 @@ zshrc_prompt_precmd() { local width=$(( COLUMNS - width_top_prefix - width_top_left + - width_top_middle - width_top_right - width_top_suffix )) - local top_separator="%F{cyan}${(pl:${width}::$dash:)}%f" + local top_left_separator="%F{cyan}${(pl:$((width / 2))::$dash:)}%f" + local top_right_separator="%F{cyan}${(pl:$((width / 2 + width % 2))::$dash:)}%f" - PROMPT="${top_prefix}${top_left}${top_separator}${top_right}${top_suffix} + PROMPT="${top_prefix}${top_left}${top_left_separator}${top_middle}${top_right_separator}${top_right}${top_suffix} ${bottom_prefix}${bottom_left} " RPROMPT="${bottom_right}${bottom_suffix}" diff --git a/zsh/vcs.zsh b/zsh/vcs.zsh new file mode 100644 index 0000000..ef69f50 --- /dev/null +++ b/zsh/vcs.zsh @@ -0,0 +1,69 @@ +autoload -Uz vcs_info + +# only look for certain VCS +zstyle ':vcs_info:*' enable git + +# check repository for changes so that they can be used in %u/%c +# (this might be slow for bigger repositories) +zstyle ':vcs_info:*' check-for-changes yes + +# display current branch (%b -> green), unstaged + staged changes (%u/%c -> green), +# VCS (%s -> blue) and custom messages (%m). +zstyle ':vcs_info:*' formats \ + "%F{green}%b%u%c%F{default}:%F{blue}%s%F{default}%m" +# during special actions (e.g. merge, rebase), also display those (%a -> red) +zstyle ':vcs_info:*' actionformats \ + "(%F{green}%b%u%c%F{default}/%F{red}%a%F{default}:%F{blue}%s%F{default}%m)" + +# set style for formats/actionformats when unstaged (%u) and staged (%c) +# changes are detected in the repository +# (check-for-changes must be true for this to work) +zstyle ':vcs_info:*' unstagedstr '¹' +zstyle ':vcs_info:*' stagedstr '²' + +# force vcs_info to be run. this prevents running it later for performance reasons. +# default to run vcs_info. will be prevented from running later if possible +# (for speedup) +zshrc_force_run_vcs_info=1 + +# cache data +zstyle ':vcs_info:*+pre-get-data:*' hooks pre-get-data ++vi-pre-get-data() { + # only git and mercurial support and need caching. ignore all other VCS + [[ $vcs != git && $vcs != hg ]] && return + + # run vcs_info on startup, on directory change (or for other custom reasons) + if [[ -n $zshrc_force_run_vcs_info ]]; then + zshrc_force_run_vcs_info= + return + fi + + # don't run vcs_info by default to speed up the shell + ret=1 + case $(fc -ln $(($HISTCMD-1))) in + # vcs status might need an update after running git/hg + git* | g\ *) + ret=0 + ;; + esac +} + +# display stash count +function +vi-git-stashes() { + if [[ -s ${hook_com[base]/.git/refs/stash} ]]; then + local -a stashes + # "grep" output of git stash list via (M) and :#(...) + stashes=( ${(M)${(f)"$(git stash list 2>/dev/null)"}:#(*WIP*)} ) + + if [[ ${#stashes} -gt 0 ]]; then + hook_com[misc]+=" %F{yellow}${#stashes}s%F{default}" + fi + fi +} +zstyle ':vcs_info:git*+set-message:*' hooks git-stashes + +# enforce running vcs_info when changing directory +prompt_chpwd() { + zshrc_force_run_vcs_info=1 +} +chpwd_functions+=(prompt_chpwd) diff --git a/zshrc b/zshrc index d147f0b..a0c35fb 100644 --- a/zshrc +++ b/zshrc @@ -2,6 +2,7 @@ source ~/.zsh/keybindings.zsh source ~/.zsh/setopt.zsh source ~/.zsh/general.zsh +source ~/.zsh/vcs.zsh source ~/.zsh/prompt.zsh source ~/.zsh/completion.zsh source ~/.zsh/history.zsh From 0819e4e95b8f4aa6d05d45337e5dd6ed4c0191da Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Wed, 21 Sep 2022 17:10:35 +0200 Subject: [PATCH 40/64] ssh: conf.d: update git-submodule for ssh config --- ssh/conf.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssh/conf.d b/ssh/conf.d index 0de3082..144f794 160000 --- a/ssh/conf.d +++ b/ssh/conf.d @@ -1 +1 @@ -Subproject commit 0de3082a12e5d60d27df8a255fc312fa3664a305 +Subproject commit 144f7941c03f8b7ffc76a8468fbe05bb2eb3edf5 From 07be5a4e7aef5c4b98d3757fdd4049e7d5a50690 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 25 Sep 2022 01:09:48 +0200 Subject: [PATCH 41/64] separate vim config from nvim config again and simplify it Separating vim's config from neovim's config simplifies the deployment of lua for neovim's configuration. At the same time, clean up current neovim config by removing all outdated options and options with equal or even better defaults. Furthermore, the 'old' vim configuration should be kept as-is to ensure compability with older systems if needed. --- config/nvim/general.vim | 25 +----- setup.sh | 17 ++-- vim/colors/dichromatic.vim | 161 +++++++++++++++++++++++++++++++++++++ vim/general.vim | 139 ++++++++++++++++++++++++++++++++ vim/keybindings.vim | 16 ++++ vimrc | 6 +- 6 files changed, 328 insertions(+), 36 deletions(-) create mode 100644 vim/colors/dichromatic.vim create mode 100644 vim/general.vim create mode 100644 vim/keybindings.vim diff --git a/config/nvim/general.vim b/config/nvim/general.vim index f040ce8..ce3cc5a 100644 --- a/config/nvim/general.vim +++ b/config/nvim/general.vim @@ -1,9 +1,5 @@ -" drop vi-compatibility -set nocompatible " disable autocmd set secure -" use utf8 only -set encoding=utf8 " file/directory matching set wildmode=list:longest,full @@ -19,24 +15,6 @@ set history=1000 " increase count of possible undos set undolevels=1000 -" encrypt buffers when saved to files -if exists('+cryptmethod') - set cryptmethod=blowfish -endif - -" enable fast terminal for tmux but not for ssh connection -if &term =~# '^screen' && !exists('SSH_CONNECTION') - set ttyfast -endif - -" enable automatic file detection, plugin and indention support -if has('autocmd') - filetype plugin indent on -endif - -" use utf8 encoding for all files and recognize latin1 -set fileencodings=utf-8,latin1 - " use unix line-endings and recognize dos endings set fileformats=unix,dos @@ -114,7 +92,7 @@ set number " show cursor position all the time set ruler -" show tabs all the time +" show vim tabs all the time set showtabline=2 " show currently typed command @@ -134,7 +112,6 @@ set updatetime=300 set timeoutlen=500 " copy paste between vim and everything else -" TODO: check whether the 'plus' suffix works with plain vim set clipboard=unnamedplus " Misc diff --git a/setup.sh b/setup.sh index 2aad4a9..4937942 100755 --- a/setup.sh +++ b/setup.sh @@ -44,18 +44,19 @@ link() link pam_environment ~/.pam_environment # application-specific config -if installed nvim || installed vim; then - echo "Setting up nvim:" - - mkdir -p ~/.config - link config/nvim ~/.config/nvim - - echo -fi if installed vim; then echo "Setting up vim:" link vimrc ~/.vimrc + link vim ~/.vim + + echo +fi +if installed nvim; then + echo "Setting up nvim:" + + mkdir -p ~/.config + link config/nvim ~/.config/nvim echo fi diff --git a/vim/colors/dichromatic.vim b/vim/colors/dichromatic.vim new file mode 100644 index 0000000..5011d6e --- /dev/null +++ b/vim/colors/dichromatic.vim @@ -0,0 +1,161 @@ +" dichromatic.vim -- Vim color scheme. +" Author: Romain Lafourcade (romainlafourcade@gmail.com) +" Webpage: https://raw.githubusercontent.com/romainl/vim-dichromatic/master/colors/dichromatic.vim +" Description: A 'dark' colorscheme for color blind vimmers. But not only. + +hi clear + +if exists("syntax_on") + syntax reset +endif + +let colors_name = "dichromatic" + +if ($TERM =~ '256' || &t_Co >= 256) || has("gui_running") + hi Normal ctermbg=232 ctermfg=252 cterm=NONE guibg=#080808 guifg=#D0D0D0 gui=NONE + hi NonText ctermbg=NONE ctermfg=240 cterm=NONE guibg=NONE guifg=#585858 gui=NONE + hi Comment ctermbg=NONE ctermfg=244 cterm=NONE guibg=NONE guifg=#808080 gui=NONE + hi Constant ctermbg=NONE ctermfg=168 cterm=NONE guibg=NONE guifg=#D75F87 gui=NONE + hi Error ctermbg=15 ctermfg=89 cterm=reverse guibg=#FFFFFF guifg=#87005F gui=reverse + hi Identifier ctermbg=NONE ctermfg=133 cterm=NONE guibg=NONE guifg=#AF5FAF gui=NONE + hi Ignore ctermbg=NONE ctermfg=NONE cterm=NONE guibg=NONE guifg=NONE gui=NONE + hi PreProc ctermbg=NONE ctermfg=186 cterm=NONE guibg=NONE guifg=#DFDF87 gui=NONE + hi Special ctermbg=NONE ctermfg=15 cterm=NONE guibg=NONE guifg=#FFFFFF gui=NONE + hi Statement ctermbg=NONE ctermfg=133 cterm=NONE guibg=NONE guifg=#AF5FAF gui=NONE + hi String ctermbg=NONE ctermfg=142 cterm=NONE guibg=NONE guifg=#AFAF00 gui=NONE + hi Todo ctermbg=NONE ctermfg=NONE cterm=reverse guibg=NONE guifg=NONE gui=reverse + hi Type ctermbg=NONE ctermfg=116 cterm=NONE guibg=NONE guifg=#87D7D7 gui=NONE + hi Underlined ctermbg=NONE ctermfg=NONE cterm=underline guibg=NONE guifg=NONE gui=underline + hi Number ctermbg=NONE ctermfg=168 cterm=NONE guibg=NONE guifg=#D75F87 gui=NONE + hi StatusLine ctermbg=15 ctermfg=240 cterm=NONE guibg=#FFFFFF guifg=#585858 gui=NONE + hi StatusLineNC ctermbg=240 ctermfg=15 cterm=NONE guibg=#585858 guifg=#FFFFFF gui=NONE + hi VertSplit ctermbg=240 ctermfg=240 cterm=NONE guibg=#585858 guifg=#585858 gui=NONE + hi TabLine ctermbg=240 ctermfg=15 cterm=NONE guibg=#585858 guifg=#FFFFFF gui=NONE + hi TabLineFill ctermbg=240 ctermfg=240 cterm=NONE guibg=#585858 guifg=#585858 gui=NONE + hi TabLineSel ctermbg=15 ctermfg=240 cterm=NONE guibg=#FFFFFF guifg=#585858 gui=NONE + hi Title ctermbg=NONE ctermfg=72 cterm=NONE guibg=NONE guifg=#5FAF87 gui=NONE + hi LineNr ctermbg=NONE ctermfg=116 cterm=NONE guibg=NONE guifg=#87D7D7 gui=NONE + hi Cursor ctermbg=15 ctermfg=232 cterm=NONE guibg=#FFFFFF guifg=#080808 gui=NONE + hi CursorColumn ctermbg=89 ctermfg=NONE cterm=NONE guibg=#87005F guifg=NONE gui=NONE + hi CursorLine ctermbg=236 ctermfg=NONE cterm=NONE guibg=#303030 guifg=NONE gui=NONE + hi CursorLineNr ctermbg=236 ctermfg=NONE cterm=NONE guibg=#303030 guifg=NONE gui=NONE + hi helpLeadBlank ctermbg=NONE ctermfg=NONE cterm=NONE guibg=NONE guifg=NONE gui=NONE + hi helpNormal ctermbg=NONE ctermfg=NONE cterm=NONE guibg=NONE guifg=NONE gui=NONE + hi Visual ctermbg=116 ctermfg=232 cterm=NONE guibg=#87D7D7 guifg=#080808 gui=NONE + hi VisualNOS ctermbg=133 ctermfg=232 cterm=NONE guibg=#AF5FAF guifg=#080808 gui=NONE + hi Pmenu ctermbg=186 ctermfg=232 cterm=NONE guibg=#DFDF87 guifg=#080808 gui=NONE + hi PmenuSbar ctermbg=142 ctermfg=186 cterm=NONE guibg=#AFAF00 guifg=#DFDF87 gui=NONE + hi PmenuSel ctermbg=133 ctermfg=232 cterm=NONE guibg=#AF5FAF guifg=#080808 gui=NONE + hi PmenuThumb ctermbg=133 ctermfg=133 cterm=NONE guibg=#AF5FAF guifg=#AF5FAF gui=NONE + hi FoldColumn ctermbg=NONE ctermfg=72 cterm=NONE guibg=NONE guifg=#5FAF87 gui=NONE + hi Folded ctermbg=NONE ctermfg=248 cterm=NONE guibg=NONE guifg=#A8A8A8 gui=NONE + hi WildMenu ctermbg=53 ctermfg=15 cterm=NONE guibg=#00005F guifg=#FFFFFF gui=NONE + hi SpecialKey ctermbg=NONE ctermfg=186 cterm=NONE guibg=NONE guifg=#DFDF87 gui=NONE + hi DiffAdd ctermbg=232 ctermfg=111 cterm=reverse guibg=#080808 guifg=#87afff gui=reverse + hi DiffChange ctermbg=232 ctermfg=188 cterm=reverse guibg=#080808 guifg=#dfdfdf gui=reverse + hi DiffDelete ctermbg=232 ctermfg=222 cterm=reverse guibg=#080808 guifg=#ffdf87 gui=reverse + hi DiffText ctermbg=232 ctermfg=145 cterm=reverse guibg=#080808 guifg=#afafaf gui=reverse + hi IncSearch ctermbg=232 ctermfg=133 cterm=reverse guibg=#080808 guifg=#AF5FAF gui=reverse + hi Search ctermbg=186 ctermfg=232 cterm=NONE guibg=#DFDF87 guifg=#080808 gui=NONE + hi Directory ctermbg=NONE ctermfg=72 cterm=NONE guibg=NONE guifg=#5FAF87 gui=NONE + hi MatchParen ctermbg=240 ctermfg=186 cterm=NONE guibg=#585858 guifg=#DFDF87 gui=NONE + hi SpellBad ctermbg=89 ctermfg=232 cterm=NONE guibg=#87005F guifg=#080808 gui=NONE guisp=#87005F + hi SpellCap ctermbg=72 ctermfg=232 cterm=NONE guibg=#5FAF87 guifg=#080808 gui=NONE guisp=#5FAF87 + hi SpellLocal ctermbg=142 ctermfg=232 cterm=NONE guibg=#AFAF00 guifg=#080808 gui=NONE guisp=#AFAF00 + hi SpellRare ctermbg=133 ctermfg=232 cterm=NONE guibg=#AF5FAF guifg=#080808 gui=NONE guisp=#AF5FAF + hi ColorColumn ctermbg=133 ctermfg=NONE cterm=NONE guibg=#AF5FAF guifg=NONE gui=NONE + hi signColumn ctermbg=NONE ctermfg=186 cterm=NONE guibg=NONE guifg=#DFDF87 gui=NONE + hi ErrorMsg ctermbg=89 ctermfg=15 cterm=NONE guibg=#87005F guifg=#FFFFFF gui=NONE + hi ModeMsg ctermbg=142 ctermfg=232 cterm=NONE guibg=#AFAF00 guifg=#080808 gui=NONE + hi MoreMsg ctermbg=NONE ctermfg=142 cterm=NONE guibg=NONE guifg=#AFAF00 gui=NONE + hi Question ctermbg=NONE ctermfg=72 cterm=NONE guibg=NONE guifg=#5FAF87 gui=NONE + hi WarningMsg ctermbg=168 ctermfg=232 cterm=NONE guibg=#D75F87 guifg=#080808 gui=NONE + hi QuickFixLine ctermbg=15 ctermfg=240 cterm=NONE guibg=#FFFFFF guifg=#585858 gui=NONE + +elseif &t_Co == 8 || $TERM !~# '^linux' || &t_Co == 16 + set t_Co=16 + + hi Normal ctermbg=black ctermfg=grey cterm=NONE + hi NonText ctermbg=NONE ctermfg=darkgrey cterm=NONE + hi Comment ctermbg=NONE ctermfg=darkgrey cterm=NONE + hi Constant ctermbg=NONE ctermfg=red cterm=NONE + hi Error ctermbg=white ctermfg=darkmagenta cterm=reverse + hi Identifier ctermbg=NONE ctermfg=darkred cterm=NONE + hi Ignore ctermbg=NONE ctermfg=NONE cterm=NONE + hi PreProc ctermbg=NONE ctermfg=yellow cterm=NONE + hi Special ctermbg=NONE ctermfg=white cterm=NONE + hi Statement ctermbg=NONE ctermfg=darkred cterm=NONE + hi String ctermbg=NONE ctermfg=darkyellow cterm=NONE + hi Todo ctermbg=NONE ctermfg=NONE cterm=reverse + hi Type ctermbg=NONE ctermfg=cyan cterm=NONE + hi Underlined ctermbg=NONE ctermfg=NONE cterm=underline + hi Number ctermbg=NONE ctermfg=red cterm=NONE + hi StatusLine ctermbg=white ctermfg=darkgrey cterm=NONE + hi StatusLineNC ctermbg=darkgrey ctermfg=white cterm=NONE + hi VertSplit ctermbg=darkgrey ctermfg=darkgrey cterm=NONE + hi TabLine ctermbg=darkgrey ctermfg=white cterm=NONE + hi TabLineFill ctermbg=darkgrey ctermfg=darkgrey cterm=NONE + hi TabLineSel ctermbg=white ctermfg=darkgrey cterm=NONE + hi Title ctermbg=NONE ctermfg=green cterm=NONE + hi LineNr ctermbg=NONE ctermfg=cyan cterm=NONE + hi Cursor ctermbg=white ctermfg=black cterm=NONE + hi CursorColumn ctermbg=darkmagenta ctermfg=NONE cterm=NONE + hi CursorLine ctermbg=black ctermfg=NONE cterm=NONE + hi CursorLineNr ctermbg=black ctermfg=NONE cterm=NONE + hi helpLeadBlank ctermbg=NONE ctermfg=NONE cterm=NONE + hi helpNormal ctermbg=NONE ctermfg=NONE cterm=NONE + hi Visual ctermbg=cyan ctermfg=black cterm=NONE + hi VisualNOS ctermbg=darkred ctermfg=black cterm=NONE + hi Pmenu ctermbg=yellow ctermfg=black cterm=NONE + hi PmenuSbar ctermbg=darkyellow ctermfg=yellow cterm=NONE + hi PmenuSel ctermbg=darkred ctermfg=black cterm=NONE + hi PmenuThumb ctermbg=darkred ctermfg=darkred cterm=NONE + hi FoldColumn ctermbg=NONE ctermfg=green cterm=NONE + hi Folded ctermbg=NONE ctermfg=grey cterm=NONE + hi WildMenu ctermbg=darkblue ctermfg=white cterm=NONE + hi SpecialKey ctermbg=NONE ctermfg=yellow cterm=NONE + hi DiffAdd ctermbg=black ctermfg=blue cterm=reverse + hi DiffChange ctermbg=black ctermfg=grey cterm=reverse + hi DiffDelete ctermbg=black ctermfg=yellow cterm=reverse + hi DiffText ctermbg=black ctermfg=darkgray cterm=reverse + hi IncSearch ctermbg=black ctermfg=darkred cterm=reverse + hi Search ctermbg=yellow ctermfg=black cterm=NONE + hi Directory ctermbg=NONE ctermfg=green cterm=NONE + hi MatchParen ctermbg=darkgrey ctermfg=yellow cterm=NONE + hi SpellBad ctermbg=darkmagenta ctermfg=black cterm=NONE + hi SpellCap ctermbg=green ctermfg=black cterm=NONE + hi SpellLocal ctermbg=darkyellow ctermfg=black cterm=NONE + hi SpellRare ctermbg=darkred ctermfg=black cterm=NONE + hi ColorColumn ctermbg=darkred ctermfg=NONE cterm=NONE + hi signColumn ctermbg=NONE ctermfg=yellow cterm=NONE + hi ErrorMsg ctermbg=darkmagenta ctermfg=white cterm=NONE + hi ModeMsg ctermbg=darkyellow ctermfg=black cterm=NONE + hi MoreMsg ctermbg=NONE ctermfg=darkyellow cterm=NONE + hi Question ctermbg=NONE ctermfg=green cterm=NONE + hi WarningMsg ctermbg=red ctermfg=black cterm=NONE + hi QuickFixLine ctermbg=white ctermfg=darkgrey cterm=NONE +endif + +hi link StatusLineTerm StatusLine +hi link StatusLineTermNC StatusLineNC + +let g:terminal_ansi_colors = [ + \ '#080808', + \ '#AF5FAF', + \ '#008700', + \ '#AFAF00', + \ '#00005F', + \ '#87005F', + \ '#87D7D7', + \ '#D0D0D0', + \ '#808080', + \ '#D75F87', + \ '#5FAF87', + \ '#DFDF87', + \ '#87D7D7', + \ '#D75F87', + \ '#87D7D7', + \ '#FFFFFF', + \ ] + +" Generated with RNB (https://gist.github.com/romainl/5cd2f4ec222805f49eca) diff --git a/vim/general.vim b/vim/general.vim new file mode 100644 index 0000000..d0ff70b --- /dev/null +++ b/vim/general.vim @@ -0,0 +1,139 @@ +" drop vi-compatibility +set nocompatible +" disable autocmd +set secure +" use utf8 only +set encoding=utf8 + +" file/directory matching +set wildmode=list:longest,full +" ignore case when completing +if exists('+wildignorecase') + set wildignorecase +endif +" ignorelist +set wildignore=*.o,*.d,*.so,*.class,*.aux,*.log,*.out,*.toc,*.pdf,*.pyc + +" increase command history +set history=1000 +" increase count of possible undos +set undolevels=1000 + +" encrypt buffers when saved to files +if exists('+cryptmethod') + set cryptmethod=blowfish +endif + +" enable fast terminal for tmux but not for ssh connection +if &term =~# '^screen' && !exists('SSH_CONNECTION') + set ttyfast +endif + +" enable automatic file detection, plugin and indention support +if has('autocmd') + filetype plugin indent on +endif + +" use utf8 encoding for all files and recognize latin1 +set fileencodings=utf-8,latin1 + +" use unix line-endings and recognize dos endings +set fileformats=unix,dos + +" tabs +set tabstop=4 +set shiftwidth=4 +set autoindent +set smartindent +set smarttab + +" allow backspacing over autoindent and line breaks +set backspace=indent,eol,start + +" already display matches while searching +set incsearch +" only check for case if the searched word contains a capital +set ignorecase +set smartcase +" highlight all matches. use to remove the highlights +set hlsearch + +" treat hyphenated words as a single word +set iskeyword+=- + +" syntax folding +if has('folding') + set foldmethod=syntax + " only use folding when there is enough space +" if &columns > 80 +" set foldcolumn=2 +" endif + set foldlevel=99 + + " dont open fold for block movements + set foldopen-=block +endif + +" allow buffers with changes to be hidden +set hidden + +" correct splitting +if has('vertsplit') + set splitright + set splitbelow +endif + +" Visual +" set text color for dark terminal background +set background=dark + +" activate syntax highlighting +if has('syntax') + syntax enable +endif + +" set colorscheme +colorscheme dichromatic + +" display line at which the current is positioned +if exists('+cursorline') + set cursorline + " remove line and make the line bold instead + highlight CursorLine term=bold cterm=bold + highlight CursorLineNR term=bold cterm=bold ctermbg=darkgrey +endif + +" display warning column at 81 and 121 +let &colorcolumn="81,121" +highlight ColorColumn ctermbg=235 guibg=#2d2d2d + +" display line numbers +set number + +" show cursor position all the time +set ruler + +" show vim tabs all the time +set showtabline=2 + +" show currently typed command +set showcmd + +" define characters to display when using 'set list' +set listchars=tab:→\ ,trail:∙,eol:¬,extends:❯,precedes:❮,nbsp:␣ + +" increase completion performance and reduce time until timeout +set updatetime=300 +set timeoutlen=500 + +" copy paste between vim and everything else +set clipboard=unnamedplus + +" Misc +set mouse=n + +" remove windows ^M when the encoding gets messed up +noremap m mmHmt:%s///ge'tzt'm + +" add convenience command for force-saving read-only files +cmap w!! w !sudo tee % diff --git a/vim/keybindings.vim b/vim/keybindings.vim new file mode 100644 index 0000000..b2ba8bc --- /dev/null +++ b/vim/keybindings.vim @@ -0,0 +1,16 @@ +" allow easier pane switching +nnoremap +nnoremap +nnoremap +nnoremap + +" allow easier pane resizing +nnoremap :resize -2 +nnoremap :resize +2 +nnoremap :vertical resize -2 +nnoremap :vertical resize +2 + +" use TAB to switch to next buffers +nnoremap :bnext +" use Shift-TAB to switch to previous buffers +nnoremap :bprevious diff --git a/vimrc b/vimrc index d2d7526..ce6afd3 100644 --- a/vimrc +++ b/vimrc @@ -1,4 +1,2 @@ -" use existing nvim configuration for vim -set runtimepath^=~/.config/nvim runtimepath+=~/.config/nvim/after -let &packpath = &runtimepath -source ~/.config/nvim/init.vim +source $HOME/.vim/general.vim +source $HOME/.vim/keybindings.vim From 6863d4c2ebfdd4b792ac0742fa619293ab17f9cc Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Thu, 13 Oct 2022 19:29:40 +0200 Subject: [PATCH 42/64] config: nvim: rewrite config in lua and use packer as plugin manager --- .gitignore | 2 +- config/nvim/general.vim | 127 -------------------------------- config/nvim/init.lua | 3 + config/nvim/init.vim | 4 - config/nvim/keybindings.vim | 20 ----- config/nvim/lsp.vim | 25 ------- config/nvim/lua/general.lua | 74 +++++++++++++++++++ config/nvim/lua/keybindings.lua | 5 ++ config/nvim/lua/plugins.lua | 61 +++++++++++++++ config/nvim/lua/utils.lua | 30 ++++++++ config/nvim/plugins.vim | 20 ----- 11 files changed, 174 insertions(+), 197 deletions(-) delete mode 100644 config/nvim/general.vim create mode 100644 config/nvim/init.lua delete mode 100644 config/nvim/init.vim delete mode 100644 config/nvim/keybindings.vim delete mode 100644 config/nvim/lsp.vim create mode 100644 config/nvim/lua/general.lua create mode 100644 config/nvim/lua/keybindings.lua create mode 100644 config/nvim/lua/plugins.lua create mode 100644 config/nvim/lua/utils.lua delete mode 100644 config/nvim/plugins.vim diff --git a/.gitignore b/.gitignore index ad6f6c6..f1895c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ zsh/zsh_history zsh/cache -config/nvim/autoload +config/nvim/plugin diff --git a/config/nvim/general.vim b/config/nvim/general.vim deleted file mode 100644 index ce3cc5a..0000000 --- a/config/nvim/general.vim +++ /dev/null @@ -1,127 +0,0 @@ -" disable autocmd -set secure - -" file/directory matching -set wildmode=list:longest,full -" ignore case when completing -if exists('+wildignorecase') - set wildignorecase -endif -" ignorelist -set wildignore=*.o,*.d,*.so,*.class,*.aux,*.log,*.out,*.toc,*.pdf,*.pyc - -" increase command history -set history=1000 -" increase count of possible undos -set undolevels=1000 - -" use unix line-endings and recognize dos endings -set fileformats=unix,dos - -" tabs -set tabstop=4 -set shiftwidth=4 -set autoindent -set smartindent -set smarttab - -" allow backspacing over autoindent and line breaks -set backspace=indent,eol,start - -" already display matches while searching -set incsearch -" only check for case if the searched word contains a capital -set ignorecase -set smartcase -" highlight all matches. use to remove the highlights -set hlsearch - -" treat hyphenated words as a single word -set iskeyword+=- - -" syntax folding -if has('folding') - set foldmethod=syntax - " only use folding when there is enough space -" if &columns > 80 -" set foldcolumn=2 -" endif - set foldlevel=99 - - " dont open fold for block movements - set foldopen-=block -endif - -" allow buffers with changes to be hidden -set hidden - -" correct splitting -if has('vertsplit') - set splitright - set splitbelow -endif - -" Visual -" set text color for dark terminal background -set background=dark - -" activate syntax highlighting -if has('syntax') - syntax enable -endif - -" set colorscheme -colorscheme dichromatic -" TODO: use `colorscheme ron` as fallback? - -" display line at which the current is positioned -if exists('+cursorline') - set cursorline - " remove line and make the line bold instead - highlight CursorLine term=bold cterm=bold - highlight CursorLineNR term=bold cterm=bold ctermbg=darkgrey -endif - -" display warning column at 81 and 121 -let &colorcolumn="81,121" -highlight ColorColumn ctermbg=235 guibg=#2d2d2d - -" display line numbers -set number - -" show cursor position all the time -set ruler - -" show vim tabs all the time -set showtabline=2 - -" show currently typed command -set showcmd - -" define characters to display when using 'set list' -set listchars=tab:→\ ,trail:∙,eol:¬,extends:❯,precedes:❮,nbsp:␣ - -" enable nvim-colorizer -if has('nvim') - set termguicolors - lua require'colorizer'.setup() -endif - -" increase completion performance and reduce time until timeout -set updatetime=300 -set timeoutlen=500 - -" copy paste between vim and everything else -set clipboard=unnamedplus - -" Misc -set mouse=n - -" remove windows ^M when the encoding gets messed up -noremap m mmHmt:%s///ge'tzt'm - -" autoreload vimrc when writing init.vim -au! BufWritePost $MYVIMRC source % - -" add convenience command for force-saving read-only files -cmap w!! w !sudo tee % diff --git a/config/nvim/init.lua b/config/nvim/init.lua new file mode 100644 index 0000000..dbfc04f --- /dev/null +++ b/config/nvim/init.lua @@ -0,0 +1,3 @@ +require('general') +require('keybindings') +require('plugins') diff --git a/config/nvim/init.vim b/config/nvim/init.vim deleted file mode 100644 index aa92ce6..0000000 --- a/config/nvim/init.vim +++ /dev/null @@ -1,4 +0,0 @@ -source $HOME/.config/nvim/plugins.vim -source $HOME/.config/nvim/general.vim -source $HOME/.config/nvim/keybindings.vim -source $HOME/.config/nvim/lsp.vim diff --git a/config/nvim/keybindings.vim b/config/nvim/keybindings.vim deleted file mode 100644 index 3b2fe66..0000000 --- a/config/nvim/keybindings.vim +++ /dev/null @@ -1,20 +0,0 @@ -" allow easier pane switching -nnoremap -nnoremap -nnoremap -nnoremap - -" allow easier pane resizing -nnoremap :resize -2 -nnoremap :resize +2 -nnoremap :vertical resize -2 -nnoremap :vertical resize +2 - -" use TAB to switch to next buffers -nnoremap :bnext -" use Shift-TAB to switch to previous buffers -nnoremap :bprevious - -" use TAB for completion -inoremap pumvisible() ? "\" : "\" -inoremap pumvisible() ? "\" : "\" diff --git a/config/nvim/lsp.vim b/config/nvim/lsp.vim deleted file mode 100644 index f91d667..0000000 --- a/config/nvim/lsp.vim +++ /dev/null @@ -1,25 +0,0 @@ -" lsp-config -if has('nvim') - nnoremap gd lua vim.lsp.buf.definition() - nnoremap gD lua vim.lsp.buf.declaration() - nnoremap gr lua vim.lsp.buf.references() - nnoremap gi lua vim.lsp.buf.implementation() - nnoremap K lua vim.lsp.buf.hover() - nnoremap lua vim.lsp.buf.signature_help() - nnoremap lua vim.lsp.buf.rename() - nnoremap lua vim.lsp.diagnostic.goto_prev() - nnoremap lua vim.lsp.diagnostic.goto_next() - - " auto-format - autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100) - autocmd BufWritePre *.jsx lua vim.lsp.buf.formatting_sync(nil, 100) - autocmd BufWritePre *.py lua vim.lsp.buf.formatting_sync(nil, 100) - - " setup lsp-providers - " (-> need to be installed manually first and then added here) - lua require'lspconfig'.ccls.setup{} - lua require'lspconfig'.clangd.setup{} - lua require'lspconfig'.pyright.setup{} - lua require'lspconfig'.bashls.setup{} - lua require'lspconfig'.gopls.setup{} -endif diff --git a/config/nvim/lua/general.lua b/config/nvim/lua/general.lua new file mode 100644 index 0000000..42b3c8a --- /dev/null +++ b/config/nvim/lua/general.lua @@ -0,0 +1,74 @@ +-- reduce boilerplate by defining some shortcuts +local opt = vim.opt +local cmd = vim.cmd +local autocmd = vim.api.nvim_create_autocmd + +-------------------- +-- General +-------------------- +opt.mouse = 'n' -- enable mouse support in normal mode +opt.clipboard = 'unnamedplus' -- copy/paste to and from system clipboard + +opt.wildmode = 'list:longest,full' +opt.wildignorecase = true +opt.wildignore = '*.o,*.d,*.so,*.class,*.aux,*.log,*.out,*.toc,*.pdf,*.pyc' + +opt.fileformats = 'unix,dos' -- use identical lineendings for all platforms +opt.secure = true -- disable autocmd for security reasons + +-------------------- +-- Tabs +-------------------- +opt.tabstop = 4 -- 1 tab == N spaces +opt.shiftwidth = 4 -- shift N spaces when pressing tab +opt.smartindent = true -- take syntax into account for applying indentation + +-------------------- +-- Search +-------------------- +opt.ignorecase = true -- ignore capitalization on search +opt.smartcase = true -- ignore capitalication unless word contains a capital + +opt.iskeyword:append '-' -- treat hyphenated words as a single word + +-------------------- +-- Neovim UI +-------------------- +opt.number = true -- line numbers +opt.ruler = true -- cursor position in statusbar +opt.showtabline = 2 -- always show vim tabs +opt.showcmd = true -- display currently typed command +opt.termguicolors = true -- enable 24-bit RGB color + +-- highlight line at which the cursor is positioned +opt.cursorline = true +cmd 'highlight CursorLine term=bold cterm=bold' +cmd 'highlight CursorLineNR term=bold cterm=bold ctermbg=darkgrey' + +-- display warning column at 81 and 121 +opt.colorcolumn = '81,121' +cmd 'highlight ColorColumn ctermbg=235 guibg=#2d2d2d' + +opt.splitright = true -- horizontal split to the right +opt.splitbelow = true -- vertical split to the bottom + +-- define characters to display when using 'set list' +opt.listchars = 'tab:→ ,trail:∙,eol:¬,extends:❯,precedes:❮,nbsp:␣' + +-------------------- +-- Performance +-------------------- +opt.hidden = true -- allow buffers with changes to be hidden +opt.updatetime = 300 -- delay (in ms) to wait before triggering event +opt.timeoutlen = 500 -- time (in ms) to wait for event to complete +opt.history = 10000 -- remember N lines of history + +-------------------- +-- Misc +-------------------- + +-- remove redundant whitespaces on save +autocmd('BufWritePre', { + pattern = '*', + command = ':%s/\\s\\+$//e' +}) diff --git a/config/nvim/lua/keybindings.lua b/config/nvim/lua/keybindings.lua new file mode 100644 index 0000000..ac354e5 --- /dev/null +++ b/config/nvim/lua/keybindings.lua @@ -0,0 +1,5 @@ +local map = require('utils').map -- import map + +-- allow switching between buffers using tab and Shift-tab +map('n', '', ':bnext') +map('n', '', ':bprevious') diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua new file mode 100644 index 0000000..01bab71 --- /dev/null +++ b/config/nvim/lua/plugins.lua @@ -0,0 +1,61 @@ +-------------------- +-- Packer Bootstrap +-------------------- +local packer_installed, _ = pcall(require, 'packer') +local packer_bootstrap = false +if (not packer_installed) then + -- ask user whether packer should be bootstrapped + packer_bootstrap = require('utils').prompt( + 'Plugin manager packer not found. Install it now?', + 'Bootstrapping packer now...', + 'Skipping setup of packer and plugins.') + + if (not packer_bootstrap) then + return + end + + -- perform actual bootstrap + local fn = vim.fn + local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' + fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) + vim.cmd('packadd packer.nvim') +end + +-- helper function to be used `config` parameter of packer's use to externalize +-- plugin configuration, expects the name of the config file +function load_config(name) + return string.format('require("plugins/%s")', name) +end + +return require('packer').startup({ + function(use) + use 'wbthomason/packer.nvim' + + -------------------- + -- Visuals + -------------------- + use { -- colorblind-friendly colorscheme + 'romainl/vim-dichromatic', + config = function() vim.cmd('colorscheme dichromatic') end, + } + use { -- color highlighter + 'norcalli/nvim-colorizer.lua', + config = function() require('colorizer').setup() end, + } + + -- Automatically set up your configuration after cloning packer.nvim + -- Put this at the end after all plugins + if packer_bootstrap then + require('packer').sync() + end + end, + config = { + display = { + open_fn = require("packer.util").float, + }, + profile = { + enable = true, + threshold = 1, -- the amount in ms that a plugins load time must be over for it to be included in the profile + }, + }, +}) diff --git a/config/nvim/lua/utils.lua b/config/nvim/lua/utils.lua new file mode 100644 index 0000000..292c148 --- /dev/null +++ b/config/nvim/lua/utils.lua @@ -0,0 +1,30 @@ +local M = {} + +-- keybinding mapper +function M.map(mode, lhs, rhs, opts) + local options = { noremap = true, silent = true } + if opts then + options = vim.tbl_extend('force', options, opts) + end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) +end + +-- simple prompt +function M.prompt(msg, accept_msg, deny_msg) + local answer = vim.fn.input(msg .. ' (YES/no) ') + while(true) do + -- clear vim cmdline before printing anything + vim.cmd('mode') + if answer == 'YES' then + print(accept_msg) + return true + elseif string.lower(answer) == 'no' then + print(deny_msg) + return false + end + -- re-request user input + answer = vim.fn.input('Please retry: ' .. msg .. ' (YES/no) ') + end +end + +return M diff --git a/config/nvim/plugins.vim b/config/nvim/plugins.vim deleted file mode 100644 index 7438321..0000000 --- a/config/nvim/plugins.vim +++ /dev/null @@ -1,20 +0,0 @@ -" warn if vim-plug is not available -if empty(glob('~/.config/nvim/autoload/plug.vim')) - echom "Install https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - \ to ~/.config/nvim/autoload/plug.vim" -endif - -call plug#begin('~/.config/nvim/autoload/plugged') - -" vim colortheme for colorblind -Plug 'romainl/vim-dichromatic' - -" only for nvim! -if has('nvim') - " language server protocol support - Plug 'neovim/nvim-lspconfig' - " colorizes colorcodes - Plug 'norcalli/nvim-colorizer.lua' -endif - -call plug#end() From f113cff6c2bf93761e9b7b2475e91b6fdd37b929 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sat, 15 Oct 2022 19:10:10 +0200 Subject: [PATCH 43/64] config: nvim: add basic autocompletion and snippet collection --- config/nvim/lua/plugins.lua | 47 ++++++++++++++ config/nvim/lua/plugins/friendly-snippets.lua | 1 + config/nvim/lua/plugins/nvim-cmp.lua | 61 +++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 config/nvim/lua/plugins/friendly-snippets.lua create mode 100644 config/nvim/lua/plugins/nvim-cmp.lua diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 01bab71..1f0a698 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -43,6 +43,53 @@ return require('packer').startup({ config = function() require('colorizer').setup() end, } + -------------------- + -- Snippets + -------------------- + use { -- snippet engine + 'L3MON4D3/LuaSnip', + requires = { + 'saadparwaiz1/cmp_luasnip', + 'rafamadriz/friendly-snippets', + }, + } + use { -- various snippets + 'rafamadriz/friendly-snippets', + after = { 'LuaSnip' }, + config = load_config('friendly-snippets'), + } + + -------------------- + -- Completion + -------------------- + use { -- nvim-cmp source for LuaSnip + 'saadparwaiz1/cmp_luasnip', + requires = { 'hrsh7th/nvim-cmp' }, + after = { 'LuaSnip' }, + } + use { -- nvim-cmp source for buffer words + 'hrsh7th/cmp-buffer', + requires = { 'hrsh7th/nvim-cmp' }, + } + use { -- nvim-cmp source for filesystem paths + 'hrsh7th/cmp-path', + requires = { 'hrsh7th/nvim-cmp' }, + } + use { -- nvim-cmp source for vim's cmdline + 'hrsh7th/cmp-cmdline', + requires = { 'hrsh7th/nvim-cmp' }, + } + use { -- completion engine + 'hrsh7th/nvim-cmp', + after = { + 'cmp-buffer', + 'cmp-path', + 'cmp-cmdline', + 'cmp_luasnip' + }, + config = load_config('nvim-cmp'), + } + -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins if packer_bootstrap then diff --git a/config/nvim/lua/plugins/friendly-snippets.lua b/config/nvim/lua/plugins/friendly-snippets.lua new file mode 100644 index 0000000..e62dc5a --- /dev/null +++ b/config/nvim/lua/plugins/friendly-snippets.lua @@ -0,0 +1 @@ +require('luasnip.loaders.from_vscode').lazy_load() diff --git a/config/nvim/lua/plugins/nvim-cmp.lua b/config/nvim/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..b4b5ef4 --- /dev/null +++ b/config/nvim/lua/plugins/nvim-cmp.lua @@ -0,0 +1,61 @@ +vim.opt.completeopt = 'menu,menuone,noselect' +-- make 'kind' readable with dichromatic colorscheme +vim.cmd('highlight! CmpItemKindDefault guibg=NONE guifg=#000000') + +local cmp = require('cmp') +cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + formatting = { + format = function(entry, vim_item) + vim_item.menu = ({ + buffer = '[Buffer]', + luasnip = '[Snippet]', + })[entry.source.name] + return vim_item + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp', keyword_length = 3 }, + { name = 'luasnip', keyword_length = 2 }, + }, { + { name = 'buffer', keyword_length = 3 }, + }) +}) + +-- configure completion for specific filetype +cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'buffer' }, + }), +}) + +-- use buffer source for `/` and `?` (if you enabled `native_menu`, this won't +-- work anymore) +cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + }, +}) + +-- use cmdline & path source for ':' (if you enabled `native_menu`, this won't +-- work anymore). +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }), +}) From 2b78050f5ff3163ec308bc443735441f03646d43 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sat, 15 Oct 2022 22:55:48 +0200 Subject: [PATCH 44/64] config: nvim: redefine leader key to space --- config/nvim/lua/keybindings.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/nvim/lua/keybindings.lua b/config/nvim/lua/keybindings.lua index ac354e5..0b0dc5a 100644 --- a/config/nvim/lua/keybindings.lua +++ b/config/nvim/lua/keybindings.lua @@ -1,5 +1,8 @@ local map = require('utils').map -- import map +-- redefine leader key +vim.g.mapleader = ' ' + -- allow switching between buffers using tab and Shift-tab map('n', '', ':bnext') map('n', '', ':bprevious') From ab5cceddab539d17de92ef53f3f9f74e54d57d0e Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 16 Oct 2022 22:07:40 +0200 Subject: [PATCH 45/64] config: nvim: use colorscheme dark_colorblind from github-nvim-theme The currently used colorscheme 'vim-dichromatic' is missing support for various neovim plugins. --- config/nvim/lua/plugins.lua | 4 ++-- config/nvim/lua/plugins/github-nvim-theme.lua | 4 ++++ config/nvim/lua/plugins/nvim-cmp.lua | 2 -- 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 config/nvim/lua/plugins/github-nvim-theme.lua diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 1f0a698..badad52 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -35,8 +35,8 @@ return require('packer').startup({ -- Visuals -------------------- use { -- colorblind-friendly colorscheme - 'romainl/vim-dichromatic', - config = function() vim.cmd('colorscheme dichromatic') end, + 'projekt0n/github-nvim-theme', + config = load_config('github-nvim-theme'), } use { -- color highlighter 'norcalli/nvim-colorizer.lua', diff --git a/config/nvim/lua/plugins/github-nvim-theme.lua b/config/nvim/lua/plugins/github-nvim-theme.lua new file mode 100644 index 0000000..4aedc02 --- /dev/null +++ b/config/nvim/lua/plugins/github-nvim-theme.lua @@ -0,0 +1,4 @@ +require('github-theme').setup({ + theme_style = 'dark_colorblind', + transparent = true, +}) diff --git a/config/nvim/lua/plugins/nvim-cmp.lua b/config/nvim/lua/plugins/nvim-cmp.lua index b4b5ef4..c2ff668 100644 --- a/config/nvim/lua/plugins/nvim-cmp.lua +++ b/config/nvim/lua/plugins/nvim-cmp.lua @@ -1,6 +1,4 @@ vim.opt.completeopt = 'menu,menuone,noselect' --- make 'kind' readable with dichromatic colorscheme -vim.cmd('highlight! CmpItemKindDefault guibg=NONE guifg=#000000') local cmp = require('cmp') cmp.setup({ From c058fa22eae9216153ff77787eaeeabae01a01ce Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 16 Oct 2022 22:38:02 +0200 Subject: [PATCH 46/64] config: nvim: add LSP support together with mason package manager --- config/nvim/lua/plugins.lua | 37 +++++++++++++++++++++++++++ config/nvim/lua/plugins/lspconfig.lua | 24 +++++++++++++++++ config/nvim/lua/plugins/mason.lua | 9 +++++++ config/nvim/lua/plugins/nvim-cmp.lua | 1 + 4 files changed, 71 insertions(+) create mode 100644 config/nvim/lua/plugins/lspconfig.lua create mode 100644 config/nvim/lua/plugins/mason.lua diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index badad52..451ebe4 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -43,6 +43,38 @@ return require('packer').startup({ config = function() require('colorizer').setup() end, } + -------------------- + -- Package Manager + -------------------- + use { -- portable package manager + 'williamboman/mason.nvim', + config = load_config('mason'), + } + use { -- update helper for mason + 'WhoIsSethDaniel/mason-tool-installer.nvim', + after = { 'mason.nvim' }, + config = function() require('mason-tool-installer').setup({}) end, + } + + -------------------- + -- LSP Setup + -------------------- + use { -- compatibility layer between mason and lspconfig + autoinstaller + 'williamboman/mason-lspconfig.nvim', + after = { 'mason.nvim' }, + requires = { + 'neovim/nvim-lspconfig', + }, + } + use { -- configuration layer for neovim LSP client + 'neovim/nvim-lspconfig', + after = { + 'mason-lspconfig.nvim', + 'cmp-nvim-lsp', + }, + config = load_config('lspconfig'), + } + -------------------- -- Snippets -------------------- @@ -62,6 +94,10 @@ return require('packer').startup({ -------------------- -- Completion -------------------- + use { -- nvim-cmp source for nvim-lsp + 'hrsh7th/cmp-nvim-lsp', + requires = { 'hrsh7th/nvim-cmp' }, + } use { -- nvim-cmp source for LuaSnip 'saadparwaiz1/cmp_luasnip', requires = { 'hrsh7th/nvim-cmp' }, @@ -82,6 +118,7 @@ return require('packer').startup({ use { -- completion engine 'hrsh7th/nvim-cmp', after = { + 'cmp-nvim-lsp', 'cmp-buffer', 'cmp-path', 'cmp-cmdline', diff --git a/config/nvim/lua/plugins/lspconfig.lua b/config/nvim/lua/plugins/lspconfig.lua new file mode 100644 index 0000000..e2418e1 --- /dev/null +++ b/config/nvim/lua/plugins/lspconfig.lua @@ -0,0 +1,24 @@ +local map = require('utils').map -- import map + +require('mason-lspconfig').setup() +require('mason-lspconfig').setup_handlers({ + function(server_name) -- default handler + -- prepare nvim-cmp source + local capabilities = require('cmp_nvim_lsp').default_capabilities() + require('lspconfig')[server_name].setup({ + -- announce nvim-cmp-lsp capabilities to each lsp server + capabilities = capabilities + }) + end +}) + +-- lsp keybindings +map('n', 'gd', 'lua vim.lsp.buf.definition()') +map('n', 'gD', 'lua vim.lsp.buf.declaration()') +map('n', 'K', 'lua vim.lsp.buf.hover()') +map('n', 'gi', 'lua vim.lsp.buf.implementation()') +map('n', 'gr', 'lua vim.lsp.buf.references()') +map('n', '', 'lua vim.lsp.buf.signature_help()') +map('n', 'rn', 'lua vim.lsp.buf.rename()') +map('n', 'ca', 'lua vim.lsp.buf.code_action()') +map('n', 'f', 'lua vim.lsp.buf.type_definition({ async = true })') diff --git a/config/nvim/lua/plugins/mason.lua b/config/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..eba961c --- /dev/null +++ b/config/nvim/lua/plugins/mason.lua @@ -0,0 +1,9 @@ +require('mason').setup({ + ui = { + icons = { + package_installed = '✓', + package_pending = '➜', + package_uninstalled = '✗', + }, + }, +}) diff --git a/config/nvim/lua/plugins/nvim-cmp.lua b/config/nvim/lua/plugins/nvim-cmp.lua index c2ff668..0f3dff8 100644 --- a/config/nvim/lua/plugins/nvim-cmp.lua +++ b/config/nvim/lua/plugins/nvim-cmp.lua @@ -10,6 +10,7 @@ cmp.setup({ formatting = { format = function(entry, vim_item) vim_item.menu = ({ + nvim_lsp = '[LSP]', buffer = '[Buffer]', luasnip = '[Snippet]', })[entry.source.name] From 2c72b7c8ddaf61533ae92f178604e3c62ee94779 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 16 Oct 2022 22:41:38 +0200 Subject: [PATCH 47/64] config: nvim: add linter/formatter support --- config/nvim/lua/plugins.lua | 17 +++++++++++++++++ config/nvim/lua/plugins/null-ls.lua | 2 ++ 2 files changed, 19 insertions(+) create mode 100644 config/nvim/lua/plugins/null-ls.lua diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 451ebe4..6d1e635 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -75,6 +75,23 @@ return require('packer').startup({ config = load_config('lspconfig'), } + -------------------- + -- Linter/Formatter + -------------------- + use { -- linter and formatter manager + 'jose-elias-alvarez/null-ls.nvim', + after = { + 'mason.nvim', + 'plenary.nvim', + }, + requires = { 'nvim-lua/plenary.nvim' }, + } + use { -- compatibility layer between mason and null-ls + 'jayp0521/mason-null-ls.nvim', + after = { 'null-ls.nvim' }, + config = load_config('null-ls') + } + -------------------- -- Snippets -------------------- diff --git a/config/nvim/lua/plugins/null-ls.lua b/config/nvim/lua/plugins/null-ls.lua new file mode 100644 index 0000000..7d41884 --- /dev/null +++ b/config/nvim/lua/plugins/null-ls.lua @@ -0,0 +1,2 @@ +require('null-ls').setup() +require('mason-null-ls').setup() From d7def752afa2779e605660649ac99f167f8b6297 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 16 Oct 2022 22:12:49 +0200 Subject: [PATCH 48/64] config: nvim: use 'rounded' border for packer and nvim-cmp --- config/nvim/lua/plugins.lua | 4 +++- config/nvim/lua/plugins/nvim-cmp.lua | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 6d1e635..990e23f 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -152,7 +152,9 @@ return require('packer').startup({ end, config = { display = { - open_fn = require("packer.util").float, + open_fn = function() + return require('packer.util').float({ border = 'rounded' }) + end, }, profile = { enable = true, diff --git a/config/nvim/lua/plugins/nvim-cmp.lua b/config/nvim/lua/plugins/nvim-cmp.lua index 0f3dff8..dfa44b7 100644 --- a/config/nvim/lua/plugins/nvim-cmp.lua +++ b/config/nvim/lua/plugins/nvim-cmp.lua @@ -17,6 +17,10 @@ cmp.setup({ return vim_item end, }, + window = { + completion = cmp.config.window.bordered({ border = 'rounded' }), + documentation = cmp.config.window.bordered({ border = 'rounded' }), + }, mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), From 05f3e283dbcd525d0f80352a90a76b27d4109f2a Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Mon, 17 Oct 2022 20:16:19 +0200 Subject: [PATCH 49/64] config: nvim: add telescope as fuzzy finder --- config/nvim/lua/plugins.lua | 9 +++++++++ config/nvim/lua/plugins/telescope.lua | 7 +++++++ 2 files changed, 16 insertions(+) create mode 100644 config/nvim/lua/plugins/telescope.lua diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 990e23f..29cdd27 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -144,6 +144,15 @@ return require('packer').startup({ config = load_config('nvim-cmp'), } + -------------------- + -- Misc Utilities + -------------------- + use { -- fuzzy finder + 'nvim-telescope/telescope.nvim', + config = load_config('telescope'), + requires = {'nvim-lua/plenary.nvim'}, + } + -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins if packer_bootstrap then diff --git a/config/nvim/lua/plugins/telescope.lua b/config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..b549b98 --- /dev/null +++ b/config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,7 @@ +local map = require('utils').map -- import map + +-- telescope keybindings +map('n', 'ff', 'Telescope find_files') +map('n', 'fg', 'Telescope live_grep') +map('n', 'fb', 'Telescope buffers') +map('n', 'fh', 'Telescope help_tags') From 0bcdd60bb3dfa14e25cc0e383fea83a826b98d8a Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sat, 29 Oct 2022 19:12:54 +0200 Subject: [PATCH 50/64] config: nvim: cleanup wildignore --- config/nvim/lua/general.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/config/nvim/lua/general.lua b/config/nvim/lua/general.lua index 42b3c8a..58269a5 100644 --- a/config/nvim/lua/general.lua +++ b/config/nvim/lua/general.lua @@ -11,7 +11,14 @@ opt.clipboard = 'unnamedplus' -- copy/paste to and from system clipboard opt.wildmode = 'list:longest,full' opt.wildignorecase = true -opt.wildignore = '*.o,*.d,*.so,*.class,*.aux,*.log,*.out,*.toc,*.pdf,*.pyc' +-- ignore C/C++ objects and other build files +opt.wildignore = '*.o,*.d,*.so,*.out' +-- ignore java classes +opt.wildignore:append '*.class' +-- ignore python cache files +opt.wildignore:append '*.pyc' +-- ignore tex-related build files +opt.wildignore:append '*.aux,*.bcf,*.lof,*.lol,*.lot,*.rubbercache,*.toc,*.pdf' opt.fileformats = 'unix,dos' -- use identical lineendings for all platforms opt.secure = true -- disable autocmd for security reasons From 53f83393dc3d43b0617bbc3bdea773e3410faefe Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sat, 29 Oct 2022 19:14:15 +0200 Subject: [PATCH 51/64] config: nvim: nvim-cmp: consider all buffers as completion sources --- config/nvim/lua/plugins/nvim-cmp.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/config/nvim/lua/plugins/nvim-cmp.lua b/config/nvim/lua/plugins/nvim-cmp.lua index dfa44b7..af95a84 100644 --- a/config/nvim/lua/plugins/nvim-cmp.lua +++ b/config/nvim/lua/plugins/nvim-cmp.lua @@ -32,7 +32,15 @@ cmp.setup({ { name = 'nvim_lsp', keyword_length = 3 }, { name = 'luasnip', keyword_length = 2 }, }, { - { name = 'buffer', keyword_length = 3 }, + { + name = 'buffer', + keyword_length = 3, + option = { + get_bufnrs = function() + return vim.api.nvim_list_bufs() + end, + }, + }, }) }) From 7a52f633f4e419af44faf5df2d9e8613289f170b Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Thu, 30 Mar 2023 20:13:15 +0200 Subject: [PATCH 52/64] zsh: split matcher into smaller matchers to fix matching Starting with zsh version 5.9, the completion behavior changed slightly (potentially due to the changed behavior of zstyle). As a result, The matching was broken for directories with the same prefix followed by a minus and further text (e.g. test-cut, test-bar). --- zsh/completion.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zsh/completion.zsh b/zsh/completion.zsh index 91e87f6..2f38e37 100644 --- a/zsh/completion.zsh +++ b/zsh/completion.zsh @@ -51,7 +51,9 @@ zstyle ':completion:::::' completer \ #TODO: keep _prefix or not? # ignore case when trying to match typed characters -zstyle ':completion:*:(^approximate):*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' +zstyle ':completion:*:(^approximate):*' matcher-list 'm:{[:lower:]}={[:upper:]}' \ + '+m:{[:upper:]}={[:lower:]}' \ + '+m:{-_}={_-}' # allow one mistake per three characters zstyle -e ':completion:*:approximate:*' max-errors \ From dad208c7baaf16bf9646985ea8202524f0e53218 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Thu, 30 Mar 2023 20:24:35 +0200 Subject: [PATCH 53/64] show failed login attempts for i3lock --- config/i3/config | 2 +- xinitrc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/i3/config b/config/i3/config index 2c6685b..8b5ec6a 100644 --- a/config/i3/config +++ b/config/i3/config @@ -139,7 +139,7 @@ bindsym $mod+Alt+c reload # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) bindsym $mod+Shift+r restart # exit i3 (logs you out of your X session) -bindsym $mod+q exec i3lock +bindsym $mod+q exec i3lock --nofork --show-failed-attempts bindsym $mod+Shift+q exit # resize window (you can also use the mouse for that) diff --git a/xinitrc b/xinitrc index 902fd61..6c8f23f 100755 --- a/xinitrc +++ b/xinitrc @@ -29,7 +29,7 @@ if type "udiskie" >/dev/null 2>&1; then fi # autolock on suspend -xss-lock -- i3lock --nofork & +xss-lock -- i3lock --nofork --show-failed-attempts & # autolock after 5 minutes of inactivity xset s 300 From 99f0c2df2d5b09d10d1d1f9acc3c11ee3fb4abff Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Thu, 30 Mar 2023 20:46:15 +0200 Subject: [PATCH 54/64] zsh: cleanup ignored-patterns for vim --- zsh/completion.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zsh/completion.zsh b/zsh/completion.zsh index 2f38e37..65140ab 100644 --- a/zsh/completion.zsh +++ b/zsh/completion.zsh @@ -109,10 +109,10 @@ zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z- # do not complete unwanted files with vim zstyle ':completion:*:*:*vim:*:globbed-files' ignored-patterns \ - '*.aux' '*.log' '*.pdf' '*.ps' '*.bbl' '*.blg' '*.out' '*-blx.bib' '*.run.xml' '*.dvi' \ - '*.o' \ - '*.pyc' \ - '*.class' + '*.o' '*.so' '*.out' \ + '*.class' \ + '*.pyc' \ + '*.aux' '*.bbl' '*.bcf' '*.blg' '*.lof' '*.lol' '*.lot' '*.pdf' '*.rubbercache' '*.run.xml' '*.toc' '*.pdf' '*.dvi' # only complete *.pdf with katarakt zstyle ':completion:*:*:katarakt:*:*' file-patterns '*.pdf *(-/)' From 355ae60ac35cd30ae2beaad434bd73f7ba2f75a5 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Thu, 30 Mar 2023 20:48:34 +0200 Subject: [PATCH 55/64] config: nvim: wildignore -= ".d" to allow completion of respectively suffixed directories --- config/nvim/lua/general.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/nvim/lua/general.lua b/config/nvim/lua/general.lua index 58269a5..162e26f 100644 --- a/config/nvim/lua/general.lua +++ b/config/nvim/lua/general.lua @@ -12,7 +12,7 @@ opt.clipboard = 'unnamedplus' -- copy/paste to and from system clipboard opt.wildmode = 'list:longest,full' opt.wildignorecase = true -- ignore C/C++ objects and other build files -opt.wildignore = '*.o,*.d,*.so,*.out' +opt.wildignore = '*.o,*.so,*.out' -- ignore java classes opt.wildignore:append '*.class' -- ignore python cache files From b56aecc78d5381613d36a40a56a4418379a38034 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Thu, 30 Mar 2023 23:08:18 +0200 Subject: [PATCH 56/64] config: nvim: require explicit selection to confirm completed itme --- config/nvim/lua/plugins/nvim-cmp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/nvim/lua/plugins/nvim-cmp.lua b/config/nvim/lua/plugins/nvim-cmp.lua index af95a84..fb69f7f 100644 --- a/config/nvim/lua/plugins/nvim-cmp.lua +++ b/config/nvim/lua/plugins/nvim-cmp.lua @@ -26,7 +26,7 @@ cmp.setup({ [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }), sources = cmp.config.sources({ { name = 'nvim_lsp', keyword_length = 3 }, From e359380b157b2435e4dfa8f8750f203c14a01a5a Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Thu, 30 Mar 2023 23:10:31 +0200 Subject: [PATCH 57/64] config: nvim: configure cmp-path to disable trailing slashes --- config/nvim/lua/plugins/nvim-cmp.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/nvim/lua/plugins/nvim-cmp.lua b/config/nvim/lua/plugins/nvim-cmp.lua index fb69f7f..a8adbf8 100644 --- a/config/nvim/lua/plugins/nvim-cmp.lua +++ b/config/nvim/lua/plugins/nvim-cmp.lua @@ -65,7 +65,13 @@ cmp.setup.cmdline({ '/', '?' }, { cmp.setup.cmdline(':', { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ - { name = 'path' } + { + name = 'path', + option = { + trailing_slash = false, + label_trailing_slash = false, + } + } }, { { name = 'cmdline' } }), From bf09d09da0eb5917f1afe7dbc5d12465c8c7976b Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Thu, 11 May 2023 09:14:17 +0200 Subject: [PATCH 58/64] Xresources: add oxygen --- Xresources | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Xresources b/Xresources index c2a8ea2..116ceb7 100644 --- a/Xresources +++ b/Xresources @@ -1,5 +1,5 @@ ! beryllium is arch-based with easy access to source code pro, let's use it -#if defined(SRVR_beryllium) +#if defined(SRVR_beryllium) || defined(SRVR_oxygen) URxvt.font: xft:Source Code Pro:size=9:antialias=true URxvt.boldFont: xft:Source Code Pro:style=bold:size=9:antialias=true #else @@ -21,7 +21,7 @@ URxvt.shading: 20 URxvt.iso14755: false URxvt.iso14755_52: false -#if defined(SRVR_beryllium) || defined(SRVR_cipbuero4) +#if defined(SRVR_beryllium) || defined(SRVR_cipbuero4) || defined(SRVR_oxygen) Xft.dpi: 192 #endif From 07e06558b695617390719da4a0b3068fd760873b Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Tue, 16 May 2023 13:49:02 +0200 Subject: [PATCH 59/64] config: nvim: update github-nvim-theme settings --- config/nvim/lua/plugins/github-nvim-theme.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config/nvim/lua/plugins/github-nvim-theme.lua b/config/nvim/lua/plugins/github-nvim-theme.lua index 4aedc02..653c7da 100644 --- a/config/nvim/lua/plugins/github-nvim-theme.lua +++ b/config/nvim/lua/plugins/github-nvim-theme.lua @@ -1,4 +1,7 @@ require('github-theme').setup({ - theme_style = 'dark_colorblind', - transparent = true, + options = { + transparent = true, + }, }) + +vim.cmd.colorscheme('github_dark_colorblind') From a118ced017fad7bee0411e56ca14558c9d974e3c Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Thu, 16 Nov 2023 22:51:52 +0100 Subject: [PATCH 60/64] zshrc: Enable usage of additional local configuration --- zshrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zshrc b/zshrc index a0c35fb..24e77ac 100644 --- a/zshrc +++ b/zshrc @@ -9,3 +9,8 @@ source ~/.zsh/history.zsh source ~/.zsh/aliases.zsh source ~/.zsh/multiplexer.zsh source ~/.zsh/exports.zsh + +# Try loading additional local config if available +if [ -f ~/.zsh/custom.zsh ]; then + source ~/.zsh/custom.zsh +fi From cdc6811415d78d592e94d1a1c8e2e11888d0e2d6 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Wed, 24 Jan 2024 17:17:55 +0100 Subject: [PATCH 61/64] gitconfig: add diff algorithm for sops-encrypted files --- gitconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gitconfig b/gitconfig index 3bcdcda..883d149 100644 --- a/gitconfig +++ b/gitconfig @@ -24,3 +24,5 @@ defaultBranch = main [diff "ansible-vault"] textconv = "ansible-vault view" +[diff "sopsdiffer"] + textconv = "sops --config /dev/null --decrypt" From cd5171d7bd0a9cc38e0d887db1b8b7dd2f8abcc5 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Tue, 6 Aug 2024 21:43:28 +0200 Subject: [PATCH 62/64] ssh: conf.d: Update git-submodule for ssh config --- ssh/conf.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssh/conf.d b/ssh/conf.d index 144f794..86d29be 160000 --- a/ssh/conf.d +++ b/ssh/conf.d @@ -1 +1 @@ -Subproject commit 144f7941c03f8b7ffc76a8468fbe05bb2eb3edf5 +Subproject commit 86d29be3a174aaf43929d50f7c12e431fd68abac From 476507e577825eb69b90a910630191f6a3be41c4 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sat, 28 Dec 2024 11:19:03 +0100 Subject: [PATCH 63/64] ssh: conf.d: Update git-submodule for ssh config --- ssh/conf.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssh/conf.d b/ssh/conf.d index 86d29be..e4647f6 160000 --- a/ssh/conf.d +++ b/ssh/conf.d @@ -1 +1 @@ -Subproject commit 86d29be3a174aaf43929d50f7c12e431fd68abac +Subproject commit e4647f691a1a135f76a4fa2c4c36dd74f6aad8a6 From f9e0d94412a44a36f1f790ae89ac17cb4957390b Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Wed, 28 May 2025 10:06:27 +0200 Subject: [PATCH 64/64] ssh: conf.d: Update git-submodule for ssh config --- ssh/conf.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssh/conf.d b/ssh/conf.d index e4647f6..e322403 160000 --- a/ssh/conf.d +++ b/ssh/conf.d @@ -1 +1 @@ -Subproject commit e4647f691a1a135f76a4fa2c4c36dd74f6aad8a6 +Subproject commit e322403a55ca26a907da9e92a50316a14cf87898