diff --git a/.bashrc b/.bashrc index e779180f..652df5c4 100644 --- a/.bashrc +++ b/.bashrc @@ -1,17 +1,4 @@ -#!/bin/bash # vim: ft=sh - -# Return if called by load leveller -# if [[ -n "$LOADL_ACTIVE" ]] ; then -# return -# fi - -# If not running interactively, don't do anything -# case $- in -# *i*) ;; -# *) return;; -# esac - # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc @@ -20,6 +7,12 @@ fi # set PATH so it includes user's private bin if it exists grep "$HOME/.local/bin" "$PATH" > /dev/null 2>&1 || export PATH="$HOME/.local/bin:$PATH" +# set PATH so it includes homebrew bin directories if they exist +HOMEBREW_BIN="/opt/homebrew/bin" +HOMEBREW_SBIN="/opt/homebrew/sbin" +grep "$HOMEBREW_SBIN" "$PATH" > /dev/null 2>&1 || export PATH="$HOMEBREW_SBIN:$PATH" +grep "$HOMEBREW_BIN" "$PATH" > /dev/null 2>&1 || export PATH="$HOMEBREW_BIN:$PATH" + # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" @@ -43,16 +36,24 @@ alias ll='ls -alF' alias la='ls -A' alias l='ls -CF' - command -v nvim > /dev/null 2>&1 && export EDITOR=nvim || export EDITOR=vi command -v xed > /dev/null 2>&1 && export VISUAL=xed || export VISUAL=vi +alias lg="lazygit" +alias nvimdiff="nvim -d" +alias vim="nvim" +alias vimdiff="nvim -d" + if [ -f "$HOME/.bashrc.local" ] ; then source "$HOME/.bashrc.local" fi export PYENV_ROOT="$HOME/.pyenv" command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" + command -v pyenv >/dev/null && eval "$(pyenv init -)" command -v direnv > /dev/null 2>&1 && eval "$(direnv hook bash)" command -v starship > /dev/null 2>&1 && eval "$(starship init bash)" + +command -v glab > /dev/null && source <(glab completion -s bash) +command -v gh > /dev/null && source <(gh completion -s bash) diff --git a/.gitignore b/.gitignore index c2ed2d05..4409f6b8 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,6 @@ config/gtk-3.0/bookmarks config/xfce4/xfconf/xfce-perchannel-xml config/i3/config.d config/nvim/.venv +config/pypoetry/poetry.lock +config/pypoetry/pyproject.toml +squashfs-root diff --git a/.inputrc b/.inputrc new file mode 100644 index 00000000..6699d120 --- /dev/null +++ b/.inputrc @@ -0,0 +1,2 @@ +$include /etc/inputrc +set completion-ignore-case On diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..251e77fe --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: +- repo: https://github.com/JohnnyMorganz/StyLua + rev: v0.16.1 + hooks: + - id: stylua diff --git a/.profile b/.profile new file mode 100644 index 00000000..c4c7402d --- /dev/null +++ b/.profile @@ -0,0 +1,9 @@ +# ~/.profile: executed by Bourne-compatible login shells. + +if [ "$BASH" ]; then + if [ -f ~/.bashrc ]; then + . ~/.bashrc + fi +fi + +mesg n 2> /dev/null || true diff --git a/.zshrc b/.zshrc new file mode 100644 index 00000000..99b5e98d --- /dev/null +++ b/.zshrc @@ -0,0 +1,61 @@ +# vim: ft=zsh +# Source global definitions +if [ -f /etc/zshrc ]; then + . /etc/zshrc +fi + +# set PATH so it includes user's private bin if it exists +LOCAL_BIN="$HOME/.local/bin" +grep "$LOCAL_BIN" "$PATH" > /dev/null 2>&1 || export PATH="$LOCAL_BIN:$PATH" + +# set PATH so it includes homebrew bin directories if they exist +HOMEBREW_BIN="/opt/homebrew/bin" +HOMEBREW_SBIN="/opt/homebrew/sbin" +grep "$HOMEBREW_SBIN" "$PATH" > /dev/null 2>&1 || export PATH="$HOMEBREW_SBIN:$PATH" +grep "$HOMEBREW_BIN" "$PATH" > /dev/null 2>&1 || export PATH="$HOMEBREW_BIN:$PATH" + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + alias dir='dir --color=auto' + alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# colored GCC warnings and errors +export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +# set LANG to be something sensible +export LANG="en_GB.utf-8" + +# some more ls aliases +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' + +command -v nvim > /dev/null 2>&1 && export EDITOR=nvim || export EDITOR=vi +command -v xed > /dev/null 2>&1 && export VISUAL=xed || export VISUAL=vi + +alias lg="lazygit" +alias nvimdiff="nvim -d" +alias vim="nvim" +alias vimdiff="nvim -d" + +if [ -f "$HOME/.zshrc.local" ] ; then + source "$HOME/.zshrc.local" +fi + +export PYENV_ROOT="$HOME/.pyenv" +command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" + +command -v pyenv >/dev/null && eval "$(pyenv init -)" +command -v direnv > /dev/null 2>&1 && eval "$(direnv hook zsh)" +command -v starship > /dev/null 2>&1 && eval "$(starship init zsh)" + +autoload -U compinit; compinit +command -v glab > /dev/null && source <(glab completion -s zsh); compdef _glab glab +command -v gh > /dev/null && source <(gh completion -s zsh); compdef _gh gh diff --git a/Makefile b/Makefile index 7dc4ae95..ad8311c0 100644 --- a/Makefile +++ b/Makefile @@ -10,57 +10,62 @@ THEMES_ITEMS := $(wildcard themes/*) THEMES_TARGETS := $(THEMES_ITEMS:themes/%=$(THEMES_DIR)/%) LAZY_REPO := https://github.com/folke/lazy.nvim.git -LAZY_DIR := $(HOME)/.local/share/nvim/lazy/lazy.nvim - PYENV_DIR := $(if $(PYENV_ROOT), $(PYENV_ROOT), $(HOME)/.pyenv) -POETRY_DIR := $(HOME)/.local/share/pypoetry -.PHONY: all clean check link unlink install uninstall pacman +.PHONY: default all clean check directories link configure install -all: link install +default: directories link configure -clean: unlink uninstall +all: default install + +clean: + for link in $(CONFIG_TARGETS); do rm "$$link"; done + for link in $(SSH_TARGETS); do rm "$$link"; done + for link in $(THEMES_TARGETS); do rm "$$link"; done + rm -rf $(LAZY_DIR) + rm $(HOME)/.profile + rm $(HOME)/.inputrc + rm $(HOME)/.bashrc + rm $(HOME)/.zshrc + rmdir $(HOME)/.ssh/sockets + rm -rf config/nvim/.venv check: echo "Placeholder" -link: $(CONFIG_TARGETS) $(SSH_TARGETS) $(THEMES_TARGETS) $(HOME)/.bashrc $(HOME)/.ssh/sockets +directories: $(CONFIG_DIR) $(SSH_DIR) $(THEMES_DIR) $(HOME)/.ssh/sockets $(HOME)/.local/bin -unlink: - for link in $(CONFIG_TARGETS); do rm "$$link"; done - for link in $(SSH_TARGETS); do rm "$$link"; done - for link in $(THEMES_TARGETS); do rm "$$link"; done - rmdir $(HOME)/.ssh/sockets +$(CONFIG_DIR) $(SSH_DIR) $(THEMES_DIR) $(HOME)/.ssh/sockets $(HOME)/.local/bin: + mkdir -p $@ -install: $(LAZY_DIR) $(PYENV_DIR) $(POETRY_DIR) config/nvim/.venv - -uninstall: - rm -rf $(LAZY_DIR) - rm -rf $(PYENV_DIR) - rm -rf $(POETRY_DIR) - rm -rf config/nvim/.venv +link: $(CONFIG_TARGETS) $(SSH_TARGETS) $(THEMES_TARGETS) $(HOME)/.profile $(HOME)/.inputrc $(HOME)/.bashrc $(HOME)/.zshrc $(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/% $(SSH_TARGETS): $(SSH_DIR)/%: ssh/% $(THEMES_TARGETS): $(THEMES_DIR)/%: themes/% +$(HOME)/.profile: $(HOME)/%: % +$(HOME)/.inputrc: $(HOME)/%: % $(HOME)/.bashrc: $(HOME)/%: % -$(CONFIG_TARGETS) $(SSH_TARGETS) $(THEMES_TARGETS) $(HOME)/.bashrc: - ln -s $(PWD)/$? -t $$(dirname $@) +$(HOME)/.zshrc: $(HOME)/%: % +$(CONFIG_TARGETS) $(SSH_TARGETS) $(THEMES_TARGETS) $(HOME)/.profile $(HOME)/.inputrc $(HOME)/.bashrc $(HOME)/.zshrc: + ln -s $(PWD)/$? $@ -$(LAZY_DIR): - git clone --depth 1 $(LAZY_REPO) $@ +configure: config/git/user_email config/nvim/.venv -$(PYENV_DIR): - bash packages/pyenv.sh - -$(POETRY_DIR): - python3 packages/poetry.py +config/git/user_email: + echo "Missing user_email; Add your email to $$(readlink -f config/git)/user_email" config/nvim/.venv: python3 -m venv $@ $@/bin/python3 -m pip install -U pip wheel $@/bin/python3 -m pip install --use-pep517 pynvim +install: $(LAZY_DIR) + command -v direnv > /dev/null || bin_path=$(HOME)/.local/bin bash packages/direnv.sh + command -v pipx > /dev/null || bash packages/pipx.sh + command -v poetry > /dev/null || python3 packages/poetry.py + command -v pyenv > /dev/null || bash packages/pyenv.sh + command -v starship > /dev/null || sh packages/starship.sh -b $(HOME)/.local/bin -$(CONFIG_DIR) $(SSH_DIR) $(THEMES_DIR) $(HOME)/.ssh/sockets: - mkdir -p $@ +$(LAZY_DIR): + git clone --depth 1 $(LAZY_REPO) $@ diff --git a/bin/starship b/bin/starship deleted file mode 100755 index 13cefbd1..00000000 Binary files a/bin/starship and /dev/null differ diff --git a/config/dunst/dunstrc b/config/dunst/dunstrc index 1dbaecc7..b46be33c 100644 --- a/config/dunst/dunstrc +++ b/config/dunst/dunstrc @@ -17,7 +17,7 @@ # # If this option is set to mouse or keyboard, the monitor option # will be ignored. - follow = none + follow = mouse ### Geometry ### @@ -30,7 +30,7 @@ height = 300 # Position the notification in the top right corner - origin = bottom-right + origin = top-right # Offset from the origin offset = 30x40 @@ -297,14 +297,14 @@ foreground = "#CAD3F5" timeout = 5 # Icon for notifications with low urgency, uncomment to enable - icon = /usr/share/icons/Arc-X-D/status/16/dialog-information.png + # icon = /usr/share/icons/Arc-X-D/status/16/dialog-information.png [urgency_normal] background = "#24273A" foreground = "#CAD3F5" timeout = 5 # Icon for notifications with normal urgency, uncomment to enable - icon = /usr/share/icons/Arc-X-D/status/16/dialog-question.png + # icon = /usr/share/icons/Arc-X-D/status/16/dialog-question.png [urgency_critical] background = "#24273A" @@ -312,7 +312,7 @@ frame_color = "#F5A97F" timeout = 120 # Icon for notifications with critical urgency, uncomment to enable - icon = /usr/share/icons/Arc-X-D/status/16/dialog-warning.png + # icon = /usr/share/icons/Arc-X-D/status/16/dialog-warning.png # Every section that isn't one of the above is interpreted as a rules to # override settings for certain messages. diff --git a/config/fish/completions/gh.fish b/config/fish/completions/gh.fish new file mode 100644 index 00000000..80fbdebd --- /dev/null +++ b/config/fish/completions/gh.fish @@ -0,0 +1,177 @@ +# fish completion for gh -*- shell-script -*- + +function __gh_debug + set -l file "$BASH_COMP_DEBUG_FILE" + if test -n "$file" + echo "$argv" >> $file + end +end + +function __gh_perform_completion + __gh_debug "Starting __gh_perform_completion" + + # Extract all args except the last one + set -l args (commandline -opc) + # Extract the last arg and escape it in case it is a space + set -l lastArg (string escape -- (commandline -ct)) + + __gh_debug "args: $args" + __gh_debug "last arg: $lastArg" + + # Disable ActiveHelp which is not supported for fish shell + set -l requestComp "GH_ACTIVE_HELP=0 $args[1] __complete $args[2..-1] $lastArg" + + __gh_debug "Calling $requestComp" + set -l results (eval $requestComp 2> /dev/null) + + # Some programs may output extra empty lines after the directive. + # Let's ignore them or else it will break completion. + # Ref: https://github.com/spf13/cobra/issues/1279 + for line in $results[-1..1] + if test (string trim -- $line) = "" + # Found an empty line, remove it + set results $results[1..-2] + else + # Found non-empty line, we have our proper output + break + end + end + + set -l comps $results[1..-2] + set -l directiveLine $results[-1] + + # For Fish, when completing a flag with an = (e.g., -n=) + # completions must be prefixed with the flag + set -l flagPrefix (string match -r -- '-.*=' "$lastArg") + + __gh_debug "Comps: $comps" + __gh_debug "DirectiveLine: $directiveLine" + __gh_debug "flagPrefix: $flagPrefix" + + for comp in $comps + printf "%s%s\n" "$flagPrefix" "$comp" + end + + printf "%s\n" "$directiveLine" +end + +# This function does two things: +# - Obtain the completions and store them in the global __gh_comp_results +# - Return false if file completion should be performed +function __gh_prepare_completions + __gh_debug "" + __gh_debug "========= starting completion logic ==========" + + # Start fresh + set --erase __gh_comp_results + + set -l results (__gh_perform_completion) + __gh_debug "Completion results: $results" + + if test -z "$results" + __gh_debug "No completion, probably due to a failure" + # Might as well do file completion, in case it helps + return 1 + end + + set -l directive (string sub --start 2 $results[-1]) + set --global __gh_comp_results $results[1..-2] + + __gh_debug "Completions are: $__gh_comp_results" + __gh_debug "Directive is: $directive" + + set -l shellCompDirectiveError 1 + set -l shellCompDirectiveNoSpace 2 + set -l shellCompDirectiveNoFileComp 4 + set -l shellCompDirectiveFilterFileExt 8 + set -l shellCompDirectiveFilterDirs 16 + + if test -z "$directive" + set directive 0 + end + + set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) % 2) + if test $compErr -eq 1 + __gh_debug "Received error directive: aborting." + # Might as well do file completion, in case it helps + return 1 + end + + set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) % 2) + set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) % 2) + if test $filefilter -eq 1; or test $dirfilter -eq 1 + __gh_debug "File extension filtering or directory filtering not supported" + # Do full file completion instead + return 1 + end + + set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) % 2) + set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) % 2) + + __gh_debug "nospace: $nospace, nofiles: $nofiles" + + # If we want to prevent a space, or if file completion is NOT disabled, + # we need to count the number of valid completions. + # To do so, we will filter on prefix as the completions we have received + # may not already be filtered so as to allow fish to match on different + # criteria than the prefix. + if test $nospace -ne 0; or test $nofiles -eq 0 + set -l prefix (commandline -t | string escape --style=regex) + __gh_debug "prefix: $prefix" + + set -l completions (string match -r -- "^$prefix.*" $__gh_comp_results) + set --global __gh_comp_results $completions + __gh_debug "Filtered completions are: $__gh_comp_results" + + # Important not to quote the variable for count to work + set -l numComps (count $__gh_comp_results) + __gh_debug "numComps: $numComps" + + if test $numComps -eq 1; and test $nospace -ne 0 + # We must first split on \t to get rid of the descriptions to be + # able to check what the actual completion will be. + # We don't need descriptions anyway since there is only a single + # real completion which the shell will expand immediately. + set -l split (string split --max 1 \t $__gh_comp_results[1]) + + # Fish won't add a space if the completion ends with any + # of the following characters: @=/:., + set -l lastChar (string sub -s -1 -- $split) + if not string match -r -q "[@=/:.,]" -- "$lastChar" + # In other cases, to support the "nospace" directive we trick the shell + # by outputting an extra, longer completion. + __gh_debug "Adding second completion to perform nospace directive" + set --global __gh_comp_results $split[1] $split[1]. + __gh_debug "Completions are now: $__gh_comp_results" + end + end + + if test $numComps -eq 0; and test $nofiles -eq 0 + # To be consistent with bash and zsh, we only trigger file + # completion when there are no other completions + __gh_debug "Requesting file completion" + return 1 + end + end + + return 0 +end + +# Since Fish completions are only loaded once the user triggers them, we trigger them ourselves +# so we can properly delete any completions provided by another script. +# Only do this if the program can be found, or else fish may print some errors; besides, +# the existing completions will only be loaded if the program can be found. +if type -q "gh" + # The space after the program name is essential to trigger completion for the program + # and not completion of the program name itself. + # Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish. + complete --do-complete "gh " > /dev/null 2>&1 +end + +# Remove any pre-existing completions for the program since we will be handling all of them. +complete -c gh -e + +# The call to __gh_prepare_completions will setup __gh_comp_results +# which provides the program's completion choices. +complete -c gh -n '__gh_prepare_completions' -f -a '$__gh_comp_results' + diff --git a/config/fish/completions/glab.fish b/config/fish/completions/glab.fish new file mode 100644 index 00000000..1841bd51 --- /dev/null +++ b/config/fish/completions/glab.fish @@ -0,0 +1,176 @@ +# fish completion for glab -*- shell-script -*- + +function __glab_debug + set -l file "$BASH_COMP_DEBUG_FILE" + if test -n "$file" + echo "$argv" >> $file + end +end + +function __glab_perform_completion + __glab_debug "Starting __glab_perform_completion" + + # Extract all args except the last one + set -l args (commandline -opc) + # Extract the last arg and escape it in case it is a space + set -l lastArg (string escape -- (commandline -ct)) + + __glab_debug "args: $args" + __glab_debug "last arg: $lastArg" + + set -l requestComp "$args[1] __complete $args[2..-1] $lastArg" + + __glab_debug "Calling $requestComp" + set -l results (eval $requestComp 2> /dev/null) + + # Some programs may output extra empty lines after the directive. + # Let's ignore them or else it will break completion. + # Ref: https://github.com/spf13/cobra/issues/1279 + for line in $results[-1..1] + if test (string trim -- $line) = "" + # Found an empty line, remove it + set results $results[1..-2] + else + # Found non-empty line, we have our proper output + break + end + end + + set -l comps $results[1..-2] + set -l directiveLine $results[-1] + + # For Fish, when completing a flag with an = (e.g., -n=) + # completions must be prefixed with the flag + set -l flagPrefix (string match -r -- '-.*=' "$lastArg") + + __glab_debug "Comps: $comps" + __glab_debug "DirectiveLine: $directiveLine" + __glab_debug "flagPrefix: $flagPrefix" + + for comp in $comps + printf "%s%s\n" "$flagPrefix" "$comp" + end + + printf "%s\n" "$directiveLine" +end + +# This function does two things: +# - Obtain the completions and store them in the global __glab_comp_results +# - Return false if file completion should be performed +function __glab_prepare_completions + __glab_debug "" + __glab_debug "========= starting completion logic ==========" + + # Start fresh + set --erase __glab_comp_results + + set -l results (__glab_perform_completion) + __glab_debug "Completion results: $results" + + if test -z "$results" + __glab_debug "No completion, probably due to a failure" + # Might as well do file completion, in case it helps + return 1 + end + + set -l directive (string sub --start 2 $results[-1]) + set --global __glab_comp_results $results[1..-2] + + __glab_debug "Completions are: $__glab_comp_results" + __glab_debug "Directive is: $directive" + + set -l shellCompDirectiveError 1 + set -l shellCompDirectiveNoSpace 2 + set -l shellCompDirectiveNoFileComp 4 + set -l shellCompDirectiveFilterFileExt 8 + set -l shellCompDirectiveFilterDirs 16 + + if test -z "$directive" + set directive 0 + end + + set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) % 2) + if test $compErr -eq 1 + __glab_debug "Received error directive: aborting." + # Might as well do file completion, in case it helps + return 1 + end + + set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) % 2) + set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) % 2) + if test $filefilter -eq 1; or test $dirfilter -eq 1 + __glab_debug "File extension filtering or directory filtering not supported" + # Do full file completion instead + return 1 + end + + set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) % 2) + set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) % 2) + + __glab_debug "nospace: $nospace, nofiles: $nofiles" + + # If we want to prevent a space, or if file completion is NOT disabled, + # we need to count the number of valid completions. + # To do so, we will filter on prefix as the completions we have received + # may not already be filtered so as to allow fish to match on different + # criteria than the prefix. + if test $nospace -ne 0; or test $nofiles -eq 0 + set -l prefix (commandline -t | string escape --style=regex) + __glab_debug "prefix: $prefix" + + set -l completions (string match -r -- "^$prefix.*" $__glab_comp_results) + set --global __glab_comp_results $completions + __glab_debug "Filtered completions are: $__glab_comp_results" + + # Important not to quote the variable for count to work + set -l numComps (count $__glab_comp_results) + __glab_debug "numComps: $numComps" + + if test $numComps -eq 1; and test $nospace -ne 0 + # We must first split on \t to get rid of the descriptions to be + # able to check what the actual completion will be. + # We don't need descriptions anyway since there is only a single + # real completion which the shell will expand immediately. + set -l split (string split --max 1 \t $__glab_comp_results[1]) + + # Fish won't add a space if the completion ends with any + # of the following characters: @=/:., + set -l lastChar (string sub -s -1 -- $split) + if not string match -r -q "[@=/:.,]" -- "$lastChar" + # In other cases, to support the "nospace" directive we trick the shell + # by outputting an extra, longer completion. + __glab_debug "Adding second completion to perform nospace directive" + set --global __glab_comp_results $split[1] $split[1]. + __glab_debug "Completions are now: $__glab_comp_results" + end + end + + if test $numComps -eq 0; and test $nofiles -eq 0 + # To be consistent with bash and zsh, we only trigger file + # completion when there are no other completions + __glab_debug "Requesting file completion" + return 1 + end + end + + return 0 +end + +# Since Fish completions are only loaded once the user triggers them, we trigger them ourselves +# so we can properly delete any completions provided by another script. +# Only do this if the program can be found, or else fish may print some errors; besides, +# the existing completions will only be loaded if the program can be found. +if type -q "glab" + # The space after the program name is essential to trigger completion for the program + # and not completion of the program name itself. + # Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish. + complete --do-complete "glab " > /dev/null 2>&1 +end + +# Remove any pre-existing completions for the program since we will be handling all of them. +complete -c glab -e + +# The call to __glab_prepare_completions will setup __glab_comp_results +# which provides the program's completion choices. +complete -c glab -n '__glab_prepare_completions' -f -a '$__glab_comp_results' + diff --git a/config/fish/conf.d/pyenv.fish b/config/fish/conf.d/pyenv.fish index 8b7e6936..a71ebfc1 100644 --- a/config/fish/conf.d/pyenv.fish +++ b/config/fish/conf.d/pyenv.fish @@ -1,4 +1,5 @@ if status is-interactive set -gx PYENV_ROOT $HOME/.pyenv set -g fish_user_paths $PYENV_ROOT/bin $fish_user_paths + pyenv init - | source end diff --git a/config/git/config b/config/git/config index ea62a790..8c855b7b 100644 --- a/config/git/config +++ b/config/git/config @@ -1,3 +1,4 @@ +# vim: ft=gitconfig [include] path = user_email diff --git a/config/i3/config b/config/i3/config index 7a3264b0..d37b164f 100644 --- a/config/i3/config +++ b/config/i3/config @@ -67,6 +67,7 @@ bindsym $mod+2 workspace $ws2 bindsym $mod+3 workspace $ws3 bindsym $mod+4 workspace $ws4 bindsym $mod+5 workspace $ws5 +bindsym $mod+6 workspace $ws6 # switch to workspace with numpad keys bindcode $mod+87 workspace 1 @@ -74,6 +75,7 @@ bindcode $mod+88 workspace 2 bindcode $mod+89 workspace 3 bindcode $mod+83 workspace 4 bindcode $mod+84 workspace 5 +bindcode $mod+85 workspace 6 # switch to workspace with numlock numpad keys bindcode $mod+Mod2+87 workspace $ws1 @@ -81,6 +83,7 @@ bindcode $mod+Mod2+88 workspace $ws2 bindcode $mod+Mod2+89 workspace $ws3 bindcode $mod+Mod2+83 workspace $ws4 bindcode $mod+Mod2+84 workspace $ws5 +bindcode $mod+Mod2+85 workspace $ws6 # move focused container to workspace bindsym $mod+Shift+1 move container to workspace $ws1 @@ -88,6 +91,7 @@ bindsym $mod+Shift+2 move container to workspace $ws2 bindsym $mod+Shift+3 move container to workspace $ws3 bindsym $mod+Shift+4 move container to workspace $ws4 bindsym $mod+Shift+5 move container to workspace $ws5 +bindsym $mod+Shift+6 move container to workspace $ws6 # move focused container to workspace with numpad keys bindcode $mod+Shift+Mod2+87 move container to workspace $ws1 @@ -95,6 +99,7 @@ bindcode $mod+Shift+Mod2+88 move container to workspace $ws2 bindcode $mod+Shift+Mod2+89 move container to workspace $ws3 bindcode $mod+Shift+Mod2+83 move container to workspace $ws4 bindcode $mod+Shift+Mod2+84 move container to workspace $ws5 +bindcode $mod+Shift+Mod2+85 move container to workspace $ws6 # move focused container to workspace with numpad keys bindcode $mod+Shift+87 move container to workspace $ws1 @@ -102,6 +107,7 @@ bindcode $mod+Shift+88 move container to workspace $ws2 bindcode $mod+Shift+89 move container to workspace $ws3 bindcode $mod+Shift+83 move container to workspace $ws4 bindcode $mod+Shift+84 move container to workspace $ws5 +bindcode $mod+Shift+85 move container to workspace $ws6 # resize window (you can also use the mouse for that): mode "resize" { @@ -259,6 +265,7 @@ set $ws2 "2:" set $ws3 "3:" set $ws4 "4:" set $ws5 "5:" +set $ws6 "6:🔑" # use workspaces on different displays: # where you have to replace VGA-0/HDMI-0 with the names for your displays @@ -268,20 +275,24 @@ set $ws5 "5:" #workspace $ws3 output HDMI-1 #workspace $ws4 output HDMI-1 #workspace $ws5 output HDMI-1 +#workspace $ws6 output HDMI-1 # bind program to workspace and focus to them on startup: assign [class="wezterm"] $ws1 assign [class="(?i)firefox"] $ws2 assign [class="Thunar"] $ws3 assign [class="thunderbird"] $ws4 +assign [class="Mailspring"] $ws4 +assign [class="Element"] $ws5 +assign [class="Signal"] $ws5 assign [class="TelegramDesktop"] $ws5 +assign [class="Bitwarden"] $ws6 # automatic set focus new window if it opens on another workspace than the current: for_window [class=wezterm] focus for_window [class=(?i)firefox] focus for_window [class=Thunar] focus for_window [class=Thunderbird] focus -for_window [class=TelegramDesktop] focus ############## # compositor # diff --git a/config/nvim/lua/config/aerial.lua b/config/nvim/lua/config/aerial.lua new file mode 100644 index 00000000..b775f56c --- /dev/null +++ b/config/nvim/lua/config/aerial.lua @@ -0,0 +1,8 @@ +return { + -- optionally use on_attach to set keymaps when aerial has attached to a buffer + on_attach = function(bufnr) + -- Jump forwards/backwards with '{' and '}' + vim.keymap.set("n", "{", "AerialPrev", { buffer = bufnr }) + vim.keymap.set("n", "}", "AerialNext", { buffer = bufnr }) + end, +} diff --git a/config/nvim/lua/config/barbecue.lua b/config/nvim/lua/config/barbecue.lua new file mode 100644 index 00000000..7d6edb42 --- /dev/null +++ b/config/nvim/lua/config/barbecue.lua @@ -0,0 +1 @@ +return { theme = "catppuccin" } diff --git a/config/nvim/lua/config/catppuccin.lua b/config/nvim/lua/config/catppuccin.lua index ef357e51..a7ac271e 100644 --- a/config/nvim/lua/config/catppuccin.lua +++ b/config/nvim/lua/config/catppuccin.lua @@ -3,6 +3,9 @@ return { term_colors = true, -- transparent_background = true, integrations = { + barbecue = { + dim_dirname = true, + }, dashboard = true, gitsigns = true, indent_blankline = { @@ -10,11 +13,16 @@ return { colored_indent_levels = true, }, cmp = true, + mason = true, native_lsp = { enabled = true, }, notify = true, nvimtree = true, + navic = { + enabled = false, + custom_bg = "NONE", + }, treesitter = true, treesitter_context = true, telescope = true, diff --git a/config/nvim/lua/config/dashboard.lua b/config/nvim/lua/config/dashboard.lua index 79d9e0b5..88f68bf7 100644 --- a/config/nvim/lua/config/dashboard.lua +++ b/config/nvim/lua/config/dashboard.lua @@ -24,9 +24,9 @@ return { { icon = " ", icon_hl = "@variable", - desc = "Git", + desc = "Git DiffView", group = "Label", - action = "Git", + action = "DiffviewOpen", key = "g", }, { diff --git a/config/nvim/lua/config/indent_blankline.lua b/config/nvim/lua/config/indent_blankline.lua index 58b3e20c..7e319d9c 100644 --- a/config/nvim/lua/config/indent_blankline.lua +++ b/config/nvim/lua/config/indent_blankline.lua @@ -1,12 +1,4 @@ return { show_current_context = true, show_current_context_start = false, - char_highlight_list = { - "IndentBlanklineIndent1", - "IndentBlanklineIndent2", - "IndentBlanklineIndent3", - "IndentBlanklineIndent4", - "IndentBlanklineIndent5", - "IndentBlanklineIndent6", - }, } diff --git a/config/nvim/lua/config/init.lua b/config/nvim/lua/config/init.lua index 8d7a559d..c47d1d60 100644 --- a/config/nvim/lua/config/init.lua +++ b/config/nvim/lua/config/init.lua @@ -1,25 +1,65 @@ -vim.opt.title = true -vim.opt.cmdheight = 0 -vim.g.python3_host_prog = vim.fn.stdpath "config" .. "/.venv/bin/python" -vim.g.python_indent = { - open_paren = "shiftwidth()", - nested_paren = "shiftwidth()", - continue = "shiftwidth()", - closed_paren_align_last_line = "v:false", -} -vim.opt.laststatus = 3 -vim.opt.mouse = "nv" +-- Opt vim.opt.shiftwidth = 4 +vim.opt.expandtab = true vim.opt.number = true vim.opt.relativenumber = true -vim.opt.listchars = { trail = ".", tab = ">_" } +vim.opt.listchars = { lead = ".", trail = ".", tab = ">-" } vim.opt.list = true -vim.opt.wrap = true -vim.opt.linebreak = true -vim.opt.autoread = true -vim.opt.expandtab = true -vim.opt.autoindent = true -vim.opt.smartindent = true vim.opt.splitbelow = true vim.opt.splitright = true -require "config.keymaps" + +-- Global +vim.g.python3_host_prog = vim.fn.stdpath "config" .. "/.venv/bin/python" +vim.g.loaded_ruby_provider = 0 +vim.g.loaded_perl_provider = 0 + +-- Keymaps +vim.keymap.set("i", "jk", "") +vim.keymap.set("n", "l", "Lazy") +vim.keymap.set("n", "m", "Mason") +vim.keymap.set("n", "s", "Dashboard") +vim.keymap.set("n", "z", "ZenMode") +vim.keymap.set("n", "g", "Git") +vim.keymap.set({ "n", "t" }, "", "NavigatorLeft") +vim.keymap.set({ "n", "t" }, "", "NavigatorRight") +vim.keymap.set({ "n", "t" }, "", "NavigatorUp") +vim.keymap.set({ "n", "t" }, "", "NavigatorDown") +vim.keymap.set({ "n", "t" }, "", "NavigatorPrevious") + +-- Telescope +vim.keymap.set("n", ";", "Telescope builtin") +vim.keymap.set("n", "ff", "Telescope find_files") +vim.keymap.set("n", "fb", "Telescope buffers") +vim.keymap.set("n", "fl", "Telescope lsp_document_symbols") +vim.keymap.set("n", "fe", "Telescope diagnostics") +vim.keymap.set("n", "fs", "Telescope treesitter") +vim.keymap.set("n", "fz", "Telescope current_buffer_fuzzy_find") + +-- Neotree +vim.keymap.set("n", "n", "Neotree toggle") +vim.keymap.set("n", "\\", "Neotree reveal") + +-- Aerial +vim.keymap.set("n", "a", "AerialToggle!") + +-- diffview +vim.keymap.set("n", "do", "DiffviewOpen") +vim.keymap.set("n", "dc", "DiffviewClose") +vim.keymap.set("n", "dh", "DiffviewFileHistory") +vim.keymap.set("n", "df", "DiffviewFileHistory %") + +-- Trouble +vim.keymap.set("n", "xx", "TroubleToggle") +vim.keymap.set("n", "xw", "TroubleToggle workspace_diagnostics") +vim.keymap.set("n", "xd", "TroubleToggle document_diagnostics") +vim.keymap.set("n", "xq", "TroubleToggle quickfix") +vim.keymap.set("n", "xl", "TroubleToggle loclist") + +-- nvim-test +vim.keymap.set("n", "ts", "TestSuite") +vim.keymap.set("n", "tf", "TestFile") +vim.keymap.set("n", "te", "TestEdit") +vim.keymap.set("n", "tn", "TestNearest") +vim.keymap.set("n", "tl", "TestLast") +vim.keymap.set("n", "tv", "TestVisit") +vim.keymap.set("n", "ti", "TestInfo") diff --git a/config/nvim/lua/config/keymaps.lua b/config/nvim/lua/config/keymaps.lua deleted file mode 100644 index 1d8dd004..00000000 --- a/config/nvim/lua/config/keymaps.lua +++ /dev/null @@ -1,50 +0,0 @@ -vim.keymap.set("i", "jk", "") -vim.keymap.set("n", "l", "Lazy") -vim.keymap.set("n", "m", "Mason") -vim.keymap.set({ "n", "t" }, "", "NavigatorLeft") -vim.keymap.set({ "n", "t" }, "", "NavigatorRight") -vim.keymap.set({ "n", "t" }, "", "NavigatorUp") -vim.keymap.set({ "n", "t" }, "", "NavigatorDown") -vim.keymap.set({ "n", "t" }, "", "NavigatorPrevious") - --- Telescope -vim.keymap.set("n", ";", "Telescope builtin") -vim.keymap.set("n", "ff", "Telescope find_files") -vim.keymap.set("n", "fb", "Telescope buffers") -vim.keymap.set("n", "fg", "Telescope live_grep") -vim.keymap.set("n", "fl", "Telescope lsp_document_symbols") -vim.keymap.set("n", "fe", "Telescope diagnostics") -vim.keymap.set("n", "fs", "Telescope treesitter") -vim.keymap.set("n", "fz", "Telescope current_buffer_fuzzy_find") - --- Neotree -vim.keymap.set("n", "n", "Neotree toggle") -vim.keymap.set("n", "\\", "Neotree reveal") - --- Git -vim.keymap.set("n", "gg", "Git") -vim.keymap.set("n", "gc", "Git commit") -vim.keymap.set("n", "gl", "Git pull") -vim.keymap.set("n", "gp", "Git push") - --- diffview -vim.keymap.set("n", "do", "DiffviewOpen") -vim.keymap.set("n", "dc", "DiffviewClose") -vim.keymap.set("n", "dh", "DiffviewFileHistory") -vim.keymap.set("n", "df", "DiffviewFileHistory %") - --- Trouble -vim.keymap.set("n", "xx", "TroubleToggle") -vim.keymap.set("n", "xw", "TroubleToggle workspace_diagnostics") -vim.keymap.set("n", "xd", "TroubleToggle document_diagnostics") -vim.keymap.set("n", "xq", "TroubleToggle quickfix") -vim.keymap.set("n", "xl", "TroubleToggle loclist") - --- nvim-test -vim.keymap.set("n", "ts", "TestSuite") -vim.keymap.set("n", "tf", "TestFile") -vim.keymap.set("n", "te", "TestEdit") -vim.keymap.set("n", "tn", "TestNearest") -vim.keymap.set("n", "tl", "TestLast") -vim.keymap.set("n", "tv", "TestVisit") -vim.keymap.set("n", "ti", "TestInfo") diff --git a/config/nvim/lua/config/lazy.lua b/config/nvim/lua/config/lazy.lua index 3fddf332..ec40b897 100644 --- a/config/nvim/lua/config/lazy.lua +++ b/config/nvim/lua/config/lazy.lua @@ -8,4 +8,9 @@ return { "habamax", }, }, + ui = { + icons = { + lazy = "💤 ", + }, + }, } diff --git a/config/nvim/lua/config/nvim-autopairs.lua b/config/nvim/lua/config/nvim-autopairs.lua new file mode 100644 index 00000000..51db88ae --- /dev/null +++ b/config/nvim/lua/config/nvim-autopairs.lua @@ -0,0 +1,5 @@ +return { + disable_in_macro = true, + disable_in_visualblock = true, + check_ts = true, +} diff --git a/config/nvim/lua/config/nvim-navic.lua b/config/nvim/lua/config/nvim-navic.lua new file mode 100644 index 00000000..e58dfc6e --- /dev/null +++ b/config/nvim/lua/config/nvim-navic.lua @@ -0,0 +1 @@ +return {highlight = true} diff --git a/config/nvim/lua/config/treesitter.lua b/config/nvim/lua/config/treesitter.lua index be807f9d..7136d8c6 100644 --- a/config/nvim/lua/config/treesitter.lua +++ b/config/nvim/lua/config/treesitter.lua @@ -4,4 +4,31 @@ return { additional_vim_regex_highlighting = false, disable = { "fortran" }, }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "gnr", + scope_incremental = "gnc", + node_decremental = "gnm", + }, + }, + indent = { + enable = true, + -- disable = { "python" }, + }, + refactor = { + smart_rename = { + enable = true, + keymaps = { + smart_rename = "grr", + }, + }, + navigation = { + enable = true, + keymaps = { + goto_definition_lsp_fallback = "gnd", + }, + }, + }, } diff --git a/config/nvim/lua/config/twilight.lua b/config/nvim/lua/config/twilight.lua new file mode 100644 index 00000000..52306835 --- /dev/null +++ b/config/nvim/lua/config/twilight.lua @@ -0,0 +1,4 @@ +return { + context = 10, + treesitter = true, +} diff --git a/config/nvim/lua/config/zen_mode.lua b/config/nvim/lua/config/zen_mode.lua new file mode 100644 index 00000000..9594b0bf --- /dev/null +++ b/config/nvim/lua/config/zen_mode.lua @@ -0,0 +1,27 @@ +return { + window = { + options = { + signcolumn = "no", -- disable signcolumn + number = false, -- disable number column + relativenumber = false, -- disable relative numbers + cursorline = false, -- disable cursorline + cursorcolumn = false, -- disable cursor column + foldcolumn = "0", -- disable fold column + list = false, -- disable whitespace characters + }, + }, + plugins = { + options = { + enabled = true, + }, + twilight = { enabled = true }, + gitsigns = { enabled = true }, + tmux = { enabled = true }, + }, + on_open = function (win) + vim.wo.scrolloff = 999 + end, + on_close = function (win) + vim.wo.scrolloff = 0 + end +} diff --git a/config/nvim/lua/lsp/cmp.lua b/config/nvim/lua/lsp/cmp.lua index 542c71b5..37af3f09 100644 --- a/config/nvim/lua/lsp/cmp.lua +++ b/config/nvim/lua/lsp/cmp.lua @@ -1,5 +1,6 @@ local cmp = require "cmp" local luasnip = require "luasnip" +local cmp_autopairs = require "nvim-autopairs.completion.cmp" require("luasnip.loaders.from_vscode").lazy_load() @@ -38,8 +39,6 @@ cmp.setup { }, sources = { { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "latex_symbols" }, }, } @@ -47,8 +46,11 @@ cmp.setup { cmp.setup.filetype("gitcommit", { sources = { { name = "git" }, + { name = "spell" }, { name = "commit" }, { name = "buffer" }, + { name = "luasnip" }, + { name = "latex_symbols" }, }, }) @@ -56,6 +58,8 @@ cmp.setup.filetype("markdown", { sources = { { name = "spell" }, { name = "buffer" }, + { name = "luasnip" }, + { name = "latex_symbols" }, }, }) @@ -73,3 +77,5 @@ cmp.setup.cmdline(":", { { name = "cmdline" }, }, }) + +cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) diff --git a/config/nvim/lua/lsp/null_ls_sources.lua b/config/nvim/lua/lsp/null_ls_sources.lua index 6aadd46c..a77bcdc7 100644 --- a/config/nvim/lua/lsp/null_ls_sources.lua +++ b/config/nvim/lua/lsp/null_ls_sources.lua @@ -2,6 +2,7 @@ local null_ls = require "null-ls" return { null_ls.builtins.code_actions.gitsigns, null_ls.builtins.diagnostics.zsh, + null_ls.builtins.diagnostics.mypy, null_ls.builtins.formatting.trim_whitespace, null_ls.builtins.hover.dictionary, } diff --git a/config/nvim/lua/plugins/aerial.lua b/config/nvim/lua/plugins/aerial.lua new file mode 100644 index 00000000..5c1b505e --- /dev/null +++ b/config/nvim/lua/plugins/aerial.lua @@ -0,0 +1,17 @@ +return { + "stevearc/aerial.nvim", + name = "aerial", + cmd = { + "AerialOpen", + "AerialOpenAll", + "AerialNext", + "AerialPrev", + "AerialGo", + "AerialInfo", + "AerialToggle", + }, + config = function() + require("aerial").setup(require "config.aerial") + vim.keymap.set("n", "fa", "Telescope aerial") + end, +} diff --git a/config/nvim/lua/plugins/barbecue.lua b/config/nvim/lua/plugins/barbecue.lua new file mode 100644 index 00000000..7ac1eec1 --- /dev/null +++ b/config/nvim/lua/plugins/barbecue.lua @@ -0,0 +1,11 @@ +return { + "utilyre/barbecue.nvim", + name = "barbecue", + version = "*", + dependencies = { + "SmiteshP/nvim-navic", + "nvim-tree/nvim-web-devicons", + }, + event = { "BufReadPre", "BufNewFile" }, + opts = require "config.barbecue", +} diff --git a/config/nvim/lua/plugins/dashboard.lua b/config/nvim/lua/plugins/dashboard.lua index b80d7a6a..bf9dc6f0 100644 --- a/config/nvim/lua/plugins/dashboard.lua +++ b/config/nvim/lua/plugins/dashboard.lua @@ -1,6 +1,7 @@ return { "glepnir/dashboard-nvim", event = "VimEnter", + cmd = "Dashboard", dependencies = { "nvim-tree/nvim-web-devicons" }, config = function() require("dashboard").setup(require "config.dashboard") end, } diff --git a/config/nvim/lua/plugins/diffview.lua b/config/nvim/lua/plugins/diffview.lua index 97966432..98d71829 100644 --- a/config/nvim/lua/plugins/diffview.lua +++ b/config/nvim/lua/plugins/diffview.lua @@ -2,8 +2,8 @@ return { "sindrets/diffview.nvim", dependencies = { "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons" }, cmd = { - "DiffviewOpen", "DiffviewFileHistory", + "DiffviewOpen", }, config = function() require("diffview").setup(require "config.diffview") end, } diff --git a/config/nvim/lua/plugins/feline.lua b/config/nvim/lua/plugins/feline.lua index d29b9e3b..9f00cb6f 100644 --- a/config/nvim/lua/plugins/feline.lua +++ b/config/nvim/lua/plugins/feline.lua @@ -1,5 +1,6 @@ return { "feline-nvim/feline.nvim", dependencies = { require "plugins.catppuccin" }, + event = { "BufReadPre", "BufNewFile" }, config = function() require("feline").setup(require "config.feline") end, } diff --git a/config/nvim/lua/plugins/fugitive.lua b/config/nvim/lua/plugins/fugitive.lua index 6e4ad0ec..1389a6a7 100644 --- a/config/nvim/lua/plugins/fugitive.lua +++ b/config/nvim/lua/plugins/fugitive.lua @@ -1,13 +1,5 @@ return { - { - "tpope/vim-fugitive", - }, - { - "tpope/vim-rhubarb", - dependencies = "tpope/vim-fugitive", - }, - { - "shumphrey/fugitive-gitlab.vim", - dependencies = "tpope/vim-fugitive", - }, + "tpope/vim-fugitive", + cmd = {"G", "Git"}, + lazy = true, } diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins/init.lua similarity index 100% rename from config/nvim/lua/plugins.lua rename to config/nvim/lua/plugins/init.lua diff --git a/config/nvim/lua/plugins/lspconfig.lua b/config/nvim/lua/plugins/lspconfig.lua index 2e69484a..d616899b 100644 --- a/config/nvim/lua/plugins/lspconfig.lua +++ b/config/nvim/lua/plugins/lspconfig.lua @@ -4,10 +4,10 @@ return { event = { "BufReadPre", "BufNewFile" }, cmd = { "LspLog", - "LspInfo", "LspStop", "LspStart", "LspRestart", + "LspInfo", }, dependencies = { { "hrsh7th/nvim-cmp" }, diff --git a/config/nvim/lua/plugins/mason.lua b/config/nvim/lua/plugins/mason.lua index 1d963596..568f9530 100644 --- a/config/nvim/lua/plugins/mason.lua +++ b/config/nvim/lua/plugins/mason.lua @@ -1,7 +1,9 @@ return { { "williamboman/mason.nvim", - lazy = false, + cmd = { + "Mason", + }, config = function() require("mason").setup(require "config.mason") end, }, { diff --git a/config/nvim/lua/plugins/nvim_autopairs.lua b/config/nvim/lua/plugins/nvim_autopairs.lua new file mode 100644 index 00000000..b8a1b3c3 --- /dev/null +++ b/config/nvim/lua/plugins/nvim_autopairs.lua @@ -0,0 +1,9 @@ +return { + "windwp/nvim-autopairs", + lazy = true, + dependencies = { + "nvim-treesitter/nvim-treesitter", + "hrsh7th/nvim-cmp", + }, + config = function() require("nvim-autopairs").setup(require "config.nvim-autopairs") end, +} diff --git a/config/nvim/lua/plugins/nvim_navic.lua b/config/nvim/lua/plugins/nvim_navic.lua new file mode 100644 index 00000000..d53de2f4 --- /dev/null +++ b/config/nvim/lua/plugins/nvim_navic.lua @@ -0,0 +1,6 @@ +return { + "SmiteshP/nvim-navic", + dependencies = "neovim/nvim-lspconfig", + lazy = true, + opts = require "config.nvim-navic", +} diff --git a/config/nvim/lua/plugins/nvim_test.lua b/config/nvim/lua/plugins/nvim_test.lua index e67d3343..539b1658 100644 --- a/config/nvim/lua/plugins/nvim_test.lua +++ b/config/nvim/lua/plugins/nvim_test.lua @@ -1,13 +1,13 @@ return { "klen/nvim-test", cmd = { - "TestSuite", "TestFile", "TestEdit", "TestNearest", "TestLast", "TestVisit", "TestInfo", + "TestSuite", }, config = function() require("nvim-test").setup(require "config.nvim_test") end, } diff --git a/config/nvim/lua/plugins/telescope.lua b/config/nvim/lua/plugins/telescope.lua index 612d8ddf..8fbf073b 100644 --- a/config/nvim/lua/plugins/telescope.lua +++ b/config/nvim/lua/plugins/telescope.lua @@ -1,62 +1,56 @@ return { - -- Telescope plugin - { - "nvim-telescope/telescope.nvim", - branch = "0.1.x", - dependencies = { - { "nvim-lua/plenary.nvim" }, - }, - cmd = "Telescope", - config = function() - require("telescope").setup(require "config.telescope") - require("telescope").load_extension "notify" - require("telescope").load_extension "fzf" - require("telescope").load_extension "lazy" - require("telescope").load_extension "luasnip" - require("telescope").load_extension "git_diffs" - require("telescope").load_extension "command_center" - require("telescope").load_extension "http" - end, - }, - -- Additional telescope extensions - { - "nvim-telescope/telescope-fzf-native.nvim", - build = "make", - dependencies = { "nvim-telescope/telescope.nvim" }, - lazy = true, - }, - { - "tsakirist/telescope-lazy.nvim", - dependencies = { - "nvim-telescope/telescope.nvim", - "folke/lazy.nvim", - }, - lazy = true, - }, - { - "benfowler/telescope-luasnip.nvim", - dependencies = { - "nvim-telescope/telescope.nvim", - "L3MON4D3/LuaSnip", - }, - lazy = true, - }, - { - "paopaol/telescope-git-diffs.nvim", - dependencies = { + "nvim-telescope/telescope.nvim", + branch = "0.1.x", + cmd = "Telescope", + config = function() require("telescope").setup(require "config.telescope") end, + dependencies = { + { "nvim-lua/plenary.nvim", - "sindrets/diffview.nvim", + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + dependencies = { "nvim-telescope/telescope.nvim" }, + config = function() require("telescope").load_extension "fzf" end, + }, + { + "tsakirist/telescope-lazy.nvim", + dependencies = { + "nvim-telescope/telescope.nvim", + "folke/lazy.nvim", + }, + config = function() require("telescope").load_extension "lazy" end, + }, + { + "benfowler/telescope-luasnip.nvim", + dependencies = { + "nvim-telescope/telescope.nvim", + "L3MON4D3/LuaSnip", + }, + config = function() require("telescope").load_extension "luasnip" end, + }, + { + "paopaol/telescope-git-diffs.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "sindrets/diffview.nvim", + }, + config = function() require("telescope").load_extension "git_diffs" end, + }, + { + "FeiyouG/command_center.nvim", + dependencies = { "nvim-telescope/telescope.nvim" }, + config = function() require("telescope").load_extension "command_center" end, + }, + { + "barrett-ruth/telescope-http.nvim", + dependencies = { "savq/paq-nvim", "nvim-telescope/telescope.nvim" }, + config = function() require("telescope").load_extension "http" end, + }, + { + "aaronhallaert/advanced-git-search.nvim", + dependencies = { "nvim-telescope/telescope.nvim" }, + config = function() require("telescope").load_extension "advanced_git_search" end, + }, }, - lazy = true, - }, - { - "FeiyouG/command_center.nvim", - dependencies = { "nvim-telescope/telescope.nvim" }, - lazy = true, - }, - { - "barrett-ruth/telescope-http.nvim", - dependencies = { "savq/paq-nvim", "nvim-telescope/telescope.nvim" }, - lazy = true, }, } diff --git a/config/nvim/lua/plugins/treesitter.lua b/config/nvim/lua/plugins/treesitter.lua index f77c8072..bdabfdc0 100644 --- a/config/nvim/lua/plugins/treesitter.lua +++ b/config/nvim/lua/plugins/treesitter.lua @@ -2,12 +2,15 @@ return { "nvim-treesitter/nvim-treesitter", event = { "BufReadPre", "BufNewFile" }, cmd = { - "TSEnable", "TSToggle", "TSBufEnable", "TSBufToggle", "TSInstall", "TSUpdate", + "TSEnable", }, config = function() require("nvim-treesitter.configs").setup(require "config.treesitter") end, + dependencies = { + "nvim-treesitter/nvim-treesitter-refactor", + }, } diff --git a/config/nvim/lua/plugins/zen_mode.lua b/config/nvim/lua/plugins/zen_mode.lua new file mode 100644 index 00000000..4dcabd21 --- /dev/null +++ b/config/nvim/lua/plugins/zen_mode.lua @@ -0,0 +1,13 @@ +return { + "folke/zen-mode.nvim", + cmd = "ZenMode", + config = function() require("zen-mode").setup(require "config.zen_mode") end, + dependencies = { + "folke/twilight.nvim", + cmd = "Twilight", + config = function() require("twilight").setup(require "config.twilight") end, + dependencies = { + "nvim-treesitter", + }, + }, +} diff --git a/config/nvim/lua/ui/feline_components.lua b/config/nvim/lua/ui/feline_components.lua index f09235f1..efced01f 100644 --- a/config/nvim/lua/ui/feline_components.lua +++ b/config/nvim/lua/ui/feline_components.lua @@ -286,24 +286,24 @@ function M.get() -- ######## Left -- treesitter position - components.active[1][14] = { - provider = function() - -- if not require("vim.treesitter.language").require_language("lua") then - -- return "" - -- end - local pos = require("nvim-treesitter").statusline { - indicator_size = 50, - transform_fn = function(line) return line:gsub("%s*[%[%(%{]+.*$", "") end, - } - if pos and pos ~= "" then return pos end - return "" - end, - hl = { - fg = sett.extras, - bg = sett.bkg, - }, - left_sep = invi_sep, - } + -- components.active[1][14] = { + -- provider = function() + -- -- if not require("vim.treesitter.language").require_language("lua") then + -- -- return "" + -- -- end + -- local pos = require("nvim-treesitter").statusline { + -- indicator_size = 50, + -- transform_fn = function(line) return line:gsub("%s*[%[%(%{]+.*$", "") end, + -- } + -- if pos and pos ~= "" then return pos end + -- return "" + -- end, + -- hl = { + -- fg = sett.extras, + -- bg = sett.bkg, + -- }, + -- left_sep = invi_sep, + -- } -- ######## Right diff --git a/config/wezterm/tab_bar_style.lua b/config/wezterm/tab_bar_style.lua index 47831f02..0ecf6a07 100644 --- a/config/wezterm/tab_bar_style.lua +++ b/config/wezterm/tab_bar_style.lua @@ -18,14 +18,15 @@ M.setup = function(scheme) }, #tabs + 1) local elements = {} table.insert(elements, "ResetAttributes") + table.insert(elements, { Background = { Color = colours[tab.tab_index + 1] } }) + table.insert(elements, { Foreground = { Color = text_fg } }) + table.insert(elements, { Text = " " }) if tab.is_active then table.insert(elements, { Attribute = { Underline = "Single" } }) table.insert(elements, { Attribute = { Intensity = "Bold" } }) end if hover then table.insert(elements, { Attribute = { Italic = true } }) end - table.insert(elements, { Background = { Color = colours[tab.tab_index + 1] } }) - table.insert(elements, { Foreground = { Color = text_fg } }) - table.insert(elements, { Text = " " .. title }) + table.insert(elements, { Text = title }) table.insert(elements, "ResetAttributes") table.insert(elements, { Background = { Color = colours[tab.tab_index + 2] } }) table.insert(elements, { Foreground = { Color = colours[tab.tab_index + 1] } }) diff --git a/packages/direnv.sh b/packages/direnv.sh new file mode 100755 index 00000000..f6796ded --- /dev/null +++ b/packages/direnv.sh @@ -0,0 +1,109 @@ +#!/usr/bin/env bash +# +# A good old bash | curl script for direnv. +# +set -euo pipefail + +{ # Prevent execution if this script was only partially downloaded + + log() { + echo "[installer] $*" >&2 + } + + die() { + log "$@" + exit 1 + } + + at_exit() { + ret=$? + if [[ $ret -gt 0 ]]; then + log "the script failed with error $ret.\n" \ + "\n" \ + "To report installation errors, submit an issue to\n" \ + " https://github.com/direnv/direnv/issues/new/choose" + fi + exit "$ret" + } + trap at_exit EXIT + + kernel=$(uname -s | tr "[:upper:]" "[:lower:]") + case "${kernel}" in + mingw*) + kernel=windows + ;; + esac + case "$(uname -m)" in + x86_64) + machine=amd64 + ;; + i686 | i386) + machine=386 + ;; + aarch64 | arm64) + machine=arm64 + ;; + *) + die "Machine $(uname -m) not supported by the installer.\n" \ + "Go to https://direnv for alternate installation methods." + ;; + esac + log "kernel=$kernel machine=$machine" + + : "${use_sudo:=}" + : "${bin_path:=}" + + if [[ -z "$bin_path" ]]; then + log "bin_path is not set, you can set bin_path to specify the installation path" + log "e.g. export bin_path=/path/to/installation before installing" + log "looking for a writeable path from PATH environment variable" + for path in $(echo "$PATH" | tr ':' '\n'); do + if [[ -w $path ]]; then + bin_path=$path + break + fi + done + fi + if [[ -z "$bin_path" ]]; then + die "did not find a writeable path in $PATH" + fi + echo "bin_path=$bin_path" + + if [[ -n "${version:-}" ]]; then + release="tags/${version}" + else + release="latest" + fi + echo "release=$release" + + log "looking for a download URL" + download_url=$( + curl -fL "https://api.github.com/repos/direnv/direnv/releases/$release" \ + | grep browser_download_url \ + | cut -d '"' -f 4 \ + | grep "direnv.$kernel.$machine" + ) + echo "download_url=$download_url" + + log "downloading" + curl -o "$bin_path/direnv" -fL "$download_url" + chmod a+x "$bin_path/direnv" + + cat < /dev/null || { + echo "python3 executable not found, exiting" + exit 1 +} + +python3 -c "import sys; assert sys.version_info[0] >= 3 and sys.version_info[1] >= 7" || { + echo python3 --version + echo "python version too old, requires >=3.7" + exit 1 +} + +USERSITE=$(python3 -c "import site; print(site._get_path(site._getuserbase()))") +mkdir -p $USERSITE + +if [[ ! -e "$USERSITE/pipx" ]] +then + python3 -m pip install --user pipx +fi diff --git a/packages/pyenv.sh b/packages/pyenv.sh index bf94140f..d033efb2 100755 --- a/packages/pyenv.sh +++ b/packages/pyenv.sh @@ -7,6 +7,7 @@ index_main() { set -e curl -s -S -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash + echo "suggested install to build python: base-devel openssl zlib xz tk" } index_main diff --git a/packages/python.txt b/packages/python.txt deleted file mode 100644 index 061741a1..00000000 --- a/packages/python.txt +++ /dev/null @@ -1,9 +0,0 @@ -python -python-pip -python-pynvim -python-virtualenv -base-devel -openssl -zlib -xz -tk diff --git a/ssh/config.d/ukaea.conf b/ssh/config.d/ukaea.conf new file mode 100644 index 00000000..c11ca55e --- /dev/null +++ b/ssh/config.d/ukaea.conf @@ -0,0 +1,26 @@ +# vim: ft=sshconfig + +Host heimdall + HostName heimdall003.jet.uk + +Host heimdall??? + HostName %h.jet.uk + +Host batch + User cxsbatch + HostName heimdall115.jetdata.eu + +Host jdc + HostName 10.40.4.103 + +Host freia + HostName freia022.hpc.l + +Host freia??? + HostName %h.hpc.l + +Host heimdall* jdc* freia* batch + User elitherl + ForwardX11 yes + ForwardX11Timeout 0 + Compression yes diff --git a/ssh/config.d/xenia.conf b/ssh/config.d/xenia.conf new file mode 100644 index 00000000..921517e4 --- /dev/null +++ b/ssh/config.d/xenia.conf @@ -0,0 +1,8 @@ +# vim: ft=sshconfig + +Host xenia + User xenia + HostName 192.168.1.230 + Port 30 + ForwardX11 no + ForwardAgent yes