Migrate to home-manager

This commit is contained in:
Daniel Lundin 2024-08-02 11:12:36 +02:00
parent 6781866277
commit 2f6d4e1d3c
No known key found for this signature in database
147 changed files with 6181 additions and 6078 deletions

View file

@ -0,0 +1,59 @@
# Bindings
bind \cg __zoxide_zi_repaint
bind \cJ forward-char
bind \cn history-prefix-search-forward
bind \cp history-prefix-search-backward
# Settings
set fish_greeting
set fish_emoji_width 2
# xdg-open support on ssh remotes
if test -n SSH_TTY; and type -q wezterm-open-url
set -x DE generic
set -x BROWSER wezterm-open-url
end
# Colors
set fish_color_command --bold
set fish_color_comment --italics --dim
set fish_color_autosuggestion --italics --bold red
set fish_color_cancel
set fish_color_command --bold
set fish_color_comment --italics --dim
set fish_color_cwd normal
set fish_color_cwd_root normal
set fish_color_end
set fish_color_error
set fish_color_escape
set fish_color_gray 6c7086
set fish_color_history_current
set fish_color_host normal
set fish_color_host_remote yellow
set fish_color_keyword
set fish_color_match
set fish_color_normal normal
set fish_color_operator
set fish_color_option
set fish_color_param normal
set fish_color_quote --italics
set fish_color_redirection
set fish_color_search_match -r
set fish_color_selection -r
set fish_color_status normal
set fish_color_string --italics
set fish_color_user normal
set fish_color_valid_path
set fish_pager_color_background
set fish_pager_color_completion normal
set fish_pager_color_description --dim
set fish_pager_color_prefix --underline
set fish_pager_color_progress --dim
set fish_pager_color_secondary_background
set fish_pager_color_secondary_completion
set fish_pager_color_secondary_description
set fish_pager_color_secondary_prefix
set fish_pager_color_selected_background -r
set fish_pager_color_selected_completion
set fish_pager_color_selected_description
set fish_pager_color_selected_prefix

View file

@ -0,0 +1,37 @@
set GO_TASK_PROGNAME task
function __task_get_tasks --description "Prints all available tasks with their description"
# Read the list of tasks (and potential errors)
$GO_TASK_PROGNAME --list-all 2>&1 | read -lz rawOutput
# Return on non-zero exit code (for cases when there is no Taskfile found or etc.)
if test $status -ne 0
return
end
# Grab names and descriptions (if any) of the tasks
set -l output (echo $rawOutput | sed -e '1d; s/\* \(.*\):\s*\(.*\)\s*(aliases.*/\1\t\2/' -e 's/\* \(.*\):\s*\(.*\)/\1\t\2/'| string split0)
if test $output
echo $output
end
end
complete -c $GO_TASK_PROGNAME -d 'Runs the specified task(s). Falls back to the "default" task if no task name was specified, or lists all tasks if an unknown task name was
specified.' -xa "(__task_get_tasks)"
complete -c $GO_TASK_PROGNAME -s c -l color -d 'colored output (default true)'
complete -c $GO_TASK_PROGNAME -s d -l dir -d 'sets directory of execution'
complete -c $GO_TASK_PROGNAME -l dry -d 'compiles and prints tasks in the order that they would be run, without executing them'
complete -c $GO_TASK_PROGNAME -s f -l force -d 'forces execution even when the task is up-to-date'
complete -c $GO_TASK_PROGNAME -s h -l help -d 'shows Task usage'
complete -c $GO_TASK_PROGNAME -s i -l init -d 'creates a new Taskfile.yml in the current folder'
complete -c $GO_TASK_PROGNAME -s l -l list -d 'lists tasks with description of current Taskfile'
complete -c $GO_TASK_PROGNAME -s o -l output -d 'sets output style: [interleaved|group|prefixed]' -xa "interleaved group prefixed"
complete -c $GO_TASK_PROGNAME -s p -l parallel -d 'executes tasks provided on command line in parallel'
complete -c $GO_TASK_PROGNAME -s s -l silent -d 'disables echoing'
complete -c $GO_TASK_PROGNAME -l status -d 'exits with non-zero exit code if any of the given tasks is not up-to-date'
complete -c $GO_TASK_PROGNAME -l summary -d 'show summary about a task'
complete -c $GO_TASK_PROGNAME -s t -l taskfile -d 'choose which Taskfile to run. Defaults to "Taskfile.yml"'
complete -c $GO_TASK_PROGNAME -s v -l verbose -d 'enables verbose mode'
complete -c $GO_TASK_PROGNAME -l version -d 'show Task version'
complete -c $GO_TASK_PROGNAME -s w -l watch -d 'enables watch of the given task'

338
files/config/fish/jj.fish Normal file
View file

@ -0,0 +1,338 @@
# TODO: passthru other args? E.g.. --at-operation, --repository
function __jj
command jj --ignore-working-copy --color=never --quiet $argv 2>/dev/null
end
# Aliases
# Based on https://github.com/fish-shell/fish-shell/blob/cd71359c42f633d9d71a63591ae16d150407a2b2/share/completions/git.fish#L625.
#
# Aliases are stored in global variables.
# `__jj_aliases` is a list of all aliases and `__jj_alias_$alias` is the command line for the alias.
function __jj_add_alias
set -l alias $argv[1]
set -l alias_escaped (string escape --style=var -- $alias)
set -g __jj_alias_$alias_escaped $argv
set --append -g __jj_aliases $alias
end
__jj config list aliases -T 'concat(name, "\t", value, "\n")' --include-defaults | while read -l config_alias
set -l parsed (string match --regex '^aliases\.(.+)\t(.*)$' --groups-only -- $config_alias)
set -l alias $parsed[1]
set -l command $parsed[2]
set -l args $alias
# Replace wrapping `[]` if any
set -l command (string replace -r --all '^\[|]$' "" -- $command)
while test (string length -- $command) -gt 0
set -l parsed (string match -r '^"((?:\\\"|[^"])*?)"(?:,\s)?(.*)$' --groups-only -- $command)
set --append args $parsed[1]
set command $parsed[2]
end
__jj_add_alias $args
end
__jj_add_alias ci commit
__jj_add_alias desc describe
__jj_add_alias op operation
__jj_add_alias st status
# Resolve aliases that call another alias.
for alias in $__jj_aliases
set -l handled $alias
while true
set -l alias_escaped (string escape --style=var -- $alias)
set -l alias_varname __jj_alias_$alias_escaped
set -l aliased_command $$alias_varname[1][2]
set -l aliased_escaped (string escape --style=var -- $aliased_command)
set -l aliased_varname __jj_alias_$aliased_escaped
set -q $aliased_varname
or break
# Prevent infinite recursion
contains $aliased_escaped $handled
and break
# Expand alias in cmdline
set -l aliased_cmdline $$aliased_varname[1][2..-1]
set --append aliased_cmdline $$alias_varname[1][3..-1]
set -g $alias_varname $$alias_varname[1][1] $aliased_cmdline
set --append handled $aliased_escaped
end
end
function __jj_aliases_with_descriptions
for alias in $__jj_aliases
set -l alias_escaped (string escape --style=var -- $alias)
set -l alias_varname __jj_alias_$alias_escaped
set -l aliased_cmdline (string join " " -- $$alias_varname[1][2..-1] | string replace -r --all '\\\"' '"')
printf "%s\talias: %s\n" $alias $aliased_cmdline
end
end
# Based on https://github.com/fish-shell/fish-shell/blob/2d4e42ee93327b9cfd554a0d809f85e3d371e70e/share/functions/__fish_seen_subcommand_from.fish.
# Test to see if we've seen a subcommand from a list.
# This logic may seem backwards, but the commandline will often be much shorter than the list.
function __jj_seen_subcommand_from
set -l cmd (commandline -opc)
set -e cmd[1]
# Check command line arguments first.
for i in $cmd
if contains -- $i $argv
return 0
end
end
# Check aliases.
set -l alias $cmd[1]
set -l alias_escaped (string escape --style=var -- $alias)
set -l varname __jj_alias_$alias_escaped
set -q $varname
or return 1
for i in $$varname[1][2..-1]
if contains -- $i $argv
return 0
end
end
return 1
end
function __jj_changes
__jj log --no-graph --limit 1000 -r $argv[1] \
-T 'separate("\t", change_id.shortest(), if(description, description.first_line(), "(no description set)")) ++ "\n"'
end
function __jj_branches
set -f filter $argv[1]
if string length --quiet -- $argv[2]
__jj branch list --all-remotes -r "$argv[2]" \
-T "if($filter, name ++ if(remote, \"@\" ++ remote) ++ \"\t\" ++ if(normal_target, normal_target.change_id().shortest() ++ \": \" ++ if(normal_target.description(), normal_target.description().first_line(), \"(no description set)\"), \"(conflicted branch)\") ++ \"\n\")"
else
__jj branch list --all-remotes \
-T "if($filter, name ++ if(remote, \"@\" ++ remote) ++ \"\t\" ++ if(normal_target, normal_target.change_id().shortest() ++ \": \" ++ if(normal_target.description(), normal_target.description().first_line(), \"(no description set)\"), \"(conflicted branch)\") ++ \"\n\")"
end
end
function __jj_all_branches
__jj_branches '!remote || !remote.starts_with("git")' $argv[1]
end
function __jj_local_branches
__jj_branches '!remote' ''
end
function __jj_remote_branches
__jj_branches 'remote && !remote.starts_with("git")' ''
end
function __jj_all_changes
if string length --quiet -- $argv[1]
set -f REV $argv[1]
else
set -f REV "all()"
end
__jj_changes $REV
__jj_all_branches $REV
end
function __jj_mutable_changes
set -f REV "mutable()"
__jj_changes $REV
__jj_all_branches $REV
end
function __jj_revision_modified_files
if test $argv[1] = "@"
set -f suffix ""
else
set -l change_id (__jj log --no-graph --limit 1 -T 'change_id.shortest()')
set -f suffix " in $change_id"
end
__jj diff -r $argv[1] --summary | while read -l line
set -l file (string split " " -m 1 -- $line)
switch $file[1]
case M
set -f change Modified
case D
set -f change Deleted
case A
set -f change Added
end
printf "%s\t%s%s\n" $file[2] $change $suffix
end
end
function __jj_remotes
__jj git remote list | while read -l remote
printf "%s\t%s\n" (string split " " -m 1 -- $remote)
end
end
function __jj_operations
__jj operation log --no-graph --limit 1000 -T 'separate("\t", id.short(), description) ++ "\n"'
end
function __jj_parse_revision
set -l cmd (commandline -opc)
set -e cmd[1]
set -l return_next false
set -l return_value 1
# Check aliases.
set -l alias $cmd[1]
set -l alias_escaped (string escape --style=var -- $alias)
set -l varname __jj_alias_$alias_escaped
if set -q $varname
set cmd $$varname[1][2..-1] $cmd[2..-1]
end
# Check command line arguments first.
for i in $cmd
if $return_next
echo $i
set return_value 0
else if contains -- $i -r --revision --from
set return_next true
else
set -l match (string match --regex '^(?:-r=?|--revision=|--from=)(.+)\s*$' --groups-only -- $i)
if set -q match[1]
echo $match[1]
set return_value 0
end
end
end
return $return_value
end
function __jj_revision_files
set -l description (__jj log --no-graph --limit 1 -r $argv[1] -T 'change_id.shortest() ++ ": " ++ coalesce(description.first_line().substr(0, 30), "(no description set)")')
__jj file list -r $argv[1] | while read -l file
printf "%s\t%s\n" $file $description
end
end
function __jj_revision_conflicted_files
__jj resolve --list -r $argv[1] | while read -l line
set -l file (string split " " -m 1 -- $line)
printf "%s\t%s\n" $file[1] $file[2]
end
end
function __jj_parse_revision_files
set -l rev (__jj_parse_revision)
if test $status -eq 1
set rev "@"
end
__jj_revision_files $rev
end
function __jj_parse_revision_conflicted_files
set -l rev (__jj_parse_revision)
if test $status -eq 1
set rev "@"
end
__jj_revision_conflicted_files $rev
end
function __jj_parse_revision_files_or_wc_modified_files
set -l revs (__jj_parse_revision)
if test $status -eq 1
__jj_revision_modified_files "@"
else
for rev in $revs
__jj_revision_files $rev
end
end
end
function __jj_parse_revision_modified_files_or_wc_modified_files
set -l revs (__jj_parse_revision)
if test $status -eq 1
__jj_revision_modified_files "@"
else
for rev in $revs
__jj_revision_modified_files $rev
end
end
end
# Aliases.
complete -f -c jj -n __fish_use_subcommand -a '(__jj_aliases_with_descriptions)'
# Files.
complete -f -c jj -n '__jj_seen_subcommand_from file; and __jj_seen_subcommand_from show' -ka '(__jj_parse_revision_files)'
complete -f -c jj -n '__jj_seen_subcommand_from file; and __jj_seen_subcommand_from chmod' -ka '(__jj_parse_revision_files)'
complete -f -c jj -n '__jj_seen_subcommand_from commit' -ka '(__jj_revision_modified_files "@")'
complete -c jj -n '__jj_seen_subcommand_from diff' -ka '(__jj_parse_revision_files_or_wc_modified_files)'
complete -c jj -n '__jj_seen_subcommand_from interdiff' -ka '(__jj_parse_revision_files)'
complete -f -c jj -n '__jj_seen_subcommand_from resolve' -ka '(__jj_parse_revision_conflicted_files)'
complete -f -c jj -n '__jj_seen_subcommand_from restore' -ka '(__jj_parse_revision_files_or_wc_modified_files)'
complete -f -c jj -n '__jj_seen_subcommand_from split' -ka '(__jj_parse_revision_modified_files_or_wc_modified_files)'
complete -f -c jj -n '__jj_seen_subcommand_from squash' -ka '(__jj_parse_revision_modified_files_or_wc_modified_files)'
complete -f -c jj -n '__jj_seen_subcommand_from untrack' -ka '(__jj_parse_revision_files_or_wc_modified_files)'
# Revisions.
complete -f -c jj -n '__jj_seen_subcommand_from abandon' -ka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from backout' -s r -l revision -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from backout' -s d -l destination -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from file; and __jj_seen_subcommand_from show' -s r -l revision -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from chmod' -s r -l revision -rka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from describe' -ka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from diff' -s r -l revision -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from diff' -l from -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from diff' -l to -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from diffedit' -s r -l revision -rka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from diffedit' -l from -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from diffedit' -l to -rka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from duplicate' -ka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from edit' -ka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from file; and __jj_seen_subcommand_from list' -s r -l revision -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from interdiff' -l from -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from interdiff' -l to -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from log' -s r -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from new' -ka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from new' -s A -l after -l insert-after -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from new' -s B -l before -l insert-before -rka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from obslog' -s r -l revision -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from parallelize' -ka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from rebase' -s r -l revisions -rka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from rebase' -s s -l source -rka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from rebase' -s b -l branch -rka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from rebase' -s d -l destination -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from rebase' -s A -l after -l insert-after -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from rebase' -s B -l before -l insert-before -rka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from resolve' -s r -l revision -rka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from restore' -l from -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from restore' -l to -rka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from restore' -s c -l changes-in -rka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from show' -ka '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from split' -s r -l revision -rka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from squash' -s r -l revision -rka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from squash' -l from -rka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from squash' -l to -l into -rka '(__jj_mutable_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from unsquash' -s r -l revision -rka '(__jj_mutable_changes)'
# Branches.
complete -f -c jj -n '__jj_seen_subcommand_from branch; and __jj_seen_subcommand_from delete forget rename set d f r s' -ka '(__jj_local_branches)'
complete -f -c jj -n '__jj_seen_subcommand_from branch; and __jj_seen_subcommand_from track t' -ka '(__jj_branches "remote && !tracked" "")'
complete -f -c jj -n '__jj_seen_subcommand_from branch; and __jj_seen_subcommand_from untrack' -ka '(__jj_branches "remote && tracked && !remote.starts_with(\"git\")" "")'
complete -f -c jj -n '__jj_seen_subcommand_from branch; and __jj_seen_subcommand_from create move set c m s' -s r -l revision -kra '(__jj_all_changes)'
complete -f -c jj -n '__jj_seen_subcommand_from branch; and __jj_seen_subcommand_from move' -l from -rka '(__jj_changes "all()")'
complete -f -c jj -n '__jj_seen_subcommand_from branch; and __jj_seen_subcommand_from move' -l to -rka '(__jj_changes "all()")'
# Git.
complete -f -c jj -n '__jj_seen_subcommand_from git; and __jj_seen_subcommand_from push' -s c -l change -kra '(__jj_changes "all()")'
complete -f -c jj -n '__jj_seen_subcommand_from git; and __jj_seen_subcommand_from push' -s r -l revisions -kra '(__jj_changes "all()")'
complete -f -c jj -n '__jj_seen_subcommand_from git; and __jj_seen_subcommand_from fetch push' -s b -l branch -rka '(__jj_local_branches)'
complete -f -c jj -n '__jj_seen_subcommand_from git; and __jj_seen_subcommand_from fetch push' -l remote -rka '(__jj_remotes)'
complete -f -c jj -n '__jj_seen_subcommand_from git; and __jj_seen_subcommand_from remote; and __jj_seen_subcommand_from remove rename set-url' -ka '(__jj_remotes)'
# Operations.
complete -f -c jj -l at-op -l at-operation -rka '(__jj_operations)'
complete -f -c jj -n '__jj_seen_subcommand_from undo' -ka '(__jj_operations)'
complete -f -c jj -n '__jj_seen_subcommand_from operation; and __jj_seen_subcommand_from abandon undo restore' -ka '(__jj_operations)'

View file

@ -0,0 +1,55 @@
## Semantic prompt (for Wezterm)
set _fishprompt_aid "fish"$fish_pid
set _fishprompt_started 0
# empty if running; or a numeric exit code; or CANCEL
set _fishprompt_postexec ""
functions -c fish_prompt _fishprompt_saved_prompt
set _fishprompt_prompt_count 0
set _fishprompt_disp_count 0
function _fishprompt_start --on-event fish_prompt
set _fishprompt_prompt_count (math $_fishprompt_prompt_count + 1)
# don't use post-exec, because it is called *before* omitted-newline output
if [ -n "$_fishprompt_postexec" ]
printf "\033]133;D;%s;aid=%s\007" "$_fishprompt_postexec" $_fishprompt_aid
end
printf "\033]133;A;aid=%s;cl=m\007" $_fishprompt_aid
end
function fish_prompt
set _fishprompt_disp_count (math $_fishprompt_disp_count + 1)
printf "\033]133;P;k=i\007%b\033]133;B\007" (string join "\n" (_fishprompt_saved_prompt))
set _fishprompt_started 1
set _fishprompt_postexec ""
end
function _fishprompt_preexec --on-event fish_preexec
if [ "$_fishprompt_started" = 1 ]
printf "\033]133;C;\007"
end
set _fishprompt_started 0
end
function _fishprompt_postexec --on-event fish_postexec
set _fishprompt_postexec $status
_fishprompt_start
end
function __fishprompt_cancel --on-event fish_cancel
set _fishprompt_postexec CANCEL
_fishprompt_start
end
function _fishprompt_exit --on-process %self
if [ "$_fishprompt_started" = 1 ]
printf "\033]133;Z;aid=%s\007" $_fishprompt_aid
end
end
if functions -q fish_right_prompt
functions -c fish_right_prompt _fishprompt_saved_right_prompt
function fish_right_prompt
printf "\033]133;P;k=r\007%b\033]133;B\007" (string join "\n" (_fishprompt_saved_right_prompt))
end
end

View file

@ -0,0 +1,72 @@
function __jj_in_repo
jj --ignore-working-copy --quiet root >>/dev/null 2>&1
end
function vcs_root
jj workspace root --ignore-working-copy 2>/dev/null || git rev-parse --show-toplevel 2>/dev/null || pwd
end
function vcs_broot
br (vcs_root)
commandline -f repaint
end
function vcs_jump
set _dir (vcs_root)
if [ "$_dir" = "$PWD" ]
set _dir (br -f --conf "$HOME/.config/broot/conf.toml")
end
[ -n "$_dir" ] && pushd $_dir >>/dev/null
commandline -f repaint
end
function vcs_status
if __jj_in_repo
jj status --ignore-working-copy
else
git status -sb
end
commandline -f repaint
end
function vcs_diff
if __jj_in_repo
jj show $argv
else
git diff --stat -p -C --color-words $argv
end
commandline -f repaint
end
function vcs_log
if __jj_in_repo
jj log --ignore-working-copy $argv
else
git diff --stat -p -C --color-words $argv
end
commandline -f repaint
end
function vcs_ui
if __jj_in_repo
lazyjj
else
gitui
end
commandline -f repaint
end
# Abbreviations
abbr -a d vcs_diff
abbr -a s vcs_status
# Bindings
bind \c_ vcs_jump
bind \ea vcs_log
bind \ee vcs_broot
bind \eg vcs_ui
bind \eS vcs_diff
bind \es vcs_status

View file

@ -0,0 +1,2 @@
-- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy")

View file

@ -0,0 +1,16 @@
-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
-- Add any additional autocmds here
local function augroup(name)
return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true })
end
-- Set comment string for CUE files
vim.api.nvim_create_autocmd("FileType", {
group = augroup("cue"),
pattern = { "cue" },
callback = function(ev)
vim.bo[ev.buf].commentstring = "// %s"
end,
})

View file

@ -0,0 +1,14 @@
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
-- C-/ should be comment instead of lazyterm
vim.api.nvim_del_keymap("n", "<c-/>")
vim.api.nvim_set_keymap("n", "<c-/>", "gcc", {})
vim.api.nvim_set_keymap("v", "<c-/>", "gc", {})
vim.api.nvim_set_keymap("n", "<Leader><c-/>", "gcgc", {})
vim.api.nvim_set_keymap("n", "<Tab>", "<Space>,", {})
vim.api.nvim_set_keymap("n", "zz", "zt", {})
vim.api.nvim_set_keymap("n", "[d", ":lua vim.diagnostic.goto_prev { float = false }<Enter>", {})
vim.api.nvim_set_keymap("n", "]d", ":lua vim.diagnostic.goto_next { float = false }<Enter>", {})

View file

@ -0,0 +1,60 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
-- bootstrap lazy.nvim
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- extras
{ import = "lazyvim.plugins.extras.dap.core" },
{ import = "lazyvim.plugins.extras.editor.overseer" },
{ import = "lazyvim.plugins.extras.editor.telescope" },
{ import = "lazyvim.plugins.extras.formatting.prettier" },
{ import = "lazyvim.plugins.extras.lang.go" },
{ import = "lazyvim.plugins.extras.lang.json" },
{ import = "lazyvim.plugins.extras.lang.markdown" },
{ import = "lazyvim.plugins.extras.lang.nix" },
{ import = "lazyvim.plugins.extras.lang.rust" },
{ import = "lazyvim.plugins.extras.lang.toml" },
{ import = "lazyvim.plugins.extras.lang.typescript" },
{ import = "lazyvim.plugins.extras.lang.yaml" },
{ import = "lazyvim.plugins.extras.lsp.none-ls" },
{ import = "lazyvim.plugins.extras.test.core" },
{ import = "lazyvim.plugins.extras.ui.edgy" },
{ import = "lazyvim.plugins.extras.ui.treesitter-context" },
{ import = "lazyvim.plugins.extras.util.gitui" },
{ import = "lazyvim.plugins.extras.util.project" },
-- plugins
{ import = "plugins" },
},
defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
checker = { enabled = false }, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {
"gzip",
-- "matchit",
-- "matchparen",
"netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View file

@ -0,0 +1,36 @@
vim.opt.number = true
vim.opt.relativenumber = false
vim.g.do_filetype_lua = 1
vim.g.root_spec = { { ".git", "lua" }, "lsp", "cwd" }
vim.o.autochdir = true
vim.o.fillchars = "stl: ,stlnc: ,eob:░"
vim.o.list = false
vim.o.scrolloff = 7
vim.o.splitkeep = "screen"
vim.o.updatetime = 500
vim.o.timeout = true
vim.o.timeoutlen = 0
-- additional filetypes
vim.filetype.add({
extension = {
templ = "templ",
},
})
-- AutoCommand OSC7 workaround for tmux
-- see https://github.com/neovim/neovim/issues/21771
vim.api.nvim_create_autocmd("dirchanged", {
pattern = "*",
command = 'call chansend(v:stderr, printf("\\033]7;%s\\033", v:event.cwd))',
})
-- (No) Statusline
vim.opt.laststatus = 0
vim.api.nvim_set_hl(0, "Statusline", { link = "Normal" })
vim.api.nvim_set_hl(0, "StatuslineNC", { link = "Normal" })
local line = string.rep("", vim.api.nvim_win_get_width(0))
vim.opt.statusline = "%#WinSeparator#" .. line .. "%*"

View file

@ -0,0 +1,69 @@
return {
{
"echasnovski/mini.pairs",
enabled = false,
},
{
"nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
opts = function(_, opts)
local cmp = require("cmp")
table.insert(opts.sources, { name = "emoji" })
opts.view = { docs = { auto_open = false }, entries = { follow_cursor = true } }
opts.completion = {
autocomplete = false,
}
local winhighlight =
"Normal:NoiceCmdlinePopupTitle,FloatBorder:NoiceCmdlinePopupBorder,CursorLine:PMenuSel,Search:Search"
opts.window = {
completion = cmp.config.window.bordered({ winhighlight = winhighlight, border = "rounded" }),
documentation = cmp.config.window.bordered({ winhighlight = winhighlight, border = "rounded" }),
preview = cmp.config.window.bordered({ winhighlight = winhighlight, border = "rounded" }),
}
-- lua sorting = { comparators = { cmp.config.compare.sort_text, -- this needs to be 1st cmp.config.compare.offset, cmp.config.compare.exact, cmp.config.compare.score, cmp.config.compare.kind, cmp.config.compare.length, cmp.config.compare.order, } }
opts.sorting = {
priority_weight = 2,
comparators = {
cmp.config.compare.exact,
cmp.config.compare.recently_used,
cmp.config.compare.locality,
cmp.config.compare.offset,
-- cmp.config.compare.scopes,
cmp.config.compare.score,
cmp.config.compare.kind,
-- cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
}
return opts
end,
},
{
"Exafunction/codeium.nvim",
opts = {
enable_chat = false,
},
},
{
"monkoose/neocodeium",
event = "VeryLazy",
config = function()
local neocodeium = require("neocodeium")
neocodeium.setup()
vim.keymap.set("i", "<C-j>", neocodeium.accept)
vim.keymap.set("i", "<A-f>", neocodeium.accept)
vim.keymap.set("i", "<C-h>", neocodeium.cycle_or_complete)
end,
},
}

View file

@ -0,0 +1,14 @@
return {
{
"https://git.shelman.io/shelmangroup/dieter.nvim.git",
lazy = false,
priority = 1000,
},
{
"LazyVim/LazyVim",
opts = {
colorscheme = "dieter",
},
},
}

View file

@ -0,0 +1,95 @@
return {
{
"folke/flash.nvim",
enabled = false,
},
{
"telescope.nvim",
keys = {
{
"<Leader><Leader>",
function()
local telescope = require("telescope")
local jj_pick_status, jj_res = pcall(telescope.extensions.jj.files, opts)
if jj_pick_status then
return
end
local git_files_status, git_res = pcall(telescope.builtin.git_files, opts)
if not git_files_status then
error("Could not launch jj/git files: \n" .. jj_res .. "\n" .. git_res)
end
end,
desc = "VCS Files",
},
},
opts = function(_, opts)
local actions = require("telescope.actions")
opts.defaults = {
layout_strategy = "horizontal",
layout_config = {
anchor = "top",
horizontal = {
prompt_position = "top",
mirror = false,
preview_width = 0.49,
-- preview_height = 0.5,
},
width = 0.99,
height = 0.9,
preview_cutoff = 10,
},
mappings = {
i = {
["<esc>"] = actions.close, -- <Esc> close popup
["<C-u>"] = false, -- <C-u> clear prompt
["<C-w>"] = false, -- <C-u> clear prompt
},
},
path_display = { "filename_first" },
-- previewer = false,
preview = {
-- hide_on_startup = true,
},
sorting_strategy = "ascending",
winblend = 0,
wrap_results = true,
}
end,
},
{ "avm99963/vim-jjdescription", lazy = false },
{
"zschreur/telescope-jj.nvim",
keys = {
{
"<Leader>jc",
function()
require("telescope").extensions.jj.conflicts()
end,
desc = "jj conflicts",
},
{
"<Leader>jd",
function()
require("telescope").extensions.jj.diff()
end,
desc = "jj diffs",
},
{
"<Leader>jf",
function()
require("telescope").extensions.jj.files()
end,
desc = "jj files",
},
},
config = function()
LazyVim.on_load("telescope.nvim", function()
local telescope = require("telescope")
telescope.load_extension("jj")
end)
end,
},
}

View file

@ -0,0 +1,99 @@
return {
{
"direnv/direnv.vim",
lazy = false,
priority = 900,
config = function()
vim.g.direnv_silent_load = 1
end,
},
{
"nvimtools/none-ls.nvim",
opts = function(_, opts)
local nls = require("null-ls")
opts.root_dir = opts.root_dir
or require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git")
opts.sources = vim.list_extend(opts.sources or {}, {
nls.builtins.formatting.mdformat,
nls.builtins.formatting.stylua,
nls.builtins.formatting.shfmt,
nls.builtins.formatting.buf,
nls.builtins.formatting.buildifier,
nls.builtins.diagnostics.buildifier,
nls.builtins.diagnostics.buf.with({
args = { "lint", "--disable-symlinks", "--path", "$FILENAME" },
cwd = function()
local file_dir = vim.fn.expand("%:p:h") .. ";"
local buf_yaml = vim.fn.findfile("buf.yaml", file_dir)
if buf_yaml then
return vim.fn.fnamemodify(buf_yaml, ":h")
end
end,
}),
})
end,
},
{
"nvim-neo-tree/neo-tree.nvim",
opts = {
window = {
width = 30,
position = "right",
},
},
},
{
"simrat39/rust-tools.nvim",
enabled = false,
},
{
"mrcjkb/rustaceanvim",
version = "^4", -- Recommended
ft = { "rust" },
opts = {
server = {
on_attach = function(_, bufnr)
vim.keymap.set("n", "<leader>cR", function()
vim.cmd.RustLsp("codeAction")
end, { desc = "Code Action", buffer = bufnr })
vim.keymap.set("n", "<leader>dr", function()
vim.cmd.RustLsp("debuggables")
end, { desc = "Rust debuggables", buffer = bufnr })
vim.keymap.set("n", "<leader>cD", function()
vim.cmd.RustLsp("externalDocs")
end, { desc = "Rust external documentation", buffer = bufnr })
end,
},
settings = {
-- rust-analyzer language server configuration
["rust-analyzer"] = {
cargo = {
allFeatures = true,
loadOutDirsFromCheck = true,
runBuildScripts = true,
targetDir = true,
},
-- Add clippy lints for Rust.
checkOnSave = {
allFeatures = true,
command = "clippy",
extraArgs = { "--no-deps" },
},
procMacro = {
enable = true,
ignored = {
["async-trait"] = { "async_trait" },
["napi-derive"] = { "napi" },
["async-recursion"] = { "async_recursion" },
},
},
},
},
},
},
}

View file

@ -0,0 +1,15 @@
return {
{
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
["cue"] = { { "cue_fmt" } },
["html"] = { { "prettierd", "prettier" } },
["nix"] = { "nixfmt" },
["sass"] = { { "prettierd", "prettier" } },
["proto"] = { { "buf" } },
["terraform"] = { { "terraform_fmt" } },
},
},
},
}

View file

@ -0,0 +1,72 @@
return {
"b0o/incline.nvim",
config = function()
local devicons = require("nvim-web-devicons")
require("incline").setup({
window = {
margin = {
horizontal = 0,
vertical = 0,
},
padding = 0,
placement = {
horizontal = "right",
vertical = "bottom",
},
},
render = function(props)
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
if filename == "" then
filename = "[No Name]"
end
local ft_icon, ft_color = devicons.get_icon_color(filename)
local function get_git_diff()
local icons = { removed = "", changed = "", added = "" }
local signs = vim.b[props.buf].gitsigns_status_dict
local labels = {}
if signs == nil then
return labels
end
for name, icon in pairs(icons) do
if tonumber(signs[name]) and signs[name] > 0 then
table.insert(labels, { icon .. signs[name] .. " ", group = "Diff" .. name })
end
end
if #labels > 0 then
table.insert(labels, { "" })
end
return labels
end
local function get_diagnostic_label()
local icons = { error = "", warn = "", info = "", hint = "" }
local label = {}
for severity, icon in pairs(icons) do
local n = #vim.diagnostic.get(
props.buf,
{ severity = vim.diagnostic.severity[string.upper(severity)] }
)
if n > 0 then
table.insert(label, { icon .. n .. " ", group = "DiagnosticSign" .. severity })
end
end
if #label > 0 then
table.insert(label, { "" })
end
return label
end
return {
{ " " },
{ get_diagnostic_label() },
{ get_git_diff() },
{ filename, group = "Label" },
{ " " },
}
end,
})
end,
event = "VeryLazy",
}

View file

@ -0,0 +1,33 @@
return {
{
"neovim/nvim-lspconfig",
opts = {
diagnostics = {
virtual_text = false,
},
inlay_hints = { enabled = false },
-- codelens = {
-- enabled = true,
-- },
servers = {
starpls = {},
yamlls = {
settings = {
yaml = {
schemas = {
-- kubernetes = "*.yaml",
["http://json.schemastore.org/github-workflow"] = ".github/workflows/*",
["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}",
["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}",
["http://json.schemastore.org/chart"] = "Chart.{yml,yaml}",
["https://json.schemastore.org/dependabot-v2"] = ".github/dependabot.{yml,yaml}",
["https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"] = "*api*.{yml,yaml}",
["https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.29.1/all.json"] = "/*.yaml",
},
},
},
},
},
},
},
}

View file

@ -0,0 +1,41 @@
return {
{
"nvim-treesitter/nvim-treesitter-context",
opts = {
enable = false,
},
},
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"bash",
"c",
"diff",
"go",
"html",
"javascript",
"jsdoc",
"json",
"jsonc",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"rust",
"toml",
"tsx",
"typescript",
"vim",
"vimdoc",
"xml",
"yaml",
})
end,
},
}

View file

@ -0,0 +1,140 @@
local logo = [[
]]
return {
{
"nvimdev/dashboard-nvim",
opts = {
theme = "hyper",
config = {
header = vim.split(string.rep("\n", 8) .. logo, "\n"),
week_header = { enable = false },
packages = { enable = false },
project = { enable = false },
footer = {},
shortcut = {},
},
},
},
{
"dgagn/diagflow.nvim",
-- event = 'LspAttach', This is what I use personnally and it works great
opts = {
scope = "line",
gap_size = 0,
max_width = 50,
max_height = 20,
show_borders = true,
toggle_event = { "InsertEnter", "InsertLeave" },
},
},
{
"akinsho/bufferline.nvim",
enabled = false,
},
{
"echasnovski/mini.indentscope",
enabled = false,
},
{
"lukas-reineke/indent-blankline.nvim",
enabled = false,
},
{ "nvimdev/indentmini.nvim", opts = { char = "" } },
{
"mvllow/modes.nvim",
opts = {
colors = {
copy = "#f5c359",
delete = "#c75c6a",
insert = "#ffcc00",
visual = "#c343fc",
},
set_cursor = true,
set_cursorline = true,
set_number = true,
},
},
{
"folke/noice.nvim",
event = "VeryLazy",
keys = {
{ "<leader>sna", "<cmd>NoiceTelescope<cr>", desc = "Show all messages in Telescope" },
},
opts = function()
local enable_conceal = true -- Hide command text if true
return {
presets = { bottom_search = true }, -- The kind of popup used for /
cmdline = {
view = "cmdline", -- The kind of popup used for :
format = {
cmdline = { conceal = enable_conceal },
search_down = { conceal = enable_conceal },
search_up = { conceal = enable_conceal },
filter = { conceal = enable_conceal },
lua = { conceal = enable_conceal },
help = { conceal = enable_conceal },
input = { conceal = enable_conceal },
},
},
messages = { enabled = true, view = "mini" },
lsp = {
hover = { enabled = false },
signature = { enabled = false },
progress = { enabled = true, view = "cmdline" },
message = { enabled = false },
smart_move = { enabled = false },
},
}
end,
},
{
"rcarriga/nvim-notify",
opts = {
timeout = 1000,
render = "wrapped-compact",
top_down = false,
max_width = function()
return math.floor(vim.o.columns * 0.5)
end,
on_open = function(win)
vim.api.nvim_win_set_config(win, {
focusable = false,
zindex = 100,
})
end,
},
},
{
"nvim-lualine/lualine.nvim",
enabled = false,
},
{
"ahmedkhalf/project.nvim",
opts = {
exclude_dirs = {
"~/.cargo/*",
"~/.config/*",
"/tmp/*",
},
manual_mode = false,
patterns = { ".git", ".jj" },
},
},
}

View file

@ -0,0 +1,316 @@
local wezterm = require("wezterm")
local mux = wezterm.mux
local act = wezterm.action
local config = {}
-- ------------------------------------------------------------------------------------
-- Workspace behavior
-- FIXME: use of the local env var here only works with the same UID on all machines
local nvim_args = { "nvim", "--listen", os.getenv("XDG_RUNTIME_DIR") .. "/nvim-persistent.sock" }
config.exec_domains = {
wezterm.exec_domain("dev", function(cmd)
local wrapped = { "ssh", "-t", "dev" }
for _, arg in ipairs(cmd.args or { os.getenv("SHELL") }) do
table.insert(wrapped, arg)
end
cmd.args = wrapped
return cmd
end),
wezterm.exec_domain("nemo", function(cmd)
local wrapped = { "ssh", "-t", "nemo" }
for _, arg in ipairs(cmd.args or { os.getenv("SHELL") }) do
table.insert(wrapped, arg)
end
cmd.args = wrapped
return cmd
end),
}
local function activate_nvim(window, pane)
wezterm.log_info("nvim")
for _, t in ipairs(window:mux_window():tabs_with_info()) do
for _, p in ipairs(t.tab:panes()) do
if p:get_title() == "nvim" or t.tab:get_title() == "nvim" then
window:perform_action(
act.Multiple({
act.ActivateTab(t.index),
act.MoveTab(0),
}),
pane
)
return
end
end
end
local nvim_tab, nvim_pane, _ = window:mux_window():spawn_tab({ args = nvim_args })
window:perform_action(act.MoveTab(0), nvim_pane)
nvim_tab:set_title("nvim")
end
local function activate_tab(title, index)
return function(window, pane)
wezterm.log_info(title)
for _, t in ipairs(window:mux_window():tabs_with_info()) do
if t.tab:get_title() == title then
window:perform_action(
act.Multiple({
act.ActivateTab(t.index),
act.MoveTab(index),
}),
pane
)
return
end
end
local tab, _, _ = window:mux_window():spawn_tab({
cwd = "~",
})
tab:set_title(title)
window:perform_action(act.MoveTab(index), pane)
end
end
wezterm.on("activate-nvim", activate_nvim)
wezterm.on("tab-2", activate_tab("t2", 1))
wezterm.on("tab-3", activate_tab("t3", 2))
wezterm.on("tab-4", activate_tab("t4", 3))
wezterm.on("tab-5", activate_tab("t5", 4))
wezterm.on("tab-6", activate_tab("t6", 5))
wezterm.on("tab-7", activate_tab("t7", 6))
wezterm.on("tab-8", activate_tab("t8", 7))
wezterm.on("tab-9", activate_tab("t9", 8))
wezterm.on("tab-10", activate_tab("t10", 9))
wezterm.on("user-var-changed", function(window, pane, name, value)
if name == "nvim_activate" then
activate_nvim(window, pane)
end
if name == "open_url" then
local url = string.match(value, "%S+")
local u = wezterm.url.parse(string.match(value, "%S+"))
if u.scheme == "https" or u.scheme == "http" then
wezterm.log_info(url)
wezterm.background_child_process({ "xdg-open", url })
end
end
end)
-- ------------------------------------------------------------------------------------
-- Appearance
local function colors_for_appearance(appearance)
if appearance:find("Dark") then
return {
background = "#0d1117",
-- background = "#000000",
foreground = "#b2b2b2",
cursor_bg = "#00d992",
cursor_fg = "#000000",
cursor_border = "#000000",
selection_bg = "#d7d7d7",
selection_fg = "#000000",
ansi = { "#000000", "#ff0035", "#85ff00", "#ffc900", "#00a7ff", "#cb01ff", "#00e0ff", "#f0f0f0" },
brights = { "#000000", "#ff8c88", "#baff94", "#ffe090", "#88ccff", "#e38dff", "#97eeff", "#ffffff" },
}
else
return {
background = "#fefeff",
foreground = "#222222",
cursor_bg = "#aa0000",
cursor_fg = "#ffffff",
cursor_border = "#ffffff",
selection_bg = "#ffe6a4",
selection_fg = "#483600",
ansi = { "#000000", "#9e001d", "#306300", "#deae00", "#00669e", "#7d009e", "#008a9e", "#f7f7f7" },
brights = { "#000000", "#ff0035", "#509e00", "#ffc900", "#00a7ff", "#cb01ff", "#00e0ff", "#ffffff" },
}
end
end
config.colors = colors_for_appearance(wezterm.gui.get_appearance())
-- ------------------------------------------------------------------------------------
-- Fonts
local berkeley_mono_features = {
-- "calt=1",
-- "dlig=0",
-- "liga",
-- "calt=1",
-- "clig=1",
-- "ss02", -- Clean Zero
"ss03", -- Slashed Zero
-- "ss04", -- Cut Zero
}
-- #[ ## ### #### ################
config.font = wezterm.font_with_fallback({
{
family = "BerkeleyMono Nerd Font",
-- family = "Ubuntu Mono",
-- weight = "Regular",
harfbuzz_features = berkeley_mono_features,
},
"Noto Sans Mono",
"Noto Color Emoji",
})
config.font_rules = {
{
italic = true,
intensity = "Bold",
reverse = false,
font = wezterm.font({
family = "BerkeleyMono Nerd Font",
-- family = "Monaspace Radon Light",
italic = true,
harfbuzz_features = berkeley_mono_features,
}),
},
}
wezterm.on("window-config-reloaded", function(window, pane)
local overrides = window:get_config_overrides() or {}
local dpi = wezterm.gui.screens().active.effective_dpi
if dpi > 96 then
overrides.font_size = 14
overrides.freetype_load_target = "Normal"
-- overrides.cell_width = 0.95
overrides.cell_width = 1.0
else
overrides.font_size = 18
overrides.freetype_load_target = "HorizontalLcd"
end
window:set_config_overrides(overrides)
end)
config.font_size = 14
config.warn_about_missing_glyphs = false
config.bold_brightens_ansi_colors = false
config.unicode_version = 14
config.custom_block_glyphs = false
config.allow_square_glyphs_to_overflow_width = "Always"
-- config.use_cap_height_to_scale_fallback_fonts = true
-- Config
config.enable_wayland = true
config.xcursor_theme = "Adwaita"
config.check_for_updates = false
-- UI
config.command_palette_font_size = 13.5
config.initial_cols = 116
config.initial_rows = 36
config.status_update_interval = 100
config.max_fps = 90
config.audible_bell = "Disabled"
config.use_resize_increments = true
config.adjust_window_size_when_changing_font_size = false
config.use_resize_increments = true
config.window_decorations = "RESIZE"
config.window_frame = {
border_left_width = "4px",
border_right_width = "4px",
border_bottom_height = "4px",
border_top_height = "4px",
border_left_color = "#000000",
border_right_color = "#000000",
border_bottom_color = "#000000",
border_top_color = "#000000",
}
config.window_padding = {
left = 10,
right = 10,
top = 0,
bottom = 0,
}
-- Hyperlinks
config.hyperlink_rules = wezterm.default_hyperlink_rules()
table.insert(config.hyperlink_rules, {
regex = [[E(\d+)]],
format = "https://doc.rust-lang.org/error_codes/E$1.html",
})
-- Tabs
config.enable_tab_bar = false
config.tab_bar_at_bottom = true
config.use_fancy_tab_bar = false
config.show_tab_index_in_tab_bar = true
-- Cursor
config.default_cursor_style = "SteadyBlock"
config.cursor_thickness = "6px"
config.cursor_blink_rate = 700
config.hide_mouse_cursor_when_typing = false
config.underline_position = -3
config.underline_thickness = 2
-- Scrolling
config.enable_scroll_bar = false
config.scrollback_lines = 5000
config.alternate_buffer_wheel_scroll_speed = 1
-- Keys
config.disable_default_key_bindings = true
config.keys = {
{ key = "c", mods = "ALT|SHIFT", action = act.CopyTo("ClipboardAndPrimarySelection") },
{ key = "v", mods = "ALT|SHIFT", action = act.PasteFrom("Clipboard") },
{ key = "c", mods = "CTRL|SHIFT", action = act.CopyTo("ClipboardAndPrimarySelection") },
{ key = "v", mods = "CTRL|SHIFT", action = act.PasteFrom("Clipboard") },
{ key = "0", mods = "CTRL", action = "ResetFontSize" },
{ key = "-", mods = "CTRL", action = "DecreaseFontSize" },
{ key = "=", mods = "CTRL", action = "IncreaseFontSize" },
{ key = "UpArrow", mods = "CTRL", action = act.ScrollToPrompt(-1) },
{ key = "DownArrow", mods = "CTRL", action = act.ScrollToPrompt(1) },
{ key = "UpArrow", mods = "SHIFT", action = act.ScrollByLine(-1) },
{ key = "DownArrow", mods = "SHIFT", action = act.ScrollByLine(1) },
{ key = "PageUp", mods = "SHIFT", action = act.ScrollByPage(-0.5) },
{ key = "PageDown", mods = "SHIFT", action = act.ScrollByPage(0.5) },
{ key = "r", mods = "ALT", action = act.ReloadConfiguration },
{ key = "o", mods = "ALT", action = act.ActivateCommandPalette },
{ key = "RightArrow", mods = "CTRL", action = act.ActivateTabRelative(1) },
{ key = "LeftArrow", mods = "CTRL", action = act.ActivateTabRelative(-1) },
{ key = "Backspace", mods = "ALT", action = act.SwitchWorkspaceRelative(1) },
{ key = "1", mods = "ALT", action = act.EmitEvent("activate-nvim") },
{ key = "2", mods = "ALT", action = act.EmitEvent("tab-2") },
{ key = "3", mods = "ALT", action = act.EmitEvent("tab-3") },
{ key = "4", mods = "ALT", action = act.EmitEvent("tab-4") },
{ key = "5", mods = "ALT", action = act.EmitEvent("tab-5") },
{ key = "6", mods = "ALT", action = act.EmitEvent("tab-6") },
{ key = "7", mods = "ALT", action = act.EmitEvent("tab-7") },
{ key = "8", mods = "ALT", action = act.EmitEvent("tab-8") },
{ key = "9", mods = "ALT", action = act.EmitEvent("tab-9") },
{ key = "0", mods = "ALT", action = act.EmitEvent("tab-10") },
}
-- Mouse
config.mouse_bindings = {
{
event = { Down = { streak = 1, button = { WheelUp = 1 } } },
mods = "SHIFT",
action = act.ScrollByLine(-5),
},
{
event = { Down = { streak = 1, button = { WheelDown = 1 } } },
mods = "SHIFT",
action = act.ScrollByLine(5),
},
{
event = { Down = { streak = 1, button = { WheelUp = 1 } } },
action = act.ScrollByLine(-1),
},
{
event = { Down = { streak = 1, button = { WheelDown = 1 } } },
action = act.ScrollByLine(1),
},
}
return config

3
files/scripts/git-signing-key Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
set -euo pipefail
ssh-add -L | awk '/^sk-ssh-/ { print "key::" $1 " " $2 }'

184
files/scripts/test-term.sh Executable file
View file

@ -0,0 +1,184 @@
echo -ne '\e[0mnormal\e[0m\t\t\t'
echo -e '\e[7m reverse \e[0m'
echo -ne '\e[2mdim\e[0m\t\t\t'
echo -e '\e[7;2m reverse dim \e[0m'
echo -ne '\e[1mbold\e[0m\t\t\t'
echo -e '\e[7;1m reverse bold \e[0m'
echo -ne '\e[3mitalic\e[0m\t\t\t'
echo -e '\e[7;3m reverse italic \e[0m'
echo -ne '\e[2;3mdim italic\e[0m\t\t'
echo -e '\e[7;2;3m reverse dim italic \e[0m'
echo -ne '\e[1;3mbold italic\e[0m\t\t'
echo -e '\e[7;1;3m reverse bold italic \e[0m'
echo
echo -e '\e[4munderline\e[0m'
echo -e '\e[3;4mitalic underline\e[0m'
echo -e '\e[4:1mthis is also underline \e[0m'
echo -e '\e[21mdouble underline \e[0m'
echo -e '\e[4:2mthis is also double underline \e[0m'
echo -e '\e[4:3mcurly underline \e[0m'
echo -e '\e[21m\e[58;5;42m256-color underline \e[0m'
echo -e '\e[4:3m\e[58;2;240;143;104mtruecolor underline (*)\e[0m'
echo -e "\e[58:2::255:0:0m\e[4:1msingle underline \e[0m"
echo -e "\e[4:2mdouble underline \e[58:2::255:0:0m and with color\e[0m"
echo -e "\e[4:3mcurly underline \e[58:2::255:0:0m and with color\e[0m"
echo -e "\e[4:4mdotted underline \e[58:2::255:0:0m and with color\e[0m"
echo -e "\e[4:5mdashed underline \e[58:2::255:0:0m and with color\e[0m"
echo
echo -e '\e[5mblink \e[0m'
echo -e '\e[8minvisible\e[0m <- invisible (but copy-pasteable)'
echo -e '\e[9mstrikethrough\e[0m'
echo -e '\e[53moverline \e[0m'
echo -e '\e[51mframed \e[0m'
echo -e '\e[52mencircled \e[0m'
echo -e '\e[31mred\e[0m'
echo -e '\e[91mbright red\e[0m'
echo -e '\e[38:5:42m256-color, de jure standard (ITU-T T.416)\e[0m'
echo -e '\e[38;5;42m256-color, de facto standard (commonly used)\e[0m'
echo -e '\e[38:2::240:143:104mtruecolor, de jure standard (ITU-T T.416) \e[0m'
echo -e '\e[38;2;240;143;104mtruecolor, de facto standard (commonly used)\e[0m'
echo -e '\e[46mcyan background\e[0m'
echo -e '\e[106mbright cyan background\e[0m'
echo -e '\e[48:5:42m256-color background, de jure standard (ITU-T T.416)\e[0m'
echo -e '\e[48;5;42m256-color background, de facto standard (commonly used)\e[0m'
echo -e '\e[48:2::240:143:104mtruecolor background, de jure standard (ITU-T T.416) \e[0m'
echo -e '\e[48:2:240:143:104mtruecolor background, rarely used incorrect format (might be removed at some point)\e[0m'
echo -e '\e[48;2;240;143;104mtruecolor background, de facto standard (commonly used)\e[0m'
echo
echo "Emoji: 🚀 💩 😁 🍖 🔥 🔷 ❤️ "
echo
echo "Nerdfonts:    󱓼 󱓺 󱓻            󱠇 󰲬  󰍎  󰬟  "
echo "   󱄅 󰣇       "
echo
echo "Geometrical:"
echo -e '◆ ◇ ◈ ● ○ ◉ ◎ ◍ ◌'
echo -e '■ □ ▢ ▣ ▤ ▥ ▦ ▧ ▨ ▩'
echo -e '◧ ◨ ◩ ◪ ◫ ◬ ◭ ◮ △ ▲ ▱ ▰ ▽ ▼ ▾ ▿'
echo -e '◠ ◡ ◢ ◣ ◤ ◥ ◦ ◧ ◨ ◩ ◪ ◫ ◬ ◭ ◮ ◯ ◰ ◱ ◲ ◳ ◴ ◵ ◶ ◷ ◸ ◹ ◺ ◻ ◼ ◽ ◾ ◿'
echo "Arrows:"
echo -e '← → ↑ ↓ ↔ ↔ ↕ ↖ ↗ ↙ ↘ ↠ ↣ ↦ ↧ ↨ ↩ ↪ ↫ ↬ ↭ ↮ ↯ ↰ ↱ ↲ ↳ ↴ ↵ ↶ ↷ ↸ ↹ ↺ ↻ ↼ ↽ ↾ ↿ ↼ ↽ ↾ ↿'
echo -e '⇄ ↔ ⇀ ⇂ ⇄ ⇆ ⇌ ⇎ ⇐ ⇑ ⇓ ⇕ ⇖ ⇗ ⇘ ⇙ ⇚ ⇛ ⇜ ⇝ ⇞ ⇟'
echo
echo "Blocks:"
echo -e '🮙 ░ ▒ ▓ █ █ ▊ ▋ ▌ ▍ ▎ ▏'
echo -e '🮙 ░ ▒ ▓ █ █ ▊ ▋ ▌ ▍ ▎ ▏'
echo -e '🮙 ░ ▒ ▓ █ █ ▊ ▋ ▌ ▍ ▎ ▏'
echo -e '▄ ▀ ▁ ▂ ▃ ▄ ▅ ▆ ▇ █'
echo
echo -e '╭──────────────╮'
echo -e '│ border chars │'
echo -e '╰──────────────╯'
echo
echo "Ligatures:"
echo "-<< -< -<- <-- <--- <<- <- -> ->> --> ---> ->- >- >>- <-> <--> <---> <----> <!--"
echo "=<< =< =<= <== <=== <<= <= => =>> ==> ===> =>= >= >>= <=> <==> <===> <====> <!---"
echo "[| |] {| |} <=< >=> <~~ <~ ~> ~~> :: ::: \/ /\ == != /= ~= <> === !== =/= =!= :>"
echo ":= :- :+ <* <*> *> <| <|> |> <. <.> .> +: -: =: <***> __ (* comm *) ++ +++ |- -|"
echo
echo 24-bit colors:
# This file was originally taken from iterm2 https://github.com/gnachman/iTerm2/blob/master/tests/24-bit-color.sh
#
# This file echoes a bunch of 24-bit color codes
# to the terminal to demonstrate its functionality.
# The foreground escape sequence is ^[38;2;<r>;<g>;<b>m
# The background escape sequence is ^[48;2;<r>;<g>;<b>m
# <r> <g> <b> range from 0 to 255 inclusive.
# The escape sequence ^[0m returns output to default
setBackgroundColor() {
printf '\x1b[48;2;%s;%s;%sm' $1 $2 $3
}
resetOutput() {
echo -en "\x1b[0m\n"
}
# Gives a color $1/255 % along HSV
# Who knows what happens when $1 is outside 0-255
# Echoes "$red $green $blue" where
# $red $green and $blue are integers
# ranging between 0 and 255 inclusive
rainbowColor() {
let h=$1/43
let f=$1-43*$h
let t=$f*255/43
let q=255-t
if [ $h -eq 0 ]; then
echo "255 $t 0"
elif [ $h -eq 1 ]; then
echo "$q 255 0"
elif [ $h -eq 2 ]; then
echo "0 255 $t"
elif [ $h -eq 3 ]; then
echo "0 $q 255"
elif [ $h -eq 4 ]; then
echo "$t 0 255"
elif [ $h -eq 5 ]; then
echo "255 0 $q"
else
# execution should never reach here
echo "0 0 0"
fi
}
for i in $(seq 0 127); do
setBackgroundColor $i 0 0
echo -en " "
done
resetOutput
for i in $(seq 255 -1 128); do
setBackgroundColor $i 0 0
echo -en " "
done
resetOutput
for i in $(seq 0 127); do
setBackgroundColor 0 $i 0
echo -n " "
done
resetOutput
for i in $(seq 255 -1 128); do
setBackgroundColor 0 $i 0
echo -n " "
done
resetOutput
for i in $(seq 0 127); do
setBackgroundColor 0 0 $i
echo -n " "
done
resetOutput
for i in $(seq 255 -1 128); do
setBackgroundColor 0 0 $i
echo -n " "
done
resetOutput
for i in $(seq 0 127); do
setBackgroundColor $(rainbowColor $i)
echo -n " "
done
resetOutput
for i in $(seq 255 -1 128); do
setBackgroundColor $(rainbowColor $i)
echo -n " "
done
resetOutput

4
files/scripts/wezterm-open-url Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
if [[ $1 == http* ]]; then
printf "\033]1337;SetUserVar=open_url=%s\007" "$(echo -n "$1" | base64)"
fi