diff --git a/.config/alacritty/alacritty.toml b/.config/alacritty/alacritty.toml index d5114a1..020550b 100644 --- a/.config/alacritty/alacritty.toml +++ b/.config/alacritty/alacritty.toml @@ -1,7 +1,14 @@ [general] -import = [ - "~/.config/alacritty/gruvbox_dark.toml" -] +import = [ "gruvbox-dark.toml" ] + +[window] +# dynamic_padding = true +padding = {x = 2, y = 2} [font.normal] -family = "Adwaita Mono" +family = "monospace" + +[keyboard] +bindings = [ + { key = "Enter", mods = "Super|Shift", action = "CreateNewWindow" } +] diff --git a/.config/alacritty/gruvbox-dark.toml b/.config/alacritty/gruvbox-dark.toml new file mode 100644 index 0000000..f953e69 --- /dev/null +++ b/.config/alacritty/gruvbox-dark.toml @@ -0,0 +1,52 @@ +# [colors] +colors.line_indicator = { foreground = "#ebdbb2", background = "#504945" } +colors.footer_bar = { foreground = "#ebdbb2", background = "#504945" } +colors.selection = { text = "CellForeground", background = "#665c54" } + +# Default colors +# [colors.primary] +# hard contrast background = = '#1d2021' +colors.primary.background = '#282828' +# soft contrast background = = '#32302f' +colors.primary.foreground = '#ebdbb2' +colors.primary.dim_foreground = '#d5c4a1' +colors.primary.bright_foreground = '#fbf1c7' + +# Normal colors +# [colors.normal] +colors.normal.black = '#282828' +colors.normal.red = '#cc241d' +colors.normal.green = '#98971a' +colors.normal.yellow = '#d79921' +colors.normal.blue = '#458588' +colors.normal.magenta = '#b16286' +colors.normal.cyan = '#689d6a' +colors.normal.white = '#a89984' + +# Bright colors +# [colors.bright] +colors.bright.black = '#928374' +colors.bright.red = '#fb4934' +colors.bright.green = '#b8bb26' +colors.bright.yellow = '#fabd2f' +colors.bright.blue = '#83a598' +colors.bright.magenta = '#d3869b' +colors.bright.cyan = '#8ec07c' +colors.bright.white = '#ebdbb2' + +colors.dim.black = '#3c3836' +colors.dim.red = '#9d0006' +colors.dim.green = '#79740e' +colors.dim.yellow = '#b57614' +colors.dim.blue = '#076678' +colors.dim.magenta = '#8f3f71' +colors.dim.cyan = '#427b58' +colors.dim.white = '#504945' + +# [colors.search] +colors.search.matches = { foreground = "#282828", background = "#fabd2f" } +colors.search.focused_match = { foreground = "#282828", background = "#fe8019" } + +# [colors.hints] +colors.hints.start = { foreground = "#282828", background = "#fe8019" } +colors.hints.end = { foreground = "#282828", background = "#fabd2f" } diff --git a/.config/alacritty/gruvbox-light.toml b/.config/alacritty/gruvbox-light.toml new file mode 100644 index 0000000..9b2f61d --- /dev/null +++ b/.config/alacritty/gruvbox-light.toml @@ -0,0 +1,52 @@ +# [colors] +colors.line_indicator = { foreground = "#3c3836", background = "#d5c4a1" } +colors.footer_bar = { foreground = "#3c3836", background = "#d5c4a1" } +colors.selection = { text = "CellForeground", background = "#bdae93" } + +# Default colors +# [colors.primary] +# hard contrast background = = '#1d2021' +# soft contrast background = = '#32302f' +colors.primary.background = '#fbf1c7' +colors.primary.foreground = '#3c3836' +colors.primary.dim_foreground = '#504945' +colors.primary.bright_foreground = '#282828' + +# Normal colors +# [colors.normal] +colors.normal.black = '#fbf1c7' +colors.normal.red = '#cc241d' +colors.normal.green = '#98971a' +colors.normal.yellow = '#d79921' +colors.normal.blue = '#458588' +colors.normal.magenta = '#b16286' +colors.normal.cyan = '#689d6a' +colors.normal.white = '#7c6f64' + +# Bright colors +# [colors.bright] +colors.bright.black = '#928374' +colors.bright.red = '#9d0006' +colors.bright.green = '#79740e' +colors.bright.yellow = '#b57614' +colors.bright.blue = '#076678' +colors.bright.magenta = '#8f3f71' +colors.bright.cyan = '#427b58' +colors.bright.white = '#3c3836' + +colors.dim.black = '#ebdbb2' +colors.dim.red = '#fb4934' +colors.dim.green = '#b8bb26' +colors.dim.yellow = '#fabd2f' +colors.dim.blue = '#83a598' +colors.dim.magenta = '#d3869b' +colors.dim.cyan = '#8ec07c' +colors.dim.white = '#d5c4a1' + +# [colors.search] +colors.search.matches = { foreground = "#fbf1c7", background = "#b57614" } +colors.search.focused_match = { foreground = "#fbf1c7", background = "#af3a03" } + +# [colors.hints] +colors.hints.start = { foreground = "#fbf1c7", background = "#af3a03" } +colors.hints.end = { foreground = "#fbf1c7", background = "#b57614" } diff --git a/.config/alacritty/gruvbox.toml b/.config/alacritty/gruvbox.toml new file mode 120000 index 0000000..5b85b4d --- /dev/null +++ b/.config/alacritty/gruvbox.toml @@ -0,0 +1 @@ +/home/never/.config/alacritty/gruvbox-light.toml \ No newline at end of file diff --git a/.config/alacritty/gruvbox_dark.toml b/.config/alacritty/gruvbox_dark.toml deleted file mode 100644 index d2845cd..0000000 --- a/.config/alacritty/gruvbox_dark.toml +++ /dev/null @@ -1,30 +0,0 @@ -# Colors (Gruvbox dark) - -# Default colors -[colors.primary] -# hard contrast background = = '#1d2021' -background = '#282828' -# soft contrast background = = '#32302f' -foreground = '#ebdbb2' - -# Normal colors -[colors.normal] -black = '#282828' -red = '#cc241d' -green = '#98971a' -yellow = '#d79921' -blue = '#458588' -magenta = '#b16286' -cyan = '#689d6a' -white = '#a89984' - -# Bright colors -[colors.bright] -black = '#928374' -red = '#fb4934' -green = '#b8bb26' -yellow = '#fabd2f' -blue = '#83a598' -magenta = '#d3869b' -cyan = '#8ec07c' -white = '#ebdbb2' diff --git a/.config/config.jsonc b/.config/config.jsonc deleted file mode 120000 index 03751c1..0000000 --- a/.config/config.jsonc +++ /dev/null @@ -1 +0,0 @@ -waybar/config.jsonc \ No newline at end of file diff --git a/.config/dconf/user b/.config/dconf/user deleted file mode 100644 index acbcd09..0000000 Binary files a/.config/dconf/user and /dev/null differ diff --git a/.config/emacs/init.el b/.config/emacs/init.el new file mode 100644 index 0000000..3b1f94c --- /dev/null +++ b/.config/emacs/init.el @@ -0,0 +1,63 @@ +(require 'package) + +;; auto install all packages called by =use-package= +(require 'use-package-ensure) +(setq use-package-always-ensure t) + +;; add package archives +(setq package-archives + '(("melpa" . "https://melpa.org/packages/") + ("gnu" . "https://elpa.gnu.org/packages/") + ("gnu-devel" . "https://elpa.gnu.org/devel/") + ("nongnu" . "https://elpa.nongnu.org/nongnu/") + )) + +(setq inhibit-startup-message t + use-dialog-box nil) + +(setq modus-themes-disable-other-themes t) + +(setq modus-themes-italic-constructs t + modus-themes-bold-constructs t + modus-themes-mixed-fonts t + modus-themes-variable-pitch-ui t) + +(setq modus-themes-headings + '((1 . (1.4)) + (2 . (1.3)) + (3 . (1.2)) + (t . (1.1)))) + +(setq modus-themes-to-toggle '(modus-operandi-tinted modus-vivendi-tinted)) +(define-key global-map (kbd "") #'modus-themes-toggle) + +(load-theme 'modus-operandi-tinted) + +;; Move customization variables to a separate file and load it +(setq custom-file (locate-user-emacs-file "custom-vars.el")) +(load custom-file 'noerror 'nomessage) + +;; Revert buffers when the underlying file has changed +(setq global-auto-revert-non-file-buffers t) +(global-auto-revert-mode 1) + +;; Turn off some unneeded UI elements +(menu-bar-mode 1) ; Leave this one on if you're a beginner! +(tool-bar-mode 0) +(scroll-bar-mode 0) + +;; Turn on some QOL +(add-hook 'prog-mode-hook 'display-line-numbers-mode) +;; (global-display-line-numbers-mode 1) +(global-hl-line-mode 1) +(global-visual-line-mode 1) +(blink-cursor-mode 0) +; (global-display-fill-column-indicator-mode 1) +(which-key-mode 1) +(recentf-mode 1) +(savehist-mode 1) +(save-place-mode 1) +(setq make-backup-files nil) + +(use-package magit) +(use-package auctex) diff --git a/.config/fish/conf.d/fish_frozen_key_bindings.fish b/.config/fish/conf.d/fish_frozen_key_bindings.fish new file mode 100644 index 0000000..dfed4d6 --- /dev/null +++ b/.config/fish/conf.d/fish_frozen_key_bindings.fish @@ -0,0 +1,14 @@ +# This file was created by fish when upgrading to version 4.3, to migrate +# the 'fish_key_bindings' variable from its old default scope (universal) +# to its new default scope (global). We recommend you delete this file +# and configure key bindings in ~/.config/fish/config.fish if needed. + +set --global fish_key_bindings fish_vi_key_bindings + +# Prior to version 4.3, fish shipped an event handler that runs +# `set --universal fish_key_bindings fish_default_key_bindings` +# whenever the fish_key_bindings variable is erased. +# This means that as long as any fish < 4.3 is still running on this system, +# we cannot complete the migration. +# As a workaround, erase the universal variable at every shell startup. +set --erase --universal fish_key_bindings diff --git a/.config/fish/conf.d/fish_frozen_theme.fish b/.config/fish/conf.d/fish_frozen_theme.fish new file mode 100644 index 0000000..ef95762 --- /dev/null +++ b/.config/fish/conf.d/fish_frozen_theme.fish @@ -0,0 +1,48 @@ +# This file was created by fish when upgrading to version 4.3, to migrate +# theme variables from universal to global scope. +# Don't edit this file, as it will be written by the web-config tool (`fish_config`). +# To customize your theme, delete this file and see +# help interactive#syntax-highlighting +# or +# man fish-interactive | less +/^SYNTAX.HIGHLIGHTING +# for appropriate commands to add to ~/.config/fish/config.fish instead. +# See also the release notes for fish 4.3.0 (run `help relnotes`). + +set --global fish_color_autosuggestion white +set --global fish_color_cancel white --bold +set --global fish_color_command brgreen --bold +set --global fish_color_comment brblack +set --global fish_color_cwd green +set --global fish_color_cwd_root red +set --global fish_color_end cyan +set --global fish_color_error red --underline=curly +set --global fish_color_escape white --bold +set --global fish_color_history_current --bold +set --global fish_color_host normal +set --global fish_color_host_remote yellow +set --global fish_color_keyword brred +set --global fish_color_match --background=brblue +set --global fish_color_normal normal +set --global fish_color_operator yellow +set --global fish_color_option brblue +set --global fish_color_param normal +set --global fish_color_quote green --italics +set --global fish_color_redirection yellow +set --global fish_color_search_match +set --global fish_color_selection --background brblack +set --global fish_color_status red +set --global fish_color_user brgreen +set --global fish_color_valid_path --underline +set --global fish_pager_color_background +set --global fish_pager_color_completion normal +set --global fish_pager_color_description yellow --italics +set --global fish_pager_color_prefix normal --bold --underline +set --global fish_pager_color_progress normal --reverse +set --global fish_pager_color_secondary_background +set --global fish_pager_color_secondary_completion +set --global fish_pager_color_secondary_description +set --global fish_pager_color_secondary_prefix +set --global fish_pager_color_selected_background --background brblue +set --global fish_pager_color_selected_completion black --bold +set --global fish_pager_color_selected_description bryellow --bold --italics +set --global fish_pager_color_selected_prefix black --bold --underline diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 09ef238..102247a 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -1,12 +1,82 @@ if status is-interactive # Commands to run in interactive sessions can go here + abbr --add ll ll -a + abbr --add adl album-dl.fish + abbr --add vv nvim + abbr --add tr gio trash + abbr --add --set-cursor tldr curl cheat.sh/% + + function copy --description 'Copy to clipboard' + fish_clipboard_copy + end + + function paste --description 'Paste from clipboard' + fish_clipboard_paste + end + + function open --wraps 'xdg-open' + xdg-open $argv &>/dev/null & disown + end + + function detach --description 'Detach a command from shell' + $argv &>/dev/null & disown + end + + function vman --description 'Uses Neovim as a manpager' + man $argv | nvim +Man! + end + + function mvi --description 'Launches mpv with mvi configuration' + mpv --config-dir=$HOME/.config/mvi/ $argv + end + + set EDITOR nvim + # Colorscheme + set fish_color_normal normal + set fish_color_command brgreen --bold + set fish_color_keyword brred + set fish_color_quote green --italics + set fish_color_redirection yellow + set fish_color_end cyan + set fish_color_error red --underline=curly + set fish_color_param normal + set fish_color_comment brblack + set fish_color_selection --background brblack + set fish_color_search_match + set fish_color_history_current + set fish_color_operator yellow + set fish_color_escape white --bold + set fish_color_cwd green + set fish_color_cwd_root red + set fish_color_option brblue + set fish_color_valid_path --underline + set fish_color_autosuggestion white + set fish_color_user brgreen + set fish_color_host normal + set fish_color_host_remote yellow + set fish_color_history_current --bold + set fish_color_status red + set fish_color_cancel white --bold + set fish_pager_color_prefix normal --bold --underline + set fish_pager_color_progress normal --reverse + set fish_pager_color_completion normal + set fish_pager_color_description yellow --italics + set fish_pager_color_selected_background --background brblue + set fish_pager_color_secondary_background + set fish_pager_color_selected_completion black --bold + set fish_pager_color_background + set fish_pager_color_selected_description bryellow --bold --italics + set fish_pager_color_secondary_prefix + set fish_pager_color_secondary_description + set fish_pager_color_selected_prefix black --bold --underline + set fish_pager_color_secondary_completion + + # if test $XDG_CURRENT_DESKTOP = "niri" + # dconf write /org/gnome/desktop/wm/preferences/button-layout "'appmenu'" + # else + # dconf reset /org/gnome/desktop/wm/preferences/button-layout + # end end -# BEGIN opam configuration -# This is useful if you're using opam as it adds: -# - the correct directories to the PATH -# - auto-completion for the opam binary -# This section can be safely removed at any time if needed. -test -r '/home/never/.opam/opam-init/init.fish' && source '/home/never/.opam/opam-init/init.fish' > /dev/null 2> /dev/null; or true -# END opam configuration + diff --git a/.config/fish/fish_variables b/.config/fish/fish_variables index 49c0c85..c6ea4cb 100644 --- a/.config/fish/fish_variables +++ b/.config/fish/fish_variables @@ -1,47 +1,9 @@ # This file contains fish universal variable definitions. # VERSION: 3.0 SETUVAR --export EDITOR:nvim -SETUVAR --export MANPAGER:nvim\x20\x2bMan\x21 +SETUVAR LESS:RAW\x2dCONTROL\x2dCHARS SETUVAR --export QT_QPA_PLATFORMTHEME:qt6ct -SETUVAR __fish_initialized:3800 -SETUVAR fish_color_autosuggestion:585858 -SETUVAR fish_color_cancel:\x2d\x2dreverse -SETUVAR fish_color_command:a1b56c -SETUVAR fish_color_comment:f7ca88 -SETUVAR fish_color_cwd:green -SETUVAR fish_color_cwd_root:red -SETUVAR fish_color_end:ba8baf -SETUVAR fish_color_error:ab4642 -SETUVAR fish_color_escape:86c1b9 -SETUVAR fish_color_history_current:\x2d\x2dbold -SETUVAR fish_color_host:normal -SETUVAR fish_color_host_remote:yellow -SETUVAR fish_color_keyword:a1b56c -SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue -SETUVAR fish_color_normal:normal -SETUVAR fish_color_operator:7cafc2 -SETUVAR fish_color_option:d8d8d8 -SETUVAR fish_color_param:d8d8d8 -SETUVAR fish_color_quote:f7ca88 -SETUVAR fish_color_redirection:d8d8d8 -SETUVAR fish_color_search_match:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack -SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack -SETUVAR fish_color_status:red -SETUVAR fish_color_user:brgreen -SETUVAR fish_color_valid_path:\x2d\x2dunderline\x3dsingle +SETUVAR --export QT_QPA_PlATFORMTHEME:qt6ct +SETUVAR __fish_initialized:4300 SETUVAR fish_greeting:\x1d -SETUVAR fish_key_bindings:fish_default_key_bindings -SETUVAR fish_pager_color_background:\x1d -SETUVAR fish_pager_color_completion:normal -SETUVAR fish_pager_color_description:B3A06D -SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline\x3dsingle -SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dcyan -SETUVAR fish_pager_color_secondary_background:\x1d -SETUVAR fish_pager_color_secondary_completion:\x1d -SETUVAR fish_pager_color_secondary_description:\x1d -SETUVAR fish_pager_color_secondary_prefix:\x1d -SETUVAR fish_pager_color_selected_background:\x2d\x2dbackground\x3dbrblack -SETUVAR fish_pager_color_selected_completion:\x1d -SETUVAR fish_pager_color_selected_description:\x1d -SETUVAR fish_pager_color_selected_prefix:\x1d -SETUVAR fish_user_paths:/usr/local/texlive/2025/bin/x86_64\x2dlinux\x1e/home/never/\x2ecargo/bin\x1e/home/never/\x2elocal/bin +SETUVAR fish_user_paths:/home/never/\x2elocal/scripts\x1e/usr/local/texlive/2025/bin/x86_64\x2dlinux\x1e/home/never/\x2ecargo/bin/ diff --git a/.config/fish/functions/fish_mode_prompt.fish b/.config/fish/functions/fish_mode_prompt.fish new file mode 100644 index 0000000..6d97f4a --- /dev/null +++ b/.config/fish/functions/fish_mode_prompt.fish @@ -0,0 +1,24 @@ +function fish_mode_prompt --description 'Displays the current mode' + # Do nothing if not in vi mode + if test "$fish_key_bindings" = fish_vi_key_bindings + or test "$fish_key_bindings" = fish_hybrid_key_bindings + switch $fish_bind_mode + case default + set_color --bold --reverse normal + echo ' N ' + case insert + set_color --bold --reverse brblue + echo ' I ' + case replace_one + set_color --bold --reverse brblue + echo ' I ' + case replace + set_color --bold --reverse brred + echo ' R ' + case visual + set_color --bold --reverse brgreen + echo ' V ' + end + set_color normal + end +end diff --git a/.config/fish/functions/fish_prompt.fish b/.config/fish/functions/fish_prompt.fish index c54ceb4..0f6ec5f 100644 --- a/.config/fish/functions/fish_prompt.fish +++ b/.config/fish/functions/fish_prompt.fish @@ -1,28 +1,22 @@ function fish_prompt - if not set -q VIRTUAL_ENV_DISABLE_PROMPT - set -g VIRTUAL_ENV_DISABLE_PROMPT true - end - # set_color yellow - # printf '%s' $USER - # set_color normal - # printf ' at ' - # set_color magenta - # echo -n (prompt_hostname) - # set_color normal - # printf ' in ' - set -U fish_greeting - set_color $fish_color_cwd - printf '%s' (prompt_pwd) + if not set -q VIRTUAL_ENV_DISABLE_PROMPT + set -g VIRTUAL_ENV_DISABLE_PROMPT true + end - set_color magenta - set -g __fish_git_prompt_show_informative_status true - printf '%s' (fish_vcs_prompt) - set_color normal - # Line 2 - # echo - if test -n "$VIRTUAL_ENV" - printf "(%s) " (set_color blue)(path basename $VIRTUAL_ENV)(set_color normal) - end - printf ' ☭ ' - set_color normal + # set_color white --background=brwhite --dim --reverse + set_color brwhite + set -g __fish_git_prompt_show_informative_status true + printf '%s' (fish_git_prompt " %s") + + # set_color black --background=white --dim --reverse + set_color white + printf ' %s ' (prompt_pwd -D 8) + echo + + if test -n "$VIRTUAL_ENV" + printf "(%s) " (set_color blue)(path basename $VIRTUAL_ENV)(set_color normal) + end + + set_color normal + echo end diff --git a/.config/fish/functions/fish_right_prompt.fish b/.config/fish/functions/fish_right_prompt.fish index 9db90f0..288ac2d 100644 --- a/.config/fish/functions/fish_right_prompt.fish +++ b/.config/fish/functions/fish_right_prompt.fish @@ -4,6 +4,6 @@ function fish_right_prompt -d "Write out the right prompt" end set_color white - date '+%H:%M:%S' + # date '+%H:%M:%S' end diff --git a/.config/fish/functions/menu.fish b/.config/fish/functions/menu.fish new file mode 100644 index 0000000..3b3195c --- /dev/null +++ b/.config/fish/functions/menu.fish @@ -0,0 +1,29 @@ +function menu --description 'Opens a menu of a list of Strings and writes the result to stdout' + argparse h/help p/prompt=? mesg=? placeholder=? index -- $argv + or return + + if set -ql _flag_help + echo "menu [-h|--help] [-p|--prompt=?] [--placeholder] [--index] [STRING ...]" + return 0 + end + + set fuzzel_args + + if set -ql _flag_prompt + set -a fuzzel_args "--prompt=$_flag_prompt" + end + + if set -ql _flag_placeholder + set -a fuzzel_args "--placeholder=$_flag_placeholder" + end + + if set -ql _flag_mesg + set -a fuzzel_args "--mesg=$_flag_mesg" + end + + if set -ql _flag_index + set -a fuzzel_args "--index" + end + + string unescape (string join -- \n $argv) | fuzzel --dmenu $fuzzel_args +end diff --git a/.config/fish/functions/prompt.fish b/.config/fish/functions/prompt.fish new file mode 100644 index 0000000..fd54a1e --- /dev/null +++ b/.config/fish/functions/prompt.fish @@ -0,0 +1,29 @@ +function prompt --description 'Opens a menu of a list of Strings and writes the result to stdout' + argparse h/help p/prompt=? placeholder=? mesg=? password -- $argv + or return + + if set -ql _flag_help + echo "menu [-h|--help] [-p|--prompt=?] [--placeholder=?] [--mesg=?] [--password] [STRING ...]" + return 0 + end + + set fuzzel_args + + if set -ql _flag_prompt + set -a fuzzel_args "--prompt=$_flag_prompt" + end + + if set -ql _flag_placeholder + set -a fuzzel_args "--placeholder=$_flag_placeholder" + end + + if set -ql _flag_mesg + set -a fuzzel_args "--mesg=$_flag_mesg" + end + + if set -ql _flag_password + set -a fuzzel_args "--password" + end + + string join -- \n $argv | fuzzel --dmenu --prompt-only='' $fuzzel_args +end diff --git a/.config/fontconfig/fonts.conf b/.config/fontconfig/fonts.conf new file mode 100644 index 0000000..9fa0ca9 --- /dev/null +++ b/.config/fontconfig/fonts.conf @@ -0,0 +1,16 @@ + + + + + serif + Caladea + + + sans-serif + Adwaita Sans + + + monospace + Adwaita Mono + + diff --git a/.config/fuzzel/fuzzel.ini b/.config/fuzzel/fuzzel.ini index 708c4d0..96c698e 100644 --- a/.config/fuzzel/fuzzel.ini +++ b/.config/fuzzel/fuzzel.ini @@ -1,5 +1,5 @@ # output= -font=Adwaita Mono +font=monospace # dpi-aware=auto # use-bold=no prompt="" @@ -8,7 +8,7 @@ placeholder="Search" # icons-enabled=yes # hide-before-typing=no # fields=filename,name,generic -# password-character=* +password-character=● # filter-desktop=no # match-mode=fzf # sort-result=yes @@ -16,17 +16,17 @@ match-counter=yes # delayed-filter-ms=300 # delayed-filter-limit=20000 # show-actions=no -# terminal=$TERMINAL -e # Note: you cannot actually use environment variables here +terminal=alacritty -e # Note: you cannot actually use environment variables here # launch-prefix= # list-executables-in-path=no # anchor=center # x-margin=0 # y-margin=0 -# lines=15 -# minimal-lines=no -width=50 -# tabs=8 +lines=16 +minimal-lines=yes +width=64 +tabs=4 horizontal-pad=8 vertical-pad=8 inner-pad=4 @@ -50,17 +50,18 @@ inner-pad=4 # enable-mouse=yes [colors] -background=191919E5 -text=ffffffff +background=191919ff +text=999999ff +message=7f7f7fff prompt=999999ff placeholder=505050ff input=ffffffff match=7fc8ffff -selection=7f7f7f7f +selection=2c2c2cff selection-text=ffffffff selection-match=7fc8ffff counter=999999ff -border=7f7f7fE5 +border=7f7f7fff [border] width=2 @@ -68,7 +69,7 @@ radius=0 [dmenu] # mode=text # text|index -# exit-immediately-if-empty=no +exit-immediately-if-empty=yes [key-bindings] # cancel=Escape Control+g Control+c Control+bracketleft diff --git a/.config/git/config b/.config/git/config new file mode 100644 index 0000000..77cd2c4 --- /dev/null +++ b/.config/git/config @@ -0,0 +1,5 @@ +[user] + email = n.gude@posteo.de + name = Never Gude +[init] + defaultBranch = main diff --git a/.config/kitty/Solarized_Light.conf b/.config/kitty/Solarized_Light.conf deleted file mode 100644 index b1f6332..0000000 --- a/.config/kitty/Solarized_Light.conf +++ /dev/null @@ -1,59 +0,0 @@ -# vim:ft=kitty - -## name: Solarized Light -## author: Ethan Schoonover -## license: MIT -## blurb: Precision colors for machines and people - -# The basic colors -foreground #657b83 -background #fdf6e3 -selection_foreground #586e75 -selection_background #eee8d5 - -# Cursor colors -cursor #657b83 -cursor_text_color #fdf6e3 - -# kitty window border colors -active_border_color #cb4b16 -inactive_border_color #93a1a1 - -# Tab bar colors -active_tab_background #fdf6e3 -active_tab_foreground #657b83 -inactive_tab_background #93a1a1 -inactive_tab_foreground #fdf6e3 - -# The basic 16 colors -# black -color0 #073642 -color8 #93a1a1 - -# red -color1 #dc322f -color9 #cb4b16 - -# green -color2 #859900 -color10 #586e75 - -# yellow -color3 #b58900 -color11 #657b83 - -# blue -color4 #268bd2 -color12 #839496 - -# magenta -color5 #d33682 -color13 #6c71c4 - -# cyan -color6 #2aa198 -color14 #93a1a1 - -# white -color7 #eee8d5 -color15 #fdf6e3 diff --git a/.config/kitty/current-theme.conf b/.config/kitty/current-theme.conf deleted file mode 100644 index ed49685..0000000 --- a/.config/kitty/current-theme.conf +++ /dev/null @@ -1,59 +0,0 @@ -# vim:ft=kitty - -## name: Solarized Dark -## author: Ethan Schoonover -## license: MIT -## blurb: Precision colors for machines and people - -# The basic colors -foreground #839496 -background #002b36 -selection_foreground #93a1a1 -selection_background #073642 - -# Cursor colors -cursor none -#cursor_text_color #002b36 - -# kitty window border colors -active_border_color #cb4b16 -inactive_border_color #839496 - -# Tab bar colors -active_tab_background #839496 -active_tab_foreground #002b36 -inactive_tab_background #002b36 -inactive_tab_foreground #839496 - -# The basic 16 colors -# black -color0 #073642 -color8 #002b36 - -# red -color1 #dc322f -color9 #cb4b16 - -# green -color2 #859900 -color10 #586e75 - -# yellow -color3 #b58900 -color11 #657b83 - -# blue -color4 #268bd2 -color12 #839496 - -# magenta -color5 #d33682 -color13 #6c71c4 - -# cyan -color6 #2aa198 -color14 #93a1a1 - -# white -color7 #eee8d5 -color15 #fdf6e3 diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf deleted file mode 100644 index b971f80..0000000 --- a/.config/kitty/kitty.conf +++ /dev/null @@ -1,2798 +0,0 @@ -# vim:fileencoding=utf-8:foldmethod=marker - -# BEGIN_KITTY_THEME -# Solarized Dark -include current-theme.conf -# END_KITTY_THEME - -#: Fonts {{{ - -#: kitty has very powerful font management. You can configure -#: individual font faces and even specify special fonts for particular -#: characters. - -# font_family monospace -# bold_font auto -# italic_font auto -# bold_italic_font auto - -#: You can specify different fonts for the bold/italic/bold-italic -#: variants. The easiest way to select fonts is to run the `kitten -#: choose-fonts` command which will present a nice UI for you to -#: select the fonts you want with previews and support for selecting -#: variable fonts and font features. If you want to learn to select -#: fonts manually, read the font specification syntax -#: . - -# font_size 11.0 - -#: Font size (in pts). - -# force_ltr no - -#: kitty does not support BIDI (bidirectional text), however, for RTL -#: scripts, words are automatically displayed in RTL. That is to say, -#: in an RTL script, the words "HELLO WORLD" display in kitty as -#: "WORLD HELLO", and if you try to select a substring of an RTL- -#: shaped string, you will get the character that would be there had -#: the string been LTR. For example, assuming the Hebrew word ירושלים, -#: selecting the character that on the screen appears to be ם actually -#: writes into the selection buffer the character י. kitty's default -#: behavior is useful in conjunction with a filter to reverse the word -#: order, however, if you wish to manipulate RTL glyphs, it can be -#: very challenging to work with, so this option is provided to turn -#: it off. Furthermore, this option can be used with the command line -#: program GNU FriBidi -#: to get BIDI support, because it will force kitty to always treat -#: the text as LTR, which FriBidi expects for terminals. - -# symbol_map - -#: E.g. symbol_map U+E0A0-U+E0A3,U+E0C0-U+E0C7 PowerlineSymbols - -#: Map the specified Unicode codepoints to a particular font. Useful -#: if you need special rendering for some symbols, such as for -#: Powerline. Avoids the need for patched fonts. Each Unicode code -#: point is specified in the form `U+`. You -#: can specify multiple code points, separated by commas and ranges -#: separated by hyphens. This option can be specified multiple times. -#: The syntax is:: - -#: symbol_map codepoints Font Family Name - -# narrow_symbols - -#: E.g. narrow_symbols U+E0A0-U+E0A3,U+E0C0-U+E0C7 1 - -#: Usually, for Private Use Unicode characters and some symbol/dingbat -#: characters, if the character is followed by one or more spaces, -#: kitty will use those extra cells to render the character larger, if -#: the character in the font has a wide aspect ratio. Using this -#: option you can force kitty to restrict the specified code points to -#: render in the specified number of cells (defaulting to one cell). -#: This option can be specified multiple times. The syntax is:: - -#: narrow_symbols codepoints [optionally the number of cells] - -# disable_ligatures never - -#: Choose how you want to handle multi-character ligatures. The -#: default is to always render them. You can tell kitty to not render -#: them when the cursor is over them by using cursor to make editing -#: easier, or have kitty never render them at all by using always, if -#: you don't like them. The ligature strategy can be set per-window -#: either using the kitty remote control facility or by defining -#: shortcuts for it in kitty.conf, for example:: - -#: map alt+1 disable_ligatures_in active always -#: map alt+2 disable_ligatures_in all never -#: map alt+3 disable_ligatures_in tab cursor - -#: Note that this refers to programming ligatures, typically -#: implemented using the calt OpenType feature. For disabling general -#: ligatures, use the font_features option. - -# font_features - -#: E.g. font_features none - -#: Choose exactly which OpenType features to enable or disable. Note -#: that for the main fonts, features can be specified when selecting -#: the font using the choose-fonts kitten. This setting is useful for -#: fallback fonts. - -#: Some fonts might have features worthwhile in a terminal. For -#: example, Fira Code includes a discretionary feature, zero, which in -#: that font changes the appearance of the zero (0), to make it more -#: easily distinguishable from Ø. Fira Code also includes other -#: discretionary features known as Stylistic Sets which have the tags -#: ss01 through ss20. - -#: For the exact syntax to use for individual features, see the -#: HarfBuzz documentation . - -#: Note that this code is indexed by PostScript name, and not the font -#: family. This allows you to define very precise feature settings; -#: e.g. you can disable a feature in the italic font but not in the -#: regular font. - -#: On Linux, font features are first read from the FontConfig database -#: and then this option is applied, so they can be configured in a -#: single, central place. - -#: To get the PostScript name for a font, use the `fc-scan file.ttf` -#: command on Linux or the `Font Book tool on macOS -#: `__. - -#: Enable alternate zero and oldstyle numerals:: - -#: font_features FiraCode-Retina +zero +onum - -#: Enable only alternate zero in the bold font:: - -#: font_features FiraCode-Bold +zero - -#: Disable the normal ligatures, but keep the calt feature which (in -#: this font) breaks up monotony:: - -#: font_features TT2020StyleB-Regular -liga +calt - -#: In conjunction with force_ltr, you may want to disable Arabic -#: shaping entirely, and only look at their isolated forms if they -#: show up in a document. You can do this with e.g.:: - -#: font_features UnifontMedium +isol -medi -fina -init - -# modify_font - -#: Modify font characteristics such as the position or thickness of -#: the underline and strikethrough. The modifications can have the -#: suffix px for pixels or % for percentage of original value. No -#: suffix means use pts. For example:: - -#: modify_font underline_position -2 -#: modify_font underline_thickness 150% -#: modify_font strikethrough_position 2px - -#: Additionally, you can modify the size of the cell in which each -#: font glyph is rendered and the baseline at which the glyph is -#: placed in the cell. For example:: - -#: modify_font cell_width 80% -#: modify_font cell_height -2px -#: modify_font baseline 3 - -#: Note that modifying the baseline will automatically adjust the -#: underline and strikethrough positions by the same amount. -#: Increasing the baseline raises glyphs inside the cell and -#: decreasing it lowers them. Decreasing the cell size might cause -#: rendering artifacts, so use with care. - -# box_drawing_scale 0.001, 1, 1.5, 2 - -#: The sizes of the lines used for the box drawing Unicode characters. -#: These values are in pts. They will be scaled by the monitor DPI to -#: arrive at a pixel value. There must be four values corresponding to -#: thin, normal, thick, and very thick lines. - -# undercurl_style thin-sparse - -#: The style with which undercurls are rendered. This option takes the -#: form (thin|thick)-(sparse|dense). Thin and thick control the -#: thickness of the undercurl. Sparse and dense control how often the -#: curl oscillates. With sparse the curl will peak once per character, -#: with dense twice. Changing this option dynamically via reloading -#: the config or remote control is undefined. - -# underline_exclusion 1 - -#: By default kitty renders gaps in underlines when they overlap with -#: descenders (the parts of letters below the baseline, such as for y, -#: q, p etc.). This option controls the thickness of the gaps. It can -#: be either a unitless number in which case it is a fraction of the -#: underline thickness as specified in the font or it can have a -#: suffix of px for pixels or pt for points. Set to zero to disable -#: the gaps. Changing this option dynamically via reloading the config -#: or remote control is undefined. - -# text_composition_strategy platform - -#: Control how kitty composites text glyphs onto the background color. -#: The default value of platform tries for text rendering as close to -#: "native" for the platform kitty is running on as possible. - -#: A value of legacy uses the old (pre kitty 0.28) strategy for how -#: glyphs are composited. This will make dark text on light -#: backgrounds look thicker and light text on dark backgrounds -#: thinner. It might also make some text appear like the strokes are -#: uneven. - -#: You can fine tune the actual contrast curve used for glyph -#: composition by specifying up to two space-separated numbers for -#: this setting. - -#: The first number is the gamma adjustment, which controls the -#: thickness of dark text on light backgrounds. Increasing the value -#: will make text appear thicker. The default value for this is 1.0 on -#: Linux and 1.7 on macOS. Valid values are 0.01 and above. The result -#: is scaled based on the luminance difference between the background -#: and the foreground. Dark text on light backgrounds receives the -#: full impact of the curve while light text on dark backgrounds is -#: affected very little. - -#: The second number is an additional multiplicative contrast. It is -#: percentage ranging from 0 to 100. The default value is 0 on Linux -#: and 30 on macOS. - -#: If you wish to achieve similar looking thickness in light and dark -#: themes, a good way to experiment is start by setting the value to -#: 1.0 0 and use a dark theme. Then adjust the second parameter until -#: it looks good. Then switch to a light theme and adjust the first -#: parameter until the perceived thickness matches the dark theme. - -# text_fg_override_threshold 0 - -#: A setting to prevent low contrast between foreground and background -#: colors. Useful when working with applications that use colors that -#: do not contrast well with your preferred color scheme. The default -#: value is 0, which means no color overriding is performed. There are -#: two modes of operation: - -#: A value with the suffix ratio represents the minimum accepted -#: contrast ratio between the foreground and background color. -#: Possible values range from 0.0 ratio to 21.0 ratio. For example, to -#: meet WCAG level AA -#: -#: a value of 4.5 ratio can be provided. The algorithm is implemented -#: using HSLuv which enables it to change the -#: perceived lightness of a color just as much as needed without -#: really changing its hue and saturation. - -#: A value with the suffix % represents the minimum accepted -#: difference in luminance between the foreground and background -#: color, below which kitty will override the foreground color. It is -#: percentage ranging from 0 % to 100 %. If the difference in -#: luminance of the foreground and background is below this threshold, -#: the foreground color will be set to white if the background is dark -#: or black if the background is light. - -#: WARNING: Some programs use characters (such as block characters) -#: for graphics display and may expect to be able to set the -#: foreground and background to the same color (or similar colors). If -#: you see unexpected stripes, dots, lines, incorrect color, no color -#: where you expect color, or any kind of graphic display problem try -#: setting text_fg_override_threshold to 0 to see if this is the cause -#: of the problem or consider using the ratio mode of operation -#: described above instead of the % mode of operation. - -#: }}} - -#: Text cursor customization {{{ - -# cursor #cccccc - -#: Default text cursor color. If set to the special value none the -#: cursor will be rendered with a "reverse video" effect. Its color -#: will be the color of the text in the cell it is over and the text -#: will be rendered with the background color of the cell. Note that -#: if the program running in the terminal sets a cursor color, this -#: takes precedence. Also, the cursor colors are modified if the cell -#: background and foreground colors have very low contrast. Note that -#: some themes set this value, so if you want to override it, place -#: your value after the lines where the theme file is included. - -# cursor_text_color #111111 - -#: The color of text under the cursor. If you want it rendered with -#: the background color of the cell underneath instead, use the -#: special keyword: `background`. Note that if cursor is set to none -#: then this option is ignored. Note that some themes set this value, -#: so if you want to override it, place your value after the lines -#: where the theme file is included. - -# cursor_shape block - -#: The cursor shape can be one of block, beam, underline. Note that -#: when reloading the config this will be changed only if the cursor -#: shape has not been set by the program running in the terminal. This -#: sets the default cursor shape, applications running in the terminal -#: can override it. In particular, shell integration -#: in kitty sets -#: the cursor shape to beam at shell prompts. You can avoid this by -#: setting shell_integration to no-cursor. - -# cursor_shape_unfocused hollow - -#: Defines the text cursor shape when the OS window is not focused. -#: The unfocused cursor shape can be one of block, beam, underline, -#: hollow and unchanged (leave the cursor shape as it is). - -# cursor_beam_thickness 1.5 - -#: The thickness of the beam cursor (in pts). - -# cursor_underline_thickness 2.0 - -#: The thickness of the underline cursor (in pts). - -# cursor_blink_interval -1 - -#: The interval to blink the cursor (in seconds). Set to zero to -#: disable blinking. Negative values mean use system default. Note -#: that the minimum interval will be limited to repaint_delay. You can -#: also animate the cursor blink by specifying an easing function. For -#: example, setting this to option to 0.5 ease-in-out will cause the -#: cursor blink to be animated over a second, in the first half of the -#: second it will go from opaque to transparent and then back again -#: over the next half. You can specify different easing functions for -#: the two halves, for example: -1 linear ease-out. kitty supports all -#: the CSS easing functions . Note that turning on animations -#: uses extra power as it means the screen is redrawn multiple times -#: per blink interval. See also, cursor_stop_blinking_after. - -# cursor_stop_blinking_after 15.0 - -#: Stop blinking cursor after the specified number of seconds of -#: keyboard inactivity. Set to zero to never stop blinking. - -# cursor_trail 0 - -#: Set this to a value larger than zero to enable a "cursor trail" -#: animation. This is an animation that shows a "trail" following the -#: movement of the text cursor. It makes it easy to follow large -#: cursor jumps and makes for a cool visual effect of the cursor -#: zooming around the screen. The actual value of this option controls -#: when the animation is triggered. It is a number of milliseconds. -#: The trail animation only follows cursors that have stayed in their -#: position for longer than the specified number of milliseconds. This -#: prevents trails from appearing for cursors that rapidly change -#: their positions during UI updates in complex applications. See -#: cursor_trail_decay to control the animation speed and -#: cursor_trail_start_threshold to control when a cursor trail is -#: started. - -# cursor_trail_decay 0.1 0.4 - -#: Controls the decay times for the cursor trail effect when the -#: cursor_trail is enabled. This option accepts two positive float -#: values specifying the fastest and slowest decay times in seconds. -#: The first value corresponds to the fastest decay time (minimum), -#: and the second value corresponds to the slowest decay time -#: (maximum). The second value must be equal to or greater than the -#: first value. Smaller values result in a faster decay of the cursor -#: trail. Adjust these values to control how quickly the cursor trail -#: fades away. - -# cursor_trail_start_threshold 2 - -#: Set the distance threshold for starting the cursor trail. This -#: option accepts a positive integer value that represents the minimum -#: number of cells the cursor must move before the trail is started. -#: When the cursor moves less than this threshold, the trail is -#: skipped, reducing unnecessary cursor trail animation. - -#: }}} - -#: Scrollback {{{ - -# scrollback_lines 2000 - -#: Number of lines of history to keep in memory for scrolling back. -#: Memory is allocated on demand. Negative numbers are (effectively) -#: infinite scrollback. Note that using very large scrollback is not -#: recommended as it can slow down performance of the terminal and -#: also use large amounts of RAM. Instead, consider using -#: scrollback_pager_history_size. Note that on config reload if this -#: is changed it will only affect newly created windows, not existing -#: ones. - -# scrollback_indicator_opacity 1.0 - -#: The opacity of the scrollback indicator which is a small colored -#: rectangle that moves along the right hand side of the window as you -#: scroll, indicating what fraction you have scrolled. The default is -#: one which means fully opaque, aka visible. Set to a value between -#: zero and one to make the indicator less visible. - -# scrollback_pager less --chop-long-lines --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER - -#: Program with which to view scrollback in a new window. The -#: scrollback buffer is passed as STDIN to this program. If you change -#: it, make sure the program you use can handle ANSI escape sequences -#: for colors and text formatting. INPUT_LINE_NUMBER in the command -#: line above will be replaced by an integer representing which line -#: should be at the top of the screen. Similarly CURSOR_LINE and -#: CURSOR_COLUMN will be replaced by the current cursor position or -#: set to 0 if there is no cursor, for example, when showing the last -#: command output. - -# scrollback_pager_history_size 0 - -#: Separate scrollback history size (in MB), used only for browsing -#: the scrollback buffer with pager. This separate buffer is not -#: available for interactive scrolling but will be piped to the pager -#: program when viewing scrollback buffer in a separate window. The -#: current implementation stores the data in UTF-8, so approximately -#: 10000 lines per megabyte at 100 chars per line, for pure ASCII, -#: unformatted text. A value of zero or less disables this feature. -#: The maximum allowed size is 4GB. Note that on config reload if this -#: is changed it will only affect newly created windows, not existing -#: ones. - -# scrollback_fill_enlarged_window no - -#: Fill new space with lines from the scrollback buffer after -#: enlarging a window. - -# wheel_scroll_multiplier 5.0 - -#: Multiplier for the number of lines scrolled by the mouse wheel. -#: Note that this is only used for low precision scrolling devices, -#: not for high precision scrolling devices on platforms such as macOS -#: and Wayland. Use negative numbers to change scroll direction. See -#: also wheel_scroll_min_lines. - -# wheel_scroll_min_lines 1 - -#: The minimum number of lines scrolled by the mouse wheel. The scroll -#: multiplier wheel_scroll_multiplier only takes effect after it -#: reaches this number. Note that this is only used for low precision -#: scrolling devices like wheel mice that scroll by very small amounts -#: when using the wheel. With a negative number, the minimum number of -#: lines will always be added. - -# touch_scroll_multiplier 1.0 - -#: Multiplier for the number of lines scrolled by a touchpad. Note -#: that this is only used for high precision scrolling devices on -#: platforms such as macOS and Wayland. Use negative numbers to change -#: scroll direction. - -#: }}} - -#: Mouse {{{ - -# mouse_hide_wait 3.0 - -#: Hide mouse cursor after the specified number of seconds of the -#: mouse not being used. Set to zero to disable mouse cursor hiding. -#: Set to a negative value to hide the mouse cursor immediately when -#: typing text. Disabled by default on macOS as getting it to work -#: robustly with the ever-changing sea of bugs that is Cocoa is too -#: much effort. - -#: By default, once the cursor is hidden, it is immediately unhidden -#: on any further mouse events. - -#: Two formats are supported: -#: - -#: - - -#: To change the unhide behavior, the optional parameters , , and may be set. - -#: -#: Waits for the specified number of seconds after mouse events before unhiding the -#: mouse cursor. Set to zero to unhide mouse cursor immediately on mouse activity. -#: This is useful to prevent the mouse cursor from unhiding on accidental swipes on -#: the trackpad. - -#: -#: Sets the threshold of mouse activity required to unhide the mouse cursor, when -#: the option is non-zero. When is zero, this has no -#: effect. - -#: For example, if is 40 and is 2.5, when kitty -#: detects a mouse event, it records the number of mouse events in the next 2.5 -#: seconds, and checks if that exceeds 40 * 2.5 = 100. If it does, then the mouse -#: cursor is unhidden, otherwise nothing happens. - -#: -#: Controls what mouse events may unhide the mouse cursor. If enabled, both scroll -#: and movement events may unhide the cursor. If disabled, only mouse movements can -#: unhide the cursor. - -#: Examples of valid values: -#: - 0.0 -#: - 1.0 -#: - -1.0 -#: - 0.1 3.0 40 yes - -# url_color #0087bd -# url_style curly - -#: The color and style for highlighting URLs on mouse-over. url_style -#: can be one of: none, straight, double, curly, dotted, dashed. - -# open_url_with default - -#: The program to open clicked URLs. The special value default will -#: first look for any URL handlers defined via the open_actions -#: facility and if non -#: are found, it will use the Operating System's default URL handler -#: (open on macOS and xdg-open on Linux). - -# url_prefixes file ftp ftps gemini git gopher http https irc ircs kitty mailto news sftp ssh - -#: The set of URL prefixes to look for when detecting a URL under the -#: mouse cursor. - -# detect_urls yes - -#: Detect URLs under the mouse. Detected URLs are highlighted with an -#: underline and the mouse cursor becomes a hand over them. Even if -#: this option is disabled, URLs are still clickable. See also the -#: underline_hyperlinks option to control how hyperlinks (as opposed -#: to plain text URLs) are displayed. - -# url_excluded_characters - -#: Additional characters to be disallowed from URLs, when detecting -#: URLs under the mouse cursor. By default, all characters that are -#: legal in URLs are allowed. Additionally, newlines are allowed (but -#: stripped). This is to accommodate programs such as mutt that add -#: hard line breaks even for continued lines. \n can be added to this -#: option to disable this behavior. Special characters can be -#: specified using backslash escapes, to specify a backslash use a -#: double backslash. - -# show_hyperlink_targets no - -#: When the mouse hovers over a terminal hyperlink, show the actual -#: URL that will be activated when the hyperlink is clicked. - -# underline_hyperlinks hover - -#: Control how hyperlinks are underlined. They can either be -#: underlined on mouse hover, always (i.e. permanently underlined) or -#: never which means that kitty will not apply any underline styling -#: to hyperlinks. Note that the value of always only applies to real -#: (OSC 8) hyperlinks not text that is detected to be a URL on mouse -#: hover. Uses the url_style and url_color settings for the underline -#: style. Note that reloading the config and changing this value -#: to/from always will only affect text subsequently received by -#: kitty. - -# copy_on_select no - -#: Copy to clipboard or a private buffer on select. With this set to -#: clipboard, selecting text with the mouse will cause the text to be -#: copied to clipboard. Useful on platforms such as macOS that do not -#: have the concept of primary selection. You can instead specify a -#: name such as a1 to copy to a private kitty buffer. Map a shortcut -#: with the paste_from_buffer action to paste from this private -#: buffer. For example:: - -#: copy_on_select a1 -#: map shift+cmd+v paste_from_buffer a1 - -#: Note that copying to the clipboard is a security risk, as all -#: programs, including websites open in your browser can read the -#: contents of the system clipboard. - -# clear_selection_on_clipboard_loss no - -#: When the contents of the clipboard no longer reflect the current -#: selection, clear it. This is primarily useful on platforms such as -#: Linux where selecting text automatically copies it to a special -#: "primary selection" clipboard or if you have copy_on_select set to -#: clipboard. - -#: Note that on macOS the system does not provide notifications when -#: the clipboard owner is changed, so there, copying to clipboard in a -#: non-kitty application will not clear selections even if -#: copy_on_select is enabled. - -# paste_actions quote-urls-at-prompt,confirm - -#: A comma separated list of actions to take when pasting text into -#: the terminal. The supported paste actions are: - -#: quote-urls-at-prompt: -#: If the text being pasted is a URL and the cursor is at a shell prompt, -#: automatically quote the URL (needs shell_integration). -#: replace-dangerous-control-codes -#: Replace dangerous control codes from pasted text, without confirmation. -#: replace-newline -#: Replace the newline character from pasted text, without confirmation. -#: confirm: -#: Confirm the paste if the text to be pasted contains any terminal control codes -#: as this can be dangerous, leading to code execution if the shell/program running -#: in the terminal does not properly handle these. -#: confirm-if-large -#: Confirm the paste if it is very large (larger than 16KB) as pasting -#: large amounts of text into shells can be very slow. -#: filter: -#: Run the filter_paste() function from the file paste-actions.py in -#: the kitty config directory on the pasted text. The text returned by the -#: function will be actually pasted. -#: no-op: -#: Has no effect. - -# strip_trailing_spaces never - -#: Remove spaces at the end of lines when copying to clipboard. A -#: value of smart will do it when using normal selections, but not -#: rectangle selections. A value of always will always do it. - -# select_by_word_characters @-./_~?&=%+# - -#: Characters considered part of a word when double clicking. In -#: addition to these characters any character that is marked as an -#: alphanumeric character in the Unicode database will be matched. - -# select_by_word_characters_forward - -#: Characters considered part of a word when extending the selection -#: forward on double clicking. In addition to these characters any -#: character that is marked as an alphanumeric character in the -#: Unicode database will be matched. - -#: If empty (default) select_by_word_characters will be used for both -#: directions. - -# click_interval -1.0 - -#: The interval between successive clicks to detect double/triple -#: clicks (in seconds). Negative numbers will use the system default -#: instead, if available, or fallback to 0.5. - -# focus_follows_mouse no - -#: Set the active window to the window under the mouse when moving the -#: mouse around. On macOS, this will also cause the OS Window under -#: the mouse to be focused automatically when the mouse enters it. - -# pointer_shape_when_grabbed arrow - -#: The shape of the mouse pointer when the program running in the -#: terminal grabs the mouse. - -# default_pointer_shape beam - -#: The default shape of the mouse pointer. - -# pointer_shape_when_dragging beam crosshair - -#: The default shape of the mouse pointer when dragging across text. -#: The optional second value sets the shape when dragging in -#: rectangular selection mode. - -#: Mouse actions {{{ - -#: Mouse buttons can be mapped to perform arbitrary actions. The -#: syntax is: - -#: .. code-block:: none - -#: mouse_map button-name event-type modes action - -#: Where button-name is one of left, middle, right, b1 ... b8 with -#: added keyboard modifiers. For example: ctrl+shift+left refers to -#: holding the Ctrl+Shift keys while clicking with the left mouse -#: button. The value b1 ... b8 can be used to refer to up to eight -#: buttons on a mouse. - -#: event-type is one of press, release, doublepress, triplepress, -#: click, doubleclick. modes indicates whether the action is performed -#: when the mouse is grabbed by the program running in the terminal, -#: or not. The values are grabbed or ungrabbed or a comma separated -#: combination of them. grabbed refers to when the program running in -#: the terminal has requested mouse events. Note that the click and -#: double click events have a delay of click_interval to disambiguate -#: from double and triple presses. - -#: You can run kitty with the kitty --debug-input command line option -#: to see mouse events. See the builtin actions below to get a sense -#: of what is possible. - -#: If you want to unmap a button, map it to nothing. For example, to -#: disable opening of URLs with a plain click:: - -#: mouse_map left click ungrabbed - -#: See all the mappable actions including mouse actions here -#: . - -#: .. note:: -#: Once a selection is started, releasing the button that started it will -#: automatically end it and no release event will be dispatched. - -# clear_all_mouse_actions no - -#: Remove all mouse action definitions up to this point. Useful, for -#: instance, to remove the default mouse actions. - -#: Click the link under the mouse or move the cursor - -# mouse_map left click ungrabbed mouse_handle_click selection link prompt - -#:: First check for a selection and if one exists do nothing. Then -#:: check for a link under the mouse cursor and if one exists, click -#:: it. Finally check if the click happened at the current shell -#:: prompt and if so, move the cursor to the click location. Note -#:: that this requires shell integration -#:: to work. - -#: Click the link under the mouse or move the cursor even when grabbed - -# mouse_map shift+left click grabbed,ungrabbed mouse_handle_click selection link prompt - -#:: Same as above, except that the action is performed even when the -#:: mouse is grabbed by the program running in the terminal. - -#: Click the link under the mouse cursor - -# mouse_map ctrl+shift+left release grabbed,ungrabbed mouse_handle_click link - -#:: Variant with Ctrl+Shift is present because the simple click based -#:: version has an unavoidable delay of click_interval, to -#:: disambiguate clicks from double clicks. - -#: Discard press event for link click - -# mouse_map ctrl+shift+left press grabbed discard_event - -#:: Prevent this press event from being sent to the program that has -#:: grabbed the mouse, as the corresponding release event is used to -#:: open a URL. - -#: Paste from the primary selection - -# mouse_map middle release ungrabbed paste_from_selection - -#: Start selecting text - -# mouse_map left press ungrabbed mouse_selection normal - -#: Start selecting text in a rectangle - -# mouse_map ctrl+alt+left press ungrabbed mouse_selection rectangle - -#: Select a word - -# mouse_map left doublepress ungrabbed mouse_selection word - -#: Select a line - -# mouse_map left triplepress ungrabbed mouse_selection line - -#: Select line from point - -# mouse_map ctrl+alt+left triplepress ungrabbed mouse_selection line_from_point - -#:: Select from the clicked point to the end of the line. If you -#:: would like to select the word at the point and then extend to the -#:: rest of the line, change `line_from_point` to -#:: `word_and_line_from_point`. - -#: Extend the current selection - -# mouse_map right press ungrabbed mouse_selection extend - -#:: If you want only the end of the selection to be moved instead of -#:: the nearest boundary, use move-end instead of extend. - -#: Paste from the primary selection even when grabbed - -# mouse_map shift+middle release ungrabbed,grabbed paste_selection -# mouse_map shift+middle press grabbed discard_event - -#: Start selecting text even when grabbed - -# mouse_map shift+left press ungrabbed,grabbed mouse_selection normal - -#: Start selecting text in a rectangle even when grabbed - -# mouse_map ctrl+shift+alt+left press ungrabbed,grabbed mouse_selection rectangle - -#: Select a word even when grabbed - -# mouse_map shift+left doublepress ungrabbed,grabbed mouse_selection word - -#: Select a line even when grabbed - -# mouse_map shift+left triplepress ungrabbed,grabbed mouse_selection line - -#: Select line from point even when grabbed - -# mouse_map ctrl+shift+alt+left triplepress ungrabbed,grabbed mouse_selection line_from_point - -#:: Select from the clicked point to the end of the line even when -#:: grabbed. If you would like to select the word at the point and -#:: then extend to the rest of the line, change `line_from_point` to -#:: `word_and_line_from_point`. - -#: Extend the current selection even when grabbed - -# mouse_map shift+right press ungrabbed,grabbed mouse_selection extend - -#: Show clicked command output in pager - -# mouse_map ctrl+shift+right press ungrabbed mouse_show_command_output - -#:: Requires shell integration -#:: to work. - -#: }}} - -#: }}} - -#: Performance tuning {{{ - -# repaint_delay 10 - -#: Delay between screen updates (in milliseconds). Decreasing it, -#: increases frames-per-second (FPS) at the cost of more CPU usage. -#: The default value yields ~100 FPS which is more than sufficient for -#: most uses. Note that to actually achieve 100 FPS, you have to -#: either set sync_to_monitor to no or use a monitor with a high -#: refresh rate. Also, to minimize latency when there is pending input -#: to be processed, this option is ignored. - -# input_delay 3 - -#: Delay before input from the program running in the terminal is -#: processed (in milliseconds). Note that decreasing it will increase -#: responsiveness, but also increase CPU usage and might cause flicker -#: in full screen programs that redraw the entire screen on each loop, -#: because kitty is so fast that partial screen updates will be drawn. -#: This setting is ignored when the input buffer is almost full. - -# sync_to_monitor yes - -#: Sync screen updates to the refresh rate of the monitor. This -#: prevents screen tearing -#: when scrolling. -#: However, it limits the rendering speed to the refresh rate of your -#: monitor. With a very high speed mouse/high keyboard repeat rate, -#: you may notice some slight input latency. If so, set this to no. - -#: }}} - -#: Terminal bell {{{ - -# enable_audio_bell yes - -#: The audio bell. Useful to disable it in environments that require -#: silence. - -# visual_bell_duration 0.0 - -#: The visual bell duration (in seconds). Flash the screen when a bell -#: occurs for the specified number of seconds. Set to zero to disable. -#: The flash is animated, fading in and out over the specified -#: duration. The easing function used for the fading can be -#: controlled. For example, 2.0 linear will casuse the flash to fade -#: in and out linearly. The default if unspecified is to use ease-in- -#: out which fades slowly at the start, middle and end. You can -#: specify different easing functions for the fade-in and fade-out -#: parts, like this: 2.0 ease-in linear. kitty supports all the CSS -#: easing functions . - -# visual_bell_color none - -#: The color used by visual bell. Set to none will fall back to -#: selection background color. If you feel that the visual bell is too -#: bright, you can set it to a darker color. - -# window_alert_on_bell yes - -#: Request window attention on bell. Makes the dock icon bounce on -#: macOS or the taskbar flash on Linux. - -# bell_on_tab "🔔 " - -#: Some text or a Unicode symbol to show on the tab if a window in the -#: tab that does not have focus has a bell. If you want to use leading -#: or trailing spaces, surround the text with quotes. See -#: tab_title_template for how this is rendered. - -#: For backwards compatibility, values of yes, y and true are -#: converted to the default bell symbol and no, n, false and none are -#: converted to the empty string. - -# command_on_bell none - -#: Program to run when a bell occurs. The environment variable -#: KITTY_CHILD_CMDLINE can be used to get the program running in the -#: window in which the bell occurred. - -# bell_path none - -#: Path to a sound file to play as the bell sound. If set to none, the -#: system default bell sound is used. Must be in a format supported by -#: the operating systems sound API, such as WAV or OGA on Linux -#: (libcanberra) or AIFF, MP3 or WAV on macOS (NSSound). - -# linux_bell_theme __custom - -#: The XDG Sound Theme kitty will use to play the bell sound. On -#: Wayland, when the compositor supports it, it is asked to play the -#: system default bell sound, and this setting has no effect. -#: Otherwise, defaults to the custom theme name specified in the XDG -#: Sound theme specification -#: , falling back to the default -#: freedesktop theme if it does not exist. To change your sound theme -#: desktop wide, create -#: :file:~/.local/share/sounds/__custom/index.theme` with the -#: contents: - -#: [Sound Theme] - -#: Inherits=name-of-the-sound-theme-you-want-to-use - -#: Replace name-of-the-sound-theme-you-want-to-use with the actual -#: theme name. Now all compliant applications should use sounds from -#: this theme. - -#: }}} - -#: Window layout {{{ - -# remember_window_size yes -# initial_window_width 640 -# initial_window_height 400 - -#: If enabled, the OS Window size will be remembered so that new -#: instances of kitty will have the same size as the previous -#: instance. If disabled, the OS Window will initially have size -#: configured by initial_window_width/height, in pixels. You can use a -#: suffix of "c" on the width/height values to have them interpreted -#: as number of cells instead of pixels. - -# remember_window_position no - -#: If enabled, the OS Window position will be remembered so that new -#: instances of kitty will have the same position as the previous -#: instance. If disabled, the OS Window will be placed by the window -#: manager. Note that remembering of position only works if the -#: underlying desktop environment/window manager supports it. It never -#: works on Wayland. See also kitty --position to specify the position -#: when launching kitty. - -# enabled_layouts * - -#: The enabled window layouts. A comma separated list of layout names. -#: The special value all means all layouts. The first listed layout -#: will be used as the startup layout. Default configuration is all -#: layouts in alphabetical order. For a list of available layouts, see -#: the layouts . - -# window_resize_step_cells 2 -# window_resize_step_lines 2 - -#: The step size (in units of cell width/cell height) to use when -#: resizing kitty windows in a layout with the shortcut -#: start_resizing_window. The cells value is used for horizontal -#: resizing, and the lines value is used for vertical resizing. - -# window_border_width 0.5pt - -#: The width of window borders. Can be either in pixels (px) or pts -#: (pt). Values in pts will be rounded to the nearest number of pixels -#: based on screen resolution. If not specified, the unit is assumed -#: to be pts. Note that borders are displayed only when more than one -#: window is visible. They are meant to separate multiple windows. - -# draw_minimal_borders yes - -#: Draw only the minimum borders needed. This means that only the -#: borders that separate the window from a neighbor are drawn. Note -#: that setting a non-zero window_margin_width overrides this and -#: causes all borders to be drawn. - -# window_margin_width 0 - -#: The window margin (in pts) (blank area outside the border). A -#: single value sets all four sides. Two values set the vertical and -#: horizontal sides. Three values set top, horizontal and bottom. Four -#: values set top, right, bottom and left. - -# single_window_margin_width -1 - -#: The window margin to use when only a single window is visible (in -#: pts). Negative values will cause the value of window_margin_width -#: to be used instead. A single value sets all four sides. Two values -#: set the vertical and horizontal sides. Three values set top, -#: horizontal and bottom. Four values set top, right, bottom and left. - -# window_padding_width 0 - -#: The window padding (in pts) (blank area between the text and the -#: window border). A single value sets all four sides. Two values set -#: the vertical and horizontal sides. Three values set top, horizontal -#: and bottom. Four values set top, right, bottom and left. - -# single_window_padding_width -1 - -#: The window padding to use when only a single window is visible (in -#: pts). Negative values will cause the value of window_padding_width -#: to be used instead. A single value sets all four sides. Two values -#: set the vertical and horizontal sides. Three values set top, -#: horizontal and bottom. Four values set top, right, bottom and left. - -# placement_strategy center - -#: When the window size is not an exact multiple of the cell size, the -#: cell area of the terminal window will have some extra padding on -#: the sides. You can control how that padding is distributed with -#: this option. Using a value of center means the cell area will be -#: placed centrally. A value of top-left means the padding will be -#: only at the bottom and right edges. The value can be one of: top- -#: left, top, top-right, left, center, right, bottom-left, bottom, -#: bottom-right. - -# active_border_color #00ff00 - -#: The color for the border of the active window. Set this to none to -#: not draw borders around the active window. - -# inactive_border_color #cccccc - -#: The color for the border of inactive windows. - -# bell_border_color #ff5a00 - -#: The color for the border of inactive windows in which a bell has -#: occurred. - -# inactive_text_alpha 1.0 - -#: Fade the text in inactive windows by the specified amount (a number -#: between zero and one, with zero being fully faded). - -# hide_window_decorations no - -#: Hide the window decorations (title-bar and window borders) with -#: yes. On macOS, titlebar-only and titlebar-and-corners can be used -#: to only hide the titlebar and the rounded corners. Whether this -#: works and exactly what effect it has depends on the window -#: manager/operating system. Note that the effects of changing this -#: option when reloading config are undefined. When using titlebar- -#: only, it is useful to also set window_margin_width and -#: placement_strategy to prevent the rounded corners from clipping -#: text. Or use titlebar-and-corners. - -# window_logo_path none - -#: Path to a logo image. Must be in PNG/JPEG/WEBP/GIF/TIFF/BMP format. -#: Relative paths are interpreted relative to the kitty config -#: directory. The logo is displayed in a corner of every kitty window. -#: The position is controlled by window_logo_position. Individual -#: windows can be configured to have different logos either using the -#: launch action or the remote control -#: facility. - -# window_logo_position bottom-right - -#: Where to position the window logo in the window. The value can be -#: one of: top-left, top, top-right, left, center, right, bottom-left, -#: bottom, bottom-right. - -# window_logo_alpha 0.5 - -#: The amount the logo should be faded into the background. With zero -#: being fully faded and one being fully opaque. - -# window_logo_scale 0 - -#: The percentage (0-100] of the window size to which the logo should -#: scale. Using a single number means the logo is scaled to that -#: percentage of the shortest window dimension, while preserving -#: aspect ratio of the logo image. - -#: Using two numbers means the width and height of the logo are scaled -#: to the respective percentage of the window's width and height. - -#: Using zero as the percentage disables scaling in that dimension. A -#: single zero (the default) disables all scaling of the window logo. - -# resize_debounce_time 0.1 0.5 - -#: The time to wait (in seconds) before asking the program running in -#: kitty to resize and redraw the screen during a live resize of the -#: OS window, when no new resize events have been received, i.e. when -#: resizing is either paused or finished. On platforms such as macOS, -#: where the operating system sends events corresponding to the start -#: and end of a live resize, the second number is used for redraw- -#: after-pause since kitty can distinguish between a pause and end of -#: resizing. On such systems the first number is ignored and redraw is -#: immediate after end of resize. On other systems only the first -#: number is used so that kitty is "ready" quickly after the end of -#: resizing, while not also continuously redrawing, to save energy. - -# resize_in_steps no - -#: Resize the OS window in steps as large as the cells, instead of -#: with the usual pixel accuracy. Combined with initial_window_width -#: and initial_window_height in number of cells, this option can be -#: used to keep the margins as small as possible when resizing the OS -#: window. Note that this does not currently work on Wayland. - -# visual_window_select_characters 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ - -#: The list of characters for visual window selection. For example, -#: for selecting a window to focus on with focus_visible_window. The -#: value should be a series of unique numbers or alphabets, case -#: insensitive, from the set 0-9A-Z\-=[];',./\\`. Specify your -#: preference as a string of characters. - -# confirm_os_window_close -1 - -#: Ask for confirmation when closing an OS window or a tab with at -#: least this number of kitty windows in it by window manager (e.g. -#: clicking the window close button or pressing the operating system -#: shortcut to close windows) or by the close_tab action. A value of -#: zero disables confirmation. This confirmation also applies to -#: requests to quit the entire application (all OS windows, via the -#: quit action). Negative values are converted to positive ones, -#: however, with shell_integration enabled, using negative values -#: means windows sitting at a shell prompt are not counted, only -#: windows where some command is currently running. You can also have -#: backgrounded jobs prevent closing, by adding count-background to -#: the setting, for example: -1 count-background. Note that if you -#: want confirmation when closing individual windows, you can map the -#: close_window_with_confirmation action. - -#: }}} - -#: Tab bar {{{ - -# tab_bar_edge bottom - -#: The edge to show the tab bar on, top or bottom. - -# tab_bar_margin_width 0.0 - -#: The margin to the left and right of the tab bar (in pts). - -# tab_bar_margin_height 0.0 0.0 - -#: The margin above and below the tab bar (in pts). The first number -#: is the margin between the edge of the OS Window and the tab bar. -#: The second number is the margin between the tab bar and the -#: contents of the current tab. - -# tab_bar_style fade - -#: The tab bar style, can be one of: - -#: fade -#: Each tab's edges fade into the background color. (See also tab_fade) -#: slant -#: Tabs look like the tabs in a physical file. -#: separator -#: Tabs are separated by a configurable separator. (See also -#: tab_separator) -#: powerline -#: Tabs are shown as a continuous line with "fancy" separators. -#: (See also tab_powerline_style) -#: custom -#: A user-supplied Python function called draw_tab is loaded from the file -#: tab_bar.py in the kitty config directory. For examples of how to -#: write such a function, see the functions named draw_tab_with_* in -#: kitty's source code: kitty/tab_bar.py. See also -#: this discussion -#: for examples from kitty users. -#: hidden -#: The tab bar is hidden. If you use this, you might want to create -#: a mapping for the select_tab action which presents you with a list of -#: tabs and allows for easy switching to a tab. - -# tab_bar_align left - -#: The horizontal alignment of the tab bar, can be one of: left, -#: center, right. - -# tab_bar_min_tabs 2 - -#: The minimum number of tabs that must exist before the tab bar is -#: shown. - -# tab_switch_strategy previous - -#: The algorithm to use when switching to a tab when the current tab -#: is closed. The default of previous will switch to the last used -#: tab. A value of left will switch to the tab to the left of the -#: closed tab. A value of right will switch to the tab to the right of -#: the closed tab. A value of last will switch to the right-most tab. - -# tab_fade 0.25 0.5 0.75 1 - -#: Control how each tab fades into the background when using fade for -#: the tab_bar_style. Each number is an alpha (between zero and one) -#: that controls how much the corresponding cell fades into the -#: background, with zero being no fade and one being full fade. You -#: can change the number of cells used by adding/removing entries to -#: this list. - -# tab_separator " ┇" - -#: The separator between tabs in the tab bar when using separator as -#: the tab_bar_style. - -# tab_powerline_style angled - -#: The powerline separator style between tabs in the tab bar when -#: using powerline as the tab_bar_style, can be one of: angled, -#: slanted, round. - -# tab_activity_symbol none - -#: Some text or a Unicode symbol to show on the tab if a window in the -#: tab that does not have focus has some activity. If you want to use -#: leading or trailing spaces, surround the text with quotes. See -#: tab_title_template for how this is rendered. - -# tab_title_max_length 0 - -#: The maximum number of cells that can be used to render the text in -#: a tab. A value of zero means that no limit is applied. - -# tab_title_template "{fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{tab.last_focused_progress_percent}{title}" - -#: A template to render the tab title. The default just renders the -#: title with optional symbols for bell and activity. If you wish to -#: include the tab-index as well, use something like: {index}:{title}. -#: Useful if you have shortcuts mapped for goto_tab N. If you prefer -#: to see the index as a superscript, use {sup.index}. All data -#: available is: - -#: title -#: The current tab title. -#: index -#: The tab index usable with goto_tab N goto_tab shortcuts. -#: layout_name -#: The current layout name. -#: num_windows -#: The number of windows in the tab. -#: num_window_groups -#: The number of window groups (a window group is a window and all of its overlay windows) in the tab. -#: tab.active_wd -#: The working directory of the currently active window in the tab -#: (expensive, requires syscall). Use tab.active_oldest_wd to get -#: the directory of the oldest foreground process rather than the newest. -#: tab.active_exe -#: The name of the executable running in the foreground of the currently -#: active window in the tab (expensive, requires syscall). Use -#: tab.active_oldest_exe for the oldest foreground process. -#: max_title_length -#: The maximum title length available. -#: keyboard_mode -#: The name of the current keyboard mode or the empty string if no keyboard mode is active. -#: tab.last_focused_progress_percent -#: If a command running in a window reports the progress for a task, show this progress as a percentage -#: from the most recently focused window in the tab. Empty string if no progress is reported. -#: tab.progress_percent -#: If a command running in a window reports the progress for a task, show this progress as a percentage -#: from all windows in the tab, averaged. Empty string is no progress is reported. - -#: Note that formatting is done by Python's string formatting -#: machinery, so you can use, for instance, {layout_name[:2].upper()} -#: to show only the first two letters of the layout name, upper-cased. -#: If you want to style the text, you can use styling directives, for -#: example: -#: `{fmt.fg.red}red{fmt.fg.tab}normal{fmt.bg._00FF00}greenbg{fmt.bg.tab}`. -#: Similarly, for bold and italic: -#: `{fmt.bold}bold{fmt.nobold}normal{fmt.italic}italic{fmt.noitalic}`. -#: The 256 eight terminal colors can be used as `fmt.fg.color0` -#: through `fmt.fg.color255`. Note that for backward compatibility, if -#: {bell_symbol} or {activity_symbol} are not present in the template, -#: they are prepended to it. - -# active_tab_title_template none - -#: Template to use for active tabs. If not specified falls back to -#: tab_title_template. - -# active_tab_foreground #000 -# active_tab_background #eee -# active_tab_font_style bold-italic -# inactive_tab_foreground #444 -# inactive_tab_background #999 -# inactive_tab_font_style normal - -#: Tab bar colors and styles. - -# tab_bar_background none - -#: Background color for the tab bar. Defaults to using the terminal -#: background color. - -# tab_bar_margin_color none - -#: Color for the tab bar margin area. Defaults to using the terminal -#: background color for margins above and below the tab bar. For side -#: margins the default color is chosen to match the background color -#: of the neighboring tab. - -#: }}} - -#: Color scheme {{{ - -# foreground #dddddd -# background #000000 - -#: The foreground and background colors. - -# background_opacity 1.0 - -#: The opacity of the background. A number between zero and one, where -#: one is opaque and zero is fully transparent. This will only work if -#: supported by the OS (for instance, when using a compositor under -#: X11). Note that it only sets the background color's opacity in -#: cells that have the same background color as the default terminal -#: background, so that things like the status bar in vim, powerline -#: prompts, etc. still look good. But it means that if you use a color -#: theme with a background color in your editor, it will not be -#: rendered as transparent. Instead you should change the default -#: background color in your kitty config and not use a background -#: color in the editor color scheme. Or use the escape codes to set -#: the terminals default colors in a shell script to launch your -#: editor. See also transparent_background_colors. Be aware that using -#: a value less than 1.0 is a (possibly significant) performance hit. -#: When using a low value for this setting, it is desirable that you -#: set the background color to a color the matches the general color -#: of the desktop background, for best text rendering. Note that to -#: workaround window managers not doing gamma-corrected blending kitty -#: makes background_opacity non-linear which means, especially for -#: light backgrounds you might need to make the value much lower than -#: you expect to get good results, see 6218 -#: for details. - -#: If you want to dynamically change transparency of windows, set -#: dynamic_background_opacity to yes (this is off by default as it has -#: a performance cost). Changing this option when reloading the config -#: will only work if dynamic_background_opacity was enabled in the -#: original config. - -# background_blur 0 - -#: Set to a positive value to enable background blur (blurring of the -#: visuals behind a transparent window) on platforms that support it. -#: Only takes effect when background_opacity is less than one. On -#: macOS, this will also control the blur radius (amount of blurring). -#: Setting it to too high a value will cause severe performance issues -#: and/or rendering artifacts. Usually, values up to 64 work well. -#: Note that this might cause performance issues, depending on how the -#: platform implements it, so use with care. Currently supported on -#: macOS and KDE. - -# transparent_background_colors - -#: A space separated list of upto 7 colors, with opacity. When the -#: background color of a cell matches one of these colors, it is -#: rendered semi-transparent using the specified opacity. - -#: Useful in more complex UIs like editors where you could want more -#: than a single background color to be rendered as transparent, for -#: instance, for a cursor highlight line background or a highlighted -#: block. Terminal applications can set this color using The kitty -#: color control escape code. - -#: The syntax for specifying colors is: color@opacity, where the -#: @opacity part is optional. When unspecified, the value of -#: background_opacity is used. For example:: - -#: transparent_background_colors red@0.5 #00ff00@0.3 - -# dynamic_background_opacity no - -#: Allow changing of the background_opacity dynamically, using either -#: keyboard shortcuts (increase_background_opacity and -#: decrease_background_opacity) or the remote control facility. -#: Changing this option by reloading the config is not supported. - -# background_image none - -#: Path to a background image. Must be in PNG/JPEG/WEBP/TIFF/GIF/BMP -#: format. Note that when using auto_color_scheme -#: -#: this option is overridden by the color scheme file and must be set -#: inside it to take effect. - -# background_image_layout tiled - -#: Whether to tile, scale or clamp the background image. The value can -#: be one of tiled, mirror-tiled, scaled, clamped, centered or -#: cscaled. The scaled and cscaled values scale the image to the -#: window size, with cscaled preserving the image aspect ratio. Note -#: that when using auto_color_scheme -#: -#: this option is overridden by the color scheme file and must be set -#: inside it to take effect. - -# background_image_linear no - -#: When background image is scaled, whether linear interpolation -#: should be used. Note that when using auto_color_scheme -#: -#: this option is overridden by the color scheme file and must be set -#: inside it to take effect. - -# background_tint 0.0 - -#: How much to tint the background image by the background color. This -#: option makes it easier to read the text. Tinting is done using the -#: current background color for each window. This option applies only -#: if background_opacity is set and transparent windows are supported -#: or background_image is set. Note that when using auto_color_scheme -#: -#: this option is overridden by the color scheme file and must be set -#: inside it to take effect. - -# background_tint_gaps 1.0 - -#: How much to tint the background image at the window gaps by the -#: background color, after applying background_tint. Since this is -#: multiplicative with background_tint, it can be used to lighten the -#: tint over the window gaps for a *separated* look. Note that when -#: using auto_color_scheme -#: -#: this option is overridden by the color scheme file and must be set -#: inside it to take effect. - -# dim_opacity 0.4 - -#: How much to dim text that has the DIM/FAINT attribute set. One -#: means no dimming and zero means fully dimmed (i.e. invisible). - -# selection_foreground #000000 -# selection_background #fffacd - -#: The foreground and background colors for text selected with the -#: mouse. Setting both of these to none will cause a "reverse video" -#: effect for selections, where the selection will be the cell text -#: color and the text will become the cell background color. Setting -#: only selection_foreground to none will cause the foreground color -#: to be used unchanged. Note that these colors can be overridden by -#: the program running in the terminal. - -#: The color table {{{ - -#: The 256 terminal colors. There are 8 basic colors, each color has a -#: dull and bright version, for the first 16 colors. You can set the -#: remaining 240 colors as color16 to color255. - -# color0 #000000 -# color8 #767676 - -#: black - -# color1 #cc0403 -# color9 #f2201f - -#: red - -# color2 #19cb00 -# color10 #23fd00 - -#: green - -# color3 #cecb00 -# color11 #fffd00 - -#: yellow - -# color4 #0d73cc -# color12 #1a8fff - -#: blue - -# color5 #cb1ed1 -# color13 #fd28ff - -#: magenta - -# color6 #0dcdcd -# color14 #14ffff - -#: cyan - -# color7 #dddddd -# color15 #ffffff - -#: white - -# mark1_foreground black - -#: Color for marks of type 1 - -# mark1_background #98d3cb - -#: Color for marks of type 1 (light steel blue) - -# mark2_foreground black - -#: Color for marks of type 2 - -# mark2_background #f2dcd3 - -#: Color for marks of type 1 (beige) - -# mark3_foreground black - -#: Color for marks of type 3 - -# mark3_background #f274bc - -#: Color for marks of type 3 (violet) - -#: }}} - -#: }}} - -#: Advanced {{{ - -# shell . - -#: The shell program to execute. The default value of . means to use -#: the value of of the SHELL environment variable or if unset, -#: whatever shell is set as the default shell for the current user. -#: Note that on macOS if you change this, you might need to add -#: --login and --interactive to ensure that the shell starts in -#: interactive mode and reads its startup rc files. Environment -#: variables are expanded in this setting. - -# editor . - -#: The terminal based text editor (such as vim or nano) to use when -#: editing the kitty config file or similar tasks. - -#: The default value of . means to use the environment variables -#: VISUAL and EDITOR in that order. If these variables aren't set, -#: kitty will run your shell ($SHELL -l -i -c env) to see if your -#: shell startup rc files set VISUAL or EDITOR. If that doesn't work, -#: kitty will cycle through various known editors (vim, emacs, etc.) -#: and take the first one that exists on your system. - -# close_on_child_death no - -#: Close the window when the child process (usually the shell) exits. -#: With the default value no, the terminal will remain open when the -#: child exits as long as there are still other processes outputting -#: to the terminal (for example disowned or backgrounded processes). -#: When enabled with yes, the window will close as soon as the child -#: process exits. Note that setting it to yes means that any -#: background processes still using the terminal can fail silently -#: because their stdout/stderr/stdin no longer work. - -# remote_control_password - -#: Allow other programs to control kitty using passwords. This option -#: can be specified multiple times to add multiple passwords. If no -#: passwords are present kitty will ask the user for permission if a -#: program tries to use remote control with a password. A password can -#: also *optionally* be associated with a set of allowed remote -#: control actions. For example:: - -#: remote_control_password "my passphrase" get-colors set-colors focus-window focus-tab - -#: Only the specified actions will be allowed when using this -#: password. Glob patterns can be used too, for example:: - -#: remote_control_password "my passphrase" set-tab-* resize-* - -#: To get a list of available actions, run:: - -#: kitten @ --help - -#: A set of actions to be allowed when no password is sent can be -#: specified by using an empty password. For example:: - -#: remote_control_password "" *-colors - -#: Finally, the path to a python module can be specified that provides -#: a function is_cmd_allowed that is used to check every remote -#: control command. For example:: - -#: remote_control_password "my passphrase" my_rc_command_checker.py - -#: Relative paths are resolved from the kitty configuration directory. -#: See rc_custom_auth for details. - -# allow_remote_control no - -#: Allow other programs to control kitty. If you turn this on, other -#: programs can control all aspects of kitty, including sending text -#: to kitty windows, opening new windows, closing windows, reading the -#: content of windows, etc. Note that this even works over SSH -#: connections. The default setting of no prevents any form of remote -#: control. The meaning of the various values are: - -#: password -#: Remote control requests received over both the TTY device and the socket -#: are confirmed based on passwords, see remote_control_password. - -#: socket-only -#: Remote control requests received over a socket are accepted -#: unconditionally. Requests received over the TTY are denied. -#: See listen_on. - -#: socket -#: Remote control requests received over a socket are accepted -#: unconditionally. Requests received over the TTY are confirmed based on -#: password. - -#: no -#: Remote control is completely disabled. - -#: yes -#: Remote control requests are always accepted. - -# listen_on none - -#: Listen to the specified socket for remote control connections. Note -#: that this will apply to all kitty instances. It can be overridden -#: by the kitty --listen-on command line option. For UNIX sockets, -#: such as unix:${TEMP}/mykitty or unix:@mykitty (on Linux). -#: Environment variables are expanded and relative paths are resolved -#: with respect to the temporary directory. If {kitty_pid} is present, -#: then it is replaced by the PID of the kitty process, otherwise the -#: PID of the kitty process is appended to the value, with a hyphen. -#: For TCP sockets such as tcp:localhost:0 a random port is always -#: used even if a non-zero port number is specified. See the help for -#: kitty --listen-on for more details. Note that this will be ignored -#: unless allow_remote_control is set to either: yes, socket or -#: socket-only. Changing this option by reloading the config is not -#: supported. - -# env - -#: Specify the environment variables to be set in all child processes. -#: Using the name with an equal sign (e.g. env VAR=) will set it to -#: the empty string. Specifying only the name (e.g. env VAR) will -#: remove the variable from the child process' environment. Note that -#: environment variables are expanded recursively, for example:: - -#: env VAR1=a -#: env VAR2=${HOME}/${VAR1}/b - -#: The value of VAR2 will be /a/b. - -# filter_notification - -#: Specify rules to filter out notifications sent by applications -#: running in kitty. Can be specified multiple times to create -#: multiple filter rules. A rule specification is of the form -#: field:regexp. A filter rule can match on any of the fields: title, -#: body, app, type. The special value of all filters out all -#: notifications. Rules can be combined using Boolean operators. Some -#: examples:: - -#: filter_notification title:hello or body:"abc.*def" -#: # filter out notification from vim except for ones about updates, (?i) -#: # makes matching case insensitive. -#: filter_notification app:"[ng]?vim" and not body:"(?i)update" -#: # filter out all notifications -#: filter_notification all - -#: The field app is the name of the application sending the -#: notification and type is the type of the notification. Not all -#: applications will send these fields, so you can also match on the -#: title and body of the notification text. More sophisticated -#: programmatic filtering and custom actions on notifications can be -#: done by creating a notifications.py file in the kitty config -#: directory (~/.config/kitty). An annotated sample is available -#: . - -# watcher - -#: Path to python file which will be loaded for watchers -#: . Can be -#: specified more than once to load multiple watchers. The watchers -#: will be added to every kitty window. Relative paths are resolved -#: relative to the kitty config directory. Note that reloading the -#: config will only affect windows created after the reload. - -# exe_search_path - -#: Control where kitty finds the programs to run. The default search -#: order is: First search the system wide PATH, then ~/.local/bin and -#: ~/bin. If still not found, the PATH defined in the login shell -#: after sourcing all its startup files is tried. Finally, if present, -#: the PATH specified by the env option is tried. - -#: This option allows you to prepend, append, or remove paths from -#: this search order. It can be specified multiple times for multiple -#: paths. A simple path will be prepended to the search order. A path -#: that starts with the + sign will be append to the search order, -#: after ~/bin above. A path that starts with the - sign will be -#: removed from the entire search order. For example:: - -#: exe_search_path /some/prepended/path -#: exe_search_path +/some/appended/path -#: exe_search_path -/some/excluded/path - -# update_check_interval 24 - -#: The interval to periodically check if an update to kitty is -#: available (in hours). If an update is found, a system notification -#: is displayed informing you of the available update. The default is -#: to check every 24 hours, set to zero to disable. Update checking is -#: only done by the official binary builds. Distro packages or source -#: builds do not do update checking. Changing this option by reloading -#: the config is not supported. - -# startup_session none - -#: Path to a session file to use for all kitty instances. Can be -#: overridden by using the kitty --session =none command line option -#: for individual instances. See sessions -#: in the kitty -#: documentation for details. Note that relative paths are interpreted -#: with respect to the kitty config directory. Environment variables -#: in the path are expanded. Changing this option by reloading the -#: config is not supported. Note that if kitty is invoked with command -#: line arguments specifying a command to run, this option is ignored. - -# clipboard_control write-clipboard write-primary read-clipboard-ask read-primary-ask - -#: Allow programs running in kitty to read and write from the -#: clipboard. You can control exactly which actions are allowed. The -#: possible actions are: write-clipboard, read-clipboard, write- -#: primary, read-primary, read-clipboard-ask, read-primary-ask. The -#: default is to allow writing to the clipboard and primary selection -#: and to ask for permission when a program tries to read from the -#: clipboard. Note that disabling the read confirmation is a security -#: risk as it means that any program, even the ones running on a -#: remote server via SSH can read your clipboard. See also -#: clipboard_max_size. - -# clipboard_max_size 512 - -#: The maximum size (in MB) of data from programs running in kitty -#: that will be stored for writing to the system clipboard. A value of -#: zero means no size limit is applied. See also clipboard_control. - -# file_transfer_confirmation_bypass - -#: The password that can be supplied to the file transfer kitten -#: to skip the -#: transfer confirmation prompt. This should only be used when -#: initiating transfers from trusted computers, over trusted networks -#: or encrypted transports, as it allows any programs running on the -#: remote machine to read/write to the local filesystem, without -#: permission. - -# allow_hyperlinks yes - -#: Process hyperlink escape sequences (OSC 8). If disabled OSC 8 -#: escape sequences are ignored. Otherwise they become clickable -#: links, that you can click with the mouse or by using the hints -#: kitten . The -#: special value of ask means that kitty will ask before opening the -#: link when clicked. - -# shell_integration enabled - -#: Enable shell integration on supported shells. This enables features -#: such as jumping to previous prompts, browsing the output of the -#: previous command in a pager, etc. on supported shells. Set to -#: disabled to turn off shell integration, completely. It is also -#: possible to disable individual features, set to a space separated -#: list of these values: no-rc, no-cursor, no-title, no-cwd, no- -#: prompt-mark, no-complete, no-sudo. See Shell integration -#: for details. - -# allow_cloning ask - -#: Control whether programs running in the terminal can request new -#: windows to be created. The canonical example is clone-in-kitty -#: . -#: By default, kitty will ask for permission for each clone request. -#: Allowing cloning unconditionally gives programs running in the -#: terminal (including over SSH) permission to execute arbitrary code, -#: as the user who is running the terminal, on the computer that the -#: terminal is running on. - -# clone_source_strategies venv,conda,env_var,path - -#: Control what shell code is sourced when running clone-in-kitty in -#: the newly cloned window. The supported strategies are: - -#: venv -#: Source the file $VIRTUAL_ENV/bin/activate. This is used by the -#: Python stdlib venv module and allows cloning venvs automatically. -#: conda -#: Run conda activate $CONDA_DEFAULT_ENV. This supports the virtual -#: environments created by conda. -#: env_var -#: Execute the contents of the environment variable -#: KITTY_CLONE_SOURCE_CODE with eval. -#: path -#: Source the file pointed to by the environment variable -#: KITTY_CLONE_SOURCE_PATH. - -#: This option must be a comma separated list of the above values. -#: Only the first valid match, in the order specified, is sourced. - -# notify_on_cmd_finish never - -#: Show a desktop notification when a long-running command finishes -#: (needs shell_integration). The possible values are: - -#: never -#: Never send a notification. - -#: unfocused -#: Only send a notification when the window does not have keyboard focus. - -#: invisible -#: Only send a notification when the window both is unfocused and not visible -#: to the user, for example, because it is in an inactive tab or its OS window -#: is not currently visible (on platforms that support OS window visibility querying -#: this considers an OS Window visible iff it is active). - -#: always -#: Always send a notification, regardless of window state. - -#: There are two optional arguments: - -#: First, the minimum duration for what is considered a long running -#: command. The default is 5 seconds. Specify a second argument to set -#: the duration. For example: invisible 15. Do not set the value too -#: small, otherwise a command that launches a new OS Window and exits -#: will spam a notification. - -#: Second, the action to perform. The default is notify. The possible -#: values are: - -#: notify -#: Send a desktop notification. The subsequent arguments are optional and specify when -#: the notification is automatically cleared. The set of possible events when the notification is -#: cleared are: focus and next. focus means that when the notification -#: policy is unfocused or invisible the notification is automatically cleared -#: when the window regains focus. The value of next means that the previous notification -#: is cleared when the next notification is shown. The default when no arguments are specified -#: is: focus next. - -#: bell -#: Ring the terminal bell. - -#: command -#: Run a custom command. All subsequent arguments are the cmdline to run. - -#: Some more examples:: - -#: # Send a notification when a command takes more than 5 seconds in an unfocused window -#: notify_on_cmd_finish unfocused -#: # Send a notification when a command takes more than 10 seconds in a invisible window -#: notify_on_cmd_finish invisible 10.0 -#: # Ring a bell when a command takes more than 10 seconds in a invisible window -#: notify_on_cmd_finish invisible 10.0 bell -#: # Run 'notify-send' when a command takes more than 10 seconds in a invisible window -#: # Here %c is replaced by the current command line and %s by the job exit code -#: notify_on_cmd_finish invisible 10.0 command notify-send "job finished with status: %s" %c -#: # Do not clear previous notification when next command finishes or window regains focus -#: notify_on_cmd_finish invisible 5.0 notify - -# term xterm-kitty - -#: The value of the TERM environment variable to set. Changing this -#: can break many terminal programs, only change it if you know what -#: you are doing, not because you read some advice on "Stack Overflow" -#: to change it. The TERM variable is used by various programs to get -#: information about the capabilities and behavior of the terminal. If -#: you change it, depending on what programs you run, and how -#: different the terminal you are changing it to is, various things -#: from key-presses, to colors, to various advanced features may not -#: work. Changing this option by reloading the config will only affect -#: newly created windows. - -# terminfo_type path - -#: The value of the TERMINFO environment variable to set. This -#: variable is used by programs running in the terminal to search for -#: terminfo databases. The default value of path causes kitty to set -#: it to a filesystem location containing the kitty terminfo database. -#: A value of direct means put the entire database into the env var -#: directly. This can be useful when connecting to containers, for -#: example. But, note that not all software supports this. A value of -#: none means do not touch the variable. - -# forward_stdio no - -#: Forward STDOUT and STDERR of the kitty process to child processes. -#: This is useful for debugging as it allows child processes to print -#: to kitty's STDOUT directly. For example, echo hello world -#: >&$KITTY_STDIO_FORWARDED in a shell will print to the parent -#: kitty's STDOUT. Sets the KITTY_STDIO_FORWARDED=fdnum environment -#: variable so child processes know about the forwarding. Note that on -#: macOS this prevents the shell from being run via the login utility -#: so getlogin() will not work in programs run in this session. - -# menu_map - -#: Specify entries for various menus in kitty. Currently only the -#: global menubar on macOS is supported. For example:: - -#: menu_map global "Actions::Launch something special" launch --hold --type=os-window sh -c "echo hello world" - -#: This will create a menu entry named "Launch something special" in -#: an "Actions" menu in the macOS global menubar. Sub-menus can be -#: created by adding more levels separated by the :: characters. - -#: }}} - -#: OS specific tweaks {{{ - -# wayland_titlebar_color system - -#: The color of the kitty window's titlebar on Wayland systems with -#: client side window decorations such as GNOME. A value of system -#: means to use the default system colors, a value of background means -#: to use the background color of the currently active kitty window -#: and finally you can use an arbitrary color, such as #12af59 or red. - -# macos_titlebar_color system - -#: The color of the kitty window's titlebar on macOS. A value of -#: system means to use the default system color, light or dark can -#: also be used to set it explicitly. A value of background means to -#: use the background color of the currently active window and finally -#: you can use an arbitrary color, such as #12af59 or red. WARNING: -#: This option works by using a hack when arbitrary color (or -#: background) is configured, as there is no proper Cocoa API for it. -#: It sets the background color of the entire window and makes the -#: titlebar transparent. As such it is incompatible with -#: background_opacity. If you want to use both, you are probably -#: better off just hiding the titlebar with hide_window_decorations. - -# macos_option_as_alt no - -#: Use the Option key as an Alt key on macOS. With this set to no, -#: kitty will use the macOS native Option+Key to enter Unicode -#: character behavior. This will break any Alt+Key keyboard shortcuts -#: in your terminal programs, but you can use the macOS Unicode input -#: technique. You can use the values: left, right or both to use only -#: the left, right or both Option keys as Alt, instead. Note that -#: kitty itself always treats Option the same as Alt. This means you -#: cannot use this option to configure different kitty shortcuts for -#: Option+Key vs. Alt+Key. Also, any kitty shortcuts using -#: Option/Alt+Key will take priority, so that any such key presses -#: will not be passed to terminal programs running inside kitty. -#: Changing this option by reloading the config is not supported. - -# macos_hide_from_tasks no - -#: Hide the kitty window from running tasks on macOS (⌘+Tab and the -#: Dock). Changing this option by reloading the config is not -#: supported. - -# macos_quit_when_last_window_closed no - -#: Have kitty quit when all the top-level windows are closed on macOS. -#: By default, kitty will stay running, even with no open windows, as -#: is the expected behavior on macOS. - -# macos_window_resizable yes - -#: Disable this if you want kitty top-level OS windows to not be -#: resizable on macOS. - -# macos_thicken_font 0 - -#: Draw an extra border around the font with the given width, to -#: increase legibility at small font sizes on macOS. For example, a -#: value of 0.75 will result in rendering that looks similar to sub- -#: pixel antialiasing at common font sizes. Note that in modern kitty, -#: this option is obsolete (although still supported). Consider using -#: text_composition_strategy instead. - -# macos_traditional_fullscreen no - -#: Use the macOS traditional full-screen transition, that is faster, -#: but less pretty. - -# macos_show_window_title_in all - -#: Control where the window title is displayed on macOS. A value of -#: window will show the title of the currently active window at the -#: top of the macOS window. A value of menubar will show the title of -#: the currently active window in the macOS global menu bar, making -#: use of otherwise wasted space. A value of all will show the title -#: in both places, and none hides the title. See -#: macos_menubar_title_max_length for how to control the length of the -#: title in the menu bar. - -# macos_menubar_title_max_length 0 - -#: The maximum number of characters from the window title to show in -#: the macOS global menu bar. Values less than one means that there is -#: no maximum limit. - -# macos_custom_beam_cursor no - -#: Use a custom mouse cursor for macOS that is easier to see on both -#: light and dark backgrounds. Nowadays, the default macOS cursor -#: already comes with a white border. WARNING: this might make your -#: mouse cursor invisible on dual GPU machines. Changing this option -#: by reloading the config is not supported. - -# macos_colorspace srgb - -#: The colorspace in which to interpret terminal colors. The default -#: of srgb will cause colors to match those seen in web browsers. The -#: value of default will use whatever the native colorspace of the -#: display is. The value of displayp3 will use Apple's special -#: snowflake display P3 color space, which will result in over -#: saturated (brighter) colors with some color shift. Reloading -#: configuration will change this value only for newly created OS -#: windows. - -# linux_display_server auto - -#: Choose between Wayland and X11 backends. By default, an appropriate -#: backend based on the system state is chosen automatically. Set it -#: to x11 or wayland to force the choice. Changing this option by -#: reloading the config is not supported. - -# wayland_enable_ime yes - -#: Enable Input Method Extension on Wayland. This is typically used -#: for inputting text in East Asian languages. However, its -#: implementation in Wayland is often buggy and introduces latency -#: into the input loop, so disable this if you know you dont need it. -#: Changing this option by reloading the config is not supported, it -#: will not have any effect. - -#: }}} - -#: Keyboard shortcuts {{{ - -#: Keys are identified simply by their lowercase Unicode characters. -#: For example: a for the A key, [ for the left square bracket key, -#: etc. For functional keys, such as Enter or Escape, the names are -#: present at Functional key definitions -#: . -#: For modifier keys, the names are ctrl (control, ⌃), shift (⇧), alt -#: (opt, option, ⌥), super (cmd, command, ⌘). - -#: Simple shortcut mapping is done with the map directive. For full -#: details on advanced mapping including modal and per application -#: maps, see mapping . Some -#: quick examples to illustrate common tasks:: - -#: # unmap a keyboard shortcut, passing it to the program running in kitty -#: map kitty_mod+space -#: # completely ignore a keyboard event -#: map ctrl+alt+f1 discard_event -#: # combine multiple actions -#: map kitty_mod+e combine : new_window : next_layout -#: # multi-key shortcuts -#: map ctrl+x>ctrl+y>z action - -#: The full list of actions that can be mapped to key presses is -#: available here . - -# kitty_mod ctrl+shift - -#: Special modifier key alias for default shortcuts. You can change -#: the value of this option to alter all default shortcuts that use -#: kitty_mod. - -# clear_all_shortcuts no - -#: Remove all shortcut definitions up to this point. Useful, for -#: instance, to remove the default shortcuts. - -# action_alias - -#: E.g. action_alias launch_tab launch --type=tab --cwd=current - -#: Define action aliases to avoid repeating the same options in -#: multiple mappings. Aliases can be defined for any action and will -#: be expanded recursively. For example, the above alias allows you to -#: create mappings to launch a new tab in the current working -#: directory without duplication:: - -#: map f1 launch_tab vim -#: map f2 launch_tab emacs - -#: Similarly, to alias kitten invocation:: - -#: action_alias hints kitten hints --hints-offset=0 - -# kitten_alias - -#: E.g. kitten_alias hints hints --hints-offset=0 - -#: Like action_alias above, but specifically for kittens. Generally, -#: prefer to use action_alias. This option is a legacy version, -#: present for backwards compatibility. It causes all invocations of -#: the aliased kitten to be substituted. So the example above will -#: cause all invocations of the hints kitten to have the --hints- -#: offset=0 option applied. - -#: Clipboard {{{ - -#: Copy to clipboard - -# map kitty_mod+c copy_to_clipboard -# map cmd+c copy_to_clipboard - -#:: There is also a copy_or_interrupt action that can be optionally -#:: mapped to Ctrl+C. It will copy only if there is a selection and -#:: send an interrupt otherwise. Similarly, -#:: copy_and_clear_or_interrupt will copy and clear the selection or -#:: send an interrupt if there is no selection. - -#: Paste from clipboard - -# map kitty_mod+v paste_from_clipboard -# map cmd+v paste_from_clipboard - -#: Paste from selection - -# map kitty_mod+s paste_from_selection -# map shift+insert paste_from_selection - -#: Pass selection to program - -# map kitty_mod+o pass_selection_to_program - -#:: You can also pass the contents of the current selection to any -#:: program with pass_selection_to_program. By default, the system's -#:: open program is used, but you can specify your own, the selection -#:: will be passed as a command line argument to the program. For -#:: example:: - -#:: map kitty_mod+o pass_selection_to_program firefox - -#:: You can pass the current selection to a terminal program running -#:: in a new kitty window, by using the @selection placeholder:: - -#:: map kitty_mod+y new_window less @selection - -#: }}} - -#: Scrolling {{{ - -#: Scroll line up - -# map kitty_mod+up scroll_line_up -# map kitty_mod+k scroll_line_up -# map opt+cmd+page_up scroll_line_up -# map cmd+up scroll_line_up - -#: Scroll line down - -# map kitty_mod+down scroll_line_down -# map kitty_mod+j scroll_line_down -# map opt+cmd+page_down scroll_line_down -# map cmd+down scroll_line_down - -#: Scroll page up - -# map kitty_mod+page_up scroll_page_up -# map cmd+page_up scroll_page_up - -#: Scroll page down - -# map kitty_mod+page_down scroll_page_down -# map cmd+page_down scroll_page_down - -#: Scroll to top - -# map kitty_mod+home scroll_home -# map cmd+home scroll_home - -#: Scroll to bottom - -# map kitty_mod+end scroll_end -# map cmd+end scroll_end - -#: Scroll to previous shell prompt - -# map kitty_mod+z scroll_to_prompt -1 - -#:: Use a parameter of 0 for scroll_to_prompt to scroll to the last -#:: jumped to or the last clicked position. Requires shell -#:: integration -#:: to work. - -#: Scroll to next shell prompt - -# map kitty_mod+x scroll_to_prompt 1 - -#: Browse scrollback buffer in pager - -# map kitty_mod+h show_scrollback - -#:: You can pipe the contents of the current screen and history -#:: buffer as STDIN to an arbitrary program using launch --stdin- -#:: source. For example, the following opens the scrollback buffer in -#:: less in an overlay window:: - -#:: map f1 launch --stdin-source=@screen_scrollback --stdin-add-formatting --type=overlay less +G -R - -#:: For more details on piping screen and buffer contents to external -#:: programs, see launch . - -#: Browse output of the last shell command in pager - -# map kitty_mod+g show_last_command_output - -#:: You can also define additional shortcuts to get the command -#:: output. For example, to get the first command output on screen:: - -#:: map f1 show_first_command_output_on_screen - -#:: To get the command output that was last accessed by a keyboard -#:: action or mouse action:: - -#:: map f1 show_last_visited_command_output - -#:: You can pipe the output of the last command run in the shell -#:: using the launch action. For example, the following opens the -#:: output in less in an overlay window:: - -#:: map f1 launch --stdin-source=@last_cmd_output --stdin-add-formatting --type=overlay less +G -R - -#:: To get the output of the first command on the screen, use -#:: @first_cmd_output_on_screen. To get the output of the last jumped -#:: to command, use @last_visited_cmd_output. - -#:: Requires shell integration -#:: to work. - -#: }}} - -#: Window management {{{ - -#: New window - -# map kitty_mod+enter new_window -# map cmd+enter new_window - -#:: You can open a new kitty window running an arbitrary program, for -#:: example:: - -#:: map kitty_mod+y launch mutt - -#:: You can open a new window with the current working directory set -#:: to the working directory of the current window using:: - -#:: map ctrl+alt+enter launch --cwd=current - -#:: You can open a new window that is allowed to control kitty via -#:: the kitty remote control facility with launch --allow-remote- -#:: control. Any programs running in that window will be allowed to -#:: control kitty. For example:: - -#:: map ctrl+enter launch --allow-remote-control some_program - -#:: You can open a new window next to the currently active window or -#:: as the first window, with:: - -#:: map ctrl+n launch --location=neighbor -#:: map ctrl+f launch --location=first - -#:: For more details, see launch -#:: . - -#: New OS window - -# map kitty_mod+n new_os_window -# map cmd+n new_os_window - -#:: Works like new_window above, except that it opens a top-level OS -#:: window. In particular you can use new_os_window_with_cwd to open -#:: a window with the current working directory. - -#: Close window - -# map kitty_mod+w close_window -# map shift+cmd+d close_window - -#: Next window - -# map kitty_mod+] next_window - -#: Previous window - -# map kitty_mod+[ previous_window - -#: Move window forward - -# map kitty_mod+f move_window_forward - -#: Move window backward - -# map kitty_mod+b move_window_backward - -#: Move window to top - -# map kitty_mod+` move_window_to_top - -#: Start resizing window - -# map kitty_mod+r start_resizing_window -# map cmd+r start_resizing_window - -#: First window - -# map kitty_mod+1 first_window -# map cmd+1 first_window - -#: Second window - -# map kitty_mod+2 second_window -# map cmd+2 second_window - -#: Third window - -# map kitty_mod+3 third_window -# map cmd+3 third_window - -#: Fourth window - -# map kitty_mod+4 fourth_window -# map cmd+4 fourth_window - -#: Fifth window - -# map kitty_mod+5 fifth_window -# map cmd+5 fifth_window - -#: Sixth window - -# map kitty_mod+6 sixth_window -# map cmd+6 sixth_window - -#: Seventh window - -# map kitty_mod+7 seventh_window -# map cmd+7 seventh_window - -#: Eighth window - -# map kitty_mod+8 eighth_window -# map cmd+8 eighth_window - -#: Ninth window - -# map kitty_mod+9 ninth_window -# map cmd+9 ninth_window - -#: Tenth window - -# map kitty_mod+0 tenth_window - -#: Visually select and focus window - -# map kitty_mod+f7 focus_visible_window - -#:: Display overlay numbers and alphabets on the window, and switch -#:: the focus to the window when you press the key. When there are -#:: only two windows, the focus will be switched directly without -#:: displaying the overlay. You can change the overlay characters and -#:: their order with option visual_window_select_characters. - -#: Visually swap window with another - -# map kitty_mod+f8 swap_with_window - -#:: Works like focus_visible_window above, but swaps the window. - -#: }}} - -#: Tab management {{{ - -#: Next tab - -# map kitty_mod+right next_tab -# map shift+cmd+] next_tab -# map ctrl+tab next_tab - -#: Previous tab - -# map kitty_mod+left previous_tab -# map shift+cmd+[ previous_tab -# map ctrl+shift+tab previous_tab - -#: New tab - -# map kitty_mod+t new_tab -# map cmd+t new_tab - -#: Close tab - -# map kitty_mod+q close_tab -# map cmd+w close_tab - -#: Close OS window - -# map shift+cmd+w close_os_window - -#: Move tab forward - -# map kitty_mod+. move_tab_forward - -#: Move tab backward - -# map kitty_mod+, move_tab_backward - -#: Set tab title - -# map kitty_mod+alt+t set_tab_title -# map shift+cmd+i set_tab_title - - -#: You can also create shortcuts to go to specific tabs, with 1 being -#: the first tab, 2 the second tab and -1 being the previously active -#: tab, -2 being the tab active before the previously active tab and -#: so on. Any number larger than the number of tabs goes to the last -#: tab and any number less than the number of previously used tabs in -#: the history goes to the oldest previously used tab in the history:: - -#: map ctrl+alt+1 goto_tab 1 -#: map ctrl+alt+2 goto_tab 2 - -#: Just as with new_window above, you can also pass the name of -#: arbitrary commands to run when using new_tab and new_tab_with_cwd. -#: Finally, if you want the new tab to open next to the current tab -#: rather than at the end of the tabs list, use:: - -#: map ctrl+t new_tab !neighbor [optional cmd to run] -#: }}} - -#: Layout management {{{ - -#: Next layout - -# map kitty_mod+l next_layout - - -#: You can also create shortcuts to switch to specific layouts:: - -#: map ctrl+alt+t goto_layout tall -#: map ctrl+alt+s goto_layout stack - -#: Similarly, to switch back to the previous layout:: - -#: map ctrl+alt+p last_used_layout - -#: There is also a toggle_layout action that switches to the named -#: layout or back to the previous layout if in the named layout. -#: Useful to temporarily "zoom" the active window by switching to the -#: stack layout:: - -#: map ctrl+alt+z toggle_layout stack -#: }}} - -#: Font sizes {{{ - -#: You can change the font size for all top-level kitty OS windows at -#: a time or only the current one. - -#: Increase font size - -# map kitty_mod+equal change_font_size all +2.0 -# map kitty_mod+plus change_font_size all +2.0 -# map kitty_mod+kp_add change_font_size all +2.0 -# map cmd+plus change_font_size all +2.0 -# map cmd+equal change_font_size all +2.0 -# map shift+cmd+equal change_font_size all +2.0 - -#: Decrease font size - -# map kitty_mod+minus change_font_size all -2.0 -# map kitty_mod+kp_subtract change_font_size all -2.0 -# map cmd+minus change_font_size all -2.0 -# map shift+cmd+minus change_font_size all -2.0 - -#: Reset font size - -# map kitty_mod+backspace change_font_size all 0 -# map cmd+0 change_font_size all 0 - - -#: To setup shortcuts for specific font sizes:: - -#: map kitty_mod+f6 change_font_size all 10.0 - -#: To setup shortcuts to change only the current OS window's font -#: size:: - -#: map kitty_mod+f6 change_font_size current 10.0 - -#: To setup shortcuts to multiply/divide the font size:: - -#: map kitty_mod+f6 change_font_size all *2.0 -#: map kitty_mod+f6 change_font_size all /2.0 -#: }}} - -#: Select and act on visible text {{{ - -#: Use the hints kitten to select text and either pass it to an -#: external program or insert it into the terminal or copy it to the -#: clipboard. - -#: Open URL - -# map kitty_mod+e open_url_with_hints - -#:: Open a currently visible URL using the keyboard. The program used -#:: to open the URL is specified in open_url_with. - -#: Insert selected path - -# map kitty_mod+p>f kitten hints --type path --program - - -#:: Select a path/filename and insert it into the terminal. Useful, -#:: for instance to run git commands on a filename output from a -#:: previous git command. - -#: Open selected path - -# map kitty_mod+p>shift+f kitten hints --type path - -#:: Select a path/filename and open it with the default open program. - -#: Insert selected line - -# map kitty_mod+p>l kitten hints --type line --program - - -#:: Select a line of text and insert it into the terminal. Useful for -#:: the output of things like: `ls -1`. - -#: Insert selected word - -# map kitty_mod+p>w kitten hints --type word --program - - -#:: Select words and insert into terminal. - -#: Insert selected hash - -# map kitty_mod+p>h kitten hints --type hash --program - - -#:: Select something that looks like a hash and insert it into the -#:: terminal. Useful with git, which uses SHA1 hashes to identify -#:: commits. - -#: Open the selected file at the selected line - -# map kitty_mod+p>n kitten hints --type linenum - -#:: Select something that looks like filename:linenum and open it in -#:: your default editor at the specified line number. - -#: Open the selected hyperlink - -# map kitty_mod+p>y kitten hints --type hyperlink - -#:: Select a hyperlink (i.e. a URL that has been marked as such by -#:: the terminal program, for example, by `ls --hyperlink=auto`). - - -#: The hints kitten has many more modes of operation that you can map -#: to different shortcuts. For a full description see hints kitten -#: . -#: }}} - -#: Miscellaneous {{{ - -#: Show documentation - -# map kitty_mod+f1 show_kitty_doc overview - -#: Toggle fullscreen - -# map kitty_mod+f11 toggle_fullscreen -# map ctrl+cmd+f toggle_fullscreen - -#: Toggle maximized - -# map kitty_mod+f10 toggle_maximized - -#: Toggle macOS secure keyboard entry - -# map opt+cmd+s toggle_macos_secure_keyboard_entry - -#: Unicode input - -# map kitty_mod+u kitten unicode_input -# map ctrl+cmd+space kitten unicode_input - -#: Edit config file - -# map kitty_mod+f2 edit_config_file -# map cmd+, edit_config_file - -#: Open the kitty command shell - -# map kitty_mod+escape kitty_shell window - -#:: Open the kitty shell in a new window / tab / overlay / os_window -#:: to control kitty using commands. - -#: Increase background opacity - -# map kitty_mod+a>m set_background_opacity +0.1 - -#: Decrease background opacity - -# map kitty_mod+a>l set_background_opacity -0.1 - -#: Make background fully opaque - -# map kitty_mod+a>1 set_background_opacity 1 - -#: Reset background opacity - -# map kitty_mod+a>d set_background_opacity default - -#: Reset the terminal - -# map kitty_mod+delete clear_terminal reset active -# map opt+cmd+r clear_terminal reset active - -#:: You can create shortcuts to clear/reset the terminal. For -#:: example:: - -#:: # Reset the terminal -#:: map f1 clear_terminal reset active -#:: # Clear the terminal screen by erasing all contents -#:: map f1 clear_terminal clear active -#:: # Clear the terminal scrollback by erasing it -#:: map f1 clear_terminal scrollback active -#:: # Scroll the contents of the screen into the scrollback -#:: map f1 clear_terminal scroll active -#:: # Clear everything on screen up to the line with the cursor or the start of the current prompt (needs shell integration) -#:: map f1 clear_terminal to_cursor active -#:: # Same as above except cleared lines are moved into scrollback -#:: map f1 clear_terminal to_cursor_scroll active - -#:: If you want to operate on all kitty windows instead of just the -#:: current one, use all instead of active. - -#:: Some useful functions that can be defined in the shell rc files -#:: to perform various kinds of clearing of the current window: - -#:: .. code-block:: sh - -#:: clear-only-screen() { -#:: printf "\e[H\e[2J" -#:: } - -#:: clear-screen-and-scrollback() { -#:: printf "\e[H\e[3J" -#:: } - -#:: clear-screen-saving-contents-in-scrollback() { -#:: printf "\e[H\e[22J" -#:: } - -#:: For instance, using these escape codes, it is possible to remap -#:: Ctrl+L to both scroll the current screen contents into the -#:: scrollback buffer and clear the screen, instead of just clearing -#:: the screen. For ZSH, in ~/.zshrc, add: - -#:: .. code-block:: zsh - -#:: ctrl_l() { -#:: builtin print -rn -- $'\r\e[0J\e[H\e[22J' >"$TTY" -#:: builtin zle .reset-prompt -#:: builtin zle -R -#:: } -#:: zle -N ctrl_l -#:: bindkey '^l' ctrl_l - -#:: Alternatively, you can just add map ctrl+l clear_terminal -#:: to_cursor_scroll active to kitty.conf which works with no changes -#:: to the shell rc files, but only clears up to the prompt, it does -#:: not clear any text at the prompt itself. - -#: Clear to start - -# map cmd+k clear_terminal to_cursor active - -#: Clear scrollback - -# map option+cmd+k clear_terminal scrollback active - -#: Clear screen - -# map cmd+ctrl+l clear_terminal to_cursor_scroll active - -#: Reload kitty.conf - -# map kitty_mod+f5 load_config_file -# map ctrl+cmd+, load_config_file - -#:: Reload kitty.conf, applying any changes since the last time it -#:: was loaded. Note that a handful of options cannot be dynamically -#:: changed and require a full restart of kitty. Particularly, when -#:: changing shortcuts for actions located on the macOS global menu -#:: bar, a full restart is needed. You can also map a keybinding to -#:: load a different config file, for example:: - -#:: map f5 load_config /path/to/alternative/kitty.conf - -#:: Note that all options from the original kitty.conf are discarded, -#:: in other words the new configuration *replace* the old ones. - -#: Debug kitty configuration - -# map kitty_mod+f6 debug_config -# map opt+cmd+, debug_config - -#:: Show details about exactly what configuration kitty is running -#:: with and its host environment. Useful for debugging issues. - -#: Send arbitrary text on key presses - -#:: E.g. map ctrl+shift+alt+h send_text all Hello World - -#:: You can tell kitty to send arbitrary (UTF-8) encoded text to the -#:: client program when pressing specified shortcut keys. For -#:: example:: - -#:: map ctrl+alt+a send_text all Special text - -#:: This will send "Special text" when you press the Ctrl+Alt+A key -#:: combination. The text to be sent decodes ANSI C escapes -#:: so you can use escapes like \e to send control -#:: codes or \u21fb to send Unicode characters (or you can just input -#:: the Unicode characters directly as UTF-8 text). You can use -#:: `kitten show-key` to get the key escape codes you want to -#:: emulate. - -#:: The first argument to send_text is the keyboard modes in which to -#:: activate the shortcut. The possible values are normal, -#:: application, kitty or a comma separated combination of them. The -#:: modes normal and application refer to the DECCKM cursor key mode -#:: for terminals, and kitty refers to the kitty extended keyboard -#:: protocol. The special value all means all of them. - -#:: Some more examples:: - -#:: # Output a word and move the cursor to the start of the line (like typing and pressing Home) -#:: map ctrl+alt+a send_text normal Word\e[H -#:: map ctrl+alt+a send_text application Word\eOH -#:: # Run a command at a shell prompt (like typing the command and pressing Enter) -#:: map ctrl+alt+a send_text normal,application some command with arguments\r - -#: Open kitty Website - -# map shift+cmd+/ open_url https://sw.kovidgoyal.net/kitty/ - -#: Hide macOS kitty application - -# map cmd+h hide_macos_app - -#: Hide macOS other applications - -# map opt+cmd+h hide_macos_other_apps - -#: Minimize macOS window - -# map cmd+m minimize_macos_window - -#: Quit kitty - -# map cmd+q quit - -#: }}} - -#: }}} - - -# BEGIN_KITTY_FONTS -font_family family="Source Code Pro" -bold_font auto -italic_font auto -bold_italic_font auto -# END_KITTY_FONTS \ No newline at end of file diff --git a/.config/kitty/kitty.conf.bak b/.config/kitty/kitty.conf.bak deleted file mode 100644 index fc8e6e0..0000000 --- a/.config/kitty/kitty.conf.bak +++ /dev/null @@ -1,2790 +0,0 @@ -# vim:fileencoding=utf-8:foldmethod=marker - -# BEGIN_KITTY_THEME -# Solarized Dark -include current-theme.conf -# END_KITTY_THEME - -#: Fonts {{{ - -#: kitty has very powerful font management. You can configure -#: individual font faces and even specify special fonts for particular -#: characters. - -# font_family monospace -# bold_font auto -# italic_font auto -# bold_italic_font auto - -#: You can specify different fonts for the bold/italic/bold-italic -#: variants. The easiest way to select fonts is to run the `kitten -#: choose-fonts` command which will present a nice UI for you to -#: select the fonts you want with previews and support for selecting -#: variable fonts and font features. If you want to learn to select -#: fonts manually, read the font specification syntax -#: . - -# font_size 11.0 - -#: Font size (in pts). - -# force_ltr no - -#: kitty does not support BIDI (bidirectional text), however, for RTL -#: scripts, words are automatically displayed in RTL. That is to say, -#: in an RTL script, the words "HELLO WORLD" display in kitty as -#: "WORLD HELLO", and if you try to select a substring of an RTL- -#: shaped string, you will get the character that would be there had -#: the string been LTR. For example, assuming the Hebrew word ירושלים, -#: selecting the character that on the screen appears to be ם actually -#: writes into the selection buffer the character י. kitty's default -#: behavior is useful in conjunction with a filter to reverse the word -#: order, however, if you wish to manipulate RTL glyphs, it can be -#: very challenging to work with, so this option is provided to turn -#: it off. Furthermore, this option can be used with the command line -#: program GNU FriBidi -#: to get BIDI support, because it will force kitty to always treat -#: the text as LTR, which FriBidi expects for terminals. - -# symbol_map - -#: E.g. symbol_map U+E0A0-U+E0A3,U+E0C0-U+E0C7 PowerlineSymbols - -#: Map the specified Unicode codepoints to a particular font. Useful -#: if you need special rendering for some symbols, such as for -#: Powerline. Avoids the need for patched fonts. Each Unicode code -#: point is specified in the form `U+`. You -#: can specify multiple code points, separated by commas and ranges -#: separated by hyphens. This option can be specified multiple times. -#: The syntax is:: - -#: symbol_map codepoints Font Family Name - -# narrow_symbols - -#: E.g. narrow_symbols U+E0A0-U+E0A3,U+E0C0-U+E0C7 1 - -#: Usually, for Private Use Unicode characters and some symbol/dingbat -#: characters, if the character is followed by one or more spaces, -#: kitty will use those extra cells to render the character larger, if -#: the character in the font has a wide aspect ratio. Using this -#: option you can force kitty to restrict the specified code points to -#: render in the specified number of cells (defaulting to one cell). -#: This option can be specified multiple times. The syntax is:: - -#: narrow_symbols codepoints [optionally the number of cells] - -# disable_ligatures never - -#: Choose how you want to handle multi-character ligatures. The -#: default is to always render them. You can tell kitty to not render -#: them when the cursor is over them by using cursor to make editing -#: easier, or have kitty never render them at all by using always, if -#: you don't like them. The ligature strategy can be set per-window -#: either using the kitty remote control facility or by defining -#: shortcuts for it in kitty.conf, for example:: - -#: map alt+1 disable_ligatures_in active always -#: map alt+2 disable_ligatures_in all never -#: map alt+3 disable_ligatures_in tab cursor - -#: Note that this refers to programming ligatures, typically -#: implemented using the calt OpenType feature. For disabling general -#: ligatures, use the font_features option. - -# font_features - -#: E.g. font_features none - -#: Choose exactly which OpenType features to enable or disable. Note -#: that for the main fonts, features can be specified when selecting -#: the font using the choose-fonts kitten. This setting is useful for -#: fallback fonts. - -#: Some fonts might have features worthwhile in a terminal. For -#: example, Fira Code includes a discretionary feature, zero, which in -#: that font changes the appearance of the zero (0), to make it more -#: easily distinguishable from Ø. Fira Code also includes other -#: discretionary features known as Stylistic Sets which have the tags -#: ss01 through ss20. - -#: For the exact syntax to use for individual features, see the -#: HarfBuzz documentation . - -#: Note that this code is indexed by PostScript name, and not the font -#: family. This allows you to define very precise feature settings; -#: e.g. you can disable a feature in the italic font but not in the -#: regular font. - -#: On Linux, font features are first read from the FontConfig database -#: and then this option is applied, so they can be configured in a -#: single, central place. - -#: To get the PostScript name for a font, use the `fc-scan file.ttf` -#: command on Linux or the `Font Book tool on macOS -#: `__. - -#: Enable alternate zero and oldstyle numerals:: - -#: font_features FiraCode-Retina +zero +onum - -#: Enable only alternate zero in the bold font:: - -#: font_features FiraCode-Bold +zero - -#: Disable the normal ligatures, but keep the calt feature which (in -#: this font) breaks up monotony:: - -#: font_features TT2020StyleB-Regular -liga +calt - -#: In conjunction with force_ltr, you may want to disable Arabic -#: shaping entirely, and only look at their isolated forms if they -#: show up in a document. You can do this with e.g.:: - -#: font_features UnifontMedium +isol -medi -fina -init - -# modify_font - -#: Modify font characteristics such as the position or thickness of -#: the underline and strikethrough. The modifications can have the -#: suffix px for pixels or % for percentage of original value. No -#: suffix means use pts. For example:: - -#: modify_font underline_position -2 -#: modify_font underline_thickness 150% -#: modify_font strikethrough_position 2px - -#: Additionally, you can modify the size of the cell in which each -#: font glyph is rendered and the baseline at which the glyph is -#: placed in the cell. For example:: - -#: modify_font cell_width 80% -#: modify_font cell_height -2px -#: modify_font baseline 3 - -#: Note that modifying the baseline will automatically adjust the -#: underline and strikethrough positions by the same amount. -#: Increasing the baseline raises glyphs inside the cell and -#: decreasing it lowers them. Decreasing the cell size might cause -#: rendering artifacts, so use with care. - -# box_drawing_scale 0.001, 1, 1.5, 2 - -#: The sizes of the lines used for the box drawing Unicode characters. -#: These values are in pts. They will be scaled by the monitor DPI to -#: arrive at a pixel value. There must be four values corresponding to -#: thin, normal, thick, and very thick lines. - -# undercurl_style thin-sparse - -#: The style with which undercurls are rendered. This option takes the -#: form (thin|thick)-(sparse|dense). Thin and thick control the -#: thickness of the undercurl. Sparse and dense control how often the -#: curl oscillates. With sparse the curl will peak once per character, -#: with dense twice. Changing this option dynamically via reloading -#: the config or remote control is undefined. - -# underline_exclusion 1 - -#: By default kitty renders gaps in underlines when they overlap with -#: descenders (the parts of letters below the baseline, such as for y, -#: q, p etc.). This option controls the thickness of the gaps. It can -#: be either a unitless number in which case it is a fraction of the -#: underline thickness as specified in the font or it can have a -#: suffix of px for pixels or pt for points. Set to zero to disable -#: the gaps. Changing this option dynamically via reloading the config -#: or remote control is undefined. - -# text_composition_strategy platform - -#: Control how kitty composites text glyphs onto the background color. -#: The default value of platform tries for text rendering as close to -#: "native" for the platform kitty is running on as possible. - -#: A value of legacy uses the old (pre kitty 0.28) strategy for how -#: glyphs are composited. This will make dark text on light -#: backgrounds look thicker and light text on dark backgrounds -#: thinner. It might also make some text appear like the strokes are -#: uneven. - -#: You can fine tune the actual contrast curve used for glyph -#: composition by specifying up to two space-separated numbers for -#: this setting. - -#: The first number is the gamma adjustment, which controls the -#: thickness of dark text on light backgrounds. Increasing the value -#: will make text appear thicker. The default value for this is 1.0 on -#: Linux and 1.7 on macOS. Valid values are 0.01 and above. The result -#: is scaled based on the luminance difference between the background -#: and the foreground. Dark text on light backgrounds receives the -#: full impact of the curve while light text on dark backgrounds is -#: affected very little. - -#: The second number is an additional multiplicative contrast. It is -#: percentage ranging from 0 to 100. The default value is 0 on Linux -#: and 30 on macOS. - -#: If you wish to achieve similar looking thickness in light and dark -#: themes, a good way to experiment is start by setting the value to -#: 1.0 0 and use a dark theme. Then adjust the second parameter until -#: it looks good. Then switch to a light theme and adjust the first -#: parameter until the perceived thickness matches the dark theme. - -# text_fg_override_threshold 0 - -#: A setting to prevent low contrast between foreground and background -#: colors. Useful when working with applications that use colors that -#: do not contrast well with your preferred color scheme. The default -#: value is 0, which means no color overriding is performed. There are -#: two modes of operation: - -#: A value with the suffix ratio represents the minimum accepted -#: contrast ratio between the foreground and background color. -#: Possible values range from 0.0 ratio to 21.0 ratio. For example, to -#: meet WCAG level AA -#: -#: a value of 4.5 ratio can be provided. The algorithm is implemented -#: using HSLuv which enables it to change the -#: perceived lightness of a color just as much as needed without -#: really changing its hue and saturation. - -#: A value with the suffix % represents the minimum accepted -#: difference in luminance between the foreground and background -#: color, below which kitty will override the foreground color. It is -#: percentage ranging from 0 % to 100 %. If the difference in -#: luminance of the foreground and background is below this threshold, -#: the foreground color will be set to white if the background is dark -#: or black if the background is light. - -#: WARNING: Some programs use characters (such as block characters) -#: for graphics display and may expect to be able to set the -#: foreground and background to the same color (or similar colors). If -#: you see unexpected stripes, dots, lines, incorrect color, no color -#: where you expect color, or any kind of graphic display problem try -#: setting text_fg_override_threshold to 0 to see if this is the cause -#: of the problem or consider using the ratio mode of operation -#: described above instead of the % mode of operation. - -#: }}} - -#: Text cursor customization {{{ - -# cursor #cccccc - -#: Default text cursor color. If set to the special value none the -#: cursor will be rendered with a "reverse video" effect. Its color -#: will be the color of the text in the cell it is over and the text -#: will be rendered with the background color of the cell. Note that -#: if the program running in the terminal sets a cursor color, this -#: takes precedence. Also, the cursor colors are modified if the cell -#: background and foreground colors have very low contrast. Note that -#: some themes set this value, so if you want to override it, place -#: your value after the lines where the theme file is included. - -# cursor_text_color #111111 - -#: The color of text under the cursor. If you want it rendered with -#: the background color of the cell underneath instead, use the -#: special keyword: `background`. Note that if cursor is set to none -#: then this option is ignored. Note that some themes set this value, -#: so if you want to override it, place your value after the lines -#: where the theme file is included. - -# cursor_shape block - -#: The cursor shape can be one of block, beam, underline. Note that -#: when reloading the config this will be changed only if the cursor -#: shape has not been set by the program running in the terminal. This -#: sets the default cursor shape, applications running in the terminal -#: can override it. In particular, shell integration -#: in kitty sets -#: the cursor shape to beam at shell prompts. You can avoid this by -#: setting shell_integration to no-cursor. - -# cursor_shape_unfocused hollow - -#: Defines the text cursor shape when the OS window is not focused. -#: The unfocused cursor shape can be one of block, beam, underline, -#: hollow and unchanged (leave the cursor shape as it is). - -# cursor_beam_thickness 1.5 - -#: The thickness of the beam cursor (in pts). - -# cursor_underline_thickness 2.0 - -#: The thickness of the underline cursor (in pts). - -# cursor_blink_interval -1 - -#: The interval to blink the cursor (in seconds). Set to zero to -#: disable blinking. Negative values mean use system default. Note -#: that the minimum interval will be limited to repaint_delay. You can -#: also animate the cursor blink by specifying an easing function. For -#: example, setting this to option to 0.5 ease-in-out will cause the -#: cursor blink to be animated over a second, in the first half of the -#: second it will go from opaque to transparent and then back again -#: over the next half. You can specify different easing functions for -#: the two halves, for example: -1 linear ease-out. kitty supports all -#: the CSS easing functions . Note that turning on animations -#: uses extra power as it means the screen is redrawn multiple times -#: per blink interval. See also, cursor_stop_blinking_after. - -# cursor_stop_blinking_after 15.0 - -#: Stop blinking cursor after the specified number of seconds of -#: keyboard inactivity. Set to zero to never stop blinking. - -# cursor_trail 0 - -#: Set this to a value larger than zero to enable a "cursor trail" -#: animation. This is an animation that shows a "trail" following the -#: movement of the text cursor. It makes it easy to follow large -#: cursor jumps and makes for a cool visual effect of the cursor -#: zooming around the screen. The actual value of this option controls -#: when the animation is triggered. It is a number of milliseconds. -#: The trail animation only follows cursors that have stayed in their -#: position for longer than the specified number of milliseconds. This -#: prevents trails from appearing for cursors that rapidly change -#: their positions during UI updates in complex applications. See -#: cursor_trail_decay to control the animation speed and -#: cursor_trail_start_threshold to control when a cursor trail is -#: started. - -# cursor_trail_decay 0.1 0.4 - -#: Controls the decay times for the cursor trail effect when the -#: cursor_trail is enabled. This option accepts two positive float -#: values specifying the fastest and slowest decay times in seconds. -#: The first value corresponds to the fastest decay time (minimum), -#: and the second value corresponds to the slowest decay time -#: (maximum). The second value must be equal to or greater than the -#: first value. Smaller values result in a faster decay of the cursor -#: trail. Adjust these values to control how quickly the cursor trail -#: fades away. - -# cursor_trail_start_threshold 2 - -#: Set the distance threshold for starting the cursor trail. This -#: option accepts a positive integer value that represents the minimum -#: number of cells the cursor must move before the trail is started. -#: When the cursor moves less than this threshold, the trail is -#: skipped, reducing unnecessary cursor trail animation. - -#: }}} - -#: Scrollback {{{ - -# scrollback_lines 2000 - -#: Number of lines of history to keep in memory for scrolling back. -#: Memory is allocated on demand. Negative numbers are (effectively) -#: infinite scrollback. Note that using very large scrollback is not -#: recommended as it can slow down performance of the terminal and -#: also use large amounts of RAM. Instead, consider using -#: scrollback_pager_history_size. Note that on config reload if this -#: is changed it will only affect newly created windows, not existing -#: ones. - -# scrollback_indicator_opacity 1.0 - -#: The opacity of the scrollback indicator which is a small colored -#: rectangle that moves along the right hand side of the window as you -#: scroll, indicating what fraction you have scrolled. The default is -#: one which means fully opaque, aka visible. Set to a value between -#: zero and one to make the indicator less visible. - -# scrollback_pager less --chop-long-lines --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER - -#: Program with which to view scrollback in a new window. The -#: scrollback buffer is passed as STDIN to this program. If you change -#: it, make sure the program you use can handle ANSI escape sequences -#: for colors and text formatting. INPUT_LINE_NUMBER in the command -#: line above will be replaced by an integer representing which line -#: should be at the top of the screen. Similarly CURSOR_LINE and -#: CURSOR_COLUMN will be replaced by the current cursor position or -#: set to 0 if there is no cursor, for example, when showing the last -#: command output. - -# scrollback_pager_history_size 0 - -#: Separate scrollback history size (in MB), used only for browsing -#: the scrollback buffer with pager. This separate buffer is not -#: available for interactive scrolling but will be piped to the pager -#: program when viewing scrollback buffer in a separate window. The -#: current implementation stores the data in UTF-8, so approximately -#: 10000 lines per megabyte at 100 chars per line, for pure ASCII, -#: unformatted text. A value of zero or less disables this feature. -#: The maximum allowed size is 4GB. Note that on config reload if this -#: is changed it will only affect newly created windows, not existing -#: ones. - -# scrollback_fill_enlarged_window no - -#: Fill new space with lines from the scrollback buffer after -#: enlarging a window. - -# wheel_scroll_multiplier 5.0 - -#: Multiplier for the number of lines scrolled by the mouse wheel. -#: Note that this is only used for low precision scrolling devices, -#: not for high precision scrolling devices on platforms such as macOS -#: and Wayland. Use negative numbers to change scroll direction. See -#: also wheel_scroll_min_lines. - -# wheel_scroll_min_lines 1 - -#: The minimum number of lines scrolled by the mouse wheel. The scroll -#: multiplier wheel_scroll_multiplier only takes effect after it -#: reaches this number. Note that this is only used for low precision -#: scrolling devices like wheel mice that scroll by very small amounts -#: when using the wheel. With a negative number, the minimum number of -#: lines will always be added. - -# touch_scroll_multiplier 1.0 - -#: Multiplier for the number of lines scrolled by a touchpad. Note -#: that this is only used for high precision scrolling devices on -#: platforms such as macOS and Wayland. Use negative numbers to change -#: scroll direction. - -#: }}} - -#: Mouse {{{ - -# mouse_hide_wait 3.0 - -#: Hide mouse cursor after the specified number of seconds of the -#: mouse not being used. Set to zero to disable mouse cursor hiding. -#: Set to a negative value to hide the mouse cursor immediately when -#: typing text. Disabled by default on macOS as getting it to work -#: robustly with the ever-changing sea of bugs that is Cocoa is too -#: much effort. - -#: By default, once the cursor is hidden, it is immediately unhidden -#: on any further mouse events. - -#: Two formats are supported: -#: - -#: - - -#: To change the unhide behavior, the optional parameters , , and may be set. - -#: -#: Waits for the specified number of seconds after mouse events before unhiding the -#: mouse cursor. Set to zero to unhide mouse cursor immediately on mouse activity. -#: This is useful to prevent the mouse cursor from unhiding on accidental swipes on -#: the trackpad. - -#: -#: Sets the threshold of mouse activity required to unhide the mouse cursor, when -#: the option is non-zero. When is zero, this has no -#: effect. - -#: For example, if is 40 and is 2.5, when kitty -#: detects a mouse event, it records the number of mouse events in the next 2.5 -#: seconds, and checks if that exceeds 40 * 2.5 = 100. If it does, then the mouse -#: cursor is unhidden, otherwise nothing happens. - -#: -#: Controls what mouse events may unhide the mouse cursor. If enabled, both scroll -#: and movement events may unhide the cursor. If disabled, only mouse movements can -#: unhide the cursor. - -#: Examples of valid values: -#: - 0.0 -#: - 1.0 -#: - -1.0 -#: - 0.1 3.0 40 yes - -# url_color #0087bd -# url_style curly - -#: The color and style for highlighting URLs on mouse-over. url_style -#: can be one of: none, straight, double, curly, dotted, dashed. - -# open_url_with default - -#: The program to open clicked URLs. The special value default will -#: first look for any URL handlers defined via the open_actions -#: facility and if non -#: are found, it will use the Operating System's default URL handler -#: (open on macOS and xdg-open on Linux). - -# url_prefixes file ftp ftps gemini git gopher http https irc ircs kitty mailto news sftp ssh - -#: The set of URL prefixes to look for when detecting a URL under the -#: mouse cursor. - -# detect_urls yes - -#: Detect URLs under the mouse. Detected URLs are highlighted with an -#: underline and the mouse cursor becomes a hand over them. Even if -#: this option is disabled, URLs are still clickable. See also the -#: underline_hyperlinks option to control how hyperlinks (as opposed -#: to plain text URLs) are displayed. - -# url_excluded_characters - -#: Additional characters to be disallowed from URLs, when detecting -#: URLs under the mouse cursor. By default, all characters that are -#: legal in URLs are allowed. Additionally, newlines are allowed (but -#: stripped). This is to accommodate programs such as mutt that add -#: hard line breaks even for continued lines. \n can be added to this -#: option to disable this behavior. Special characters can be -#: specified using backslash escapes, to specify a backslash use a -#: double backslash. - -# show_hyperlink_targets no - -#: When the mouse hovers over a terminal hyperlink, show the actual -#: URL that will be activated when the hyperlink is clicked. - -# underline_hyperlinks hover - -#: Control how hyperlinks are underlined. They can either be -#: underlined on mouse hover, always (i.e. permanently underlined) or -#: never which means that kitty will not apply any underline styling -#: to hyperlinks. Note that the value of always only applies to real -#: (OSC 8) hyperlinks not text that is detected to be a URL on mouse -#: hover. Uses the url_style and url_color settings for the underline -#: style. Note that reloading the config and changing this value -#: to/from always will only affect text subsequently received by -#: kitty. - -# copy_on_select no - -#: Copy to clipboard or a private buffer on select. With this set to -#: clipboard, selecting text with the mouse will cause the text to be -#: copied to clipboard. Useful on platforms such as macOS that do not -#: have the concept of primary selection. You can instead specify a -#: name such as a1 to copy to a private kitty buffer. Map a shortcut -#: with the paste_from_buffer action to paste from this private -#: buffer. For example:: - -#: copy_on_select a1 -#: map shift+cmd+v paste_from_buffer a1 - -#: Note that copying to the clipboard is a security risk, as all -#: programs, including websites open in your browser can read the -#: contents of the system clipboard. - -# clear_selection_on_clipboard_loss no - -#: When the contents of the clipboard no longer reflect the current -#: selection, clear it. This is primarily useful on platforms such as -#: Linux where selecting text automatically copies it to a special -#: "primary selection" clipboard or if you have copy_on_select set to -#: clipboard. - -#: Note that on macOS the system does not provide notifications when -#: the clipboard owner is changed, so there, copying to clipboard in a -#: non-kitty application will not clear selections even if -#: copy_on_select is enabled. - -# paste_actions quote-urls-at-prompt,confirm - -#: A comma separated list of actions to take when pasting text into -#: the terminal. The supported paste actions are: - -#: quote-urls-at-prompt: -#: If the text being pasted is a URL and the cursor is at a shell prompt, -#: automatically quote the URL (needs shell_integration). -#: replace-dangerous-control-codes -#: Replace dangerous control codes from pasted text, without confirmation. -#: replace-newline -#: Replace the newline character from pasted text, without confirmation. -#: confirm: -#: Confirm the paste if the text to be pasted contains any terminal control codes -#: as this can be dangerous, leading to code execution if the shell/program running -#: in the terminal does not properly handle these. -#: confirm-if-large -#: Confirm the paste if it is very large (larger than 16KB) as pasting -#: large amounts of text into shells can be very slow. -#: filter: -#: Run the filter_paste() function from the file paste-actions.py in -#: the kitty config directory on the pasted text. The text returned by the -#: function will be actually pasted. -#: no-op: -#: Has no effect. - -# strip_trailing_spaces never - -#: Remove spaces at the end of lines when copying to clipboard. A -#: value of smart will do it when using normal selections, but not -#: rectangle selections. A value of always will always do it. - -# select_by_word_characters @-./_~?&=%+# - -#: Characters considered part of a word when double clicking. In -#: addition to these characters any character that is marked as an -#: alphanumeric character in the Unicode database will be matched. - -# select_by_word_characters_forward - -#: Characters considered part of a word when extending the selection -#: forward on double clicking. In addition to these characters any -#: character that is marked as an alphanumeric character in the -#: Unicode database will be matched. - -#: If empty (default) select_by_word_characters will be used for both -#: directions. - -# click_interval -1.0 - -#: The interval between successive clicks to detect double/triple -#: clicks (in seconds). Negative numbers will use the system default -#: instead, if available, or fallback to 0.5. - -# focus_follows_mouse no - -#: Set the active window to the window under the mouse when moving the -#: mouse around. On macOS, this will also cause the OS Window under -#: the mouse to be focused automatically when the mouse enters it. - -# pointer_shape_when_grabbed arrow - -#: The shape of the mouse pointer when the program running in the -#: terminal grabs the mouse. - -# default_pointer_shape beam - -#: The default shape of the mouse pointer. - -# pointer_shape_when_dragging beam crosshair - -#: The default shape of the mouse pointer when dragging across text. -#: The optional second value sets the shape when dragging in -#: rectangular selection mode. - -#: Mouse actions {{{ - -#: Mouse buttons can be mapped to perform arbitrary actions. The -#: syntax is: - -#: .. code-block:: none - -#: mouse_map button-name event-type modes action - -#: Where button-name is one of left, middle, right, b1 ... b8 with -#: added keyboard modifiers. For example: ctrl+shift+left refers to -#: holding the Ctrl+Shift keys while clicking with the left mouse -#: button. The value b1 ... b8 can be used to refer to up to eight -#: buttons on a mouse. - -#: event-type is one of press, release, doublepress, triplepress, -#: click, doubleclick. modes indicates whether the action is performed -#: when the mouse is grabbed by the program running in the terminal, -#: or not. The values are grabbed or ungrabbed or a comma separated -#: combination of them. grabbed refers to when the program running in -#: the terminal has requested mouse events. Note that the click and -#: double click events have a delay of click_interval to disambiguate -#: from double and triple presses. - -#: You can run kitty with the kitty --debug-input command line option -#: to see mouse events. See the builtin actions below to get a sense -#: of what is possible. - -#: If you want to unmap a button, map it to nothing. For example, to -#: disable opening of URLs with a plain click:: - -#: mouse_map left click ungrabbed - -#: See all the mappable actions including mouse actions here -#: . - -#: .. note:: -#: Once a selection is started, releasing the button that started it will -#: automatically end it and no release event will be dispatched. - -# clear_all_mouse_actions no - -#: Remove all mouse action definitions up to this point. Useful, for -#: instance, to remove the default mouse actions. - -#: Click the link under the mouse or move the cursor - -# mouse_map left click ungrabbed mouse_handle_click selection link prompt - -#:: First check for a selection and if one exists do nothing. Then -#:: check for a link under the mouse cursor and if one exists, click -#:: it. Finally check if the click happened at the current shell -#:: prompt and if so, move the cursor to the click location. Note -#:: that this requires shell integration -#:: to work. - -#: Click the link under the mouse or move the cursor even when grabbed - -# mouse_map shift+left click grabbed,ungrabbed mouse_handle_click selection link prompt - -#:: Same as above, except that the action is performed even when the -#:: mouse is grabbed by the program running in the terminal. - -#: Click the link under the mouse cursor - -# mouse_map ctrl+shift+left release grabbed,ungrabbed mouse_handle_click link - -#:: Variant with Ctrl+Shift is present because the simple click based -#:: version has an unavoidable delay of click_interval, to -#:: disambiguate clicks from double clicks. - -#: Discard press event for link click - -# mouse_map ctrl+shift+left press grabbed discard_event - -#:: Prevent this press event from being sent to the program that has -#:: grabbed the mouse, as the corresponding release event is used to -#:: open a URL. - -#: Paste from the primary selection - -# mouse_map middle release ungrabbed paste_from_selection - -#: Start selecting text - -# mouse_map left press ungrabbed mouse_selection normal - -#: Start selecting text in a rectangle - -# mouse_map ctrl+alt+left press ungrabbed mouse_selection rectangle - -#: Select a word - -# mouse_map left doublepress ungrabbed mouse_selection word - -#: Select a line - -# mouse_map left triplepress ungrabbed mouse_selection line - -#: Select line from point - -# mouse_map ctrl+alt+left triplepress ungrabbed mouse_selection line_from_point - -#:: Select from the clicked point to the end of the line. If you -#:: would like to select the word at the point and then extend to the -#:: rest of the line, change `line_from_point` to -#:: `word_and_line_from_point`. - -#: Extend the current selection - -# mouse_map right press ungrabbed mouse_selection extend - -#:: If you want only the end of the selection to be moved instead of -#:: the nearest boundary, use move-end instead of extend. - -#: Paste from the primary selection even when grabbed - -# mouse_map shift+middle release ungrabbed,grabbed paste_selection -# mouse_map shift+middle press grabbed discard_event - -#: Start selecting text even when grabbed - -# mouse_map shift+left press ungrabbed,grabbed mouse_selection normal - -#: Start selecting text in a rectangle even when grabbed - -# mouse_map ctrl+shift+alt+left press ungrabbed,grabbed mouse_selection rectangle - -#: Select a word even when grabbed - -# mouse_map shift+left doublepress ungrabbed,grabbed mouse_selection word - -#: Select a line even when grabbed - -# mouse_map shift+left triplepress ungrabbed,grabbed mouse_selection line - -#: Select line from point even when grabbed - -# mouse_map ctrl+shift+alt+left triplepress ungrabbed,grabbed mouse_selection line_from_point - -#:: Select from the clicked point to the end of the line even when -#:: grabbed. If you would like to select the word at the point and -#:: then extend to the rest of the line, change `line_from_point` to -#:: `word_and_line_from_point`. - -#: Extend the current selection even when grabbed - -# mouse_map shift+right press ungrabbed,grabbed mouse_selection extend - -#: Show clicked command output in pager - -# mouse_map ctrl+shift+right press ungrabbed mouse_show_command_output - -#:: Requires shell integration -#:: to work. - -#: }}} - -#: }}} - -#: Performance tuning {{{ - -# repaint_delay 10 - -#: Delay between screen updates (in milliseconds). Decreasing it, -#: increases frames-per-second (FPS) at the cost of more CPU usage. -#: The default value yields ~100 FPS which is more than sufficient for -#: most uses. Note that to actually achieve 100 FPS, you have to -#: either set sync_to_monitor to no or use a monitor with a high -#: refresh rate. Also, to minimize latency when there is pending input -#: to be processed, this option is ignored. - -# input_delay 3 - -#: Delay before input from the program running in the terminal is -#: processed (in milliseconds). Note that decreasing it will increase -#: responsiveness, but also increase CPU usage and might cause flicker -#: in full screen programs that redraw the entire screen on each loop, -#: because kitty is so fast that partial screen updates will be drawn. -#: This setting is ignored when the input buffer is almost full. - -# sync_to_monitor yes - -#: Sync screen updates to the refresh rate of the monitor. This -#: prevents screen tearing -#: when scrolling. -#: However, it limits the rendering speed to the refresh rate of your -#: monitor. With a very high speed mouse/high keyboard repeat rate, -#: you may notice some slight input latency. If so, set this to no. - -#: }}} - -#: Terminal bell {{{ - -# enable_audio_bell yes - -#: The audio bell. Useful to disable it in environments that require -#: silence. - -# visual_bell_duration 0.0 - -#: The visual bell duration (in seconds). Flash the screen when a bell -#: occurs for the specified number of seconds. Set to zero to disable. -#: The flash is animated, fading in and out over the specified -#: duration. The easing function used for the fading can be -#: controlled. For example, 2.0 linear will casuse the flash to fade -#: in and out linearly. The default if unspecified is to use ease-in- -#: out which fades slowly at the start, middle and end. You can -#: specify different easing functions for the fade-in and fade-out -#: parts, like this: 2.0 ease-in linear. kitty supports all the CSS -#: easing functions . - -# visual_bell_color none - -#: The color used by visual bell. Set to none will fall back to -#: selection background color. If you feel that the visual bell is too -#: bright, you can set it to a darker color. - -# window_alert_on_bell yes - -#: Request window attention on bell. Makes the dock icon bounce on -#: macOS or the taskbar flash on Linux. - -# bell_on_tab "🔔 " - -#: Some text or a Unicode symbol to show on the tab if a window in the -#: tab that does not have focus has a bell. If you want to use leading -#: or trailing spaces, surround the text with quotes. See -#: tab_title_template for how this is rendered. - -#: For backwards compatibility, values of yes, y and true are -#: converted to the default bell symbol and no, n, false and none are -#: converted to the empty string. - -# command_on_bell none - -#: Program to run when a bell occurs. The environment variable -#: KITTY_CHILD_CMDLINE can be used to get the program running in the -#: window in which the bell occurred. - -# bell_path none - -#: Path to a sound file to play as the bell sound. If set to none, the -#: system default bell sound is used. Must be in a format supported by -#: the operating systems sound API, such as WAV or OGA on Linux -#: (libcanberra) or AIFF, MP3 or WAV on macOS (NSSound). - -# linux_bell_theme __custom - -#: The XDG Sound Theme kitty will use to play the bell sound. On -#: Wayland, when the compositor supports it, it is asked to play the -#: system default bell sound, and this setting has no effect. -#: Otherwise, defaults to the custom theme name specified in the XDG -#: Sound theme specification -#: , falling back to the default -#: freedesktop theme if it does not exist. To change your sound theme -#: desktop wide, create -#: :file:~/.local/share/sounds/__custom/index.theme` with the -#: contents: - -#: [Sound Theme] - -#: Inherits=name-of-the-sound-theme-you-want-to-use - -#: Replace name-of-the-sound-theme-you-want-to-use with the actual -#: theme name. Now all compliant applications should use sounds from -#: this theme. - -#: }}} - -#: Window layout {{{ - -# remember_window_size yes -# initial_window_width 640 -# initial_window_height 400 - -#: If enabled, the OS Window size will be remembered so that new -#: instances of kitty will have the same size as the previous -#: instance. If disabled, the OS Window will initially have size -#: configured by initial_window_width/height, in pixels. You can use a -#: suffix of "c" on the width/height values to have them interpreted -#: as number of cells instead of pixels. - -# remember_window_position no - -#: If enabled, the OS Window position will be remembered so that new -#: instances of kitty will have the same position as the previous -#: instance. If disabled, the OS Window will be placed by the window -#: manager. Note that remembering of position only works if the -#: underlying desktop environment/window manager supports it. It never -#: works on Wayland. See also kitty --position to specify the position -#: when launching kitty. - -# enabled_layouts * - -#: The enabled window layouts. A comma separated list of layout names. -#: The special value all means all layouts. The first listed layout -#: will be used as the startup layout. Default configuration is all -#: layouts in alphabetical order. For a list of available layouts, see -#: the layouts . - -# window_resize_step_cells 2 -# window_resize_step_lines 2 - -#: The step size (in units of cell width/cell height) to use when -#: resizing kitty windows in a layout with the shortcut -#: start_resizing_window. The cells value is used for horizontal -#: resizing, and the lines value is used for vertical resizing. - -# window_border_width 0.5pt - -#: The width of window borders. Can be either in pixels (px) or pts -#: (pt). Values in pts will be rounded to the nearest number of pixels -#: based on screen resolution. If not specified, the unit is assumed -#: to be pts. Note that borders are displayed only when more than one -#: window is visible. They are meant to separate multiple windows. - -# draw_minimal_borders yes - -#: Draw only the minimum borders needed. This means that only the -#: borders that separate the window from a neighbor are drawn. Note -#: that setting a non-zero window_margin_width overrides this and -#: causes all borders to be drawn. - -# window_margin_width 0 - -#: The window margin (in pts) (blank area outside the border). A -#: single value sets all four sides. Two values set the vertical and -#: horizontal sides. Three values set top, horizontal and bottom. Four -#: values set top, right, bottom and left. - -# single_window_margin_width -1 - -#: The window margin to use when only a single window is visible (in -#: pts). Negative values will cause the value of window_margin_width -#: to be used instead. A single value sets all four sides. Two values -#: set the vertical and horizontal sides. Three values set top, -#: horizontal and bottom. Four values set top, right, bottom and left. - -# window_padding_width 0 - -#: The window padding (in pts) (blank area between the text and the -#: window border). A single value sets all four sides. Two values set -#: the vertical and horizontal sides. Three values set top, horizontal -#: and bottom. Four values set top, right, bottom and left. - -# single_window_padding_width -1 - -#: The window padding to use when only a single window is visible (in -#: pts). Negative values will cause the value of window_padding_width -#: to be used instead. A single value sets all four sides. Two values -#: set the vertical and horizontal sides. Three values set top, -#: horizontal and bottom. Four values set top, right, bottom and left. - -# placement_strategy center - -#: When the window size is not an exact multiple of the cell size, the -#: cell area of the terminal window will have some extra padding on -#: the sides. You can control how that padding is distributed with -#: this option. Using a value of center means the cell area will be -#: placed centrally. A value of top-left means the padding will be -#: only at the bottom and right edges. The value can be one of: top- -#: left, top, top-right, left, center, right, bottom-left, bottom, -#: bottom-right. - -# active_border_color #00ff00 - -#: The color for the border of the active window. Set this to none to -#: not draw borders around the active window. - -# inactive_border_color #cccccc - -#: The color for the border of inactive windows. - -# bell_border_color #ff5a00 - -#: The color for the border of inactive windows in which a bell has -#: occurred. - -# inactive_text_alpha 1.0 - -#: Fade the text in inactive windows by the specified amount (a number -#: between zero and one, with zero being fully faded). - -# hide_window_decorations no - -#: Hide the window decorations (title-bar and window borders) with -#: yes. On macOS, titlebar-only and titlebar-and-corners can be used -#: to only hide the titlebar and the rounded corners. Whether this -#: works and exactly what effect it has depends on the window -#: manager/operating system. Note that the effects of changing this -#: option when reloading config are undefined. When using titlebar- -#: only, it is useful to also set window_margin_width and -#: placement_strategy to prevent the rounded corners from clipping -#: text. Or use titlebar-and-corners. - -# window_logo_path none - -#: Path to a logo image. Must be in PNG/JPEG/WEBP/GIF/TIFF/BMP format. -#: Relative paths are interpreted relative to the kitty config -#: directory. The logo is displayed in a corner of every kitty window. -#: The position is controlled by window_logo_position. Individual -#: windows can be configured to have different logos either using the -#: launch action or the remote control -#: facility. - -# window_logo_position bottom-right - -#: Where to position the window logo in the window. The value can be -#: one of: top-left, top, top-right, left, center, right, bottom-left, -#: bottom, bottom-right. - -# window_logo_alpha 0.5 - -#: The amount the logo should be faded into the background. With zero -#: being fully faded and one being fully opaque. - -# window_logo_scale 0 - -#: The percentage (0-100] of the window size to which the logo should -#: scale. Using a single number means the logo is scaled to that -#: percentage of the shortest window dimension, while preserving -#: aspect ratio of the logo image. - -#: Using two numbers means the width and height of the logo are scaled -#: to the respective percentage of the window's width and height. - -#: Using zero as the percentage disables scaling in that dimension. A -#: single zero (the default) disables all scaling of the window logo. - -# resize_debounce_time 0.1 0.5 - -#: The time to wait (in seconds) before asking the program running in -#: kitty to resize and redraw the screen during a live resize of the -#: OS window, when no new resize events have been received, i.e. when -#: resizing is either paused or finished. On platforms such as macOS, -#: where the operating system sends events corresponding to the start -#: and end of a live resize, the second number is used for redraw- -#: after-pause since kitty can distinguish between a pause and end of -#: resizing. On such systems the first number is ignored and redraw is -#: immediate after end of resize. On other systems only the first -#: number is used so that kitty is "ready" quickly after the end of -#: resizing, while not also continuously redrawing, to save energy. - -# resize_in_steps no - -#: Resize the OS window in steps as large as the cells, instead of -#: with the usual pixel accuracy. Combined with initial_window_width -#: and initial_window_height in number of cells, this option can be -#: used to keep the margins as small as possible when resizing the OS -#: window. Note that this does not currently work on Wayland. - -# visual_window_select_characters 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ - -#: The list of characters for visual window selection. For example, -#: for selecting a window to focus on with focus_visible_window. The -#: value should be a series of unique numbers or alphabets, case -#: insensitive, from the set 0-9A-Z\-=[];',./\\`. Specify your -#: preference as a string of characters. - -# confirm_os_window_close -1 - -#: Ask for confirmation when closing an OS window or a tab with at -#: least this number of kitty windows in it by window manager (e.g. -#: clicking the window close button or pressing the operating system -#: shortcut to close windows) or by the close_tab action. A value of -#: zero disables confirmation. This confirmation also applies to -#: requests to quit the entire application (all OS windows, via the -#: quit action). Negative values are converted to positive ones, -#: however, with shell_integration enabled, using negative values -#: means windows sitting at a shell prompt are not counted, only -#: windows where some command is currently running. You can also have -#: backgrounded jobs prevent closing, by adding count-background to -#: the setting, for example: -1 count-background. Note that if you -#: want confirmation when closing individual windows, you can map the -#: close_window_with_confirmation action. - -#: }}} - -#: Tab bar {{{ - -# tab_bar_edge bottom - -#: The edge to show the tab bar on, top or bottom. - -# tab_bar_margin_width 0.0 - -#: The margin to the left and right of the tab bar (in pts). - -# tab_bar_margin_height 0.0 0.0 - -#: The margin above and below the tab bar (in pts). The first number -#: is the margin between the edge of the OS Window and the tab bar. -#: The second number is the margin between the tab bar and the -#: contents of the current tab. - -# tab_bar_style fade - -#: The tab bar style, can be one of: - -#: fade -#: Each tab's edges fade into the background color. (See also tab_fade) -#: slant -#: Tabs look like the tabs in a physical file. -#: separator -#: Tabs are separated by a configurable separator. (See also -#: tab_separator) -#: powerline -#: Tabs are shown as a continuous line with "fancy" separators. -#: (See also tab_powerline_style) -#: custom -#: A user-supplied Python function called draw_tab is loaded from the file -#: tab_bar.py in the kitty config directory. For examples of how to -#: write such a function, see the functions named draw_tab_with_* in -#: kitty's source code: kitty/tab_bar.py. See also -#: this discussion -#: for examples from kitty users. -#: hidden -#: The tab bar is hidden. If you use this, you might want to create -#: a mapping for the select_tab action which presents you with a list of -#: tabs and allows for easy switching to a tab. - -# tab_bar_align left - -#: The horizontal alignment of the tab bar, can be one of: left, -#: center, right. - -# tab_bar_min_tabs 2 - -#: The minimum number of tabs that must exist before the tab bar is -#: shown. - -# tab_switch_strategy previous - -#: The algorithm to use when switching to a tab when the current tab -#: is closed. The default of previous will switch to the last used -#: tab. A value of left will switch to the tab to the left of the -#: closed tab. A value of right will switch to the tab to the right of -#: the closed tab. A value of last will switch to the right-most tab. - -# tab_fade 0.25 0.5 0.75 1 - -#: Control how each tab fades into the background when using fade for -#: the tab_bar_style. Each number is an alpha (between zero and one) -#: that controls how much the corresponding cell fades into the -#: background, with zero being no fade and one being full fade. You -#: can change the number of cells used by adding/removing entries to -#: this list. - -# tab_separator " ┇" - -#: The separator between tabs in the tab bar when using separator as -#: the tab_bar_style. - -# tab_powerline_style angled - -#: The powerline separator style between tabs in the tab bar when -#: using powerline as the tab_bar_style, can be one of: angled, -#: slanted, round. - -# tab_activity_symbol none - -#: Some text or a Unicode symbol to show on the tab if a window in the -#: tab that does not have focus has some activity. If you want to use -#: leading or trailing spaces, surround the text with quotes. See -#: tab_title_template for how this is rendered. - -# tab_title_max_length 0 - -#: The maximum number of cells that can be used to render the text in -#: a tab. A value of zero means that no limit is applied. - -# tab_title_template "{fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{tab.last_focused_progress_percent}{title}" - -#: A template to render the tab title. The default just renders the -#: title with optional symbols for bell and activity. If you wish to -#: include the tab-index as well, use something like: {index}:{title}. -#: Useful if you have shortcuts mapped for goto_tab N. If you prefer -#: to see the index as a superscript, use {sup.index}. All data -#: available is: - -#: title -#: The current tab title. -#: index -#: The tab index usable with goto_tab N goto_tab shortcuts. -#: layout_name -#: The current layout name. -#: num_windows -#: The number of windows in the tab. -#: num_window_groups -#: The number of window groups (a window group is a window and all of its overlay windows) in the tab. -#: tab.active_wd -#: The working directory of the currently active window in the tab -#: (expensive, requires syscall). Use tab.active_oldest_wd to get -#: the directory of the oldest foreground process rather than the newest. -#: tab.active_exe -#: The name of the executable running in the foreground of the currently -#: active window in the tab (expensive, requires syscall). Use -#: tab.active_oldest_exe for the oldest foreground process. -#: max_title_length -#: The maximum title length available. -#: keyboard_mode -#: The name of the current keyboard mode or the empty string if no keyboard mode is active. -#: tab.last_focused_progress_percent -#: If a command running in a window reports the progress for a task, show this progress as a percentage -#: from the most recently focused window in the tab. Empty string if no progress is reported. -#: tab.progress_percent -#: If a command running in a window reports the progress for a task, show this progress as a percentage -#: from all windows in the tab, averaged. Empty string is no progress is reported. - -#: Note that formatting is done by Python's string formatting -#: machinery, so you can use, for instance, {layout_name[:2].upper()} -#: to show only the first two letters of the layout name, upper-cased. -#: If you want to style the text, you can use styling directives, for -#: example: -#: `{fmt.fg.red}red{fmt.fg.tab}normal{fmt.bg._00FF00}greenbg{fmt.bg.tab}`. -#: Similarly, for bold and italic: -#: `{fmt.bold}bold{fmt.nobold}normal{fmt.italic}italic{fmt.noitalic}`. -#: The 256 eight terminal colors can be used as `fmt.fg.color0` -#: through `fmt.fg.color255`. Note that for backward compatibility, if -#: {bell_symbol} or {activity_symbol} are not present in the template, -#: they are prepended to it. - -# active_tab_title_template none - -#: Template to use for active tabs. If not specified falls back to -#: tab_title_template. - -# active_tab_foreground #000 -# active_tab_background #eee -# active_tab_font_style bold-italic -# inactive_tab_foreground #444 -# inactive_tab_background #999 -# inactive_tab_font_style normal - -#: Tab bar colors and styles. - -# tab_bar_background none - -#: Background color for the tab bar. Defaults to using the terminal -#: background color. - -# tab_bar_margin_color none - -#: Color for the tab bar margin area. Defaults to using the terminal -#: background color for margins above and below the tab bar. For side -#: margins the default color is chosen to match the background color -#: of the neighboring tab. - -#: }}} - -#: Color scheme {{{ - -# foreground #dddddd -# background #000000 - -#: The foreground and background colors. - -# background_opacity 1.0 - -#: The opacity of the background. A number between zero and one, where -#: one is opaque and zero is fully transparent. This will only work if -#: supported by the OS (for instance, when using a compositor under -#: X11). Note that it only sets the background color's opacity in -#: cells that have the same background color as the default terminal -#: background, so that things like the status bar in vim, powerline -#: prompts, etc. still look good. But it means that if you use a color -#: theme with a background color in your editor, it will not be -#: rendered as transparent. Instead you should change the default -#: background color in your kitty config and not use a background -#: color in the editor color scheme. Or use the escape codes to set -#: the terminals default colors in a shell script to launch your -#: editor. See also transparent_background_colors. Be aware that using -#: a value less than 1.0 is a (possibly significant) performance hit. -#: When using a low value for this setting, it is desirable that you -#: set the background color to a color the matches the general color -#: of the desktop background, for best text rendering. Note that to -#: workaround window managers not doing gamma-corrected blending kitty -#: makes background_opacity non-linear which means, especially for -#: light backgrounds you might need to make the value much lower than -#: you expect to get good results, see 6218 -#: for details. - -#: If you want to dynamically change transparency of windows, set -#: dynamic_background_opacity to yes (this is off by default as it has -#: a performance cost). Changing this option when reloading the config -#: will only work if dynamic_background_opacity was enabled in the -#: original config. - -# background_blur 0 - -#: Set to a positive value to enable background blur (blurring of the -#: visuals behind a transparent window) on platforms that support it. -#: Only takes effect when background_opacity is less than one. On -#: macOS, this will also control the blur radius (amount of blurring). -#: Setting it to too high a value will cause severe performance issues -#: and/or rendering artifacts. Usually, values up to 64 work well. -#: Note that this might cause performance issues, depending on how the -#: platform implements it, so use with care. Currently supported on -#: macOS and KDE. - -# transparent_background_colors - -#: A space separated list of upto 7 colors, with opacity. When the -#: background color of a cell matches one of these colors, it is -#: rendered semi-transparent using the specified opacity. - -#: Useful in more complex UIs like editors where you could want more -#: than a single background color to be rendered as transparent, for -#: instance, for a cursor highlight line background or a highlighted -#: block. Terminal applications can set this color using The kitty -#: color control escape code. - -#: The syntax for specifying colors is: color@opacity, where the -#: @opacity part is optional. When unspecified, the value of -#: background_opacity is used. For example:: - -#: transparent_background_colors red@0.5 #00ff00@0.3 - -# dynamic_background_opacity no - -#: Allow changing of the background_opacity dynamically, using either -#: keyboard shortcuts (increase_background_opacity and -#: decrease_background_opacity) or the remote control facility. -#: Changing this option by reloading the config is not supported. - -# background_image none - -#: Path to a background image. Must be in PNG/JPEG/WEBP/TIFF/GIF/BMP -#: format. Note that when using auto_color_scheme -#: -#: this option is overridden by the color scheme file and must be set -#: inside it to take effect. - -# background_image_layout tiled - -#: Whether to tile, scale or clamp the background image. The value can -#: be one of tiled, mirror-tiled, scaled, clamped, centered or -#: cscaled. The scaled and cscaled values scale the image to the -#: window size, with cscaled preserving the image aspect ratio. Note -#: that when using auto_color_scheme -#: -#: this option is overridden by the color scheme file and must be set -#: inside it to take effect. - -# background_image_linear no - -#: When background image is scaled, whether linear interpolation -#: should be used. Note that when using auto_color_scheme -#: -#: this option is overridden by the color scheme file and must be set -#: inside it to take effect. - -# background_tint 0.0 - -#: How much to tint the background image by the background color. This -#: option makes it easier to read the text. Tinting is done using the -#: current background color for each window. This option applies only -#: if background_opacity is set and transparent windows are supported -#: or background_image is set. Note that when using auto_color_scheme -#: -#: this option is overridden by the color scheme file and must be set -#: inside it to take effect. - -# background_tint_gaps 1.0 - -#: How much to tint the background image at the window gaps by the -#: background color, after applying background_tint. Since this is -#: multiplicative with background_tint, it can be used to lighten the -#: tint over the window gaps for a *separated* look. Note that when -#: using auto_color_scheme -#: -#: this option is overridden by the color scheme file and must be set -#: inside it to take effect. - -# dim_opacity 0.4 - -#: How much to dim text that has the DIM/FAINT attribute set. One -#: means no dimming and zero means fully dimmed (i.e. invisible). - -# selection_foreground #000000 -# selection_background #fffacd - -#: The foreground and background colors for text selected with the -#: mouse. Setting both of these to none will cause a "reverse video" -#: effect for selections, where the selection will be the cell text -#: color and the text will become the cell background color. Setting -#: only selection_foreground to none will cause the foreground color -#: to be used unchanged. Note that these colors can be overridden by -#: the program running in the terminal. - -#: The color table {{{ - -#: The 256 terminal colors. There are 8 basic colors, each color has a -#: dull and bright version, for the first 16 colors. You can set the -#: remaining 240 colors as color16 to color255. - -# color0 #000000 -# color8 #767676 - -#: black - -# color1 #cc0403 -# color9 #f2201f - -#: red - -# color2 #19cb00 -# color10 #23fd00 - -#: green - -# color3 #cecb00 -# color11 #fffd00 - -#: yellow - -# color4 #0d73cc -# color12 #1a8fff - -#: blue - -# color5 #cb1ed1 -# color13 #fd28ff - -#: magenta - -# color6 #0dcdcd -# color14 #14ffff - -#: cyan - -# color7 #dddddd -# color15 #ffffff - -#: white - -# mark1_foreground black - -#: Color for marks of type 1 - -# mark1_background #98d3cb - -#: Color for marks of type 1 (light steel blue) - -# mark2_foreground black - -#: Color for marks of type 2 - -# mark2_background #f2dcd3 - -#: Color for marks of type 1 (beige) - -# mark3_foreground black - -#: Color for marks of type 3 - -# mark3_background #f274bc - -#: Color for marks of type 3 (violet) - -#: }}} - -#: }}} - -#: Advanced {{{ - -# shell . - -#: The shell program to execute. The default value of . means to use -#: the value of of the SHELL environment variable or if unset, -#: whatever shell is set as the default shell for the current user. -#: Note that on macOS if you change this, you might need to add -#: --login and --interactive to ensure that the shell starts in -#: interactive mode and reads its startup rc files. Environment -#: variables are expanded in this setting. - -# editor . - -#: The terminal based text editor (such as vim or nano) to use when -#: editing the kitty config file or similar tasks. - -#: The default value of . means to use the environment variables -#: VISUAL and EDITOR in that order. If these variables aren't set, -#: kitty will run your shell ($SHELL -l -i -c env) to see if your -#: shell startup rc files set VISUAL or EDITOR. If that doesn't work, -#: kitty will cycle through various known editors (vim, emacs, etc.) -#: and take the first one that exists on your system. - -# close_on_child_death no - -#: Close the window when the child process (usually the shell) exits. -#: With the default value no, the terminal will remain open when the -#: child exits as long as there are still other processes outputting -#: to the terminal (for example disowned or backgrounded processes). -#: When enabled with yes, the window will close as soon as the child -#: process exits. Note that setting it to yes means that any -#: background processes still using the terminal can fail silently -#: because their stdout/stderr/stdin no longer work. - -# remote_control_password - -#: Allow other programs to control kitty using passwords. This option -#: can be specified multiple times to add multiple passwords. If no -#: passwords are present kitty will ask the user for permission if a -#: program tries to use remote control with a password. A password can -#: also *optionally* be associated with a set of allowed remote -#: control actions. For example:: - -#: remote_control_password "my passphrase" get-colors set-colors focus-window focus-tab - -#: Only the specified actions will be allowed when using this -#: password. Glob patterns can be used too, for example:: - -#: remote_control_password "my passphrase" set-tab-* resize-* - -#: To get a list of available actions, run:: - -#: kitten @ --help - -#: A set of actions to be allowed when no password is sent can be -#: specified by using an empty password. For example:: - -#: remote_control_password "" *-colors - -#: Finally, the path to a python module can be specified that provides -#: a function is_cmd_allowed that is used to check every remote -#: control command. For example:: - -#: remote_control_password "my passphrase" my_rc_command_checker.py - -#: Relative paths are resolved from the kitty configuration directory. -#: See rc_custom_auth for details. - -# allow_remote_control no - -#: Allow other programs to control kitty. If you turn this on, other -#: programs can control all aspects of kitty, including sending text -#: to kitty windows, opening new windows, closing windows, reading the -#: content of windows, etc. Note that this even works over SSH -#: connections. The default setting of no prevents any form of remote -#: control. The meaning of the various values are: - -#: password -#: Remote control requests received over both the TTY device and the socket -#: are confirmed based on passwords, see remote_control_password. - -#: socket-only -#: Remote control requests received over a socket are accepted -#: unconditionally. Requests received over the TTY are denied. -#: See listen_on. - -#: socket -#: Remote control requests received over a socket are accepted -#: unconditionally. Requests received over the TTY are confirmed based on -#: password. - -#: no -#: Remote control is completely disabled. - -#: yes -#: Remote control requests are always accepted. - -# listen_on none - -#: Listen to the specified socket for remote control connections. Note -#: that this will apply to all kitty instances. It can be overridden -#: by the kitty --listen-on command line option. For UNIX sockets, -#: such as unix:${TEMP}/mykitty or unix:@mykitty (on Linux). -#: Environment variables are expanded and relative paths are resolved -#: with respect to the temporary directory. If {kitty_pid} is present, -#: then it is replaced by the PID of the kitty process, otherwise the -#: PID of the kitty process is appended to the value, with a hyphen. -#: For TCP sockets such as tcp:localhost:0 a random port is always -#: used even if a non-zero port number is specified. See the help for -#: kitty --listen-on for more details. Note that this will be ignored -#: unless allow_remote_control is set to either: yes, socket or -#: socket-only. Changing this option by reloading the config is not -#: supported. - -# env - -#: Specify the environment variables to be set in all child processes. -#: Using the name with an equal sign (e.g. env VAR=) will set it to -#: the empty string. Specifying only the name (e.g. env VAR) will -#: remove the variable from the child process' environment. Note that -#: environment variables are expanded recursively, for example:: - -#: env VAR1=a -#: env VAR2=${HOME}/${VAR1}/b - -#: The value of VAR2 will be /a/b. - -# filter_notification - -#: Specify rules to filter out notifications sent by applications -#: running in kitty. Can be specified multiple times to create -#: multiple filter rules. A rule specification is of the form -#: field:regexp. A filter rule can match on any of the fields: title, -#: body, app, type. The special value of all filters out all -#: notifications. Rules can be combined using Boolean operators. Some -#: examples:: - -#: filter_notification title:hello or body:"abc.*def" -#: # filter out notification from vim except for ones about updates, (?i) -#: # makes matching case insensitive. -#: filter_notification app:"[ng]?vim" and not body:"(?i)update" -#: # filter out all notifications -#: filter_notification all - -#: The field app is the name of the application sending the -#: notification and type is the type of the notification. Not all -#: applications will send these fields, so you can also match on the -#: title and body of the notification text. More sophisticated -#: programmatic filtering and custom actions on notifications can be -#: done by creating a notifications.py file in the kitty config -#: directory (~/.config/kitty). An annotated sample is available -#: . - -# watcher - -#: Path to python file which will be loaded for watchers -#: . Can be -#: specified more than once to load multiple watchers. The watchers -#: will be added to every kitty window. Relative paths are resolved -#: relative to the kitty config directory. Note that reloading the -#: config will only affect windows created after the reload. - -# exe_search_path - -#: Control where kitty finds the programs to run. The default search -#: order is: First search the system wide PATH, then ~/.local/bin and -#: ~/bin. If still not found, the PATH defined in the login shell -#: after sourcing all its startup files is tried. Finally, if present, -#: the PATH specified by the env option is tried. - -#: This option allows you to prepend, append, or remove paths from -#: this search order. It can be specified multiple times for multiple -#: paths. A simple path will be prepended to the search order. A path -#: that starts with the + sign will be append to the search order, -#: after ~/bin above. A path that starts with the - sign will be -#: removed from the entire search order. For example:: - -#: exe_search_path /some/prepended/path -#: exe_search_path +/some/appended/path -#: exe_search_path -/some/excluded/path - -# update_check_interval 24 - -#: The interval to periodically check if an update to kitty is -#: available (in hours). If an update is found, a system notification -#: is displayed informing you of the available update. The default is -#: to check every 24 hours, set to zero to disable. Update checking is -#: only done by the official binary builds. Distro packages or source -#: builds do not do update checking. Changing this option by reloading -#: the config is not supported. - -# startup_session none - -#: Path to a session file to use for all kitty instances. Can be -#: overridden by using the kitty --session =none command line option -#: for individual instances. See sessions -#: in the kitty -#: documentation for details. Note that relative paths are interpreted -#: with respect to the kitty config directory. Environment variables -#: in the path are expanded. Changing this option by reloading the -#: config is not supported. Note that if kitty is invoked with command -#: line arguments specifying a command to run, this option is ignored. - -# clipboard_control write-clipboard write-primary read-clipboard-ask read-primary-ask - -#: Allow programs running in kitty to read and write from the -#: clipboard. You can control exactly which actions are allowed. The -#: possible actions are: write-clipboard, read-clipboard, write- -#: primary, read-primary, read-clipboard-ask, read-primary-ask. The -#: default is to allow writing to the clipboard and primary selection -#: and to ask for permission when a program tries to read from the -#: clipboard. Note that disabling the read confirmation is a security -#: risk as it means that any program, even the ones running on a -#: remote server via SSH can read your clipboard. See also -#: clipboard_max_size. - -# clipboard_max_size 512 - -#: The maximum size (in MB) of data from programs running in kitty -#: that will be stored for writing to the system clipboard. A value of -#: zero means no size limit is applied. See also clipboard_control. - -# file_transfer_confirmation_bypass - -#: The password that can be supplied to the file transfer kitten -#: to skip the -#: transfer confirmation prompt. This should only be used when -#: initiating transfers from trusted computers, over trusted networks -#: or encrypted transports, as it allows any programs running on the -#: remote machine to read/write to the local filesystem, without -#: permission. - -# allow_hyperlinks yes - -#: Process hyperlink escape sequences (OSC 8). If disabled OSC 8 -#: escape sequences are ignored. Otherwise they become clickable -#: links, that you can click with the mouse or by using the hints -#: kitten . The -#: special value of ask means that kitty will ask before opening the -#: link when clicked. - -# shell_integration enabled - -#: Enable shell integration on supported shells. This enables features -#: such as jumping to previous prompts, browsing the output of the -#: previous command in a pager, etc. on supported shells. Set to -#: disabled to turn off shell integration, completely. It is also -#: possible to disable individual features, set to a space separated -#: list of these values: no-rc, no-cursor, no-title, no-cwd, no- -#: prompt-mark, no-complete, no-sudo. See Shell integration -#: for details. - -# allow_cloning ask - -#: Control whether programs running in the terminal can request new -#: windows to be created. The canonical example is clone-in-kitty -#: . -#: By default, kitty will ask for permission for each clone request. -#: Allowing cloning unconditionally gives programs running in the -#: terminal (including over SSH) permission to execute arbitrary code, -#: as the user who is running the terminal, on the computer that the -#: terminal is running on. - -# clone_source_strategies venv,conda,env_var,path - -#: Control what shell code is sourced when running clone-in-kitty in -#: the newly cloned window. The supported strategies are: - -#: venv -#: Source the file $VIRTUAL_ENV/bin/activate. This is used by the -#: Python stdlib venv module and allows cloning venvs automatically. -#: conda -#: Run conda activate $CONDA_DEFAULT_ENV. This supports the virtual -#: environments created by conda. -#: env_var -#: Execute the contents of the environment variable -#: KITTY_CLONE_SOURCE_CODE with eval. -#: path -#: Source the file pointed to by the environment variable -#: KITTY_CLONE_SOURCE_PATH. - -#: This option must be a comma separated list of the above values. -#: Only the first valid match, in the order specified, is sourced. - -# notify_on_cmd_finish never - -#: Show a desktop notification when a long-running command finishes -#: (needs shell_integration). The possible values are: - -#: never -#: Never send a notification. - -#: unfocused -#: Only send a notification when the window does not have keyboard focus. - -#: invisible -#: Only send a notification when the window both is unfocused and not visible -#: to the user, for example, because it is in an inactive tab or its OS window -#: is not currently visible (on platforms that support OS window visibility querying -#: this considers an OS Window visible iff it is active). - -#: always -#: Always send a notification, regardless of window state. - -#: There are two optional arguments: - -#: First, the minimum duration for what is considered a long running -#: command. The default is 5 seconds. Specify a second argument to set -#: the duration. For example: invisible 15. Do not set the value too -#: small, otherwise a command that launches a new OS Window and exits -#: will spam a notification. - -#: Second, the action to perform. The default is notify. The possible -#: values are: - -#: notify -#: Send a desktop notification. The subsequent arguments are optional and specify when -#: the notification is automatically cleared. The set of possible events when the notification is -#: cleared are: focus and next. focus means that when the notification -#: policy is unfocused or invisible the notification is automatically cleared -#: when the window regains focus. The value of next means that the previous notification -#: is cleared when the next notification is shown. The default when no arguments are specified -#: is: focus next. - -#: bell -#: Ring the terminal bell. - -#: command -#: Run a custom command. All subsequent arguments are the cmdline to run. - -#: Some more examples:: - -#: # Send a notification when a command takes more than 5 seconds in an unfocused window -#: notify_on_cmd_finish unfocused -#: # Send a notification when a command takes more than 10 seconds in a invisible window -#: notify_on_cmd_finish invisible 10.0 -#: # Ring a bell when a command takes more than 10 seconds in a invisible window -#: notify_on_cmd_finish invisible 10.0 bell -#: # Run 'notify-send' when a command takes more than 10 seconds in a invisible window -#: # Here %c is replaced by the current command line and %s by the job exit code -#: notify_on_cmd_finish invisible 10.0 command notify-send "job finished with status: %s" %c -#: # Do not clear previous notification when next command finishes or window regains focus -#: notify_on_cmd_finish invisible 5.0 notify - -# term xterm-kitty - -#: The value of the TERM environment variable to set. Changing this -#: can break many terminal programs, only change it if you know what -#: you are doing, not because you read some advice on "Stack Overflow" -#: to change it. The TERM variable is used by various programs to get -#: information about the capabilities and behavior of the terminal. If -#: you change it, depending on what programs you run, and how -#: different the terminal you are changing it to is, various things -#: from key-presses, to colors, to various advanced features may not -#: work. Changing this option by reloading the config will only affect -#: newly created windows. - -# terminfo_type path - -#: The value of the TERMINFO environment variable to set. This -#: variable is used by programs running in the terminal to search for -#: terminfo databases. The default value of path causes kitty to set -#: it to a filesystem location containing the kitty terminfo database. -#: A value of direct means put the entire database into the env var -#: directly. This can be useful when connecting to containers, for -#: example. But, note that not all software supports this. A value of -#: none means do not touch the variable. - -# forward_stdio no - -#: Forward STDOUT and STDERR of the kitty process to child processes. -#: This is useful for debugging as it allows child processes to print -#: to kitty's STDOUT directly. For example, echo hello world -#: >&$KITTY_STDIO_FORWARDED in a shell will print to the parent -#: kitty's STDOUT. Sets the KITTY_STDIO_FORWARDED=fdnum environment -#: variable so child processes know about the forwarding. Note that on -#: macOS this prevents the shell from being run via the login utility -#: so getlogin() will not work in programs run in this session. - -# menu_map - -#: Specify entries for various menus in kitty. Currently only the -#: global menubar on macOS is supported. For example:: - -#: menu_map global "Actions::Launch something special" launch --hold --type=os-window sh -c "echo hello world" - -#: This will create a menu entry named "Launch something special" in -#: an "Actions" menu in the macOS global menubar. Sub-menus can be -#: created by adding more levels separated by the :: characters. - -#: }}} - -#: OS specific tweaks {{{ - -# wayland_titlebar_color system - -#: The color of the kitty window's titlebar on Wayland systems with -#: client side window decorations such as GNOME. A value of system -#: means to use the default system colors, a value of background means -#: to use the background color of the currently active kitty window -#: and finally you can use an arbitrary color, such as #12af59 or red. - -# macos_titlebar_color system - -#: The color of the kitty window's titlebar on macOS. A value of -#: system means to use the default system color, light or dark can -#: also be used to set it explicitly. A value of background means to -#: use the background color of the currently active window and finally -#: you can use an arbitrary color, such as #12af59 or red. WARNING: -#: This option works by using a hack when arbitrary color (or -#: background) is configured, as there is no proper Cocoa API for it. -#: It sets the background color of the entire window and makes the -#: titlebar transparent. As such it is incompatible with -#: background_opacity. If you want to use both, you are probably -#: better off just hiding the titlebar with hide_window_decorations. - -# macos_option_as_alt no - -#: Use the Option key as an Alt key on macOS. With this set to no, -#: kitty will use the macOS native Option+Key to enter Unicode -#: character behavior. This will break any Alt+Key keyboard shortcuts -#: in your terminal programs, but you can use the macOS Unicode input -#: technique. You can use the values: left, right or both to use only -#: the left, right or both Option keys as Alt, instead. Note that -#: kitty itself always treats Option the same as Alt. This means you -#: cannot use this option to configure different kitty shortcuts for -#: Option+Key vs. Alt+Key. Also, any kitty shortcuts using -#: Option/Alt+Key will take priority, so that any such key presses -#: will not be passed to terminal programs running inside kitty. -#: Changing this option by reloading the config is not supported. - -# macos_hide_from_tasks no - -#: Hide the kitty window from running tasks on macOS (⌘+Tab and the -#: Dock). Changing this option by reloading the config is not -#: supported. - -# macos_quit_when_last_window_closed no - -#: Have kitty quit when all the top-level windows are closed on macOS. -#: By default, kitty will stay running, even with no open windows, as -#: is the expected behavior on macOS. - -# macos_window_resizable yes - -#: Disable this if you want kitty top-level OS windows to not be -#: resizable on macOS. - -# macos_thicken_font 0 - -#: Draw an extra border around the font with the given width, to -#: increase legibility at small font sizes on macOS. For example, a -#: value of 0.75 will result in rendering that looks similar to sub- -#: pixel antialiasing at common font sizes. Note that in modern kitty, -#: this option is obsolete (although still supported). Consider using -#: text_composition_strategy instead. - -# macos_traditional_fullscreen no - -#: Use the macOS traditional full-screen transition, that is faster, -#: but less pretty. - -# macos_show_window_title_in all - -#: Control where the window title is displayed on macOS. A value of -#: window will show the title of the currently active window at the -#: top of the macOS window. A value of menubar will show the title of -#: the currently active window in the macOS global menu bar, making -#: use of otherwise wasted space. A value of all will show the title -#: in both places, and none hides the title. See -#: macos_menubar_title_max_length for how to control the length of the -#: title in the menu bar. - -# macos_menubar_title_max_length 0 - -#: The maximum number of characters from the window title to show in -#: the macOS global menu bar. Values less than one means that there is -#: no maximum limit. - -# macos_custom_beam_cursor no - -#: Use a custom mouse cursor for macOS that is easier to see on both -#: light and dark backgrounds. Nowadays, the default macOS cursor -#: already comes with a white border. WARNING: this might make your -#: mouse cursor invisible on dual GPU machines. Changing this option -#: by reloading the config is not supported. - -# macos_colorspace srgb - -#: The colorspace in which to interpret terminal colors. The default -#: of srgb will cause colors to match those seen in web browsers. The -#: value of default will use whatever the native colorspace of the -#: display is. The value of displayp3 will use Apple's special -#: snowflake display P3 color space, which will result in over -#: saturated (brighter) colors with some color shift. Reloading -#: configuration will change this value only for newly created OS -#: windows. - -# linux_display_server auto - -#: Choose between Wayland and X11 backends. By default, an appropriate -#: backend based on the system state is chosen automatically. Set it -#: to x11 or wayland to force the choice. Changing this option by -#: reloading the config is not supported. - -# wayland_enable_ime yes - -#: Enable Input Method Extension on Wayland. This is typically used -#: for inputting text in East Asian languages. However, its -#: implementation in Wayland is often buggy and introduces latency -#: into the input loop, so disable this if you know you dont need it. -#: Changing this option by reloading the config is not supported, it -#: will not have any effect. - -#: }}} - -#: Keyboard shortcuts {{{ - -#: Keys are identified simply by their lowercase Unicode characters. -#: For example: a for the A key, [ for the left square bracket key, -#: etc. For functional keys, such as Enter or Escape, the names are -#: present at Functional key definitions -#: . -#: For modifier keys, the names are ctrl (control, ⌃), shift (⇧), alt -#: (opt, option, ⌥), super (cmd, command, ⌘). - -#: Simple shortcut mapping is done with the map directive. For full -#: details on advanced mapping including modal and per application -#: maps, see mapping . Some -#: quick examples to illustrate common tasks:: - -#: # unmap a keyboard shortcut, passing it to the program running in kitty -#: map kitty_mod+space -#: # completely ignore a keyboard event -#: map ctrl+alt+f1 discard_event -#: # combine multiple actions -#: map kitty_mod+e combine : new_window : next_layout -#: # multi-key shortcuts -#: map ctrl+x>ctrl+y>z action - -#: The full list of actions that can be mapped to key presses is -#: available here . - -# kitty_mod ctrl+shift - -#: Special modifier key alias for default shortcuts. You can change -#: the value of this option to alter all default shortcuts that use -#: kitty_mod. - -# clear_all_shortcuts no - -#: Remove all shortcut definitions up to this point. Useful, for -#: instance, to remove the default shortcuts. - -# action_alias - -#: E.g. action_alias launch_tab launch --type=tab --cwd=current - -#: Define action aliases to avoid repeating the same options in -#: multiple mappings. Aliases can be defined for any action and will -#: be expanded recursively. For example, the above alias allows you to -#: create mappings to launch a new tab in the current working -#: directory without duplication:: - -#: map f1 launch_tab vim -#: map f2 launch_tab emacs - -#: Similarly, to alias kitten invocation:: - -#: action_alias hints kitten hints --hints-offset=0 - -# kitten_alias - -#: E.g. kitten_alias hints hints --hints-offset=0 - -#: Like action_alias above, but specifically for kittens. Generally, -#: prefer to use action_alias. This option is a legacy version, -#: present for backwards compatibility. It causes all invocations of -#: the aliased kitten to be substituted. So the example above will -#: cause all invocations of the hints kitten to have the --hints- -#: offset=0 option applied. - -#: Clipboard {{{ - -#: Copy to clipboard - -# map kitty_mod+c copy_to_clipboard -# map cmd+c copy_to_clipboard - -#:: There is also a copy_or_interrupt action that can be optionally -#:: mapped to Ctrl+C. It will copy only if there is a selection and -#:: send an interrupt otherwise. Similarly, -#:: copy_and_clear_or_interrupt will copy and clear the selection or -#:: send an interrupt if there is no selection. - -#: Paste from clipboard - -# map kitty_mod+v paste_from_clipboard -# map cmd+v paste_from_clipboard - -#: Paste from selection - -# map kitty_mod+s paste_from_selection -# map shift+insert paste_from_selection - -#: Pass selection to program - -# map kitty_mod+o pass_selection_to_program - -#:: You can also pass the contents of the current selection to any -#:: program with pass_selection_to_program. By default, the system's -#:: open program is used, but you can specify your own, the selection -#:: will be passed as a command line argument to the program. For -#:: example:: - -#:: map kitty_mod+o pass_selection_to_program firefox - -#:: You can pass the current selection to a terminal program running -#:: in a new kitty window, by using the @selection placeholder:: - -#:: map kitty_mod+y new_window less @selection - -#: }}} - -#: Scrolling {{{ - -#: Scroll line up - -# map kitty_mod+up scroll_line_up -# map kitty_mod+k scroll_line_up -# map opt+cmd+page_up scroll_line_up -# map cmd+up scroll_line_up - -#: Scroll line down - -# map kitty_mod+down scroll_line_down -# map kitty_mod+j scroll_line_down -# map opt+cmd+page_down scroll_line_down -# map cmd+down scroll_line_down - -#: Scroll page up - -# map kitty_mod+page_up scroll_page_up -# map cmd+page_up scroll_page_up - -#: Scroll page down - -# map kitty_mod+page_down scroll_page_down -# map cmd+page_down scroll_page_down - -#: Scroll to top - -# map kitty_mod+home scroll_home -# map cmd+home scroll_home - -#: Scroll to bottom - -# map kitty_mod+end scroll_end -# map cmd+end scroll_end - -#: Scroll to previous shell prompt - -# map kitty_mod+z scroll_to_prompt -1 - -#:: Use a parameter of 0 for scroll_to_prompt to scroll to the last -#:: jumped to or the last clicked position. Requires shell -#:: integration -#:: to work. - -#: Scroll to next shell prompt - -# map kitty_mod+x scroll_to_prompt 1 - -#: Browse scrollback buffer in pager - -# map kitty_mod+h show_scrollback - -#:: You can pipe the contents of the current screen and history -#:: buffer as STDIN to an arbitrary program using launch --stdin- -#:: source. For example, the following opens the scrollback buffer in -#:: less in an overlay window:: - -#:: map f1 launch --stdin-source=@screen_scrollback --stdin-add-formatting --type=overlay less +G -R - -#:: For more details on piping screen and buffer contents to external -#:: programs, see launch . - -#: Browse output of the last shell command in pager - -# map kitty_mod+g show_last_command_output - -#:: You can also define additional shortcuts to get the command -#:: output. For example, to get the first command output on screen:: - -#:: map f1 show_first_command_output_on_screen - -#:: To get the command output that was last accessed by a keyboard -#:: action or mouse action:: - -#:: map f1 show_last_visited_command_output - -#:: You can pipe the output of the last command run in the shell -#:: using the launch action. For example, the following opens the -#:: output in less in an overlay window:: - -#:: map f1 launch --stdin-source=@last_cmd_output --stdin-add-formatting --type=overlay less +G -R - -#:: To get the output of the first command on the screen, use -#:: @first_cmd_output_on_screen. To get the output of the last jumped -#:: to command, use @last_visited_cmd_output. - -#:: Requires shell integration -#:: to work. - -#: }}} - -#: Window management {{{ - -#: New window - -# map kitty_mod+enter new_window -# map cmd+enter new_window - -#:: You can open a new kitty window running an arbitrary program, for -#:: example:: - -#:: map kitty_mod+y launch mutt - -#:: You can open a new window with the current working directory set -#:: to the working directory of the current window using:: - -#:: map ctrl+alt+enter launch --cwd=current - -#:: You can open a new window that is allowed to control kitty via -#:: the kitty remote control facility with launch --allow-remote- -#:: control. Any programs running in that window will be allowed to -#:: control kitty. For example:: - -#:: map ctrl+enter launch --allow-remote-control some_program - -#:: You can open a new window next to the currently active window or -#:: as the first window, with:: - -#:: map ctrl+n launch --location=neighbor -#:: map ctrl+f launch --location=first - -#:: For more details, see launch -#:: . - -#: New OS window - -# map kitty_mod+n new_os_window -# map cmd+n new_os_window - -#:: Works like new_window above, except that it opens a top-level OS -#:: window. In particular you can use new_os_window_with_cwd to open -#:: a window with the current working directory. - -#: Close window - -# map kitty_mod+w close_window -# map shift+cmd+d close_window - -#: Next window - -# map kitty_mod+] next_window - -#: Previous window - -# map kitty_mod+[ previous_window - -#: Move window forward - -# map kitty_mod+f move_window_forward - -#: Move window backward - -# map kitty_mod+b move_window_backward - -#: Move window to top - -# map kitty_mod+` move_window_to_top - -#: Start resizing window - -# map kitty_mod+r start_resizing_window -# map cmd+r start_resizing_window - -#: First window - -# map kitty_mod+1 first_window -# map cmd+1 first_window - -#: Second window - -# map kitty_mod+2 second_window -# map cmd+2 second_window - -#: Third window - -# map kitty_mod+3 third_window -# map cmd+3 third_window - -#: Fourth window - -# map kitty_mod+4 fourth_window -# map cmd+4 fourth_window - -#: Fifth window - -# map kitty_mod+5 fifth_window -# map cmd+5 fifth_window - -#: Sixth window - -# map kitty_mod+6 sixth_window -# map cmd+6 sixth_window - -#: Seventh window - -# map kitty_mod+7 seventh_window -# map cmd+7 seventh_window - -#: Eighth window - -# map kitty_mod+8 eighth_window -# map cmd+8 eighth_window - -#: Ninth window - -# map kitty_mod+9 ninth_window -# map cmd+9 ninth_window - -#: Tenth window - -# map kitty_mod+0 tenth_window - -#: Visually select and focus window - -# map kitty_mod+f7 focus_visible_window - -#:: Display overlay numbers and alphabets on the window, and switch -#:: the focus to the window when you press the key. When there are -#:: only two windows, the focus will be switched directly without -#:: displaying the overlay. You can change the overlay characters and -#:: their order with option visual_window_select_characters. - -#: Visually swap window with another - -# map kitty_mod+f8 swap_with_window - -#:: Works like focus_visible_window above, but swaps the window. - -#: }}} - -#: Tab management {{{ - -#: Next tab - -# map kitty_mod+right next_tab -# map shift+cmd+] next_tab -# map ctrl+tab next_tab - -#: Previous tab - -# map kitty_mod+left previous_tab -# map shift+cmd+[ previous_tab -# map ctrl+shift+tab previous_tab - -#: New tab - -# map kitty_mod+t new_tab -# map cmd+t new_tab - -#: Close tab - -# map kitty_mod+q close_tab -# map cmd+w close_tab - -#: Close OS window - -# map shift+cmd+w close_os_window - -#: Move tab forward - -# map kitty_mod+. move_tab_forward - -#: Move tab backward - -# map kitty_mod+, move_tab_backward - -#: Set tab title - -# map kitty_mod+alt+t set_tab_title -# map shift+cmd+i set_tab_title - - -#: You can also create shortcuts to go to specific tabs, with 1 being -#: the first tab, 2 the second tab and -1 being the previously active -#: tab, -2 being the tab active before the previously active tab and -#: so on. Any number larger than the number of tabs goes to the last -#: tab and any number less than the number of previously used tabs in -#: the history goes to the oldest previously used tab in the history:: - -#: map ctrl+alt+1 goto_tab 1 -#: map ctrl+alt+2 goto_tab 2 - -#: Just as with new_window above, you can also pass the name of -#: arbitrary commands to run when using new_tab and new_tab_with_cwd. -#: Finally, if you want the new tab to open next to the current tab -#: rather than at the end of the tabs list, use:: - -#: map ctrl+t new_tab !neighbor [optional cmd to run] -#: }}} - -#: Layout management {{{ - -#: Next layout - -# map kitty_mod+l next_layout - - -#: You can also create shortcuts to switch to specific layouts:: - -#: map ctrl+alt+t goto_layout tall -#: map ctrl+alt+s goto_layout stack - -#: Similarly, to switch back to the previous layout:: - -#: map ctrl+alt+p last_used_layout - -#: There is also a toggle_layout action that switches to the named -#: layout or back to the previous layout if in the named layout. -#: Useful to temporarily "zoom" the active window by switching to the -#: stack layout:: - -#: map ctrl+alt+z toggle_layout stack -#: }}} - -#: Font sizes {{{ - -#: You can change the font size for all top-level kitty OS windows at -#: a time or only the current one. - -#: Increase font size - -# map kitty_mod+equal change_font_size all +2.0 -# map kitty_mod+plus change_font_size all +2.0 -# map kitty_mod+kp_add change_font_size all +2.0 -# map cmd+plus change_font_size all +2.0 -# map cmd+equal change_font_size all +2.0 -# map shift+cmd+equal change_font_size all +2.0 - -#: Decrease font size - -# map kitty_mod+minus change_font_size all -2.0 -# map kitty_mod+kp_subtract change_font_size all -2.0 -# map cmd+minus change_font_size all -2.0 -# map shift+cmd+minus change_font_size all -2.0 - -#: Reset font size - -# map kitty_mod+backspace change_font_size all 0 -# map cmd+0 change_font_size all 0 - - -#: To setup shortcuts for specific font sizes:: - -#: map kitty_mod+f6 change_font_size all 10.0 - -#: To setup shortcuts to change only the current OS window's font -#: size:: - -#: map kitty_mod+f6 change_font_size current 10.0 - -#: To setup shortcuts to multiply/divide the font size:: - -#: map kitty_mod+f6 change_font_size all *2.0 -#: map kitty_mod+f6 change_font_size all /2.0 -#: }}} - -#: Select and act on visible text {{{ - -#: Use the hints kitten to select text and either pass it to an -#: external program or insert it into the terminal or copy it to the -#: clipboard. - -#: Open URL - -# map kitty_mod+e open_url_with_hints - -#:: Open a currently visible URL using the keyboard. The program used -#:: to open the URL is specified in open_url_with. - -#: Insert selected path - -# map kitty_mod+p>f kitten hints --type path --program - - -#:: Select a path/filename and insert it into the terminal. Useful, -#:: for instance to run git commands on a filename output from a -#:: previous git command. - -#: Open selected path - -# map kitty_mod+p>shift+f kitten hints --type path - -#:: Select a path/filename and open it with the default open program. - -#: Insert selected line - -# map kitty_mod+p>l kitten hints --type line --program - - -#:: Select a line of text and insert it into the terminal. Useful for -#:: the output of things like: `ls -1`. - -#: Insert selected word - -# map kitty_mod+p>w kitten hints --type word --program - - -#:: Select words and insert into terminal. - -#: Insert selected hash - -# map kitty_mod+p>h kitten hints --type hash --program - - -#:: Select something that looks like a hash and insert it into the -#:: terminal. Useful with git, which uses SHA1 hashes to identify -#:: commits. - -#: Open the selected file at the selected line - -# map kitty_mod+p>n kitten hints --type linenum - -#:: Select something that looks like filename:linenum and open it in -#:: your default editor at the specified line number. - -#: Open the selected hyperlink - -# map kitty_mod+p>y kitten hints --type hyperlink - -#:: Select a hyperlink (i.e. a URL that has been marked as such by -#:: the terminal program, for example, by `ls --hyperlink=auto`). - - -#: The hints kitten has many more modes of operation that you can map -#: to different shortcuts. For a full description see hints kitten -#: . -#: }}} - -#: Miscellaneous {{{ - -#: Show documentation - -# map kitty_mod+f1 show_kitty_doc overview - -#: Toggle fullscreen - -# map kitty_mod+f11 toggle_fullscreen -# map ctrl+cmd+f toggle_fullscreen - -#: Toggle maximized - -# map kitty_mod+f10 toggle_maximized - -#: Toggle macOS secure keyboard entry - -# map opt+cmd+s toggle_macos_secure_keyboard_entry - -#: Unicode input - -# map kitty_mod+u kitten unicode_input -# map ctrl+cmd+space kitten unicode_input - -#: Edit config file - -# map kitty_mod+f2 edit_config_file -# map cmd+, edit_config_file - -#: Open the kitty command shell - -# map kitty_mod+escape kitty_shell window - -#:: Open the kitty shell in a new window / tab / overlay / os_window -#:: to control kitty using commands. - -#: Increase background opacity - -# map kitty_mod+a>m set_background_opacity +0.1 - -#: Decrease background opacity - -# map kitty_mod+a>l set_background_opacity -0.1 - -#: Make background fully opaque - -# map kitty_mod+a>1 set_background_opacity 1 - -#: Reset background opacity - -# map kitty_mod+a>d set_background_opacity default - -#: Reset the terminal - -# map kitty_mod+delete clear_terminal reset active -# map opt+cmd+r clear_terminal reset active - -#:: You can create shortcuts to clear/reset the terminal. For -#:: example:: - -#:: # Reset the terminal -#:: map f1 clear_terminal reset active -#:: # Clear the terminal screen by erasing all contents -#:: map f1 clear_terminal clear active -#:: # Clear the terminal scrollback by erasing it -#:: map f1 clear_terminal scrollback active -#:: # Scroll the contents of the screen into the scrollback -#:: map f1 clear_terminal scroll active -#:: # Clear everything on screen up to the line with the cursor or the start of the current prompt (needs shell integration) -#:: map f1 clear_terminal to_cursor active -#:: # Same as above except cleared lines are moved into scrollback -#:: map f1 clear_terminal to_cursor_scroll active - -#:: If you want to operate on all kitty windows instead of just the -#:: current one, use all instead of active. - -#:: Some useful functions that can be defined in the shell rc files -#:: to perform various kinds of clearing of the current window: - -#:: .. code-block:: sh - -#:: clear-only-screen() { -#:: printf "\e[H\e[2J" -#:: } - -#:: clear-screen-and-scrollback() { -#:: printf "\e[H\e[3J" -#:: } - -#:: clear-screen-saving-contents-in-scrollback() { -#:: printf "\e[H\e[22J" -#:: } - -#:: For instance, using these escape codes, it is possible to remap -#:: Ctrl+L to both scroll the current screen contents into the -#:: scrollback buffer and clear the screen, instead of just clearing -#:: the screen. For ZSH, in ~/.zshrc, add: - -#:: .. code-block:: zsh - -#:: ctrl_l() { -#:: builtin print -rn -- $'\r\e[0J\e[H\e[22J' >"$TTY" -#:: builtin zle .reset-prompt -#:: builtin zle -R -#:: } -#:: zle -N ctrl_l -#:: bindkey '^l' ctrl_l - -#:: Alternatively, you can just add map ctrl+l clear_terminal -#:: to_cursor_scroll active to kitty.conf which works with no changes -#:: to the shell rc files, but only clears up to the prompt, it does -#:: not clear any text at the prompt itself. - -#: Clear to start - -# map cmd+k clear_terminal to_cursor active - -#: Clear scrollback - -# map option+cmd+k clear_terminal scrollback active - -#: Clear screen - -# map cmd+ctrl+l clear_terminal to_cursor_scroll active - -#: Reload kitty.conf - -# map kitty_mod+f5 load_config_file -# map ctrl+cmd+, load_config_file - -#:: Reload kitty.conf, applying any changes since the last time it -#:: was loaded. Note that a handful of options cannot be dynamically -#:: changed and require a full restart of kitty. Particularly, when -#:: changing shortcuts for actions located on the macOS global menu -#:: bar, a full restart is needed. You can also map a keybinding to -#:: load a different config file, for example:: - -#:: map f5 load_config /path/to/alternative/kitty.conf - -#:: Note that all options from the original kitty.conf are discarded, -#:: in other words the new configuration *replace* the old ones. - -#: Debug kitty configuration - -# map kitty_mod+f6 debug_config -# map opt+cmd+, debug_config - -#:: Show details about exactly what configuration kitty is running -#:: with and its host environment. Useful for debugging issues. - -#: Send arbitrary text on key presses - -#:: E.g. map ctrl+shift+alt+h send_text all Hello World - -#:: You can tell kitty to send arbitrary (UTF-8) encoded text to the -#:: client program when pressing specified shortcut keys. For -#:: example:: - -#:: map ctrl+alt+a send_text all Special text - -#:: This will send "Special text" when you press the Ctrl+Alt+A key -#:: combination. The text to be sent decodes ANSI C escapes -#:: so you can use escapes like \e to send control -#:: codes or \u21fb to send Unicode characters (or you can just input -#:: the Unicode characters directly as UTF-8 text). You can use -#:: `kitten show-key` to get the key escape codes you want to -#:: emulate. - -#:: The first argument to send_text is the keyboard modes in which to -#:: activate the shortcut. The possible values are normal, -#:: application, kitty or a comma separated combination of them. The -#:: modes normal and application refer to the DECCKM cursor key mode -#:: for terminals, and kitty refers to the kitty extended keyboard -#:: protocol. The special value all means all of them. - -#:: Some more examples:: - -#:: # Output a word and move the cursor to the start of the line (like typing and pressing Home) -#:: map ctrl+alt+a send_text normal Word\e[H -#:: map ctrl+alt+a send_text application Word\eOH -#:: # Run a command at a shell prompt (like typing the command and pressing Enter) -#:: map ctrl+alt+a send_text normal,application some command with arguments\r - -#: Open kitty Website - -# map shift+cmd+/ open_url https://sw.kovidgoyal.net/kitty/ - -#: Hide macOS kitty application - -# map cmd+h hide_macos_app - -#: Hide macOS other applications - -# map opt+cmd+h hide_macos_other_apps - -#: Minimize macOS window - -# map cmd+m minimize_macos_window - -#: Quit kitty - -# map cmd+q quit - -#: }}} - -#: }}} diff --git a/.config/kitty/light-theme.auto.conf b/.config/kitty/light-theme.auto.conf deleted file mode 100644 index b1f6332..0000000 --- a/.config/kitty/light-theme.auto.conf +++ /dev/null @@ -1,59 +0,0 @@ -# vim:ft=kitty - -## name: Solarized Light -## author: Ethan Schoonover -## license: MIT -## blurb: Precision colors for machines and people - -# The basic colors -foreground #657b83 -background #fdf6e3 -selection_foreground #586e75 -selection_background #eee8d5 - -# Cursor colors -cursor #657b83 -cursor_text_color #fdf6e3 - -# kitty window border colors -active_border_color #cb4b16 -inactive_border_color #93a1a1 - -# Tab bar colors -active_tab_background #fdf6e3 -active_tab_foreground #657b83 -inactive_tab_background #93a1a1 -inactive_tab_foreground #fdf6e3 - -# The basic 16 colors -# black -color0 #073642 -color8 #93a1a1 - -# red -color1 #dc322f -color9 #cb4b16 - -# green -color2 #859900 -color10 #586e75 - -# yellow -color3 #b58900 -color11 #657b83 - -# blue -color4 #268bd2 -color12 #839496 - -# magenta -color5 #d33682 -color13 #6c71c4 - -# cyan -color6 #2aa198 -color14 #93a1a1 - -# white -color7 #eee8d5 -color15 #fdf6e3 diff --git a/.config/latexmk/latexmkrc b/.config/latexmk/latexmkrc new file mode 100644 index 0000000..730b2f8 --- /dev/null +++ b/.config/latexmk/latexmkrc @@ -0,0 +1,4 @@ +$pdf_previewer='papers %S'; + +$pdf_mode = 4; +$postscript_mode = $dvi_mode = 0; diff --git a/.config/luakit/theme.lua b/.config/luakit/theme.lua new file mode 100644 index 0000000..4760bba --- /dev/null +++ b/.config/luakit/theme.lua @@ -0,0 +1,101 @@ +-------------------------- +-- Default luakit theme -- +-------------------------- + +local theme = {} + +-- Default settings +theme.font = "12px monospace" +theme.fg = "#ebdbb2" +theme.bg = "#282828" + +-- General colours +theme.success_fg = "#98971a" +theme.loaded_fg = "#458588" +theme.error_fg = "#cc241d" +theme.error_bg = theme.bg + +-- Warning colours +theme.warning_fg = "#d79921" +theme.warning_bg = theme.bg + +-- Notification colours +theme.notif_fg = theme.fg +theme.notif_bg = theme.bg + +-- Menu colours +theme.menu_fg = theme.fg +theme.menu_bg = theme.bg +theme.menu_selected_fg = "#282828" +theme.menu_selected_bg = "#83a598" +theme.menu_title_bg = "#504945" +theme.menu_primary_title_fg = theme.fg +theme.menu_secondary_title_fg = "#d5c4a1" + +theme.menu_disabled_fg = "#928374" +theme.menu_disabled_bg = theme.menu_bg +theme.menu_enabled_fg = theme.menu_fg +theme.menu_enabled_bg = theme.menu_bg +theme.menu_active_fg = "#98971a" +theme.menu_active_bg = theme.menu_bg + +-- Proxy manager +theme.proxy_active_menu_fg = theme.menu_fg +theme.proxy_active_menu_bg = theme.menu_bg +theme.proxy_inactive_menu_fg = theme.menu_disabled_fg +theme.proxy_inactive_menu_bg = theme.menu_disabled_bg + +-- Statusbar specific +theme.sbar_fg = theme.fg +theme.sbar_bg = theme.bg + +-- Downloadbar specific +theme.dbar_fg = theme.fg +theme.dbar_bg = theme.bg +theme.dbar_error_fg = "#cc241d" + +-- Input bar specific +theme.ibar_fg = theme.fg +theme.ibar_bg = theme.bg + +-- Tab label +theme.tab_fg = theme.fg +theme.tab_bg = theme.bg +theme.tab_hover_bg = "#3c3836" +theme.tab_ntheme = "#282828" +theme.selected_fg = theme.tab_fg +theme.selected_bg = "#504945" +theme.selected_ntheme = "#282828" +theme.loading_fg = "#458588" +theme.loading_bg = theme.tab_bg + +theme.selected_private_tab_bg = "#d3869b" +theme.private_tab_bg = "#b16286" + +-- Trusted/untrusted ssl colours +theme.trust_fg = "#98971a" +theme.notrust_fg = "#cc241d" + +-- Follow mode hints +theme.hint_font = "10px monospace, courier, sans-serif" +theme.hint_fg = "#282828" +theme.hint_bg = "#fabd2f" +theme.hint_border = "1px solid #282828" +theme.hint_opacity = "0.3" +theme.hint_overlay_bg = "#fabd2f" +theme.hint_overlay_border = "1px solid #282828" +theme.hint_overlay_selected_bg = "#fe8019" +theme.hint_overlay_selected_border = theme.hint_overlay_border + +-- General colour pairings +theme.ok = { fg = "#ebdbb2", bg = "#282828" } +theme.warn = { fg = "#d79921", bg = "#282828" } +theme.error = { fg = "#cc241d", bg = "#282828" } + +-- Gopher page style (override defaults) +theme.gopher_light = { bg = "#fbf1c7", fg = "#3c3836", link = "#458588" } +theme.gopher_dark = { bg = "#282828", fg = "#ebdbb2", link = "#458588" } + +return theme + +-- vim: et:sw=4:ts=8:sts=4:tw=80 diff --git a/.config/luakit/userconf.lua b/.config/luakit/userconf.lua new file mode 100644 index 0000000..43dfa49 --- /dev/null +++ b/.config/luakit/userconf.lua @@ -0,0 +1,6 @@ +local select = require "select" + +select.label_maker = function (s) + local chars = s.interleave("gfds", "hjkl") + return chars +end diff --git a/.config/mako/config b/.config/mako/config index f64cb4a..3c06638 100644 --- a/.config/mako/config +++ b/.config/mako/config @@ -1,11 +1,33 @@ -font=Adwaita Sans 10 +font=sans-serif default-timeout=5000 +max-history=8 +max-visible=8 +on-button-right=exec makoctl menu -n "$id" -- fuzzel --dmenu +on-button-middle=dismiss -anchor=top-center -margin=16 +layer=overlay +anchor=top-right +outer-margin=8 +margin=0,0,4 padding=8 background-color=#191919E5 border-color=#505050E5 -progress-color=source #909090E5 +progress-color=source #7f7f7fE5 + +[urgency=low] +border-color=#2c2c2cE5 + +[urgency=high] +border-color=#9b0000E5 +default-timeout=0 + +[category=status] +anchor=bottom-center +group-by=category +history=0 +format=%s %b +default-timeout=1000 + +# vim: ft=conf diff --git a/.config/mpd/mpd.conf b/.config/mpd/mpd.conf new file mode 100644 index 0000000..cf8ef90 --- /dev/null +++ b/.config/mpd/mpd.conf @@ -0,0 +1,7 @@ +db_file "~/.local/share/mpd/database" +state_file "~/.local/state/mpd/state" + +audio_output { + type "pulse" + name "Music" +} diff --git a/.config/mvi/README.md b/.config/mvi/README.md new file mode 100644 index 0000000..a34b8f2 --- /dev/null +++ b/.config/mvi/README.md @@ -0,0 +1,87 @@ +This repository aggregates configurations, scripts and tips for using [mpv](https://github.com/mpv-player/mpv) as an image viewer. The affectionate nickname `mvi` is given to mpv in such case. + +This README assumes basic familiarity with mpv and its configuration. The information here should be platform-agnostic for the most part. + +[![demo](https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F674986351_1280x720.jpg&src1=https%3A%2F%2Ff.vimeocdn.com%2Fimages_v6%2Fshare%2Fplay_icon_overlay.png)](https://vimeo.com/249231479) + +# Why? + +mpv is a competent video player and sufficiently lightweight to use comfortably to view images. It features advanced scaling algorithms and color management, which are key features in an image viewer. +It is also very extensible which allows us to compensate for some missing image viewer features easily. +It won't compete with `feh` or the likes when it comes to size or startup time, but it is still plenty fast. + +# Configuration + +There are several options for making an mvi configuration. +* Use the normal mpv config, and apply changes at runtime. You will need `detect-image.lua` and use [input sections](https://mpv.io/manual/master/#input-sections) and [profiles](https://mpv.io/manual/master/#profiles) to make this work. +* Or create an entirely separate `~/.config/mvi/` directory and use the alias `alias mvi='mpv --config-dir=$HOME/.config/mvi'` + +The first option is more complex, the second results in essentially two separate programs. + +The examples `mpv.conf` and `input.conf` in this repository are commented to highlight (un)desirable settings. + +# Scripts + +## image-positioning.lua + +Adds several high-level commands to zoom and pan: + +`drag-to-pan`: pan the image with the cursor, while keeping the same part of the image under the cursor +`pan-follows-cursor`: pan the image in the direction of the cursor +`cursor-centric-zoom`: (de)zoom the video while keeping the same part of the image under the cursor +`align-border`: align the border of the image with the border of the window +`pan-image`: pan the image in a direction, optionally ignoring the zoom or forcing the image to stay visible +`rotate-video`: rotate the image in 90 degrees increment +`reset-pan-if-visible`: reset the pan if the entire image is visible + +There are no default bindings, see [`input.conf`](input.conf#L19-L67) for how to bind them. + +## status-line.lua + +Adds a status line that can show different properties in the corner of the window. By default it shows `filename [positon/total]` in the bottom left. + +Can be activated with the commands `status-line-enable`, `status-line-disable`, `status-line-toggle` and configured through [`status_line.conf`](script-opts/status_line.conf). + +## detect-image.lua + +Allows you to run specific commands when images are being displayed. Does not do anything by default, needs to be configured through [`detect_image.conf`](script-opts/detect_image.conf). + +For example, this makes it possible to setup bindings that are only in effect with images, like so: +``` +command_on_first_image_loaded=enable-section image-viewer +command_on_non_image_loaded=disable-section image-viewer +``` +Where the 'image-viewer' bindings are specified like so [`input.conf`](input.conf#L96-L99). + +## minimap.lua + +Adds a minimap that displays the position of the image relative to the view. +Can be activated with `minimap-enable`, `minimap-disable`, `minimap-toggle` and configured through [`minimap.conf`](script-opts/minimap.conf). + +## ruler.lua + +Adds a `ruler` command that lets you measure positions, distances and angles in the image. +Can be configured through [`ruler.conf`](script-opts/ruler.conf). + +## freeze-window.lua + +By default, mpv automatically resizes the window when the current file changes to fit its size. This script freezes the window so that this does not happen. +There is no configuration. + +## Others + +Some other mpv scripts work well with mvi, here are a few (feel free to send a PR for others): + +[playlist-view](https://github.com/occivink/mpv-gallery-view): show all images in a grid view +[zones](https://github.com/wiiaboo/mpv-scripts/blob/master/zones.lua): send different commands depending on cursor position +[autoload](https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/autoload.lua): automatically load all files in the same directory. Set `videos=no` and `audio=no` in `script-opts/autoload.conf` to only autoload images. +[delete-file](https://github.com/zenyd/mpv-scripts#delete-file): delete the current file +[mpv_crop_script](https://github.com/TheAMM/mpv_crop_script): featureful screenshot tool +[auto-profiles](https://github.com/wiiaboo/mpv-scripts/blob/master/auto-profiles.lua): apply profiles conditionally. Can be used to lower settings with huge images +[crop](https://github.com/occivink/mpv-scripts#croplua): simple cropping script +[playlist-manager](https://github.com/jonniek/mpv-playlistmanager): playlist management script +[blacklist-extensions](https://github.com/occivink/mpv-scripts#blacklist-extensionslua): remove files from the playlist based on their types + +# Credits + +Thanks to haasn for coming up first with the [image-viewer config](https://gist.github.com/haasn/7919afd765e308fa91cbe19a64631d0f), all the mpv devs and the /mpv/ funposters. diff --git a/.config/mvi/UNLICENSE b/.config/mvi/UNLICENSE new file mode 100644 index 0000000..68a49da --- /dev/null +++ b/.config/mvi/UNLICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/.config/mvi/input.conf b/.config/mvi/input.conf new file mode 100644 index 0000000..0eb9f48 --- /dev/null +++ b/.config/mvi/input.conf @@ -0,0 +1,105 @@ +1 change-list script-opts append image_positioning-drag_to_pan_margin=200 +2 change-list script-opts append ruler-exit_bindings=8 +3 change-list script-opts append ruler-line_color=FF +4 change-list script-opts append ruler-scale=25 +5 change-list script-opts append ruler-max_size=20,20 + +SPACE repeatable playlist-next +alt+SPACE repeatable playlist-prev + +UP ignore +DOWN ignore +LEFT repeatable playlist-prev +RIGHT repeatable playlist-next + +# simple reminder of default bindings +#1 add contrast -1 +#2 add contrast 1 +#3 add brightness -1 +#4 add brightness 1 +#5 add gamma -1 +#6 add gamma 1 +#7 add saturation -1 +#8 add saturation 1 + +# mouse-centric bindings +MBTN_RIGHT script-binding drag-to-pan +MBTN_LEFT script-binding pan-follows-cursor +MBTN_LEFT_DBL ignore +WHEEL_UP script-message cursor-centric-zoom 0.1 +WHEEL_DOWN script-message cursor-centric-zoom -0.1 + +# panning with the keyboard: +# pan-image takes the following arguments +# pan-image AXIS AMOUNT ZOOM_INVARIANT IMAGE_CONSTRAINED +# ^ ^ ^ +# x or y | | +# | | +# if yes, will pan by the same if yes, stops panning if the image +# amount regardless of zoom would go outside of the window + +ctrl+down repeatable script-message pan-image y -0.1 yes yes +ctrl+up repeatable script-message pan-image y +0.1 yes yes +ctrl+right repeatable script-message pan-image x -0.1 yes yes +ctrl+left repeatable script-message pan-image x +0.1 yes yes + +# now with more precision +alt+down repeatable script-message pan-image y -0.01 yes yes +alt+up repeatable script-message pan-image y +0.01 yes yes +alt+right repeatable script-message pan-image x -0.01 yes yes +alt+left repeatable script-message pan-image x +0.01 yes yes + +# replace at will with h,j,k,l if you prefer vim-style bindings + +# on a trackpad you may want to use these +#WHEEL_UP repeatable script-message pan-image y -0.02 yes yes +#WHEEL_DOWN repeatable script-message pan-image y +0.02 yes yes +#WHEEL_LEFT repeatable script-message pan-image x -0.02 yes yes +#WHEEL_RIGHT repeatable script-message pan-image x +0.02 yes yes + +# align the border of the image to the border of the window +# align-border takes the following arguments: +# align-border ALIGN_X ALIGN_Y +# any value for ALIGN_* is accepted, -1 and 1 map to the border of the window +ctrl+shift+right script-message align-border -1 "" +ctrl+shift+left script-message align-border 1 "" +ctrl+shift+down script-message align-border "" -1 +ctrl+shift+up script-message align-border "" 1 + +# reset the image +ctrl+0 no-osd set video-pan-x 0; no-osd set video-pan-y 0; no-osd set video-zoom 0 + ++ add video-zoom 0.5 +- add video-zoom -0.5; script-message reset-pan-if-visible += no-osd set video-zoom 0; script-message reset-pan-if-visible + +e script-message equalizer-toggle +alt+e script-message equalizer-reset + +h no-osd vf toggle hflip; show-text "Horizontal flip" +v no-osd vf toggle vflip; show-text "Vertical flip" + +r script-message rotate-video 90; show-text "Clockwise rotation" +R script-message rotate-video -90; show-text "Counter-clockwise rotation" +alt+r no-osd set video-rotate 0; show-text "Reset rotation" + +d script-message ruler + +# Toggling between pixel-exact reproduction and interpolation +a cycle-values scale nearest ewa_lanczossharp + +# Toggle color management on or off +c cycle icc-profile-auto + +# Screenshot of the window output +S screenshot window + +# Toggle aspect ratio information on and off +A cycle-values video-aspect-override "-1" "no" + +p script-message force-print-filename + +# ADVANCED: you can define bindings that belong to a "section" (named "image-viewer" here) like so: +#alt+SPACE {image-viewer} repeatable playlist-prev +#SPACE {image-viewer} repeatable playlist-next +# to load them conditionally with a command. See scripts-opts/image_viewer.conf for how you can do this diff --git a/.config/mvi/mpv.conf b/.config/mvi/mpv.conf new file mode 100644 index 0000000..973ba42 --- /dev/null +++ b/.config/mvi/mpv.conf @@ -0,0 +1,49 @@ +## IMAGE +# classic opengl-hq parameter, change at will +scale=spline36 +cscale=spline36 +dscale=mitchell +dither-depth=auto +correct-downscaling +sigmoid-upscaling +# debanding seems rarely useful with images +#deband +# dark grey background instead of pure black +background=color +background-color=0.2 + +## MISC +mute=yes +# the osc is mostly useful for videos +osc=no +# don't try to autoload subtitles or audio files +sub-auto=no +audio-file-auto=no +# get rid of the useless V: 00:00:00 / 00:00:00 line +term-status-msg= + +# replace mpv with mvi in the window title +title="${?media-title:${media-title}}${!media-title:No file} - mvi" + +# don't slideshow by default +image-display-duration=inf +# loop files in case of webms or gifs +loop-file=inf +# and loop the whole playlist +loop-playlist=inf + +# you need this if you plan to use drag-to-pan or pan-follows-cursor with MOUSE_LEFT +window-dragging=no + +#according to haasn, aspect ratio info for PNG and JPG is "universally bust" +[extension.png] +video-aspect-override=no + +[extension.jpg] +video-aspect-override=no + +[extension.jpeg] +profile=extension.jpg + +[silent] +msg-level=all=no diff --git a/.config/mvi/script-opts/detect_image.conf b/.config/mvi/script-opts/detect_image.conf new file mode 100644 index 0000000..586fb95 --- /dev/null +++ b/.config/mvi/script-opts/detect_image.conf @@ -0,0 +1,17 @@ +# commands to execute when a file detected as an image (1 frame, no audio) is loaded or unloaded + +# an image was loaded, and the previous file was not an image (or there was no previous file) +command_on_first_image_loaded= +# an image was loaded (regardless of what the previous file was) +command_on_image_loaded= +# a non-image was loaded, and the previous file was an image +command_on_non_image_loaded= + +# the purpose of these "hooks" is to let you change bindings, profiles, reset properties... +# see https://mpv.io/manual/master/#list-of-input-commands for general command information +# note that there is no such thing as "unloading a profile", to emulate this you must create an opposite profile and load that + +# example possible values: +#command_on_first_image_loaded=apply-profile image; enable-section image-viewer; script-message status-line-enable +#command_on_image_loaded=no-osd set video-pan-x 0; script-message align-border "" -1 +#command_on_non_image_loaded=disable-section image-viewer; no-osd set video-pan-x 0; no-osd set video-pan-y 0; no-osd set video-zoom 0; script-message status-line-disable diff --git a/.config/mvi/script-opts/image_positioning.conf b/.config/mvi/script-opts/image_positioning.conf new file mode 100644 index 0000000..998ec64 --- /dev/null +++ b/.config/mvi/script-opts/image_positioning.conf @@ -0,0 +1,14 @@ +# size of the margins with drag-to-pan +drag_to_pan_margin=50 +drag_to_pan_move_if_full_view=no + +# size of the margins with pan-follows-cursor +pan_follows_cursor_margin=50 + +# size of the margins with cursor-centric-zoom +cursor_centric_zoom_margin=50 +# if the borders would show up, move the image +# this makes it not exactly cursor-centric in some cases +cursor_centric_zoom_auto_center=yes +# allow zooming out if the image can already fully fit in the window +cursor_centric_zoom_dezoom_if_full_view=no diff --git a/.config/mvi/script-opts/minimap.conf b/.config/mvi/script-opts/minimap.conf new file mode 100644 index 0000000..72a05ea --- /dev/null +++ b/.config/mvi/script-opts/minimap.conf @@ -0,0 +1,19 @@ +# whether to show by default +enabled=yes +# the position of the center of the minimap, in percentage of the window (x, y) +center=92,92 +# the scale of the minimap (i.e. the view rectangle is scale / 100 times the size of the window) +scale=12 +# the cutoff size of the minimap (i.e. the image rectangle is clipped if it falls outside of the this zone) +max_size=16,16 +# opacity of the "image" (from 00=opaque to FF=transparent) +image_opacity=88 +# color of the "image" (#BBGGRR where each component rages from 00 to FF) +image_color=BBBBBB +# opacity of the "view" +view_opacity=BB +view_color=222222 +# whether the view should be drawn above the image +view_above_image=yes +# whether to show the minimap if the current image is fully visible +hide_when_full_image_in_view=yes diff --git a/.config/mvi/script-opts/ruler.conf b/.config/mvi/script-opts/ruler.conf new file mode 100644 index 0000000..5e6f48d --- /dev/null +++ b/.config/mvi/script-opts/ruler.conf @@ -0,0 +1,21 @@ +# whether to show the length of the lines between the two points +show_distance=yes +# whether to show the coordinates of the two points +show_coordinates=yes +# the coordinate space of the text shown. Can be "image", "window", "both" +coordinates_space=image +# can be "degrees", "radians", "both", or "no" +show_angles=degrees +line_width=2 +dots_radius=3 +font_size=36 +# ranges from 00 (black) to FF (white) +line_color=33 +# bindings used to set points. The binding to trigger ruler mode can also be used. Comma-separated list +confirm_bindings=MBTN_LEFT,ENTER +# bindings used to set points. The binding to trigger ruler mode can also be used. Comma-separated list +exit_bindings=ESC +# if yes, the first point will be immediately set at the cursor position when calling 'ruler' +set_first_point_on_begin=no +# if yes, the ruler overlay will be immediately cleared when setting the second point +clear_on_second_point_set=no diff --git a/.config/mvi/script-opts/status_line.conf b/.config/mvi/script-opts/status_line.conf new file mode 100644 index 0000000..ec15108 --- /dev/null +++ b/.config/mvi/script-opts/status_line.conf @@ -0,0 +1,14 @@ +# whether to show by default +enabled=yes +# its font size +size=36 +# distance of the text to the borders +margin=10 +# the text to be expanded +# see property expansion: https://mpv.io/manual/master/#property-expansion +# \N can be used for line breaks +# you can also use ass tags, see here: http://docs.aegisub.org/3.2/ASS_Tags/ +text_top_left= +text_top_right= +text_bottom_left=${filename} [${playlist-pos-1}/${playlist-count}] +text_bottom_right=[${dwidth:X}x${dheight:X}] diff --git a/.config/mvi/scripts/detect-image.lua b/.config/mvi/scripts/detect-image.lua new file mode 100644 index 0000000..bfe52c2 --- /dev/null +++ b/.config/mvi/scripts/detect-image.lua @@ -0,0 +1,73 @@ +local opts = { + command_on_first_image_loaded="", + command_on_image_loaded="", + command_on_non_image_loaded="", +} +local options = require 'mp.options' +local msg = require 'mp.msg' + +options.read_options(opts, nil, function() end) + +function run_maybe(str) + if str ~= "" then + mp.command(str) + end +end + +local was_image = false + +function set_image(is_image) + if is_image and not was_image then + msg.info("First image detected") + run_maybe(opts.command_on_first_image_loaded) + end + if is_image then + msg.info("Image detected") + run_maybe(opts.command_on_image_loaded) + end + if not is_image and was_image then + msg.info("Non-image detected") + run_maybe(opts.command_on_non_image_loaded) + end + was_image = is_image +end + +local properties = {} + +function properties_changed() + local dwidth = properties["dwidth"] + local tracks = properties["track-list"] + local path = properties["path"] + local framecount = properties["estimated-frame-count"] + + if not path or path == "" then return end + if not tracks or #tracks == 0 then return end + local audio_tracks = 0 + for _, track in ipairs(tracks) do + if track.type == "audio" then + audio_tracks = audio_tracks + 1 + end + end + + -- only do things when state is consistent + if not framecount and audio_tracks > 0 then + set_image(false) + elseif framecount and dwidth and dwidth > 0 then + -- png have 0 frames, jpg 1 ¯\_(ツ)_/¯ + set_image((framecount == 0 or framecount == 1) and audio_tracks == 0) + end +end + +function observe(propname) + mp.observe_property(propname, "native", function(_, val) + if val ~= properties[propname] then + properties[propname] = val + msg.verbose("Property " .. propname .. " changed") + properties_changed() + end + end) +end +observe("estimated-frame-count") +observe("track-list") +observe("dwidth") +observe("path") diff --git a/.config/mvi/scripts/equalizer.lua b/.config/mvi/scripts/equalizer.lua new file mode 100644 index 0000000..f7a50ab --- /dev/null +++ b/.config/mvi/scripts/equalizer.lua @@ -0,0 +1,176 @@ +local opts = { + bars = 'brightness,contrast,gamma,saturation,hue', + draw_icons = true, +} + +local msg = require 'mp.msg' +local assdraw = require 'mp.assdraw' +local options = require 'mp.options' +local utils = require 'mp.utils' + +options.read_options(opts, nil, function(c) +end) + +local enabled = false +local active_bars = {} +local bar_being_dragged = nil +local stale = false + +function split_comma(input) + local ret = {} + for str in string.gmatch(input, "([^,]+)") do + ret[#ret + 1] = str + end + return ret +end + +function get_position_normalized(x, y, bar) + return (x - bar.x) / bar.w, (y - bar.y) / bar.h +end + +function handle_mouse_move() + if not bar_being_dragged then return end + local bar = bar_being_dragged + local mx, my = mp.get_mouse_pos() + local nx, _ = get_position_normalized(mx, my, bar) + nx = math.max(0, math.min(nx, 1)) + local val = math.floor(nx * (bar.max_value - bar.min_value) + bar.min_value + 0.5) + mp.set_property_number(bar.property, val) + -- the observe_property call will take care of setting the value +end + +function handle_mouse_left(table) + if table["event"] == "down" then + local mx, my = mp.get_mouse_pos() + for _, bar in ipairs(active_bars) do + local nx, ny = get_position_normalized(mx, my, bar) + if nx >= 0 and ny >= 0 and nx <= 1 and ny <= 1 then + bar_being_dragged = bar + local val = math.floor(nx * (bar.max_value - bar.min_value) + bar.min_value + 0.5) + mp.set_property_number(bar.property, val) + mp.add_forced_key_binding("mouse_move", "mouse_move", handle_mouse_move) + break + end + end + elseif table["event"] == "up" then + mp.remove_key_binding("mouse_move") + bar_being_dragged = nil + end +end + +function property_changed(prop, val) + for _, bar in ipairs(active_bars) do + if bar.property == prop then + bar.value = val + stale = true + break + end + end +end + +function idle_handler() + if not stale then return end + stale = false + local a = assdraw.ass_new() + a:new_event() + a:append(string.format('{\\an0\\bord2\\shad0\\1a&00&\\1c&%s&}', '888888')) + a:pos(0, 0) + a:draw_start() + for _, bar in ipairs(active_bars) do + a:rect_cw(bar.x, bar.y, bar.x + bar.w, bar.y + bar.h) + end + a:new_event() + a:append(string.format('{\\an0\\bord2\\shad0\\1a&00&\\1c&%s&}', 'dddddd')) + a:pos(0, 0) + a:draw_start() + for _, bar in ipairs(active_bars) do + if bar.value > bar.min_value then + local val_norm = (bar.value - bar.min_value) / (bar.max_value - bar.min_value) + a:rect_cw(bar.x, bar.y, bar.x + val_norm * bar.w, bar.y + bar.h) + end + end + for _, bar in ipairs(active_bars) do + a:new_event() + a:append("{\\an6\\fs40\\bord2}") + a:pos(bar.x - 8, bar.y + bar.h/2 - 2) + a:append(bar.property:sub(1,1):upper() .. bar.property:sub(2,-1)) + end + local ww, wh = mp.get_osd_size() + mp.set_osd_ass(ww, wh, a.text) +end + +function fix_position() + local ww, wh = mp.get_osd_size() + for i, bar in ipairs(active_bars) do + bar.x = ww / 5 + bar.y = wh / 2 + i * 50 + bar.w = ww - 2 * (ww / 5) + bar.h = 30 + end +end + +function dimensions_changed() + stale = true + fix_position() +end + +function enable() + if enabled then return end + enabled = true + mp.add_forced_key_binding("MBTN_LEFT", "mouse_left", handle_mouse_left, {complex=true}) + for i, prop in ipairs(split_comma(opts.bars)) do + local prop_info = mp.get_property_native("option-info/" .. prop) + if not prop_info then + msg.warn("Property \'" .. prop .. "\' does not exist") + elseif not prop_info.type == 'Integer' then + msg.warn("Property \'" .. prop .. "\' is not an integer") + else + mp.observe_property(prop, 'native', property_changed) + active_bars[#active_bars + 1] = { + property = prop, + value = mp.get_property_number(prop), + min_value = prop_info.min, + max_value = prop_info.max, + } + end + end + stale = true + fix_position() + mp.observe_property("osd-dimensions", "native", dimensions_changed) + mp.register_idle(idle_handler) +end + +function disable() + if not enabled then return end + enabled = false + active_bars = {} + bar_being_dragged = nil + mp.remove_key_binding("mouse_left") + mp.remove_key_binding("mouse_move") + mp.unobserve_property(property_changed) + mp.unobserve_property(dimensions_changed) + mp.unregister_idle(idle_handler) + mp.set_osd_ass(1280, 720, "") +end + +function toggle() + if enabled then + disable() + else + enable() + end +end + +function reset() + for _, prop in ipairs(split_comma(opts.bars)) do + local prop_info = mp.get_property_native("option-info/" .. prop) + if prop_info and prop_info["default-value"] then + mp.set_property(prop_info["name"], prop_info["default-value"]) + end + end +end + +mp.add_key_binding(nil, "equalizer-enable", enable) +mp.add_key_binding(nil, "equalizer-disable", disable) +mp.add_key_binding(nil, "equalizer-toggle", toggle) +mp.add_key_binding(nil, "equalizer-reset", reset) diff --git a/.config/mvi/scripts/freeze-window.lua b/.config/mvi/scripts/freeze-window.lua new file mode 100644 index 0000000..693c717 --- /dev/null +++ b/.config/mvi/scripts/freeze-window.lua @@ -0,0 +1,14 @@ +-- credit to TheAMM + +local size_changed = false + +mp.register_idle(function() + if not size_changed then return end + local ww, wh = mp.get_osd_size() + if not ww or ww <= 0 or not wh or wh <= 0 then return end + mp.set_property("geometry", string.format("%dx%d", ww, wh)) + size_changed = false +end) + +mp.observe_property("osd-width", "native", function() size_changed = true end) +mp.observe_property("osd-height", "native", function() size_changed = true end) diff --git a/.config/mvi/scripts/image-positioning.lua b/.config/mvi/scripts/image-positioning.lua new file mode 100644 index 0000000..c0036d9 --- /dev/null +++ b/.config/mvi/scripts/image-positioning.lua @@ -0,0 +1,277 @@ +local opts = { + drag_to_pan_margin = 50, + drag_to_pan_move_if_full_view=false, + + pan_follows_cursor_margin = 50, + + cursor_centric_zoom_margin = 50, + cursor_centric_zoom_auto_center = true, + cursor_centric_zoom_dezoom_if_full_view = false, +} +local options = require 'mp.options' +local msg = require 'mp.msg' +local assdraw = require 'mp.assdraw' + +options.read_options(opts, nil, function() end) + +function clamp(value, low, high) + if value <= low then + return low + elseif value >= high then + return high + else + return value + end +end + + +local cleanup = nil -- function set up by drag-to-pan/pan-follows cursor and must be called to clean lingering state + +function drag_to_pan_handler(table) + if cleanup then + cleanup() + cleanup = nil + end + if table["event"] == "down" then + local dim = mp.get_property_native("osd-dimensions") + if not dim then return end + local mouse_pos_origin, video_pan_origin = {}, {} + local moved = false + mouse_pos_origin[1], mouse_pos_origin[2] = mp.get_mouse_pos() + video_pan_origin[1] = mp.get_property_number("video-pan-x") + video_pan_origin[2] = mp.get_property_number("video-pan-y") + local video_size = { dim.w - dim.ml - dim.mr, dim.h - dim.mt - dim.mb } + local margin = opts.drag_to_pan_margin + local move_up = true + local move_lateral = true + if not opts.drag_to_pan_move_if_full_view then + if dim.ml >= 0 and dim.mr >= 0 then + move_lateral = false + end + if dim.mt >= 0 and dim.mb >= 0 then + move_up = false + end + end + if not move_up and not move_lateral then return end + local idle = function() + if moved then + local mX, mY = mp.get_mouse_pos() + local pX = video_pan_origin[1] + local pY = video_pan_origin[2] + if move_lateral then + pX = video_pan_origin[1] + (mX - mouse_pos_origin[1]) / video_size[1] + if 2 * margin > dim.ml + dim.mr then + pX = clamp(pX, + (-margin + dim.w / 2) / video_size[1] - 0.5, + (margin - dim.w / 2) / video_size[1] + 0.5) + else + pX = clamp(pX, + (margin - dim.w / 2) / video_size[1] + 0.5, + (-margin + dim.w / 2) / video_size[1] - 0.5) + end + end + if move_up then + pY = video_pan_origin[2] + (mY - mouse_pos_origin[2]) / video_size[2] + if 2 * margin > dim.mt + dim.mb then + pY = clamp(pY, + (-margin + dim.h / 2) / video_size[2] - 0.5, + (margin - dim.h / 2) / video_size[2] + 0.5) + else + pY = clamp(pY, + (margin - dim.h / 2) / video_size[2] + 0.5, + (-margin + dim.h / 2) / video_size[2] - 0.5) + end + end + mp.command("no-osd set video-pan-x " .. clamp(pX, -3, 3) .. "; no-osd set video-pan-y " .. clamp(pY, -3, 3)) + moved = false + end + end + mp.register_idle(idle) + mp.add_forced_key_binding("mouse_move", "image-viewer-mouse-move", function() moved = true end) + cleanup = function() + mp.remove_key_binding("image-viewer-mouse-move") + mp.unregister_idle(idle) + end + end +end + +function pan_follows_cursor_handler(table) + if cleanup then + cleanup() + cleanup = nil + end + if table["event"] == "down" then + local dim = mp.get_property_native("osd-dimensions") + if not dim then return end + local video_size = { dim.w - dim.ml - dim.mr, dim.h - dim.mt - dim.mb } + local moved = true + local idle = function() + if moved then + local mX, mY = mp.get_mouse_pos() + local x = math.min(1, math.max(- 2 * mX / dim.w + 1, -1)) + local y = math.min(1, math.max(- 2 * mY / dim.h + 1, -1)) + local command = "" + local margin = opts.pan_follows_cursor_margin + if dim.ml + dim.mr < 0 then + command = command .. "no-osd set video-pan-x " .. clamp(x * (2 * margin - dim.ml - dim.mr) / (2 * video_size[1]), -3, 3) .. ";" + elseif mp.get_property_number("video-pan-x") ~= 0 then + command = command .. "no-osd set video-pan-x " .. "0;" + end + if dim.mt + dim.mb < 0 then + command = command .. "no-osd set video-pan-y " .. clamp(y * (2 * margin - dim.mt - dim.mb) / (2 * video_size[2]), -3, 3) .. ";" + elseif mp.get_property_number("video-pan-y") ~= 0 then + command = command .. "no-osd set video-pan-y " .. "0;" + end + if command ~= "" then + mp.command(command) + end + moved = false + end + end + mp.register_idle(idle) + mp.add_forced_key_binding("mouse_move", "image-viewer-mouse-move", function() moved = true end) + cleanup = function() + mp.remove_key_binding("image-viewer-mouse-move") + mp.unregister_idle(idle) + end + end +end + +function cursor_centric_zoom_handler(amt) + local zoom_inc = tonumber(amt) + if not zoom_inc or zoom_inc == 0 then return end + local dim = mp.get_property_native("osd-dimensions") + if not dim then return end + + local margin = opts.cursor_centric_zoom_margin + + local video_size = { dim.w - dim.ml - dim.mr, dim.h - dim.mt - dim.mb } + + -- the size in pixels of the (in|de)crement + local diff_width = (2 ^ zoom_inc - 1) * video_size[1] + local diff_height = (2 ^ zoom_inc - 1) * video_size[2] + if not opts.cursor_centric_zoom_dezoom_if_full_view and + zoom_inc < 0 and + video_size[1] + diff_width + 2 * margin <= dim.w and + video_size[2] + diff_height + 2 * margin <= dim.h + then + -- the zoom decrement is too much, reduce it such that the full image is visible, no more, no less + -- in addition, this should take care of trying too zoom out while everything is already visible + local new_zoom_inc_x = math.log((dim.w - 2 * margin) / video_size[1]) / math.log(2) + local new_zoom_inc_y = math.log((dim.h - 2 * margin) / video_size[2]) / math.log(2) + local new_zoom_inc = math.min(0, math.min(new_zoom_inc_x, new_zoom_inc_y)) + zoom_inc = new_zoom_inc + diff_width = (2 ^ zoom_inc - 1) * video_size[1] + diff_height = (2 ^ zoom_inc - 1) * video_size[2] + end + local new_width = video_size[1] + diff_width + local new_height = video_size[2] + diff_height + + local mouse_pos_origin = {} + mouse_pos_origin[1], mouse_pos_origin[2] = mp.get_mouse_pos() + local new_pan_x, new_pan_y + + -- some additional constraints: + -- if image can be fully visible (in either direction), set pan to 0 + -- if border would show on either side, then prefer adjusting the pan even if not cursor-centric + local auto_c = opts.cursor_centric_zoom_auto_center + if auto_c and new_width <= dim.w then + new_pan_x = 0 + else + local pan_x = mp.get_property("video-pan-x") + local rx = (dim.ml + video_size[1] / 2 - mouse_pos_origin[1]) / (video_size[1] / 2) + new_pan_x = (pan_x * video_size[1] + rx * diff_width / 2) / new_width + if auto_c then + new_pan_x = clamp(new_pan_x, (dim.w - 2 * margin) / (2 * new_width) - 0.5, - (dim.w - 2 * margin) / (2 * new_width) + 0.5) + end + end + + if auto_c and new_height <= dim.h then + new_pan_y = 0 + else + local pan_y = mp.get_property("video-pan-y") + local ry = (dim.mt + video_size[2] / 2 - mouse_pos_origin[2]) / (video_size[2] / 2) + new_pan_y = (pan_y * video_size[2] + ry * diff_height / 2) / new_height + if auto_c then + new_pan_y = clamp(new_pan_y, (dim.h - 2 * margin) / (2 * new_height) - 0.5, - (dim.h - 2 * margin) / (2 * new_height) + 0.5) + end + end + + local zoom_origin = mp.get_property("video-zoom") + mp.command("no-osd set video-zoom " .. zoom_origin + zoom_inc .. "; no-osd set video-pan-x " .. clamp(new_pan_x, -3, 3) .. "; no-osd set video-pan-y " .. clamp(new_pan_y, -3, 3)) +end + +function align_border(x, y) + local dim = mp.get_property_native("osd-dimensions") + if not dim then return end + local video_size = { dim.w - dim.ml - dim.mr, dim.h - dim.mt - dim.mb } + local x, y = tonumber(x), tonumber(y) + local command = "" + if x then + command = command .. "no-osd set video-pan-x " .. clamp(- x * (dim.ml + dim.mr) / (2 * video_size[1]), -3, 3) .. ";" + end + if y then + command = command .. "no-osd set video-pan-y " .. clamp(- y * (dim.mt + dim.mb) / (2 * video_size[2]), -3, 3) .. ";" + end + if command ~= "" then + mp.command(command) + end +end + +function pan_image(axis, amount, zoom_invariant, image_constrained) + amount = tonumber(amount) + if not amount or amount == 0 or axis ~= "x" and axis ~= "y" then return end + if zoom_invariant == "yes" then + amount = amount / 2 ^ mp.get_property_number("video-zoom") + end + local prop = "video-pan-" .. axis + local old_pan = mp.get_property_number(prop) + if image_constrained == "yes" then + local dim = mp.get_property_native("osd-dimensions") + if not dim then return end + local margin = + (axis == "x" and amount > 0) and dim.ml + or (axis == "x" and amount < 0) and dim.mr + or (amount > 0) and dim.mt + or (amount < 0) and dim.mb + local vid_size = (axis == "x") and (dim.w - dim.ml - dim.mr) or (dim.h - dim.mt - dim.mb) + local pixels_moved = math.abs(amount) * vid_size + -- the margin is already visible, no point going further + if margin >= 0 then + return + elseif margin + pixels_moved > 0 then + amount = -(math.abs(amount) / amount) * margin / vid_size + end + end + mp.set_property_number(prop, old_pan + amount) +end + +function rotate_video(amt) + local rot = mp.get_property_number("video-rotate") + rot = (rot + amt) % 360 + mp.set_property_number("video-rotate", rot) +end + +function reset_pan_if_visible() + local dim = mp.get_property_native("osd-dimensions") + if not dim then return end + local command = "" + if (dim.ml + dim.mr >= 0) then + command = command .. "no-osd set video-pan-x 0" .. ";" + end + if (dim.mt + dim.mb >= 0) then + command = command .. "no-osd set video-pan-y 0" .. ";" + end + if command ~= "" then + mp.command(command) + end +end + +mp.add_key_binding(nil, "drag-to-pan", drag_to_pan_handler, {complex = true}) +mp.add_key_binding(nil, "pan-follows-cursor", pan_follows_cursor_handler, {complex = true}) +mp.add_key_binding(nil, "cursor-centric-zoom", cursor_centric_zoom_handler) +mp.add_key_binding(nil, "align-border", align_border) +mp.add_key_binding(nil, "pan-image", pan_image) +mp.add_key_binding(nil, "rotate-video", rotate_video) +mp.add_key_binding(nil, "reset-pan-if-visible", reset_pan_if_visible) +mp.add_key_binding(nil, "force-print-filename", force_print_filename) diff --git a/.config/mvi/scripts/minimap.lua b/.config/mvi/scripts/minimap.lua new file mode 100644 index 0000000..f1b9a7d --- /dev/null +++ b/.config/mvi/scripts/minimap.lua @@ -0,0 +1,201 @@ +local opts = { + enabled = true, + center = "92,92", + scale = 12, + max_size = "16,16", + image_opacity = "88", + image_color = "BBBBBB", + view_opacity = "BB", + view_color = "222222", + view_above_image = true, + hide_when_full_image_in_view = true, +} + +local msg = require 'mp.msg' +local assdraw = require 'mp.assdraw' +local options = require 'mp.options' + +options.read_options(opts, nil, function(c) + if c["enabled"] then + if opts.enabled then + enable() + else + disable() + end + end + mark_stale() +end) + +function split_comma(input) + local ret = {} + for str in string.gmatch(input, "([^,]+)") do + ret[#ret + 1] = tonumber(str) + end + return ret +end + +local active = false +local refresh = true + +function draw_ass(ass) + local ww, wh = mp.get_osd_size() + mp.set_osd_ass(ww, wh, ass) +end + +function mark_stale() + refresh = true +end + +function refresh_minimap() + if not refresh then return end + refresh = false + + local dim = mp.get_property_native("osd-dimensions") + if not dim then + draw_ass("") + return + end + local ww, wh = dim.w, dim.h + + if not (ww > 0 and wh > 0) then return end + if opts.hide_when_full_image_in_view then + if dim.mt >= 0 and dim.mb >= 0 and dim.ml >= 0 and dim.mr >= 0 then + draw_ass("") + return + end + end + + local center = split_comma(opts.center) + center[1] = center[1] * 0.01 * ww + center[2] = center[2] * 0.01 * wh + local cutoff = split_comma(opts.max_size) + cutoff[1] = cutoff[1] * 0.01 * ww * 0.5 + cutoff[2] = cutoff[2] * 0.01 * wh * 0.5 + + local a = assdraw.ass_new() + local draw = function(x, y, w, h, opacity, color) + a:new_event() + a:pos(center[1], center[2]) + a:append("{\\bord0}") + a:append("{\\shad0}") + a:append("{\\c&" .. color .. "&}") + a:append("{\\2a&HFF}") + a:append("{\\3a&HFF}") + a:append("{\\4a&HFF}") + a:append("{\\1a&H" .. opacity .. "}") + w = w * 0.5 + h = h * 0.5 + a:draw_start() + local rounded = {true,true,true,true} -- tl, tr, br, bl + local x0,y0,x1,y1 = x-w, y-h, x+w, y+h + if x0 < -cutoff[1] then + x0 = -cutoff[1] + rounded[4] = false + rounded[1] = false + end + if y0 < -cutoff[2] then + y0 = -cutoff[2] + rounded[1] = false + rounded[2] = false + end + if x1 > cutoff[1] then + x1 = cutoff[1] + rounded[2] = false + rounded[3] = false + end + if y1 > cutoff[2] then + y1 = cutoff[2] + rounded[3] = false + rounded[4] = false + end + + local r = 3 + local c = 0.551915024494 * r + if rounded[0] then + a:move_to(x0 + r, y0) + else + a:move_to(x0,y0) + end + if rounded[1] then + a:line_to(x1 - r, y0) + a:bezier_curve(x1 - r + c, y0, x1, y0 + r - c, x1, y0 + r) + else + a:line_to(x1, y0) + end + if rounded[2] then + a:line_to(x1, y1 - r) + a:bezier_curve(x1, y1 - r + c, x1 - r + c, y1, x1 - r, y1) + else + a:line_to(x1, y1) + end + if rounded[3] then + a:line_to(x0 + r, y1) + a:bezier_curve(x0 + r - c, y1, x0, y1 - r + c, x0, y1 - r) + else + a:line_to(x0, y1) + end + if rounded[4] then + a:line_to(x0, y0 + r) + a:bezier_curve(x0, y0 + r - c, x0 + r - c, y0, x0 + r, y0) + else + a:line_to(x0, y0) + end + a:draw_stop() + end + local image = function() + draw((dim.ml/2 - dim.mr/2) / opts.scale, + (dim.mt/2 - dim.mb/2) / opts.scale, + (ww - dim.ml - dim.mr) / opts.scale, + (wh - dim.mt - dim.mb) / opts.scale, + opts.image_opacity, + opts.image_color) + end + local view = function() + draw(0, + 0, + ww / opts.scale, + wh / opts.scale, + opts.view_opacity, + opts.view_color) + end + if opts.view_above_image then + image() + view() + else + view() + image() + end + draw_ass(a.text) +end + +function enable() + if active then return end + active = true + mp.observe_property("osd-dimensions", nil, mark_stale) + mp.register_idle(refresh_minimap) + mark_stale() +end + +function disable() + if not active then return end + active = false + mp.unobserve_property(mark_stale) + mp.unregister_idle(refresh_minimap) + draw_ass("") +end + +function toggle() + if active then + disable() + else + enable() + end +end + +if opts.enabled then + enable() +end + +mp.add_key_binding(nil, "minimap-enable", enable) +mp.add_key_binding(nil, "minimap-disable", disable) +mp.add_key_binding(nil, "minimap-toggle", toggle) diff --git a/.config/mvi/scripts/ruler.lua b/.config/mvi/scripts/ruler.lua new file mode 100644 index 0000000..2cfcd0f --- /dev/null +++ b/.config/mvi/scripts/ruler.lua @@ -0,0 +1,314 @@ +local opts = { + show_distance = true, + show_coordinates = true, + coordinates_space = "image", + show_angles = "degrees", + line_width = 2, + dots_radius = 3, + font_size = 36, + line_color = "33", + confirm_bindings = "MBTN_LEFT,ENTER", + exit_bindings = "ESC", + set_first_point_on_begin = false, + clear_on_second_point_set = false, +} + +local options = require 'mp.options' +local msg = require 'mp.msg' +local assdraw = require 'mp.assdraw' + +local state = 0 -- {0,1,2,3} = {inactive,setting first point,setting second point,done} +local first_point = nil -- in normalized video space coordinates +local second_point = nil -- in normalized video space coordinates +local video_dimensions_stale = false + +function split(input) + local ret = {} + for str in string.gmatch(input, "([^,]+)") do + ret[#ret + 1] = str + end + return ret +end + +local confirm_bindings = split(opts.confirm_bindings) +local exit_bindings = split(opts.exit_bindings) + +options.read_options(opts, nil, function() + if state ~= 0 then + remove_bindings() + end + confirm_bindings = split(opts.confirm_bindings) + exit_bindings = split(opts.exit_bindings) + if state ~= 0 then + add_bindings() + mark_stale() + end +end) + +function draw_ass(ass) + local ww, wh = mp.get_osd_size() + mp.set_osd_ass(ww, wh, ass) +end + + +function cursor_video_space_normalized(dim) + local mx, my = mp.get_mouse_pos() + local ret = {} + ret[1] = (mx - dim.ml) / (dim.w - dim.ml - dim.mr) + ret[2] = (my - dim.mt) / (dim.h - dim.mt - dim.mb) + return ret +end + +function refresh() + if not video_dimensions_stale then return end + video_dimensions_stale = false + + local dim = mp.get_property_native("osd-dimensions") + local out_params = mp.get_property_native("video-out-params") + if not dim or not out_params then + draw_ass("") + return + end + local vid_width = out_params.dw + local vid_height = out_params.dh + + function video_space_normalized_to_video(point) + local ret = {} + ret[1] = point[1] * vid_width + ret[2] = point[2] * vid_height + return ret + end + function video_space_normalized_to_screen(point) + local ret = {} + ret[1] = point[1] * (dim.w - dim.ml - dim.mr) + dim.ml + ret[2] = point[2] * (dim.h - dim.mt - dim.mb) + dim.mt + return ret + end + + local line_start = {} + local line_end = {} + if second_point then + line_start.image = video_space_normalized_to_video(first_point) + line_start.screen = video_space_normalized_to_screen(first_point) + line_end.image = video_space_normalized_to_video(second_point) + line_end.screen = video_space_normalized_to_screen(second_point) + elseif first_point then + line_start.image = video_space_normalized_to_video(first_point) + line_start.screen = video_space_normalized_to_screen(first_point) + line_end.image = video_space_normalized_to_video(cursor_video_space_normalized(dim)) + line_end.screen = {} + line_end.screen[1], line_end.screen[2] = mp.get_mouse_pos() + else + local mx, my = mp.get_mouse_pos() + line_start.image = video_space_normalized_to_video(cursor_video_space_normalized(dim)) + line_start.screen = {} + line_start.screen[1], line_start.screen[2] = mp.get_mouse_pos() + line_end = line_start + end + local distinct = (math.abs(line_start.screen[1] - line_end.screen[1]) >= 1 + or math.abs(line_start.screen[2] - line_end.screen[2]) >= 1) + + local a = assdraw:ass_new() + local draw_setup = function(bord) + a:new_event() + a:pos(0,0) + a:append("{\\bord" .. bord .. "}") + a:append("{\\shad0}") + local r = opts.line_color + a:append("{\\3c&H".. r .. r .. r .. "&}") + a:append("{\\1a&HFF}") + a:append("{\\2a&HFF}") + a:append("{\\3a&H00}") + a:append("{\\4a&HFF}") + a:draw_start() + end + local dot = function(pos, size) + draw_setup(size) + a:move_to(pos[1], pos[2]-0.5) + a:line_to(pos[1], pos[2]+0.5) + end + local line = function(from, to, size) + draw_setup(size) + a:move_to(from[1], from[2]) + a:line_to(to[1], to[2]) + end + if distinct then + dot(line_start.screen, opts.dots_radius) + line(line_start.screen, line_end.screen, opts.line_width) + dot(line_end.screen, opts.dots_radius) + else + dot(line_start.screen, opts.dots_radius) + end + + local line_info = function() + if not opts.show_distance then return end + a:new_event() + a:append("{\\fs36}{\\bord1}") + a:pos((line_start.screen[1] + line_end.screen[1]) / 2, (line_start.screen[2] + line_end.screen[2]) / 2) + local an = 1 + if line_start.image[1] < line_end.image[1] then an = an + 2 end + if line_start.image[2] < line_end.image[2] then an = an + 6 end + a:an(an) + local image = math.sqrt(math.pow(line_start.image[1] - line_end.image[1], 2) + math.pow(line_start.image[2] - line_end.image[2], 2)) + local screen = math.sqrt(math.pow(line_start.screen[1] - line_end.screen[1], 2) + math.pow(line_start.screen[2] - line_end.screen[2], 2)) + if opts.coordinates_space == "both" then + a:append(string.format("image: %.1f\\Nscreen: %.1f", image, screen)) + elseif opts.coordinates_space == "image" then + a:append(string.format("%.1f", image)) + elseif opts.coordinates_space == "window" then + a:append(string.format("%.1f", screen)) + end + end + local dot_info = function(pos, opposite) + if not opts.show_coordinates then return end + a:new_event() + a:append("{\\fs" .. opts.font_size .."}{\\bord1}") + a:pos(pos.screen[1], pos.screen[2]) + local an + if distinct then + an = 1 + if line_start.image[1] > line_end.image[1] then an = an + 2 end + if line_start.image[2] < line_end.image[2] then an = an + 6 end + else + an = 7 + end + if opposite then + an = 9 + 1 - an + end + a:an(an) + if opts.coordinates_space == "both" then + a:append(string.format("image: %.1f, %.1f\\Nscreen: %i, %i", + pos.image[1], pos.image[2], pos.screen[1], pos.screen[2])) + elseif opts.coordinates_space == "image" then + a:append(string.format("%.1f, %.1f", pos.image[1], pos.image[2])) + elseif opts.coordinates_space == "window" then + a:append(string.format("%i, %i", pos.screen[1], pos.screen[2])) + end + end + dot_info(line_start, true) + if distinct then + line_info() + dot_info(line_end, false) + end + if distinct and opts.show_angles ~= "no" then + local dist = 50 + local pos_from_angle = function(mult, angle) + return { + line_start.screen[1] + mult * dist * math.cos(angle), + line_start.screen[2] + mult * dist * math.sin(angle), + } + end + local extended = { line_start.screen[1], line_start.screen[2] } + if line_end.screen[1] > line_start.screen[1] then + extended[1] = extended[1] + dist + else + extended[1] = extended[1] - dist + end + line(line_start.screen, extended, math.max(0, opts.line_width-0.5)) + local angle = math.atan(math.abs(line_start.image[2] - line_end.image[2]) / math.abs(line_start.image[1] - line_end.image[1])) + local fix_angle + local an + if line_end.image[2] < line_start.image[2] and line_end.image[1] > line_start.image[1] then + -- upper-right + an = 4 + fix_angle = function(angle) return - angle end + elseif line_end.image[2] < line_start.image[2] then + -- upper-left + an = 6 + fix_angle = function(angle) return math.pi + angle end + elseif line_end.image[1] < line_start.image[1] then + -- bottom-left + an = 6 + fix_angle = function(angle) return math.pi - angle end + else + -- bottom-right + an = 4 + fix_angle = function(angle) return angle end + end + -- should implement this https://math.stackexchange.com/questions/873224/calculate-control-points-of-cubic-bezier-curve-approximating-a-part-of-a-circle + local cp1 = pos_from_angle(1, fix_angle(angle*1/4)) + local cp2 = pos_from_angle(1, fix_angle(angle*3/4)) + local p2 = pos_from_angle(1, fix_angle(angle)) + a:bezier_curve(cp1[1], cp1[2], cp2[1], cp2[2], p2[1], p2[2]) + + a:new_event() + a:append("{\\fs" .. opts.font_size .."}{\\bord1}") + local text_pos = pos_from_angle(1.1, fix_angle(angle*2/3)) -- you'd think /2 would make more sense, but *2/3 looks better + a:pos(text_pos[1], text_pos[2]) + a:an(an) + if opts.show_angles == "both" then + a:append(string.format("%.2f\\N%.1f°", angle, angle / math.pi * 180)) + elseif opts.show_angles == "degrees" then + a:append(string.format("%.1f°", angle / math.pi * 180)) + elseif opts.show_angles == "radians" then + a:append(string.format("%.2f", angle)) + end + end + + draw_ass(a.text) +end + +function mark_stale() + video_dimensions_stale = true +end + +function add_bindings() + mp.add_forced_key_binding("mouse_move", "ruler-mouse-move", mark_stale) + for _, key in ipairs(confirm_bindings) do + mp.add_forced_key_binding(key, "ruler-next-" .. key, next_step) + end + for _, key in ipairs(exit_bindings) do + mp.add_forced_key_binding(key, "ruler-stop-" .. key, stop) + end +end + +function remove_bindings() + for _, key in ipairs(confirm_bindings) do + mp.remove_key_binding("ruler-next-" .. key) + end + for _, key in ipairs(exit_bindings) do + mp.remove_key_binding("ruler-stop-" .. key) + end + mp.remove_key_binding("ruler-mouse-move") +end + +function next_step() + if state == 0 then + state = 1 + mp.register_idle(refresh) + mp.observe_property("osd-dimensions", nil, mark_stale) + mark_stale() + add_bindings() + if opts.set_first_point_on_begin then + next_step() + end + elseif state == 1 then + local dim = mp.get_property_native("osd-dimensions") + if not dim then return end + state = 2 + first_point = cursor_video_space_normalized(dim) + elseif state == 2 then + local dim = mp.get_property_native("osd-dimensions") + if not dim then return end + state = 3 + second_point = cursor_video_space_normalized(dim) + if opts.clear_on_second_point_set then + next_step() + end + else + stop() + end +end + +function stop() + if state == 0 then return end + mp.unregister_idle(refresh) + mp.unobserve_property(mark_stale) + remove_bindings() + state = 0 + first_point = nil + second_point = nil + draw_ass("") +end + +mp.add_key_binding(nil, "ruler", next_step) diff --git a/.config/mvi/scripts/status-line.lua b/.config/mvi/scripts/status-line.lua new file mode 100644 index 0000000..7ac5168 --- /dev/null +++ b/.config/mvi/scripts/status-line.lua @@ -0,0 +1,142 @@ +local opts = { + enabled = true, + size = 36, + margin = 10, + text_top_left = "", + text_top_right = "", + text_bottom_left = "${filename} [${playlist-pos-1}/${playlist-count}]", + text_bottom_right = "[${dwidth:X}x${dheight:X}]", +} + +local msg = require 'mp.msg' +local assdraw = require 'mp.assdraw' +local options = require 'mp.options' + +options.read_options(opts, nil, function(c) + if c["enabled"] then + if opts.enabled then + enable() + else + disable() + end + end + if c["size"] or c["margin"] then + mark_stale() + end + if c["text_top_left"] or + c["text_top_right"] or + c["text_bottom_left"] or + c["text_bottom_right"] + then + observe_properties() + mark_stale() + end +end) + +local stale = true +local active = false + +function draw_ass(ass) + local ww, wh = mp.get_osd_size() + mp.set_osd_ass(ww, wh, ass) +end + +function refresh() + if not stale then return end + stale = false + local a = assdraw:ass_new() + local draw_text = function(text, an, x, y) + if text == "" then return end + local expanded = mp.command_native({ "expand-text", text}) + if not expanded then + msg.error("Error expanding status-line") + return + end + msg.verbose("Status-line changed to: " .. expanded) + a:new_event() + a:an(an) + a:pos(x,y) + a:append("{\\fs".. opts.size.. "}{\\bord1.0}") + a:append(expanded) + end + local w,h = mp.get_osd_size() + local m = opts.margin + draw_text(opts.text_top_left, 7, m, m) + draw_text(opts.text_top_right, 9, w-m, m) + draw_text(opts.text_bottom_left, 1, m, h-m) + draw_text(opts.text_bottom_right, 3, w-m, h-m) + draw_ass(a.text) +end + +function mark_stale() + stale = true +end + +function observe_properties() + mp.unobserve_property(mark_stale) + if not active then return end + for _, str in ipairs({ + opts.text_top_left, + opts.text_top_right, + opts.text_bottom_left, + opts.text_bottom_right, + }) do + local start = 0 + while true do + local s, e, cap = string.find(str, "%${[?!]?([%l%d-/]*)", start) + if not s then break end + msg.verbose("Observing property " .. cap) + mp.observe_property(cap, nil, mark_stale) + start = e + end + end + mp.observe_property("osd-width", nil, mark_stale) + mp.observe_property("osd-height", nil, mark_stale) +end + +function enable() + if active then return end + active = true + observe_properties() + mp.register_idle(refresh) + mark_stale() +end + + +function disable() + if not active then return end + active = false + observe_properties() + mp.unregister_idle(refresh) + draw_ass("") +end + +function toggle() + if active then + disable() + else + enable() + end +end + +if opts.enabled then + enable() +end + +mp.add_key_binding(nil, "status-line-enable", enable) +mp.add_key_binding(nil, "status-line-disable", disable) +mp.add_key_binding(nil, "status-line-toggle", toggle) + +-- TODO remove +mp.add_key_binding(nil, "enable-status-line", function() + msg.warn("This binding is deprecated, use 'status-line-enable' instead") + enable() +end) +mp.add_key_binding(nil, "disable-status-line", function() + msg.warn("This binding is deprecated, use 'status-line-disable' instead") + disable() +end) +mp.add_key_binding(nil, "toggle-status-line", function() + msg.warn("This binding is deprecated, use 'status-line-toggle' instead") + toggle() +end) diff --git a/.config/niri/backgrounds/f43-01-day.jxl b/.config/niri/backgrounds/f43-01-day.jxl new file mode 100644 index 0000000..0f6783d Binary files /dev/null and b/.config/niri/backgrounds/f43-01-day.jxl differ diff --git a/.config/niri/backgrounds/f43-01-night.jxl b/.config/niri/backgrounds/f43-01-night.jxl new file mode 100644 index 0000000..7efb0bd Binary files /dev/null and b/.config/niri/backgrounds/f43-01-night.jxl differ diff --git a/.config/niri/backgrounds/f43.xml b/.config/niri/backgrounds/f43.xml new file mode 100644 index 0000000..c854b62 --- /dev/null +++ b/.config/niri/backgrounds/f43.xml @@ -0,0 +1,38 @@ + + + 2025 + 10 + 28 + 8 + 00 + 00 + + + + + +36000.0 +/usr/share/backgrounds/f43/default/f43-01-day.jxl + + + + +7200.0 +/usr/share/backgrounds/f43/default/f43-01-day.jxl +/usr/share/backgrounds/f43/default/f43-01-night.jxl + + + + +36000.0 +/usr/share/backgrounds/f43/default/f43-01-night.jxl + + + + +7200.0 +/usr/share/backgrounds/f43/default/f43-01-night.jxl +/usr/share/backgrounds/f43/default/f43-01-day.jxl + + + diff --git a/.config/niri/backgrounds/wallpaper.png b/.config/niri/backgrounds/wallpaper.png new file mode 100644 index 0000000..6e3e1bb Binary files /dev/null and b/.config/niri/backgrounds/wallpaper.png differ diff --git a/.config/niri/config.kdl b/.config/niri/config.kdl index 99209c5..16dc0aa 100644 --- a/.config/niri/config.kdl +++ b/.config/niri/config.kdl @@ -7,66 +7,66 @@ // Find the full list of options on the wiki: // https://yalter.github.io/niri/Configuration:-Input input { - keyboard { - xkb { - // You can set rules, model, layout, variant and options. - // For more information, see xkeyboard-config(7). + keyboard { + xkb { + // You can set rules, model, layout, variant and options. + // For more information, see xkeyboard-config(7). - // For example: - layout "de" - // options "grp:win_space_toggle,compose:ralt,ctrl:nocaps" + // For example: + layout "de(us)" + options "caps:escape" - // If this section is empty, niri will fetch xkb settings - // from org.freedesktop.locale1. You can control these using - // localectl set-x11-keymap. - } + // If this section is empty, niri will fetch xkb settings + // from org.freedesktop.locale1. You can control these using + // localectl set-x11-keymap. + } - // Enable numlock on startup, omitting this setting disables it. - numlock - } + // Enable numlock on startup, omitting this setting disables it. + numlock + } - // Next sections include libinput settings. - // Omitting settings disables them, or leaves them at their default values. - // All commented-out settings here are examples, not defaults. - touchpad { - // off - tap - // dwt - // dwtp - // drag false - // drag-lock - natural-scroll - // accel-speed 0.2 - // accel-profile "flat" - // scroll-method "two-finger" - // disabled-on-external-mouse - } + // Next sections include libinput settings. + // Omitting settings disables them, or leaves them at their default values. + // All commented-out settings here are examples, not defaults. + touchpad { + // off + tap + dwt + // dwtp + // drag false + // drag-lock + natural-scroll + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "two-finger" + // disabled-on-external-mouse + } - mouse { - // off - // natural-scroll - // accel-speed 0.2 - // accel-profile "flat" - // scroll-method "no-scroll" - } + mouse { + // off + // natural-scroll + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "no-scroll" + } - trackpoint { - // off - // natural-scroll - // accel-speed 0.2 - // accel-profile "flat" - // scroll-method "on-button-down" - // scroll-button 273 - // scroll-button-lock - // middle-emulation - } + trackpoint { + // off + // natural-scroll + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "on-button-down" + // scroll-button 273 + // scroll-button-lock + // middle-emulation + } - // Uncomment this to make the mouse warp to the center of newly focused windows. - // warp-mouse-to-focus + // Uncomment this to make the mouse warp to the center of newly focused windows. + // warp-mouse-to-focus - // Focus windows and outputs automatically when moving the mouse into them. - // Setting max-scroll-amount="0%" makes it work only on windows already fully on screen. - // focus-follows-mouse max-scroll-amount="0%" + // Focus windows and outputs automatically when moving the mouse into them. + // Setting max-scroll-amount="0%" makes it work only on windows already fully on screen. + // focus-follows-mouse max-scroll-amount="0%" } // You can configure outputs by their name, which you can find @@ -76,191 +76,203 @@ input { // https://yalter.github.io/niri/Configuration:-Outputs // Remember to uncomment the node by removing "/-"! output "eDP-1" { - // Uncomment this line to disable this output. - // off + // Uncomment this line to disable this output. + // off - // Resolution and, optionally, refresh rate of the output. - // The format is "x" or "x@". - // If the refresh rate is omitted, niri will pick the highest refresh rate - // for the resolution. - // If the mode is omitted altogether or is invalid, niri will pick one automatically. - // Run `niri msg outputs` while inside a niri instance to list all outputs and their modes. - // mode "1920x1080@120.030" + // Resolution and, optionally, refresh rate of the output. + // The format is "x" or "x@". + // If the refresh rate is omitted, niri will pick the highest refresh rate + // for the resolution. + // If the mode is omitted altogether or is invalid, niri will pick one automatically. + // Run `niri msg outputs` while inside a niri instance to list all outputs and their modes. + // mode "1920x1080@120.030" - // You can use integer or fractional scale, for example use 1.5 for 150% scale. - scale 1.5 + // You can use integer or fractional scale, for example use 1.5 for 150% scale. + scale 1.66 - // Transform allows to rotate the output counter-clockwise, valid values are: - // normal, 90, 180, 270, flipped, flipped-90, flipped-180 and flipped-270. - transform "normal" + // Transform allows to rotate the output counter-clockwise, valid values are: + // normal, 90, 180, 270, flipped, flipped-90, flipped-180 and flipped-270. + transform "normal" - // Position of the output in the global coordinate space. - // This affects directional monitor actions like "focus-monitor-left", and cursor movement. - // The cursor can only move between directly adjacent outputs. - // Output scale and rotation has to be taken into account for positioning: - // outputs are sized in logical, or scaled, pixels. - // For example, a 3840×2160 output with scale 2.0 will have a logical size of 1920×1080, - // so to put another output directly adjacent to it on the right, set its x to 1920. - // If the position is unset or results in an overlap, the output is instead placed - // automatically. - position x=1280 y=0 + // Position of the output in the global coordinate space. + // This affects directional monitor actions like "focus-monitor-left", and cursor movement. + // The cursor can only move between directly adjacent outputs. + // Output scale and rotation has to be taken into account for positioning: + // outputs are sized in logical, or scaled, pixels. + // For example, a 3840×2160 output with scale 2.0 will have a logical size of 1920×1080, + // so to put another output directly adjacent to it on the right, set its x to 1920. + // If the position is unset or results in an overlap, the output is instead placed + // automatically. + position x=320 y=1441 +} + +output "ViewSonic Corporation VX2758A-2K XLK245220057" { + position x=0 y=0 } // Settings that influence how windows are positioned and sized. // Find more information on the wiki: // https://yalter.github.io/niri/Configuration:-Layout layout { - // Set gaps around windows in logical pixels. - gaps 8 + // Set gaps around windows in logical pixels. + gaps 4 - //background-color "#351e4c" - // When to center a column when changing focus, options are: - // - "never", default behavior, focusing an off-screen column will keep at the left - // or right edge of the screen. - // - "always", the focused column will always be centered. - // - "on-overflow", focusing a column will center it if it doesn't fit - // together with the previously focused column. - center-focused-column "never" + //background-color "#351e4c" + // When to center a column when changing focus, options are: + // - "never", default behavior, focusing an off-screen column will keep at the left + // or right edge of the screen. + // - "always", the focused column will always be centered. + // - "on-overflow", focusing a column will center it if it doesn't fit + // together with the previously focused column. + center-focused-column "never" - // You can customize the widths that "switch-preset-column-width" (Mod+R) toggles between. - preset-column-widths { - // Proportion sets the width as a fraction of the output width, taking gaps into account. - // For example, you can perfectly fit four windows sized "proportion 0.25" on an output. - // The default preset widths are 1/3, 1/2 and 2/3 of the output. - proportion 0.33333 - proportion 0.5 - proportion 0.66667 + // You can customize the widths that "switch-preset-column-width" (Mod+R) toggles between. + preset-column-widths { + // Proportion sets the width as a fraction of the output width, taking gaps into account. + // For example, you can perfectly fit four windows sized "proportion 0.25" on an output. + // The default preset widths are 1/3, 1/2 and 2/3 of the output. + proportion 0.33333 + proportion 0.5 + proportion 0.66667 - // Fixed sets the width in logical pixels exactly. - // fixed 1920 - } + // Fixed sets the width in logical pixels exactly. + // fixed 1920 + } - // You can also customize the heights that "switch-preset-window-height" (Mod+Shift+R) toggles between. - // preset-window-heights { } + // You can also customize the heights that "switch-preset-window-height" (Mod+Shift+R) toggles between. + // preset-window-heights { } - // You can change the default width of the new windows. - default-column-width { proportion 0.5; } - // If you leave the brackets empty, the windows themselves will decide their initial width. - // default-column-width {} + // You can change the default width of the new windows. + default-column-width { proportion 0.5; } + // If you leave the brackets empty, the windows themselves will decide their initial width. + // default-column-width {} - // By default focus ring and border are rendered as a solid background rectangle - // behind windows. That is, they will show up through semitransparent windows. - // This is because windows using client-side decorations can have an arbitrary shape. - // - // If you don't like that, you should uncomment `prefer-no-csd` below. - // Niri will draw focus ring and border *around* windows that agree to omit their - // client-side decorations. - // - // Alternatively, you can override it with a window rule called - // `draw-border-with-background`. + // By default focus ring and border are rendered as a solid background rectangle + // behind windows. That is, they will show up through semitransparent windows. + // This is because windows using client-side decorations can have an arbitrary shape. + // + // If you don't like that, you should uncomment `prefer-no-csd` below. + // Niri will draw focus ring and border *around* windows that agree to omit their + // client-side decorations. + // + // Alternatively, you can override it with a window rule called + // `draw-border-with-background`. - // You can change how the focus ring looks. - focus-ring { - // Uncomment this line to disable the focus ring. - on + // You can change how the focus ring looks. + focus-ring { + // Uncomment this line to disable the focus ring. + off - // How many logical pixels the ring extends out from the windows. - width 4 + // How many logical pixels the ring extends out from the windows. + width 2 - // Colors can be set in a variety of ways: - // - CSS named colors: "red" - // - RGB hex: "#rgb", "#rgba", "#rrggbb", "#rrggbbaa" - // - CSS-like notation: "rgb(255, 127, 0)", rgba(), hsl() and a few others. + // Colors can be set in a variety of ways: + // - CSS named colors: "red" + // - RGB hex: "#rgb", "#rgba", "#rrggbb", "#rrggbbaa" + // - CSS-like notation: "rgb(255, 127, 0)", rgba(), hsl() and a few others. - // Color of the ring on the active monitor. - active-color "#7fc8ff" + // Color of the ring on the active monitor. + active-color "#7fc8ff" - // Color of the ring on inactive monitors. - // - // The focus ring only draws around the active window, so the only place - // where you can see its inactive-color is on other monitors. - inactive-color "#505050" + // Color of the ring on inactive monitors. + // + // The focus ring only draws around the active window, so the only place + // where you can see its inactive-color is on other monitors. + inactive-color "#505050" - // You can also use gradients. They take precedence over solid colors. - // Gradients are rendered the same as CSS linear-gradient(angle, from, to). - // The angle is the same as in linear-gradient, and is optional, - // defaulting to 180 (top-to-bottom gradient). - // You can use any CSS linear-gradient tool on the web to set these up. - // Changing the color space is also supported, check the wiki for more info. - // - // active-gradient from="#80c8ff" to="#c7ff7f" angle=45 + // You can also use gradients. They take precedence over solid colors. + // Gradients are rendered the same as CSS linear-gradient(angle, from, to). + // The angle is the same as in linear-gradient, and is optional, + // defaulting to 180 (top-to-bottom gradient). + // You can use any CSS linear-gradient tool on the web to set these up. + // Changing the color space is also supported, check the wiki for more info. + // + // active-gradient from="#80c8ff" to="#c7ff7f" angle=45 - // You can also color the gradient relative to the entire view - // of the workspace, rather than relative to just the window itself. - // To do that, set relative-to="workspace-view". - // - // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" - } + // You can also color the gradient relative to the entire view + // of the workspace, rather than relative to just the window itself. + // To do that, set relative-to="workspace-view". + // + // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" + } - // You can also add a border. It's similar to the focus ring, but always visible. - border { - // The settings are the same as for the focus ring. - // If you enable the border, you probably want to disable the focus ring. - off + // You can also add a border. It's similar to the focus ring, but always visible. + border { + // The settings are the same as for the focus ring. + // If you enable the border, you probably want to disable the focus ring. + on - width 4 - active-color "#ffc87f" - inactive-color "#505050" + width 2 + // active-color "#ffc87f" + active-color "#7fc8ff" + inactive-color "#505050" - // Color of the border around windows that request your attention. - urgent-color "#9b0000" + // Color of the border around windows that request your attention. + urgent-color "#9b0000" - // Gradients can use a few different interpolation color spaces. - // For example, this is a pastel rainbow gradient via in="oklch longer hue". - // - // active-gradient from="#e5989b" to="#ffb4a2" angle=45 relative-to="workspace-view" in="oklch longer hue" + // Gradients can use a few different interpolation color spaces. + // For example, this is a pastel rainbow gradient via in="oklch longer hue". + // + // active-gradient from="#e5989b" to="#ffb4a2" angle=45 relative-to="workspace-view" in="oklch longer hue" - // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" - } + // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" + } - // You can enable drop shadows for windows. - shadow { - // Uncomment the next line to enable shadows. - on + // You can enable drop shadows for windows. + shadow { + // Uncomment the next line to enable shadows. + on - // By default, the shadow draws only around its window, and not behind it. - // Uncomment this setting to make the shadow draw behind its window. - // - // Note that niri has no way of knowing about the CSD window corner - // radius. It has to assume that windows have square corners, leading to - // shadow artifacts inside the CSD rounded corners. This setting fixes - // those artifacts. - // - // However, instead you may want to set prefer-no-csd and/or - // geometry-corner-radius. Then, niri will know the corner radius and - // draw the shadow correctly, without having to draw it behind the - // window. These will also remove client-side shadows if the window - // draws any. - // - // draw-behind-window true + // By default, the shadow draws only around its window, and not behind it. + // Uncomment this setting to make the shadow draw behind its window. + // + // Note that niri has no way of knowing about the CSD window corner + // radius. It has to assume that windows have square corners, leading to + // shadow artifacts inside the CSD rounded corners. This setting fixes + // those artifacts. + // + // However, instead you may want to set prefer-no-csd and/or + // geometry-corner-radius. Then, niri will know the corner radius and + // draw the shadow correctly, without having to draw it behind the + // window. These will also remove client-side shadows if the window + // draws any. + // + // draw-behind-window true - // You can change how shadows look. The values below are in logical - // pixels and match the CSS box-shadow properties. + // You can change how shadows look. The values below are in logical + // pixels and match the CSS box-shadow properties. - // Softness controls the shadow blur radius. - softness 30 + // Softness controls the shadow blur radius. + softness 30 - // Spread expands the shadow. - spread 5 + // Spread expands the shadow. + spread 5 - // Offset moves the shadow relative to the window. - offset x=0 y=5 + // Offset moves the shadow relative to the window. + offset x=0 y=5 - // You can also change the shadow color and opacity. - color "#0007" - } + // You can also change the shadow color and opacity. + color "#0007" + } - // Struts shrink the area occupied by windows, similarly to layer-shell panels. - // You can think of them as a kind of outer gaps. They are set in logical pixels. - // Left and right struts will cause the next window to the side to always be visible. - // Top and bottom struts will simply add outer gaps in addition to the area occupied by - // layer-shell panels and regular gaps. - struts { - // left 64 - // right 64 - // top 64 - // bottom 64 - } + tab-indicator { + on + place-within-column + gap 3 + width 4 + } + + // Struts shrink the area occupied by windows, similarly to layer-shell panels. + // You can think of them as a kind of outer gaps. They are set in logical pixels. + // Left and right struts will cause the next window to the side to always be visible. + // Top and bottom struts will simply add outer gaps in addition to the area occupied by + // layer-shell panels and regular gaps. + struts { + // left 64 + // right 64 + // top 64 + // bottom 64 + } } // Add lines like this to spawn processes at startup. @@ -275,8 +287,8 @@ layout { // spawn-sh-at-startup "qs -c ~/source/qs/MyAwesomeShell" hotkey-overlay { - // Uncomment this line to disable the "Important Hotkeys" pop-up at startup. - // skip-at-startup + // Uncomment this line to disable the "Important Hotkeys" pop-up at startup. + skip-at-startup } // Uncomment this line to ask the clients to omit their client-side decorations if possible. @@ -285,7 +297,6 @@ hotkey-overlay { // This option will also fix border/focus ring drawing behind some semitransparent windows. // After enabling or disabling this, you need to restart the apps for this to take effect. prefer-no-csd - // You can change the path where screenshots are saved. // A ~ at the front will be expanded to the home directory. // The path is formatted with strftime(3) to give you the screenshot date and time. @@ -298,11 +309,11 @@ screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png" // The wiki explains how to configure individual animations: // https://yalter.github.io/niri/Configuration:-Animations animations { - // Uncomment to turn off all animations. - // off + // Uncomment to turn off all animations. + // off - // Slow down all animations by this factor. Values below 1 speed them up instead. - // slowdown 3.0 + // Slow down all animations by this factor. Values below 1 speed them up instead. + // slowdown 3.0 } // Window rules let you adjust behavior for individual windows. @@ -312,305 +323,333 @@ animations { // Work around WezTerm's initial configure bug // by setting an empty default-column-width. window-rule { - // This regular expression is intentionally made as specific as possible, - // since this is the default config, and we want no false positives. - // You can get away with just app-id="wezterm" if you want. - match app-id=r#"^org\.wezfurlong\.wezterm$"# - default-column-width {} + // This regular expression is intentionally made as specific as possible, + // since this is the default config, and we want no false positives. + // You can get away with just app-id="wezterm" if you want. + match app-id=r#"^org\.wezfurlong\.wezterm$"# + default-column-width {} } // Open the Firefox picture-in-picture player as floating by default. window-rule { - // This app-id regular expression will work for both: - // - host Firefox (app-id is "firefox") - // - Flatpak Firefox (app-id is "org.mozilla.firefox") - match app-id=r#"firefox$"# title="^Picture-in-Picture$" - open-floating true + // This app-id regular expression will work for both: + // - host Firefox (app-id is "firefox") + // - Flatpak Firefox (app-id is "org.mozilla.firefox") + match app-id=r#"firefox$"# title="^Picture-in-Picture$" + open-floating true +} + +window-rule { + match app-id=r#"ipe$"# title="^Ipe: waiting$" + open-floating true + open-focused false + default-floating-position x=8 y=8 relative-to="bottom-left" + max-width 169 + max-height 37 +} + +// window-rule { +// match app-id=r#"ipe$"# title="^Create text object$" +// open-floating false +// default-column-width { proportion 0.2; } +// } + +window-rule { + match is-floating=true + baba-is-float false } // Example: block out two password managers from screen capture. // (This example rule is commented out with a "/-" in front.) -/-window-rule { - match app-id=r#"^org\.keepassxc\.KeePassXC$"# - match app-id=r#"^org\.gnome\.World\.Secrets$"# +window-rule { + match app-id=r#"^org\.keepassxc\.KeePassXC$"# + match app-id=r#"^org\.gnome\.World\.Secrets$"# - block-out-from "screen-capture" + block-out-from "screen-capture" - // Use this instead if you want them visible on third-party screenshot tools. - // block-out-from "screencast" + // Use this instead if you want them visible on third-party screenshot tools. + // block-out-from "screencast" } // Example: enable rounded corners for all windows. // (This example rule is commented out with a "/-" in front.) /-window-rule { - geometry-corner-radius 12 - clip-to-geometry true + geometry-corner-radius 12 + clip-to-geometry true } binds { - // Keys consist of modifiers separated by + signs, followed by an XKB key name - // in the end. To find an XKB name for a particular key, you may use a program - // like wev. - // - // "Mod" is a special modifier equal to Super when running on a TTY, and to Alt - // when running as a winit window. - // - // Most actions that you can bind here can also be invoked programmatically with - // `niri msg action do-something`. + // Keys consist of modifiers separated by + signs, followed by an XKB key name + // in the end. To find an XKB name for a particular key, you may use a program + // like wev. + // + // "Mod" is a special modifier equal to Super when running on a TTY, and to Alt + // when running as a winit window. + // + // Most actions that you can bind here can also be invoked programmatically with + // `niri msg action do-something`. + + // Mod-Shift-/, which is usually the same as Mod-?, + // shows a list of important hotkeys. + Mod+Shift+0 { show-hotkey-overlay; } - // Mod-Shift-/, which is usually the same as Mod-?, - // shows a list of important hotkeys. - Mod+Shift+0 { show-hotkey-overlay; } + // Suggested binds for running programs: terminal, app launcher, screen locker. + Mod+Return hotkey-overlay-title="Open a Terminal: alacritty" { spawn-sh "alacritty msg create-window"; } + Mod+D hotkey-overlay-title="Run an Application: fuzzel" { spawn "fuzzel"; } + Mod+Shift+D hotkey-overlay-title="Switch to Window: fuzzel" { spawn "windowmenu.fish"; } + Mod+B hotkey-overlay-title="Search the Web: fuzzel" { spawn "browserprompt.fish"; } + Mod+E hotkey-overlay-title="Open Email Client: evolution" { spawn "evolution"; } + Super+Alt+L hotkey-overlay-title="Lock the Screen: swaylock" { spawn "swaylock"; } + Mod+P hotkey-overlay-title="Show the Power menu: fuzzel" { spawn "powermenu.fish"; } + Mod+A hotkey-overlay-title="Show the Action menu: fuzzel" { spawn "actionmenu.fish"; } + // Use spawn-sh to run a shell command. Do this if you need pipes, multiple commands, etc. + // Note: the entire command goes as a single argument. It's passed verbatim to `sh -c`. + // For example, this is a standard bind to toggle the screen reader (orca). + Super+Alt+S allow-when-locked=true hotkey-overlay-title=null { spawn-sh "pkill orca || exec orca"; } - // Suggested binds for running programs: terminal, app launcher, screen locker. - Mod+Return hotkey-overlay-title="Open a Terminal: alacritty" { spawn "alacritty"; } - Mod+D hotkey-overlay-title="Run an Application: fuzzel" { spawn "fuzzel"; } - Super+Alt+L hotkey-overlay-title="Lock the Screen: swaylock" { spawn "swaylock"; } + // Example volume keys mappings for PipeWire & WirePlumber. + // The allow-when-locked=true property makes them work even when the session is locked. + // Using spawn-sh allows to pass multiple arguments together with the command. + XF86AudioRaiseVolume allow-when-locked=true { spawn-sh "wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 0.05+ && volumenotify.fish"; } + XF86AudioLowerVolume allow-when-locked=true { spawn-sh "wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 0.05- && volumenotify.fish"; } + XF86AudioMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && volumenotify.fish"; } + XF86AudioMicMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; } - // Use spawn-sh to run a shell command. Do this if you need pipes, multiple commands, etc. - // Note: the entire command goes as a single argument. It's passed verbatim to `sh -c`. - // For example, this is a standard bind to toggle the screen reader (orca). - Super+Alt+S allow-when-locked=true hotkey-overlay-title=null { spawn-sh "pkill orca || exec orca"; } + XF86AudioPlay allow-when-locked=true { spawn-sh "mpc toggle"; } + XF86AudioPrev allow-when-locked=true { spawn-sh "mpc prev"; } + XF86AudioNext allow-when-locked=true { spawn-sh "mpc next"; } + // Example brightness key mappings for brightnessctl. + // You can use regular spawn with multiple arguments too (to avoid going through "sh"), + // but you need to manually put each argument in separate "" quotes. + XF86MonBrightnessUp allow-when-locked=true { spawn-sh "brightnessctl --class=backlight set +5% && brightnessnotify.fish"; } + XF86MonBrightnessDown allow-when-locked=true { spawn-sh "brightnessctl --class=backlight set 5%- && brightnessnotify.fish"; } + - // Example volume keys mappings for PipeWire & WirePlumber. - // The allow-when-locked=true property makes them work even when the session is locked. - // Using spawn-sh allows to pass multiple arguments together with the command. - XF86AudioRaiseVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+"; } - XF86AudioLowerVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-"; } - XF86AudioMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; } - XF86AudioMicMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; } + // Open/close the Overview: a zoomed-out view of workspaces and windows. + // You can also move the mouse into the top-left hot corner, + // or do a four-finger swipe up on a touchpad. + Mod+O repeat=false { toggle-overview; } - // Example brightness key mappings for brightnessctl. - // You can use regular spawn with multiple arguments too (to avoid going through "sh"), - // but you need to manually put each argument in separate "" quotes. - XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "+10%"; } - XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "10%-"; } + Mod+Q repeat=false { close-window; } - // Open/close the Overview: a zoomed-out view of workspaces and windows. - // You can also move the mouse into the top-left hot corner, - // or do a four-finger swipe up on a touchpad. - Mod+O repeat=false { toggle-overview; } + Mod+Left { focus-column-left; } + Mod+Down { focus-window-down; } + Mod+Up { focus-window-up; } + Mod+Right { focus-column-right; } + Mod+H { focus-column-left; } + Mod+J { focus-window-down; } + Mod+K { focus-window-up; } + Mod+L { focus-column-right; } - Mod+Q repeat=false { close-window; } + Mod+Ctrl+Left { move-column-left; } + Mod+Ctrl+Down { move-window-down; } + Mod+Ctrl+Up { move-window-up; } + Mod+Ctrl+Right { move-column-right; } + Mod+Ctrl+H { move-column-left; } + Mod+Ctrl+J { move-window-down; } + Mod+Ctrl+K { move-window-up; } + Mod+Ctrl+L { move-column-right; } - Mod+Left { focus-column-left; } - Mod+Down { focus-window-down; } - Mod+Up { focus-window-up; } - Mod+Right { focus-column-right; } - Mod+H { focus-column-left; } - Mod+J { focus-window-down; } - Mod+K { focus-window-up; } - Mod+L { focus-column-right; } + // Alternative commands that move across workspaces when reaching + // the first or last window in a column. + // Mod+J { focus-window-or-workspace-down; } + // Mod+K { focus-window-or-workspace-up; } + // Mod+Ctrl+J { move-window-down-or-to-workspace-down; } + // Mod+Ctrl+K { move-window-up-or-to-workspace-up; } - Mod+Ctrl+Left { move-column-left; } - Mod+Ctrl+Down { move-window-down; } - Mod+Ctrl+Up { move-window-up; } - Mod+Ctrl+Right { move-column-right; } - Mod+Ctrl+H { move-column-left; } - Mod+Ctrl+J { move-window-down; } - Mod+Ctrl+K { move-window-up; } - Mod+Ctrl+L { move-column-right; } + Mod+Home { focus-column-first; } + Mod+End { focus-column-last; } + Mod+Ctrl+Home { move-column-to-first; } + Mod+Ctrl+End { move-column-to-last; } - // Alternative commands that move across workspaces when reaching - // the first or last window in a column. - // Mod+J { focus-window-or-workspace-down; } - // Mod+K { focus-window-or-workspace-up; } - // Mod+Ctrl+J { move-window-down-or-to-workspace-down; } - // Mod+Ctrl+K { move-window-up-or-to-workspace-up; } + Mod+Shift+Left { focus-monitor-left; } + Mod+Shift+Down { focus-monitor-down; } + Mod+Shift+Up { focus-monitor-up; } + Mod+Shift+Right { focus-monitor-right; } + Mod+Shift+H { focus-monitor-left; } + Mod+Shift+J { focus-monitor-down; } + Mod+Shift+K { focus-monitor-up; } + Mod+Shift+L { focus-monitor-right; } - Mod+Home { focus-column-first; } - Mod+End { focus-column-last; } - Mod+Ctrl+Home { move-column-to-first; } - Mod+Ctrl+End { move-column-to-last; } + Mod+Shift+Ctrl+Left { move-column-to-monitor-left; } + Mod+Shift+Ctrl+Down { move-column-to-monitor-down; } + Mod+Shift+Ctrl+Up { move-column-to-monitor-up; } + Mod+Shift+Ctrl+Right { move-column-to-monitor-right; } + Mod+Shift+Ctrl+H { move-column-to-monitor-left; } + Mod+Shift+Ctrl+J { move-column-to-monitor-down; } + Mod+Shift+Ctrl+K { move-column-to-monitor-up; } + Mod+Shift+Ctrl+L { move-column-to-monitor-right; } - Mod+Shift+Left { focus-monitor-left; } - Mod+Shift+Down { focus-monitor-down; } - Mod+Shift+Up { focus-monitor-up; } - Mod+Shift+Right { focus-monitor-right; } - Mod+Shift+H { focus-monitor-left; } - Mod+Shift+J { focus-monitor-down; } - Mod+Shift+K { focus-monitor-up; } - Mod+Shift+L { focus-monitor-right; } + // Alternatively, there are commands to move just a single window: + // Mod+Shift+Ctrl+Left { move-window-to-monitor-left; } + // ... - Mod+Shift+Ctrl+Left { move-column-to-monitor-left; } - Mod+Shift+Ctrl+Down { move-column-to-monitor-down; } - Mod+Shift+Ctrl+Up { move-column-to-monitor-up; } - Mod+Shift+Ctrl+Right { move-column-to-monitor-right; } - Mod+Shift+Ctrl+H { move-column-to-monitor-left; } - Mod+Shift+Ctrl+J { move-column-to-monitor-down; } - Mod+Shift+Ctrl+K { move-column-to-monitor-up; } - Mod+Shift+Ctrl+L { move-column-to-monitor-right; } + // And you can also move a whole workspace to another monitor: + // Mod+Shift+Ctrl+Left { move-workspace-to-monitor-left; } + // ... - // Alternatively, there are commands to move just a single window: - // Mod+Shift+Ctrl+Left { move-window-to-monitor-left; } - // ... + Mod+Page_Down { focus-workspace-down; } + Mod+Page_Up { focus-workspace-up; } + Mod+U { focus-workspace-down; } + Mod+I { focus-workspace-up; } + Mod+Ctrl+Page_Down { move-column-to-workspace-down; } + Mod+Ctrl+Page_Up { move-column-to-workspace-up; } + Mod+Ctrl+U { move-column-to-workspace-down; } + Mod+Ctrl+I { move-column-to-workspace-up; } - // And you can also move a whole workspace to another monitor: - // Mod+Shift+Ctrl+Left { move-workspace-to-monitor-left; } - // ... + // Alternatively, there are commands to move just a single window: + // Mod+Ctrl+Page_Down { move-window-to-workspace-down; } + // ... - Mod+Page_Down { focus-workspace-down; } - Mod+Page_Up { focus-workspace-up; } - Mod+U { focus-workspace-down; } - Mod+I { focus-workspace-up; } - Mod+Ctrl+Page_Down { move-column-to-workspace-down; } - Mod+Ctrl+Page_Up { move-column-to-workspace-up; } - Mod+Ctrl+U { move-column-to-workspace-down; } - Mod+Ctrl+I { move-column-to-workspace-up; } + Mod+Shift+Page_Down { move-workspace-down; } + Mod+Shift+Page_Up { move-workspace-up; } + Mod+Shift+U { move-workspace-down; } + Mod+Shift+I { move-workspace-up; } - // Alternatively, there are commands to move just a single window: - // Mod+Ctrl+Page_Down { move-window-to-workspace-down; } - // ... + // You can bind mouse wheel scroll ticks using the following syntax. + // These binds will change direction based on the natural-scroll setting. + // + // To avoid scrolling through workspaces really fast, you can use + // the cooldown-ms property. The bind will be rate-limited to this value. + // You can set a cooldown on any bind, but it's most useful for the wheel. + Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } + Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; } + Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; } + Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; } - Mod+Shift+Page_Down { move-workspace-down; } - Mod+Shift+Page_Up { move-workspace-up; } - Mod+Shift+U { move-workspace-down; } - Mod+Shift+I { move-workspace-up; } + Mod+WheelScrollRight { focus-column-right; } + Mod+WheelScrollLeft { focus-column-left; } + Mod+Ctrl+WheelScrollRight { move-column-right; } + Mod+Ctrl+WheelScrollLeft { move-column-left; } - // You can bind mouse wheel scroll ticks using the following syntax. - // These binds will change direction based on the natural-scroll setting. - // - // To avoid scrolling through workspaces really fast, you can use - // the cooldown-ms property. The bind will be rate-limited to this value. - // You can set a cooldown on any bind, but it's most useful for the wheel. - Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } - Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; } - Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; } - Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; } + // Usually scrolling up and down with Shift in applications results in + // horizontal scrolling; these binds replicate that. + Mod+Shift+WheelScrollDown { focus-column-right; } + Mod+Shift+WheelScrollUp { focus-column-left; } + Mod+Ctrl+Shift+WheelScrollDown { move-column-right; } + Mod+Ctrl+Shift+WheelScrollUp { move-column-left; } - Mod+WheelScrollRight { focus-column-right; } - Mod+WheelScrollLeft { focus-column-left; } - Mod+Ctrl+WheelScrollRight { move-column-right; } - Mod+Ctrl+WheelScrollLeft { move-column-left; } + // Similarly, you can bind touchpad scroll "ticks". + // Touchpad scrolling is continuous, so for these binds it is split into + // discrete intervals. + // These binds are also affected by touchpad's natural-scroll, so these + // example binds are "inverted", since we have natural-scroll enabled for + // touchpads by default. + // Mod+TouchpadScrollDown { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02+"; } + // Mod+TouchpadScrollUp { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02-"; } - // Usually scrolling up and down with Shift in applications results in - // horizontal scrolling; these binds replicate that. - Mod+Shift+WheelScrollDown { focus-column-right; } - Mod+Shift+WheelScrollUp { focus-column-left; } - Mod+Ctrl+Shift+WheelScrollDown { move-column-right; } - Mod+Ctrl+Shift+WheelScrollUp { move-column-left; } + // You can refer to workspaces by index. However, keep in mind that + // niri is a dynamic workspace system, so these commands are kind of + // "best effort". Trying to refer to a workspace index bigger than + // the current workspace count will instead refer to the bottommost + // (empty) workspace. + // + // For example, with 2 workspaces + 1 empty, indices 3, 4, 5 and so on + // will all refer to the 3rd workspace. + Mod+1 { focus-workspace 1; } + Mod+2 { focus-workspace 2; } + Mod+3 { focus-workspace 3; } + Mod+4 { focus-workspace 4; } + Mod+5 { focus-workspace 5; } + Mod+6 { focus-workspace 6; } + Mod+7 { focus-workspace 7; } + Mod+8 { focus-workspace 8; } + Mod+9 { focus-workspace 9; } + Mod+Ctrl+1 { move-column-to-workspace 1; } + Mod+Ctrl+2 { move-column-to-workspace 2; } + Mod+Ctrl+3 { move-column-to-workspace 3; } + Mod+Ctrl+4 { move-column-to-workspace 4; } + Mod+Ctrl+5 { move-column-to-workspace 5; } + Mod+Ctrl+6 { move-column-to-workspace 6; } + Mod+Ctrl+7 { move-column-to-workspace 7; } + Mod+Ctrl+8 { move-column-to-workspace 8; } + Mod+Ctrl+9 { move-column-to-workspace 9; } - // Similarly, you can bind touchpad scroll "ticks". - // Touchpad scrolling is continuous, so for these binds it is split into - // discrete intervals. - // These binds are also affected by touchpad's natural-scroll, so these - // example binds are "inverted", since we have natural-scroll enabled for - // touchpads by default. - // Mod+TouchpadScrollDown { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02+"; } - // Mod+TouchpadScrollUp { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02-"; } + // Alternatively, there are commands to move just a single window: + // Mod+Ctrl+1 { move-window-to-workspace 1; } - // You can refer to workspaces by index. However, keep in mind that - // niri is a dynamic workspace system, so these commands are kind of - // "best effort". Trying to refer to a workspace index bigger than - // the current workspace count will instead refer to the bottommost - // (empty) workspace. - // - // For example, with 2 workspaces + 1 empty, indices 3, 4, 5 and so on - // will all refer to the 3rd workspace. - Mod+1 { focus-workspace 1; } - Mod+2 { focus-workspace 2; } - Mod+3 { focus-workspace 3; } - Mod+4 { focus-workspace 4; } - Mod+5 { focus-workspace 5; } - Mod+6 { focus-workspace 6; } - Mod+7 { focus-workspace 7; } - Mod+8 { focus-workspace 8; } - Mod+9 { focus-workspace 9; } - Mod+Ctrl+1 { move-column-to-workspace 1; } - Mod+Ctrl+2 { move-column-to-workspace 2; } - Mod+Ctrl+3 { move-column-to-workspace 3; } - Mod+Ctrl+4 { move-column-to-workspace 4; } - Mod+Ctrl+5 { move-column-to-workspace 5; } - Mod+Ctrl+6 { move-column-to-workspace 6; } - Mod+Ctrl+7 { move-column-to-workspace 7; } - Mod+Ctrl+8 { move-column-to-workspace 8; } - Mod+Ctrl+9 { move-column-to-workspace 9; } + // Switches focus between the current and the previous workspace. + // Mod+Tab { focus-workspace-previous; } - // Alternatively, there are commands to move just a single window: - // Mod+Ctrl+1 { move-window-to-workspace 1; } + // The following binds move the focused window in and out of a column. + // If the window is alone, they will consume it into the nearby column to the side. + // If the window is already in a column, they will expel it out. + Mod+Ctrl+Y { consume-or-expel-window-left; } + Mod+Ctrl+O { consume-or-expel-window-right; } - // Switches focus between the current and the previous workspace. - // Mod+Tab { focus-workspace-previous; } + // Consume one window from the right to the bottom of the focused column. + Mod+Comma { consume-window-into-column; } + // Expel the bottom window from the focused column to the right. + Mod+Period { expel-window-from-column; } - // The following binds move the focused window in and out of a column. - // If the window is alone, they will consume it into the nearby column to the side. - // If the window is already in a column, they will expel it out. - Mod+BracketLeft { consume-or-expel-window-left; } - Mod+BracketRight { consume-or-expel-window-right; } + Mod+R { switch-preset-column-width; } + // Cycling through the presets in reverse order is also possible. + // Mod+R { switch-preset-column-width-back; } + Mod+Shift+R { switch-preset-window-height; } + Mod+Ctrl+R { reset-window-height; } + Mod+F { maximize-column; } + Mod+Shift+F { fullscreen-window; } - // Consume one window from the right to the bottom of the focused column. - Mod+Comma { consume-window-into-column; } - // Expel the bottom window from the focused column to the right. - Mod+Period { expel-window-from-column; } + // Expand the focused column to space not taken up by other fully visible columns. + // Makes the column "fill the rest of the space". + Mod+Ctrl+F { expand-column-to-available-width; } - Mod+R { switch-preset-column-width; } - // Cycling through the presets in reverse order is also possible. - // Mod+R { switch-preset-column-width-back; } - Mod+Shift+R { switch-preset-window-height; } - Mod+Ctrl+R { reset-window-height; } - Mod+F { maximize-column; } - Mod+Shift+F { fullscreen-window; } + Mod+C { center-column; } - // Expand the focused column to space not taken up by other fully visible columns. - // Makes the column "fill the rest of the space". - Mod+Ctrl+F { expand-column-to-available-width; } + // Center all fully visible columns on screen. + Mod+Ctrl+C { center-visible-columns; } - Mod+C { center-column; } + // Finer width adjustments. + // This command can also: + // * set width in pixels: "1000" + // * adjust width in pixels: "-5" or "+5" + // * set width as a percentage of screen width: "25%" + // * adjust width as a percentage of screen width: "-10%" or "+10%" + // Pixel sizes use logical, or scaled, pixels. I.e. on an output with scale 2.0, + // set-column-width "100" will make the column occupy 200 physical screen pixels. + Mod+Minus { set-column-width "-10%"; } + Mod+Equal { set-column-width "+10%"; } - // Center all fully visible columns on screen. - Mod+Ctrl+C { center-visible-columns; } + // Finer height adjustments when in column with other windows. + Mod+Shift+Minus { set-window-height "-10%"; } + Mod+Shift+Equal { set-window-height "+10%"; } - // Finer width adjustments. - // This command can also: - // * set width in pixels: "1000" - // * adjust width in pixels: "-5" or "+5" - // * set width as a percentage of screen width: "25%" - // * adjust width as a percentage of screen width: "-10%" or "+10%" - // Pixel sizes use logical, or scaled, pixels. I.e. on an output with scale 2.0, - // set-column-width "100" will make the column occupy 200 physical screen pixels. - Mod+Minus { set-column-width "-10%"; } - Mod+Plus { set-column-width "+10%"; } + // Move the focused window between the floating and the tiling layout. + Mod+V { toggle-window-floating; } + Mod+Shift+V { switch-focus-between-floating-and-tiling; } - // Finer height adjustments when in column with other windows. - Mod+Shift+Minus { set-window-height "-10%"; } - Mod+Shift+Plus { set-window-height "+10%"; } + // Toggle tabbed column display mode. + // Windows in this column will appear as vertical tabs, + // rather than stacked on top of each other. + Mod+W { toggle-column-tabbed-display; } - // Move the focused window between the floating and the tiling layout. - Mod+V { toggle-window-floating; } - Mod+Shift+V { switch-focus-between-floating-and-tiling; } + // Actions to switch layouts. + // Note: if you uncomment these, make sure you do NOT have + // a matching layout switch hotkey configured in xkb options above. + // Having both at once on the same hotkey will break the switching, + // since it will switch twice upon pressing the hotkey (once by xkb, once by niri). + // Mod+Space { switch-layout "next"; } + // Mod+Shift+Space { switch-layout "prev"; } - // Toggle tabbed column display mode. - // Windows in this column will appear as vertical tabs, - // rather than stacked on top of each other. - Mod+W { toggle-column-tabbed-display; } + Print { screenshot; } + Ctrl+Print { screenshot-screen; } + Alt+Print { screenshot-window; } - // Actions to switch layouts. - // Note: if you uncomment these, make sure you do NOT have - // a matching layout switch hotkey configured in xkb options above. - // Having both at once on the same hotkey will break the switching, - // since it will switch twice upon pressing the hotkey (once by xkb, once by niri). - // Mod+Space { switch-layout "next"; } - // Mod+Shift+Space { switch-layout "prev"; } + // Applications such as remote-desktop clients and software KVM switches may + // request that niri stops processing the keyboard shortcuts defined here + // so they may, for example, forward the key presses as-is to a remote machine. + // It's a good idea to bind an escape hatch to toggle the inhibitor, + // so a buggy application can't hold your session hostage. + // + // The allow-inhibiting=false property can be applied to other binds as well, + // which ensures niri always processes them, even when an inhibitor is active. + Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; } - Print { screenshot; } - Ctrl+Print { screenshot-screen; } - Alt+Print { screenshot-window; } + // The quit action will show a confirmation dialog to avoid accidental exits. + Mod+Shift+E { quit; } + Ctrl+Alt+Delete { quit; } - // Applications such as remote-desktop clients and software KVM switches may - // request that niri stops processing the keyboard shortcuts defined here - // so they may, for example, forward the key presses as-is to a remote machine. - // It's a good idea to bind an escape hatch to toggle the inhibitor, - // so a buggy application can't hold your session hostage. - // - // The allow-inhibiting=false property can be applied to other binds as well, - // which ensures niri always processes them, even when an inhibitor is active. - Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; } - - // The quit action will show a confirmation dialog to avoid accidental exits. - Mod+Shift+E { quit; } - Ctrl+Alt+Delete { quit; } - - // Powers off the monitors. To turn them back on, do any input like - // moving the mouse or pressing any other key. - Mod+Shift+P { power-off-monitors; } + // Powers off the monitors. To turn them back on, do any input like + // moving the mouse or pressing any other key. + Mod+Shift+P { power-off-monitors; } } diff --git a/.config/niri/config.kdl.cosmic b/.config/niri/config.kdl.cosmic new file mode 100644 index 0000000..e8060dc --- /dev/null +++ b/.config/niri/config.kdl.cosmic @@ -0,0 +1,662 @@ +// This config is in the KDL format: https://kdl.dev +// "/-" comments out the following node. +// Check the wiki for a full description of the configuration: +// https://yalter.github.io/niri/Configuration:-Introduction + +// Input device configuration. +// Find the full list of options on the wiki: +// https://yalter.github.io/niri/Configuration:-Input +input { + keyboard { + xkb { + // You can set rules, model, layout, variant and options. + // For more information, see xkeyboard-config(7). + + // For example: + layout "de(us)" + options "caps:escape" + + // If this section is empty, niri will fetch xkb settings + // from org.freedesktop.locale1. You can control these using + // localectl set-x11-keymap. + } + + // Enable numlock on startup, omitting this setting disables it. + numlock + } + + // Next sections include libinput settings. + // Omitting settings disables them, or leaves them at their default values. + // All commented-out settings here are examples, not defaults. + touchpad { + // off + tap + dwt + // dwtp + // drag false + // drag-lock + natural-scroll + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "two-finger" + // disabled-on-external-mouse + } + + mouse { + // off + // natural-scroll + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "no-scroll" + } + + trackpoint { + // off + // natural-scroll + // accel-speed 0.2 + // accel-profile "flat" + // scroll-method "on-button-down" + // scroll-button 273 + // scroll-button-lock + // middle-emulation + } + + // Uncomment this to make the mouse warp to the center of newly focused windows. + // warp-mouse-to-focus + + // Focus windows and outputs automatically when moving the mouse into them. + // Setting max-scroll-amount="0%" makes it work only on windows already fully on screen. + // focus-follows-mouse max-scroll-amount="0%" +} + +// You can configure outputs by their name, which you can find +// by running `niri msg outputs` while inside a niri instance. +// The built-in laptop monitor is usually called "eDP-1". +// Find more information on the wiki: +// https://yalter.github.io/niri/Configuration:-Outputs +// Remember to uncomment the node by removing "/-"! +output "eDP-1" { + // Uncomment this line to disable this output. + // off + + // Resolution and, optionally, refresh rate of the output. + // The format is "x" or "x@". + // If the refresh rate is omitted, niri will pick the highest refresh rate + // for the resolution. + // If the mode is omitted altogether or is invalid, niri will pick one automatically. + // Run `niri msg outputs` while inside a niri instance to list all outputs and their modes. + // mode "1920x1080@120.030" + + // You can use integer or fractional scale, for example use 1.5 for 150% scale. + scale 1.66 + + // Transform allows to rotate the output counter-clockwise, valid values are: + // normal, 90, 180, 270, flipped, flipped-90, flipped-180 and flipped-270. + transform "normal" + + // Position of the output in the global coordinate space. + // This affects directional monitor actions like "focus-monitor-left", and cursor movement. + // The cursor can only move between directly adjacent outputs. + // Output scale and rotation has to be taken into account for positioning: + // outputs are sized in logical, or scaled, pixels. + // For example, a 3840×2160 output with scale 2.0 will have a logical size of 1920×1080, + // so to put another output directly adjacent to it on the right, set its x to 1920. + // If the position is unset or results in an overlap, the output is instead placed + // automatically. + position x=320 y=1441 +} + +output "ViewSonic Corporation VX2758A-2K XLK245220057" { + position x=0 y=0 +} + +// Settings that influence how windows are positioned and sized. +// Find more information on the wiki: +// https://yalter.github.io/niri/Configuration:-Layout +layout { + // Set gaps around windows in logical pixels. + gaps 4 + + //background-color "#351e4c" + // When to center a column when changing focus, options are: + // - "never", default behavior, focusing an off-screen column will keep at the left + // or right edge of the screen. + // - "always", the focused column will always be centered. + // - "on-overflow", focusing a column will center it if it doesn't fit + // together with the previously focused column. + center-focused-column "never" + + // You can customize the widths that "switch-preset-column-width" (Mod+R) toggles between. + preset-column-widths { + // Proportion sets the width as a fraction of the output width, taking gaps into account. + // For example, you can perfectly fit four windows sized "proportion 0.25" on an output. + // The default preset widths are 1/3, 1/2 and 2/3 of the output. + proportion 0.33333 + proportion 0.5 + proportion 0.66667 + + // Fixed sets the width in logical pixels exactly. + // fixed 1920 + } + + // You can also customize the heights that "switch-preset-window-height" (Mod+Shift+R) toggles between. + // preset-window-heights { } + + // You can change the default width of the new windows. + default-column-width { proportion 0.5; } + // If you leave the brackets empty, the windows themselves will decide their initial width. + // default-column-width {} + + // By default focus ring and border are rendered as a solid background rectangle + // behind windows. That is, they will show up through semitransparent windows. + // This is because windows using client-side decorations can have an arbitrary shape. + // + // If you don't like that, you should uncomment `prefer-no-csd` below. + // Niri will draw focus ring and border *around* windows that agree to omit their + // client-side decorations. + // + // Alternatively, you can override it with a window rule called + // `draw-border-with-background`. + + // You can change how the focus ring looks. + focus-ring { + // Uncomment this line to disable the focus ring. + off + + // How many logical pixels the ring extends out from the windows. + width 2 + + // Colors can be set in a variety of ways: + // - CSS named colors: "red" + // - RGB hex: "#rgb", "#rgba", "#rrggbb", "#rrggbbaa" + // - CSS-like notation: "rgb(255, 127, 0)", rgba(), hsl() and a few others. + + // Color of the ring on the active monitor. + active-color "#7fc8ff" + + // Color of the ring on inactive monitors. + // + // The focus ring only draws around the active window, so the only place + // where you can see its inactive-color is on other monitors. + inactive-color "#505050" + + // You can also use gradients. They take precedence over solid colors. + // Gradients are rendered the same as CSS linear-gradient(angle, from, to). + // The angle is the same as in linear-gradient, and is optional, + // defaulting to 180 (top-to-bottom gradient). + // You can use any CSS linear-gradient tool on the web to set these up. + // Changing the color space is also supported, check the wiki for more info. + // + // active-gradient from="#80c8ff" to="#c7ff7f" angle=45 + + // You can also color the gradient relative to the entire view + // of the workspace, rather than relative to just the window itself. + // To do that, set relative-to="workspace-view". + // + // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" + } + + // You can also add a border. It's similar to the focus ring, but always visible. + border { + // The settings are the same as for the focus ring. + // If you enable the border, you probably want to disable the focus ring. + on + + width 2 + // active-color "#ffc87f" + active-color "#7fc8ff" + inactive-color "#505050" + + // Color of the border around windows that request your attention. + urgent-color "#9b0000" + + // Gradients can use a few different interpolation color spaces. + // For example, this is a pastel rainbow gradient via in="oklch longer hue". + // + // active-gradient from="#e5989b" to="#ffb4a2" angle=45 relative-to="workspace-view" in="oklch longer hue" + + // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" + } + + // You can enable drop shadows for windows. + shadow { + // Uncomment the next line to enable shadows. + on + + // By default, the shadow draws only around its window, and not behind it. + // Uncomment this setting to make the shadow draw behind its window. + // + // Note that niri has no way of knowing about the CSD window corner + // radius. It has to assume that windows have square corners, leading to + // shadow artifacts inside the CSD rounded corners. This setting fixes + // those artifacts. + // + // However, instead you may want to set prefer-no-csd and/or + // geometry-corner-radius. Then, niri will know the corner radius and + // draw the shadow correctly, without having to draw it behind the + // window. These will also remove client-side shadows if the window + // draws any. + // + // draw-behind-window true + + // You can change how shadows look. The values below are in logical + // pixels and match the CSS box-shadow properties. + + // Softness controls the shadow blur radius. + softness 30 + + // Spread expands the shadow. + spread 5 + + // Offset moves the shadow relative to the window. + offset x=0 y=5 + + // You can also change the shadow color and opacity. + color "#0007" + } + + tab-indicator { + on + place-within-column + gap 3 + width 4 + } + + // Struts shrink the area occupied by windows, similarly to layer-shell panels. + // You can think of them as a kind of outer gaps. They are set in logical pixels. + // Left and right struts will cause the next window to the side to always be visible. + // Top and bottom struts will simply add outer gaps in addition to the area occupied by + // layer-shell panels and regular gaps. + struts { + // left 64 + // right 64 + // top 64 + // bottom 64 + } +} + +// Add lines like this to spawn processes at startup. +// Note that running niri as a session supports xdg-desktop-autostart, +// which may be more convenient to use. +// See the binds section below for more spawn examples. + +// This line starts waybar, a commonly used bar for Wayland compositors. +// spawn-at-startup "waybar" + +// To run a shell command (with variables, pipes, etc.), use spawn-sh-at-startup: +// spawn-sh-at-startup "qs -c ~/source/qs/MyAwesomeShell" + +hotkey-overlay { + // Uncomment this line to disable the "Important Hotkeys" pop-up at startup. + skip-at-startup +} + +// Uncomment this line to ask the clients to omit their client-side decorations if possible. +// If the client will specifically ask for CSD, the request will be honored. +// Additionally, clients will be informed that they are tiled, removing some client-side rounded corners. +// This option will also fix border/focus ring drawing behind some semitransparent windows. +// After enabling or disabling this, you need to restart the apps for this to take effect. +prefer-no-csd +// You can change the path where screenshots are saved. +// A ~ at the front will be expanded to the home directory. +// The path is formatted with strftime(3) to give you the screenshot date and time. +screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png" + +// You can also set this to null to disable saving screenshots to disk. +// screenshot-path null + +// Animation settings. +// The wiki explains how to configure individual animations: +// https://yalter.github.io/niri/Configuration:-Animations +animations { + // Uncomment to turn off all animations. + // off + + // Slow down all animations by this factor. Values below 1 speed them up instead. + // slowdown 3.0 +} + +// Window rules let you adjust behavior for individual windows. +// Find more information on the wiki: +// https://yalter.github.io/niri/Configuration:-Window-Rules + +// Work around WezTerm's initial configure bug +// by setting an empty default-column-width. +window-rule { + // This regular expression is intentionally made as specific as possible, + // since this is the default config, and we want no false positives. + // You can get away with just app-id="wezterm" if you want. + match app-id=r#"^org\.wezfurlong\.wezterm$"# + default-column-width {} +} + +// Open the Firefox picture-in-picture player as floating by default. +window-rule { + // This app-id regular expression will work for both: + // - host Firefox (app-id is "firefox") + // - Flatpak Firefox (app-id is "org.mozilla.firefox") + match app-id=r#"firefox$"# title="^Picture-in-Picture$" + open-floating true +} + +window-rule { + match app-id=r#"ipe$"# title="^Ipe: waiting$" + open-floating true + open-focused false + default-floating-position x=8 y=8 relative-to="bottom-left" + max-width 169 + max-height 37 +} + +// window-rule { +// match app-id=r#"ipe$"# title="^Create text object$" +// open-floating false +// default-column-width { proportion 0.2; } +// } + +window-rule { + match is-floating=true + baba-is-float false +} + +// Example: block out two password managers from screen capture. +// (This example rule is commented out with a "/-" in front.) +window-rule { + match app-id=r#"^org\.keepassxc\.KeePassXC$"# + match app-id=r#"^org\.gnome\.World\.Secrets$"# + + block-out-from "screen-capture" + + // Use this instead if you want them visible on third-party screenshot tools. + // block-out-from "screencast" +} + +// Example: enable rounded corners for all windows. +// (This example rule is commented out with a "/-" in front.) +/-window-rule { + geometry-corner-radius 12 + clip-to-geometry true +} + +spawn-at-startup "cosmic-ext-alternative-startup" + +binds { + // Keys consist of modifiers separated by + signs, followed by an XKB key name + // in the end. To find an XKB name for a particular key, you may use a program + // like wev. + // + // "Mod" is a special modifier equal to Super when running on a TTY, and to Alt + // when running as a winit window. + // + // Most actions that you can bind here can also be invoked programmatically with + // `niri msg action do-something`. + + // Mod-Shift-/, which is usually the same as Mod-?, + // shows a list of important hotkeys. + Mod+Shift+0 { show-hotkey-overlay; } + + // Suggested binds for running programs: terminal, app launcher, screen locker. + Mod+Return hotkey-overlay-title="Open a Terminal: alacritty" { spawn-sh "alacritty msg create-window"; } + Mod+T hotkey-overlay-title="Open a Terminal: alacritty" { spawn "cosmic-term"; } + // Mod+D hotkey-overlay-title="Run an Application: fuzzel" { spawn "fuzzel"; } + Mod+D hotkey-overlay-title="Run an Application: fuzzel" { spawn "cosmic-launcher"; } + // Mod+Shift+D hotkey-overlay-title="Switch to Window: fuzzel" { spawn "windowmenu.fish"; } + Mod+Shift+D hotkey-overlay-title="Switch to Window: fuzzel" { spawn "cosmic-app-library"; } + Mod+B hotkey-overlay-title="Search the Web: fuzzel" { spawn "browserprompt.fish"; } + Mod+E hotkey-overlay-title="Open Email Client: evolution" { spawn "evolution"; } + // Super+Alt+L hotkey-overlay-title="Lock the Screen: swaylock" { spawn "swaylock"; } + // Mod+Alt+L hotkey-overlay-title="Lock the Screen: swaylock" { spawn "swaylock"; } + Mod+Alt+L hotkey-overlay-title="Lock the Screen: swaylock" { spawn "cosmic-greeter"; } + Mod+P hotkey-overlay-title="Show the Power menu: fuzzel" { spawn "powermenu.fish"; } + Mod+A hotkey-overlay-title="Show the Action menu: fuzzel" { spawn "actionmenu.fish"; } + // Use spawn-sh to run a shell command. Do this if you need pipes, multiple commands, etc. + // Note: the entire command goes as a single argument. It's passed verbatim to `sh -c`. + // For example, this is a standard bind to toggle the screen reader (orca). + Super+Alt+S allow-when-locked=true hotkey-overlay-title=null { spawn-sh "pkill orca || exec orca"; } + + // Example volume keys mappings for PipeWire & WirePlumber. + // The allow-when-locked=true property makes them work even when the session is locked. + // Using spawn-sh allows to pass multiple arguments together with the command. + XF86AudioRaiseVolume allow-when-locked=true { spawn-sh "wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 0.05+ && volumenotify.fish"; } + XF86AudioLowerVolume allow-when-locked=true { spawn-sh "wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 0.05- && volumenotify.fish"; } + XF86AudioMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && volumenotify.fish"; } + XF86AudioMicMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; } + + XF86AudioPlay allow-when-locked=true { spawn-sh "mpc toggle"; } + XF86AudioPrev allow-when-locked=true { spawn-sh "mpc prev"; } + XF86AudioNext allow-when-locked=true { spawn-sh "mpc next"; } + // Example brightness key mappings for brightnessctl. + // You can use regular spawn with multiple arguments too (to avoid going through "sh"), + // but you need to manually put each argument in separate "" quotes. + XF86MonBrightnessUp allow-when-locked=true { spawn-sh "brightnessctl --class=backlight set +5% && brightnessnotify.fish"; } + XF86MonBrightnessDown allow-when-locked=true { spawn-sh "brightnessctl --class=backlight set 5%- && brightnessnotify.fish"; } + + + // Open/close the Overview: a zoomed-out view of workspaces and windows. + // You can also move the mouse into the top-left hot corner, + // or do a four-finger swipe up on a touchpad. + Mod+O repeat=false { toggle-overview; } + + Mod+Q repeat=false { close-window; } + + Mod+Left { focus-column-left; } + Mod+Down { focus-window-down; } + Mod+Up { focus-window-up; } + Mod+Right { focus-column-right; } + Mod+H { focus-column-left; } + Mod+J { focus-window-down; } + Mod+K { focus-window-up; } + Mod+L { focus-column-right; } + + Mod+Ctrl+Left { move-column-left; } + Mod+Ctrl+Down { move-window-down; } + Mod+Ctrl+Up { move-window-up; } + Mod+Ctrl+Right { move-column-right; } + Mod+Ctrl+H { move-column-left; } + Mod+Ctrl+J { move-window-down; } + Mod+Ctrl+K { move-window-up; } + Mod+Ctrl+L { move-column-right; } + + // Alternative commands that move across workspaces when reaching + // the first or last window in a column. + // Mod+J { focus-window-or-workspace-down; } + // Mod+K { focus-window-or-workspace-up; } + // Mod+Ctrl+J { move-window-down-or-to-workspace-down; } + // Mod+Ctrl+K { move-window-up-or-to-workspace-up; } + + Mod+Home { focus-column-first; } + Mod+End { focus-column-last; } + Mod+Ctrl+Home { move-column-to-first; } + Mod+Ctrl+End { move-column-to-last; } + + Mod+Shift+Left { focus-monitor-left; } + Mod+Shift+Down { focus-monitor-down; } + Mod+Shift+Up { focus-monitor-up; } + Mod+Shift+Right { focus-monitor-right; } + Mod+Shift+H { focus-monitor-left; } + Mod+Shift+J { focus-monitor-down; } + Mod+Shift+K { focus-monitor-up; } + Mod+Shift+L { focus-monitor-right; } + + Mod+Shift+Ctrl+Left { move-column-to-monitor-left; } + Mod+Shift+Ctrl+Down { move-column-to-monitor-down; } + Mod+Shift+Ctrl+Up { move-column-to-monitor-up; } + Mod+Shift+Ctrl+Right { move-column-to-monitor-right; } + Mod+Shift+Ctrl+H { move-column-to-monitor-left; } + Mod+Shift+Ctrl+J { move-column-to-monitor-down; } + Mod+Shift+Ctrl+K { move-column-to-monitor-up; } + Mod+Shift+Ctrl+L { move-column-to-monitor-right; } + + // Alternatively, there are commands to move just a single window: + // Mod+Shift+Ctrl+Left { move-window-to-monitor-left; } + // ... + + // And you can also move a whole workspace to another monitor: + // Mod+Shift+Ctrl+Left { move-workspace-to-monitor-left; } + // ... + + Mod+Page_Down { focus-workspace-down; } + Mod+Page_Up { focus-workspace-up; } + Mod+U { focus-workspace-down; } + Mod+I { focus-workspace-up; } + Mod+Ctrl+Page_Down { move-column-to-workspace-down; } + Mod+Ctrl+Page_Up { move-column-to-workspace-up; } + Mod+Ctrl+U { move-column-to-workspace-down; } + Mod+Ctrl+I { move-column-to-workspace-up; } + + // Alternatively, there are commands to move just a single window: + // Mod+Ctrl+Page_Down { move-window-to-workspace-down; } + // ... + + Mod+Shift+Page_Down { move-workspace-down; } + Mod+Shift+Page_Up { move-workspace-up; } + Mod+Shift+U { move-workspace-down; } + Mod+Shift+I { move-workspace-up; } + + // You can bind mouse wheel scroll ticks using the following syntax. + // These binds will change direction based on the natural-scroll setting. + // + // To avoid scrolling through workspaces really fast, you can use + // the cooldown-ms property. The bind will be rate-limited to this value. + // You can set a cooldown on any bind, but it's most useful for the wheel. + Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } + Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; } + Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; } + Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; } + + Mod+WheelScrollRight { focus-column-right; } + Mod+WheelScrollLeft { focus-column-left; } + Mod+Ctrl+WheelScrollRight { move-column-right; } + Mod+Ctrl+WheelScrollLeft { move-column-left; } + + // Usually scrolling up and down with Shift in applications results in + // horizontal scrolling; these binds replicate that. + Mod+Shift+WheelScrollDown { focus-column-right; } + Mod+Shift+WheelScrollUp { focus-column-left; } + Mod+Ctrl+Shift+WheelScrollDown { move-column-right; } + Mod+Ctrl+Shift+WheelScrollUp { move-column-left; } + + // Similarly, you can bind touchpad scroll "ticks". + // Touchpad scrolling is continuous, so for these binds it is split into + // discrete intervals. + // These binds are also affected by touchpad's natural-scroll, so these + // example binds are "inverted", since we have natural-scroll enabled for + // touchpads by default. + // Mod+TouchpadScrollDown { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02+"; } + // Mod+TouchpadScrollUp { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02-"; } + + // You can refer to workspaces by index. However, keep in mind that + // niri is a dynamic workspace system, so these commands are kind of + // "best effort". Trying to refer to a workspace index bigger than + // the current workspace count will instead refer to the bottommost + // (empty) workspace. + // + // For example, with 2 workspaces + 1 empty, indices 3, 4, 5 and so on + // will all refer to the 3rd workspace. + Mod+1 { focus-workspace 1; } + Mod+2 { focus-workspace 2; } + Mod+3 { focus-workspace 3; } + Mod+4 { focus-workspace 4; } + Mod+5 { focus-workspace 5; } + Mod+6 { focus-workspace 6; } + Mod+7 { focus-workspace 7; } + Mod+8 { focus-workspace 8; } + Mod+9 { focus-workspace 9; } + Mod+Ctrl+1 { move-column-to-workspace 1; } + Mod+Ctrl+2 { move-column-to-workspace 2; } + Mod+Ctrl+3 { move-column-to-workspace 3; } + Mod+Ctrl+4 { move-column-to-workspace 4; } + Mod+Ctrl+5 { move-column-to-workspace 5; } + Mod+Ctrl+6 { move-column-to-workspace 6; } + Mod+Ctrl+7 { move-column-to-workspace 7; } + Mod+Ctrl+8 { move-column-to-workspace 8; } + Mod+Ctrl+9 { move-column-to-workspace 9; } + + // Alternatively, there are commands to move just a single window: + // Mod+Ctrl+1 { move-window-to-workspace 1; } + + // Switches focus between the current and the previous workspace. + // Mod+Tab { focus-workspace-previous; } + + // The following binds move the focused window in and out of a column. + // If the window is alone, they will consume it into the nearby column to the side. + // If the window is already in a column, they will expel it out. + Mod+Ctrl+Y { consume-or-expel-window-left; } + Mod+Ctrl+O { consume-or-expel-window-right; } + + // Consume one window from the right to the bottom of the focused column. + Mod+Comma { consume-window-into-column; } + // Expel the bottom window from the focused column to the right. + Mod+Period { expel-window-from-column; } + + Mod+R { switch-preset-column-width; } + // Cycling through the presets in reverse order is also possible. + // Mod+R { switch-preset-column-width-back; } + Mod+Shift+R { switch-preset-window-height; } + Mod+Ctrl+R { reset-window-height; } + Mod+F { maximize-column; } + Mod+Shift+F { fullscreen-window; } + + // Expand the focused column to space not taken up by other fully visible columns. + // Makes the column "fill the rest of the space". + Mod+Ctrl+F { expand-column-to-available-width; } + + Mod+C { center-column; } + + // Center all fully visible columns on screen. + Mod+Ctrl+C { center-visible-columns; } + + // Finer width adjustments. + // This command can also: + // * set width in pixels: "1000" + // * adjust width in pixels: "-5" or "+5" + // * set width as a percentage of screen width: "25%" + // * adjust width as a percentage of screen width: "-10%" or "+10%" + // Pixel sizes use logical, or scaled, pixels. I.e. on an output with scale 2.0, + // set-column-width "100" will make the column occupy 200 physical screen pixels. + Mod+Minus { set-column-width "-10%"; } + Mod+Equal { set-column-width "+10%"; } + + // Finer height adjustments when in column with other windows. + Mod+Shift+Minus { set-window-height "-10%"; } + Mod+Shift+Equal { set-window-height "+10%"; } + + // Move the focused window between the floating and the tiling layout. + Mod+V { toggle-window-floating; } + Mod+Shift+V { switch-focus-between-floating-and-tiling; } + + // Toggle tabbed column display mode. + // Windows in this column will appear as vertical tabs, + // rather than stacked on top of each other. + Mod+W { toggle-column-tabbed-display; } + + // Actions to switch layouts. + // Note: if you uncomment these, make sure you do NOT have + // a matching layout switch hotkey configured in xkb options above. + // Having both at once on the same hotkey will break the switching, + // since it will switch twice upon pressing the hotkey (once by xkb, once by niri). + // Mod+Space { switch-layout "next"; } + // Mod+Shift+Space { switch-layout "prev"; } + + Print { screenshot; } + Ctrl+Print { screenshot-screen; } + Alt+Print { screenshot-window; } + + // Applications such as remote-desktop clients and software KVM switches may + // request that niri stops processing the keyboard shortcuts defined here + // so they may, for example, forward the key presses as-is to a remote machine. + // It's a good idea to bind an escape hatch to toggle the inhibitor, + // so a buggy application can't hold your session hostage. + // + // The allow-inhibiting=false property can be applied to other binds as well, + // which ensures niri always processes them, even when an inhibitor is active. + Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; } + + // The quit action will show a confirmation dialog to avoid accidental exits. + Mod+Shift+E { quit; } + Ctrl+Alt+Delete { quit; } + + // Powers off the monitors. To turn them back on, do any input like + // moving the mouse or pressing any other key. + Mod+Shift+P { power-off-monitors; } +} diff --git a/.config/noctalia/colors.json b/.config/noctalia/colors.json deleted file mode 100644 index acd82c2..0000000 --- a/.config/noctalia/colors.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "mError": "#ff4c4c", - "mOnError": "#ffffff", - "mOnPrimary": "#000000", - "mOnSecondary": "#ffffff", - "mOnSurface": "#ffffff", - "mOnSurfaceVariant": "#ffffff", - "mOnTertiary": "#ffffff", - "mOutline": "#4c4c4c", - "mPrimary": "#7fccff", - "mSecondary": "#4c4c4c", - "mShadow": "#000000", - "mSurface": "#191919", - "mSurfaceVariant": "#191919", - "mTertiary": "#2c2c2c" -} diff --git a/.config/noctalia/settings.json b/.config/noctalia/settings.json deleted file mode 100644 index 2b17817..0000000 --- a/.config/noctalia/settings.json +++ /dev/null @@ -1,225 +0,0 @@ -{ - "appLauncher": { - "backgroundOpacity": 1, - "enableClipboardHistory": true, - "pinnedExecs": [ - ], - "position": "center", - "sortByMostUsed": true, - "useApp2Unit": false - }, - "audio": { - "cavaFrameRate": 30, - "mprisBlacklist": [ - ], - "preferredPlayer": "", - "visualizerType": "linear", - "volumeStep": 5 - }, - "bar": { - "backgroundOpacity": 1, - "density": "default", - "floating": false, - "marginHorizontal": 0.25, - "marginVertical": 0.25, - "monitors": [ - "eDP-1", - "HDMI-A-1" - ], - "position": "top", - "showCapsule": false, - "widgets": { - "center": [ - { - "hideWhenZero": true, - "id": "NotificationHistory", - "showUnreadBadge": true - }, - { - "formatHorizontal": "HH:mm ddd, MMM dd", - "formatVertical": "HH mm - dd MM", - "id": "Clock", - "useMonospacedFont": true, - "usePrimaryColor": true - } - ], - "left": [ - { - "hideUnoccupied": false, - "id": "Workspace", - "labelMode": "none" - }, - { - "id": "MediaMini", - "showAlbumArt": true, - "showVisualizer": false, - "visualizerType": "linear" - }, - { - "id": "ActiveWindow", - "showIcon": true - } - ], - "right": [ - { - "id": "ScreenRecorderIndicator" - }, - { - "id": "Tray" - }, - { - "id": "WiFi" - }, - { - "id": "Bluetooth" - }, - { - "displayMode": "onhover", - "id": "Battery", - "warningThreshold": 30 - }, - { - "displayMode": "onhover", - "id": "Volume" - }, - { - "displayMode": "onhover", - "id": "Brightness" - }, - { - "id": "NightLight" - }, - { - "icon": "noctalia", - "id": "SidePanelToggle", - "useDistroLogo": false - } - ] - } - }, - "brightness": { - "brightnessStep": 1 - }, - "colorSchemes": { - "darkMode": true, - "predefinedScheme": "Niri", - "useWallpaperColors": false - }, - "dock": { - "autoHide": false, - "backgroundOpacity": 1, - "exclusive": true, - "floatingRatio": 1, - "monitors": [ - ] - }, - "general": { - "animationSpeed": 1, - "avatarImage": "/home/never/.face", - "dimDesktop": false, - "forceBlackScreenCorners": false, - "radiusRatio": 0, - "screenRadiusRatio": 1, - "showScreenCorners": false - }, - "hooks": { - "darkModeChange": "", - "enabled": false, - "wallpaperChange": "" - }, - "location": { - "name": "Würzburg", - "showWeekNumberInCalendar": false, - "use12hourFormat": false, - "useFahrenheit": false - }, - "matugen": { - "enableUserTemplates": false, - "foot": false, - "fuzzel": false, - "ghostty": false, - "gtk3": false, - "gtk4": false, - "kitty": false, - "pywalfox": false, - "qt5": false, - "qt6": false, - "vesktop": false - }, - "network": { - "bluetoothEnabled": true, - "wifiEnabled": true - }, - "nightLight": { - "autoSchedule": true, - "dayTemp": "6500", - "enabled": true, - "forced": false, - "manualSunrise": "06:30", - "manualSunset": "18:30", - "nightTemp": "4000" - }, - "notifications": { - "criticalUrgencyDuration": 15, - "doNotDisturb": true, - "lastSeenTs": 1759063307000, - "lowUrgencyDuration": 3, - "monitors": [ - "eDP-1" - ], - "normalUrgencyDuration": 8 - }, - "screenRecorder": { - "audioCodec": "opus", - "audioSource": "default_output", - "colorRange": "limited", - "directory": "~/Videos", - "frameRate": 60, - "quality": "very_high", - "showCursor": true, - "videoCodec": "h264", - "videoSource": "portal" - }, - "settingsVersion": 1, - "ui": { - "fontBillboard": "Inter Display", - "fontDefault": "Adwaita Sans", - "fontFixed": "Adwaita Mono", - "idleInhibitorEnabled": false, - "monitorsScaling": [ - { - "name": "eDP-1", - "scale": 0.7999999999999999 - }, - { - "name": "HDMI-A-1", - "scale": 0.7999999999999999 - } - ] - }, - "wallpaper": { - "directory": "/home/never/.local/share/wallpapers/", - "enableMultiMonitorDirectories": true, - "enabled": true, - "fillColor": "#000000", - "fillMode": "crop", - "monitors": [ - { - "directory": "/home/never/.local/share/wallpapers/", - "name": "eDP-1", - "wallpaper": "/home/never/.local/share/wallpapers//scarlet-tree-dark.png" - }, - { - "directory": "/home/never/.local/share/wallpapers/", - "name": "HDMI-A-1", - "wallpaper": "/home/never/.local/share/wallpapers//scarlet-tree-dark.png" - } - ], - "randomEnabled": false, - "randomIntervalSec": 300, - "setWallpaperOnAllMonitors": true, - "transitionDuration": 1500, - "transitionEdgeSmoothness": 0.05, - "transitionType": "random" - } -} diff --git a/.config/nvim b/.config/nvim deleted file mode 160000 index 7545731..0000000 --- a/.config/nvim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 75457315b297fd854da4c58be924588013414477 diff --git a/.config/nvim/colors/gruvbox.lua b/.config/nvim/colors/gruvbox.lua new file mode 100644 index 0000000..f25f984 --- /dev/null +++ b/.config/nvim/colors/gruvbox.lua @@ -0,0 +1 @@ +require("gruvbox").load() diff --git a/.config/nvim/ftplugin/python.lua b/.config/nvim/ftplugin/python.lua new file mode 100644 index 0000000..fe6caae --- /dev/null +++ b/.config/nvim/ftplugin/python.lua @@ -0,0 +1 @@ +vim.treesitter.start() diff --git a/.config/nvim/ftplugin/tex.lua b/.config/nvim/ftplugin/tex.lua new file mode 100644 index 0000000..5cebd8e --- /dev/null +++ b/.config/nvim/ftplugin/tex.lua @@ -0,0 +1,22 @@ +vim.treesitter.start() + +vim.opt.spelllang = "de" +vim.opt.spell = true + +-- vim.wo[0][0].foldexpr = 'v:lua.vim.treesitter.foldexpr()' +-- vim.wo[0][0].foldmethod = 'expr' + +vim.keymap.set('n', 'tb', ':LspTexlabBuild', + { desc = 'Build using LuaLaTeX'}) +vim.keymap.set('n', 'ts', ':LspTexlabForward', + { desc = 'Forward search'}) +vim.keymap.set('n', 'tc', ':LspTexlabCancelBuild', + { desc = 'Cancel build'}) +vim.keymap.set('n', 'tdr', ':LspTexlabCleanArtifacts', + { desc = 'Clean artifacts'}) +vim.keymap.set('n', 'tdx', ':LspTexlabCleanAuxiliary', + { desc = 'Clean auxiliary'}) +vim.keymap.set('n', 'tes', ':LspTexlabFindEnvironments', + { desc = 'Find environments'}) +vim.keymap.set('n', 'tec', ':LspTexlabChangeEnvironment', + { desc = 'Change environment'}) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..9ad2d78 --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,343 @@ +-- Set as the leader key +-- See `:help mapleader` +-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +vim.o.guifont = "Adwaita Mono:h12" + +-- Disable mouse input +vim.o.mouse = "" + +-- Minimal number of screen lines to keep above and below the cursor. +vim.o.scrolloff = 10 + +-- Highlight the line where the cursor is on +vim.o.cursorline = true + +-- Column at 80 characters +vim.o.colorcolumn = "80" + +-- Set default tabstop and shiftwidth +vim.o.tabstop = 4 +vim.o.shiftwidth = 4 +vim.o.expandtab = false + +-- Show and trailing spaces +vim.o.list = true +vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" } + +-- Configure line wrap +vim.o.linebreak = true +vim.o.breakindent = true +vim.o.showbreak = "↪ " + +-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term +vim.o.ignorecase = true +vim.o.smartcase = true + +-- Use undofile to preserve actions over restarts +vim.o.undofile = true + +-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`), +-- instead raise a dialog asking if you wish to save the current file(s) See `:help 'confirm'` +vim.o.confirm = true + +-- local toggle_background = function (obj) +-- print(string.find(obj.stdout, "prefer-light")) +-- if string.find(obj.stdout, "prefer-light") then +-- print('light') +-- else +-- print('dark') +-- end +-- end +-- +-- vim.o.background = 'light' +-- vim.system({"dconf", "read", "/org/gnome/desktop/interface/color-scheme"}, toggle_background) + +vim.cmd.colorscheme("gruvbox") + +-- [[ Set up keymaps ]] See `:h vim.keymap.set()`, `:h mapping`, `:h keycodes` + +-- Use to exit terminal mode +vim.keymap.set("t", "", "") + +-- Map , , , to navigate between windows in any modes +vim.keymap.set({ "t", "i" }, "", "h") +vim.keymap.set({ "t", "i" }, "", "j") +vim.keymap.set({ "t", "i" }, "", "k") +vim.keymap.set({ "t", "i" }, "", "l") +vim.keymap.set({ "n" }, "", "h") +vim.keymap.set({ "n" }, "", "j") +vim.keymap.set({ "n" }, "", "k") +vim.keymap.set({ "n" }, "", "l") + +-- [[ Basic Autocommands ]]. +-- See `:h lua-guide-autocommands`, `:h autocmd`, `:h nvim_create_autocmd()` +-- Highlight when yanking (copying) text. +-- Try it with `yap` in normal mode. See `:h vim.hl.on_yank()` +vim.api.nvim_create_autocmd("TextYankPost", { + desc = "Highlight when yanking (copying) text", + callback = function() + vim.hl.on_yank() + end, +}) + +-- Sync clipboard between OS and Neovim. Schedule the setting after `UiEnter` because it can +-- increase startup-time. Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +vim.api.nvim_create_autocmd("UIEnter", { + callback = function() + vim.o.clipboard = "unnamedplus" + end, +}) + +-- Print the line number in front of each line +vim.o.number = true +vim.o.relativenumber = true + +-- [[ Create user commands ]] +-- See `:h nvim_create_user_command()` and `:h user-commands` + +-- Create a command `:GitBlameLine` that print the git blame for the current line +vim.api.nvim_create_user_command("GitBlameLine", function() + local line_number = vim.fn.line(".") -- Get the current line number. See `:h line()` + local filename = vim.api.nvim_buf_get_name(0) + print(vim.fn.system({ "git", "blame", "-L", line_number .. ",+1", filename })) +end, { desc = "Print the git blame for the current line" }) + +-- [[ Add optional packages ]] +-- Nvim comes bundled with a set of packages that are not enabled by +-- default. You can enable any of them by using the `:packadd` command. + +-- For example, to add the "nohlsearch" package to automatically turn off search highlighting after +-- 'updatetime' and when going to insert mode +vim.cmd("packadd! nohlsearch") + +-- [[ Language Setup ]] + +-- Treat Ipe stylesheets as xml code +vim.filetype.add({ + extension = { + isy = "xml", + }, +}) + +-- Install nvim-treesitter +vim.pack.add({ "https://github.com/nvim-treesitter/nvim-treesitter" }) +require("nvim-treesitter").install({ 'fish', 'java', 'latex', 'make', 'python' }) + +vim.api.nvim_create_autocmd('FileType', { + pattern = { '' }, + callback = function() + vim.treesitter.start() + vim.wo[0][0].foldexpr = 'v:lua.vim.treesitter.foldexpr()' + vim.wo[0][0].foldmethod = 'expr' + end, +}) + +vim.pack.add({ "https://github.com/mason-org/mason.nvim" }) +require("mason").setup() + +vim.lsp.enable({ 'lua_ls', 'texlab', 'clangd', 'jdtls', 'fish_lsp', 'html', 'cssls', 'lemminx', 'pyright' }) + + +vim.keymap.set('n', 'lf', vim.lsp.buf.format, + { desc = 'Formats a buffer using the attached language server clients' }) +vim.keymap.set('n', 'lh', vim.lsp.buf.hover, + { desc = 'Displays hover information about the symbol' }) +vim.keymap.set('n', 'lr', vim.lsp.buf.rename, + { desc = 'Renames all references to the symbol' }) +vim.keymap.set('n', 'ld', vim.lsp.buf.definition, + { desc = 'Jumps to the definition of the symbol' }) + +vim.diagnostic.config({ + signs = { + text = { + [vim.diagnostic.severity.ERROR] = "W ", + [vim.diagnostic.severity.WARN] = "w ", + [vim.diagnostic.severity.INFO] = "I ", + [vim.diagnostic.severity.HINT] = "H ", + }, + }, + virtual_text = true, -- Show inline diagnostics +}) + +vim.keymap.set("n", "dn", "]d", { desc = "Jump to next diagnostic" }) +vim.keymap.set("n", "dp", "[d", { desc = "Jump to previous diagnostic" }) +vim.keymap.set("n", "dN", "]D", { desc = "Jump to last diagnostic" }) +vim.keymap.set("n", "dP", "[D", { desc = "Jump to first diagnostic" }) +vim.keymap.set("n", "ds", "d", { desc = "Display diagnostic on current line" }) + +vim.api.nvim_create_autocmd('FileType', { + pattern = { 'c', 'cpp', 'rust' }, + callback = function() + vim.pack.add({ "https://github.com/mfussenegger/nvim-dap", "https://github.com/theHamsta/nvim-dap-virtual-text" }) + local dap = require("dap") + local dap_widgets = require("dap.ui.widgets") + local dap_sidebar_s = dap_widgets.sidebar(dap_widgets.scopes) + local dap_sidebar_f = dap_widgets.sidebar(dap_widgets.frames) + + vim.keymap.set("n", "bb", dap.toggle_breakpoint, { desc = "Toggle breakpoint" }) + vim.keymap.set("n", "bc", dap.continue, { desc = "Continue execution" }) + dap.listeners.on_session["debug"] = function() + vim.keymap.set("n", "bs", dap_sidebar_s.toggle, { desc = "Toggle scopes" }) + vim.keymap.set("n", "bf", dap_sidebar_f.toggle, { desc = "Toggle frames" }) + vim.keymap.set("n", "br", dap.repl.toggle, { desc = "Toggle REPL" }) + + vim.keymap.set("n", "", dap.step_out, { desc = "Step out" }) + vim.keymap.set("n", "", dap.step_into, { desc = "Step into" }) + vim.keymap.set("n", "", dap.step_over, { desc = "Step over" }) + vim.keymap.set("n", "", dap.restart_frame, { desc = "Restart frame" }) + end + + dap.adapters.gdb = { + type = "executable", + command = "gdb", + args = { "--interpreter=dap", "--eval-command", "set print pretty on" } + } + + dap.configurations.c = { + { + name = "Launch", + type = "gdb", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + args = {}, -- provide arguments if needed + cwd = "${workspaceFolder}", + stopAtBeginningOfMainSubprogram = false, + }, + { + name = "Select and attach to process", + type = "gdb", + request = "attach", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + pid = function() + local name = vim.fn.input('Executable name (filter): ') + return require("dap.utils").pick_process({ filter = name }) + end, + cwd = '${workspaceFolder}' + }, + { + name = 'Attach to gdbserver :1234', + type = 'gdb', + request = 'attach', + target = 'localhost:1234', + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}' + } + } + + dap.configurations.cpp = dap.configurations.c + dap.configurations.rust = dap.configurations.c + end, +}) +-- +-- [[ UI Configuration ]] +vim.pack.add({ "https://github.com/nvim-mini/mini.nvim" }) + +vim.o.winborder = "none" + +-- Use mini.completion +require("mini.completion").setup() + +local imap_expr = function(lhs, rhs) + vim.keymap.set('i', lhs, rhs, { expr = true }) +end +imap_expr('', [[pumvisible() ? "\" : "\"]]) +imap_expr('', [[pumvisible() ? "\" : "\"]]) + +-- Snippet integration for mini.completion +-- require("mini.snippets").setup() + +-- Icons for statusline and completion +require("mini.icons").setup() + +-- Use mini.statusline instead of native showmode +require("mini.statusline").setup() +vim.o.showmode = false + +-- Git integration for statusline and Command mode +require("mini.git").setup() + +-- Show git diff in linenumbers +require("mini.diff").setup() + +-- Use mini.notify +-- require("mini.notify").setup() + +-- Use and configure mini.clue +local clue = require("mini.clue") +clue.setup({ + triggers = { + -- Leader triggers + { mode = { "n", "x" }, keys = "" }, + + -- `[` and `]` keys + { mode = "n", keys = "[" }, + { mode = "n", keys = "]" }, + + -- Built-in completion + { mode = "i", keys = "" }, + + -- `g` key + { mode = { "n", "x" }, keys = "g" }, + + -- Marks + { mode = { "n", "x" }, keys = "'" }, + { mode = { "n", "x" }, keys = "`" }, + + -- Registers + { mode = { "n", "x" }, keys = '"' }, + { mode = { "i", "c" }, keys = "" }, + + -- Window commands + { mode = "n", keys = "" }, + + -- `z` key + { mode = { "n", "x" }, keys = "z" }, + + -- `i/a` key + { mode = { "n", "x" }, keys = "i" }, + }, + + clues = { + -- Enhance this by adding descriptions for mapping groups + clue.gen_clues.square_brackets(), + clue.gen_clues.builtin_completion(), + clue.gen_clues.g(), + clue.gen_clues.marks(), + clue.gen_clues.registers(), + clue.gen_clues.windows(), + clue.gen_clues.z(), + }, + + window = { + delay = 200, + config = { + width = 'auto', + } + } +}) + + +-- Use and configure mini.hipatterns +-- local hipatterns = require('mini.hipatterns') +-- hipatterns.setup({ +-- highlighters = { +-- -- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE' +-- fixme = { pattern = '%f[%w]()FIXME()%f[%W]', group = 'MiniHipatternsFixme' }, +-- hack = { pattern = '%f[%w]()HACK()%f[%W]', group = 'MiniHipatternsHack' }, +-- todo = { pattern = '%f[%w]()TODO()%f[%W]', group = 'MiniHipatternsTodo' }, +-- note = { pattern = '%f[%w]()NOTE()%f[%W]', group = 'MiniHipatternsNote' }, +-- +-- -- Highlight hex color strings (`#rrggbb`) using that color +-- hex_color = hipatterns.gen_highlighter.hex_color(), +-- }, +-- }) diff --git a/.config/nvim/lsp/ada_ls.lua b/.config/nvim/lsp/ada_ls.lua new file mode 100644 index 0000000..eae327a --- /dev/null +++ b/.config/nvim/lsp/ada_ls.lua @@ -0,0 +1,31 @@ +---@brief +--- +--- https://github.com/AdaCore/ada_language_server +--- +--- Installation instructions can be found [here](https://github.com/AdaCore/ada_language_server#Install). +--- +--- Workspace-specific [settings](https://github.com/AdaCore/ada_language_server/blob/master/doc/settings.md) such as `projectFile` can be provided in a `.als.json` file at the root of the workspace. +--- Alternatively, configuration may be passed as a "settings" object to `vim.lsp.config('ada_ls', {})`: +--- +--- ```lua +--- vim.lsp.config('ada_ls', { +--- settings = { +--- ada = { +--- projectFile = "project.gpr"; +--- scenarioVariables = { ... }; +--- } +--- } +--- }) +--- ``` + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'ada_language_server' }, + filetypes = { 'ada' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern('Makefile', '.git', 'alire.toml', '*.gpr', '*.adc')(fname)) + end, +} diff --git a/.config/nvim/lsp/agda_ls.lua b/.config/nvim/lsp/agda_ls.lua new file mode 100644 index 0000000..64ca652 --- /dev/null +++ b/.config/nvim/lsp/agda_ls.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/agda/agda-language-server +--- +--- Language Server for Agda. + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'als' }, + filetypes = { 'agda' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern('.git', '*.agda-lib')(fname)) + end, +} diff --git a/.config/nvim/lsp/aiken.lua b/.config/nvim/lsp/aiken.lua new file mode 100644 index 0000000..8fb57b2 --- /dev/null +++ b/.config/nvim/lsp/aiken.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/aiken-lang/aiken +--- +--- A language server for Aiken Programming Language. +--- [Installation](https://aiken-lang.org/installation-instructions) +--- +--- It can be i + +---@type vim.lsp.Config +return { + cmd = { 'aiken', 'lsp' }, + filetypes = { 'aiken' }, + root_markers = { 'aiken.toml', '.git' }, +} diff --git a/.config/nvim/lsp/air.lua b/.config/nvim/lsp/air.lua new file mode 100644 index 0000000..47dbfc1 --- /dev/null +++ b/.config/nvim/lsp/air.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/posit-dev/air +--- +--- Air is an R formatter and language server, written in Rust. +--- +--- Refer to the [documentation](https://posit-dev.github.io/air/editors.html) for more details. + +---@type vim.lsp.Config +return { + cmd = { 'air', 'language-server' }, + filetypes = { 'r' }, + root_markers = { 'air.toml', '.air.toml', '.git' }, +} diff --git a/.config/nvim/lsp/alloy_ls.lua b/.config/nvim/lsp/alloy_ls.lua new file mode 100644 index 0000000..9fdf6da --- /dev/null +++ b/.config/nvim/lsp/alloy_ls.lua @@ -0,0 +1,30 @@ +---@brief +--- +--- https://github.com/AlloyTools/org.alloytools.alloy +--- +--- Alloy is a formal specification language for describing structures and a tool for exploring them. +--- +--- You may also need to configure the filetype for Alloy (*.als) files: +--- +--- ``` +--- autocmd BufNewFile,BufRead *.als set filetype=alloy +--- ``` +--- +--- or +--- +--- ```lua +--- vim.filetype.add({ +--- pattern = { +--- ['.*/*.als'] = 'alloy', +--- }, +--- }) +--- ``` +--- +--- Alternatively, you may use a syntax plugin like https://github.com/runoshun/vim-alloy. + +---@type vim.lsp.Config +return { + cmd = { 'alloy', 'lsp' }, + filetypes = { 'alloy' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/anakin_language_server.lua b/.config/nvim/lsp/anakin_language_server.lua new file mode 100644 index 0000000..6673683 --- /dev/null +++ b/.config/nvim/lsp/anakin_language_server.lua @@ -0,0 +1,71 @@ +---@brief +--- +--- https://pypi.org/project/anakin-language-server/ +--- +--- `anakin-language-server` is yet another Jedi Python language server. +--- +--- Available options: +--- +--- * Initialization: https://github.com/muffinmad/anakin-language-server#initialization-option +--- * Configuration: https://github.com/muffinmad/anakin-language-server#configuration-options + +---@type vim.lsp.Config +return { + cmd = { 'anakinls' }, + filetypes = { 'python' }, + root_markers = { + 'pyproject.toml', + 'setup.py', + 'setup.cfg', + 'requirements.txt', + 'Pipfile', + '.git', + }, + settings = { + anakinls = { + pyflakes_errors = { + -- Full list: https://github.com/PyCQA/pyflakes/blob/master/pyflakes/messages.py + + 'ImportStarNotPermitted', + + 'UndefinedExport', + 'UndefinedLocal', + 'UndefinedName', + + 'DuplicateArgument', + 'MultiValueRepeatedKeyLiteral', + 'MultiValueRepeatedKeyVariable', + + 'FutureFeatureNotDefined', + 'LateFutureImport', + + 'ReturnOutsideFunction', + 'YieldOutsideFunction', + 'ContinueOutsideLoop', + 'BreakOutsideLoop', + + 'TwoStarredExpressions', + 'TooManyExpressionsInStarredAssignment', + + 'ForwardAnnotationSyntaxError', + 'RaiseNotImplemented', + + 'StringDotFormatExtraPositionalArguments', + 'StringDotFormatExtraNamedArguments', + 'StringDotFormatMissingArgument', + 'StringDotFormatMixingAutomatic', + 'StringDotFormatInvalidFormat', + + 'PercentFormatInvalidFormat', + 'PercentFormatMixedPositionalAndNamed', + 'PercentFormatUnsupportedFormat', + 'PercentFormatPositionalCountMismatch', + 'PercentFormatExtraNamedArguments', + 'PercentFormatMissingArgument', + 'PercentFormatExpectedMapping', + 'PercentFormatExpectedSequence', + 'PercentFormatStarRequiresSequence', + }, + }, + }, +} diff --git a/.config/nvim/lsp/angularls.lua b/.config/nvim/lsp/angularls.lua new file mode 100644 index 0000000..af82b87 --- /dev/null +++ b/.config/nvim/lsp/angularls.lua @@ -0,0 +1,123 @@ +---@brief +--- +--- https://github.com/angular/vscode-ng-language-service +--- `angular-language-server` can be installed via npm `npm install -g @angular/language-server`. +--- +--- ```lua +--- local project_library_path = "/path/to/project/lib" +--- local cmd = {"ngserver", "--stdio", "--tsProbeLocations", project_library_path , "--ngProbeLocations", project_library_path} +--- +--- vim.lsp.config('angularls', { +--- cmd = cmd, +--- }) +--- ``` + +-- Angular requires a node_modules directory to probe for @angular/language-service and typescript +-- in order to use your projects configured versions. +local fs, fn, uv = vim.fs, vim.fn, vim.uv + +--- Recursively solve for the original ngserver path on Windows +-- For a given ngserver path: +-- - If it is not a CMD wrapper, return the path; +-- - Or else, extract the path from the CMD wrapper. +-- +-- @param cmd_path (string) path for the ngserver executable or its CMD wrapper. +-- @return (string) the original executable path for ngserver +-- @usage +-- -- Base case: cmd_path already points to ngserver (expected behavior on Linux) +-- resolve_cmd_shim('/home/user/project/node_modules/@angular/language-server/bin/ngserver') +-- => '/home/user/project/node_modules/@angular/language-server/bin/ngserver' +-- +-- -- Recursive case: cmd_path points to a CMD wrapper (Windows) +-- resolve_cmd_shim('C:/Users/user/project/node_modules/.bin/ngserver.cmd') +-- => 'C:/Users/user/project/node_modules/@angular/language-server/bin/ngserver' +local function resolve_cmd_shim(cmd_path) + if not cmd_path:lower():match('%ngserver.cmd$') then + return cmd_path + end + + local ok, content = pcall(fn.readblob, cmd_path) + if not ok or not content then + return cmd_path + end + + local target = content:match('%s%"%%dp0%%\\([^\r\n]-ngserver[^\r\n]-)%"') + if not target then + return cmd_path + end + + local full = fs.normalize(fs.joinpath(fs.dirname(cmd_path), target)) + + return resolve_cmd_shim(full) +end + +local function collect_node_modules(root_dir) + local results = {} + + local project_node = fs.joinpath(root_dir, 'node_modules') + if uv.fs_stat(project_node) then + table.insert(results, project_node) + end + + local ngserver_exe = fn.exepath('ngserver') + if ngserver_exe and #ngserver_exe > 0 then + local realpath = uv.fs_realpath(ngserver_exe) or ngserver_exe + realpath = resolve_cmd_shim(realpath) + local candidate = fs.normalize(fs.joinpath(fs.dirname(realpath), '../../..')) + if uv.fs_stat(candidate) then + table.insert(results, candidate) + end + end + + return results +end + +local function get_angular_core_version(root_dir) + local package_json = fs.joinpath(root_dir, 'package.json') + if not uv.fs_stat(package_json) then + return '' + end + + local ok, content = pcall(fn.readblob, package_json) + if not ok or not content then + return '' + end + + local json = vim.json.decode(content) or {} + + local version = (json.dependencies or {})['@angular/core'] or '' + return version:match('%d+%.%d+%.%d+') or '' +end + +---@type vim.lsp.Config +return { + cmd = function(dispatchers, config) + local root_dir = (config and config.root_dir) or fn.getcwd() + local node_paths = collect_node_modules(root_dir) + + local ts_probe = table.concat(node_paths, ',') + local ng_probe = table.concat( + vim + .iter(node_paths) + :map(function(p) + return fs.joinpath(p, '@angular/language-server/node_modules') + end) + :totable(), + ',' + ) + local cmd = { + 'ngserver', + '--stdio', + '--tsProbeLocations', + ts_probe, + '--ngProbeLocations', + ng_probe, + '--angularCoreVersion', + get_angular_core_version(root_dir), + } + return vim.lsp.rpc.start(cmd, dispatchers) + end, + + filetypes = { 'typescript', 'html', 'typescriptreact', 'typescript.tsx', 'htmlangular' }, + root_markers = { 'angular.json', 'nx.json' }, +} diff --git a/.config/nvim/lsp/ansiblels.lua b/.config/nvim/lsp/ansiblels.lua new file mode 100644 index 0000000..db292c3 --- /dev/null +++ b/.config/nvim/lsp/ansiblels.lua @@ -0,0 +1,38 @@ +---@brief +--- +--- https://github.com/ansible/vscode-ansible +--- +--- Language server for the ansible configuration management tool. +--- +--- `ansible-language-server` can be installed via `npm`: +--- +--- ```sh +--- npm install -g @ansible/ansible-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'ansible-language-server', '--stdio' }, + settings = { + ansible = { + python = { + interpreterPath = 'python', + }, + ansible = { + path = 'ansible', + }, + executionEnvironment = { + enabled = false, + }, + validation = { + enabled = true, + lint = { + enabled = true, + path = 'ansible-lint', + }, + }, + }, + }, + filetypes = { 'yaml.ansible' }, + root_markers = { 'ansible.cfg', '.ansible-lint' }, +} diff --git a/.config/nvim/lsp/antlersls.lua b/.config/nvim/lsp/antlersls.lua new file mode 100644 index 0000000..28777bf --- /dev/null +++ b/.config/nvim/lsp/antlersls.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://www.npmjs.com/package/antlers-language-server +--- +--- `antlersls` can be installed via `npm`: +--- ```sh +--- npm install -g antlers-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'antlersls', '--stdio' }, + filetypes = { 'html', 'antlers' }, + root_markers = { 'composer.json' }, +} diff --git a/.config/nvim/lsp/apex_ls.lua b/.config/nvim/lsp/apex_ls.lua new file mode 100644 index 0000000..7052c19 --- /dev/null +++ b/.config/nvim/lsp/apex_ls.lua @@ -0,0 +1,61 @@ +--- @brief +--- +--- https://github.com/forcedotcom/salesforcedx-vscode +--- +--- Language server for Apex. +--- +--- For manual installation, download the JAR file from the [VSCode +--- extension](https://github.com/forcedotcom/salesforcedx-vscode/tree/develop/packages/salesforcedx-vscode-apex) and adjust the `apex_jar_path` appropriately. +--- +--- ```lua +--- vim.lsp.config('apex_ls', { +--- apex_jar_path = '/path/to/apex-jorje-lsp.jar', +--- apex_enable_semantic_errors = false, -- Whether to allow Apex Language Server to surface semantic errors +--- apex_enable_completion_statistics = false, -- Whether to allow Apex Language Server to collect telemetry on code completion usage +--- } +---``` +--- +--- Example configuration using Mason: +--- +---```lua +--- vim.lsp.config('apex_ls', { +--- apex_jar_path = vim.fn.stdpath('data') .. '/mason/share/apex-language-server/apex-jorje-lsp.jar', +--- } +---``` +--- +--- For a complete experience, you may need to ensure the treesitter parsers for 'apex' are installed (:TSInstall apex) as well as configure the filetype for apex (*.cls) files: +--- +--- ```lua +--- vim.filetype.add({ +--- pattern = { +--- ['.*/*.cls'] = 'apex', +--- }, +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = function(dispatchers, config) + ---@diagnostic disable: undefined-field + local local_cmd = { + vim.env.JAVA_HOME and (vim.env.JAVA_HOME .. '/bin/java') or 'java', + '-cp', + config.apex_jar_path, + '-Ddebug.internal.errors=true', + '-Ddebug.semantic.errors=' .. tostring(config.apex_enable_semantic_errors or false), + '-Ddebug.completion.statistics=' .. tostring(config.apex_enable_completion_statistics or false), + '-Dlwc.typegeneration.disabled=true', + } + if config.apex_jvm_max_heap then + table.insert(local_cmd, '-Xmx' .. config.apex_jvm_max_heap) + end + ---@diagnostic enable: undefined-field + table.insert(local_cmd, 'apex.jorje.lsp.ApexLanguageServerLauncher') + + return vim.lsp.rpc.start(local_cmd, dispatchers) + end, + filetypes = { 'apex', 'apexcode' }, + root_markers = { + 'sfdx-project.json', + }, +} diff --git a/.config/nvim/lsp/arduino_language_server.lua b/.config/nvim/lsp/arduino_language_server.lua new file mode 100644 index 0000000..769a917 --- /dev/null +++ b/.config/nvim/lsp/arduino_language_server.lua @@ -0,0 +1,93 @@ +---@brief +--- +--- https://github.com/arduino/arduino-language-server +--- +--- Language server for Arduino +--- +--- The `arduino-language-server` can be installed by running: +--- +--- ``` +--- go install github.com/arduino/arduino-language-server@latest +--- ``` +--- +--- The `arduino-cli` tool must also be installed. Follow [these +--- installation instructions](https://arduino.github.io/arduino-cli/latest/installation/) for +--- your platform. +--- +--- After installing `arduino-cli`, follow [these +--- instructions](https://arduino.github.io/arduino-cli/latest/getting-started/#create-a-configuration-file) +--- for generating a configuration file if you haven't done so already, and make +--- sure you [install any relevant platforms +--- libraries](https://arduino.github.io/arduino-cli/latest/getting-started/#install-the-core-for-your-board). +--- +--- The language server also requires `clangd` to be installed. Follow [these +--- installation instructions](https://clangd.llvm.org/installation) for your +--- platform. +--- +--- If you don't have a sketch yet create one. +--- +--- ```sh +--- $ arduino-cli sketch new test +--- $ cd test +--- ``` +--- +--- You will need a `sketch.yaml` file in order for the language server to understand your project. It will also save you passing options to `arduino-cli` each time you compile or upload a file. You can generate the file by using the following commands. +--- +--- +--- First gather some information about your board. Make sure your board is connected and run the following: +--- +--- ```sh +--- $ arduino-cli board list +--- Port Protocol Type Board Name FQBN Core +--- /dev/ttyACM0 serial Serial Port (USB) Arduino Uno arduino:avr:uno arduino:avr +--- ``` +--- +--- Then generate the file: +--- +--- ```sh +--- arduino-cli board attach -p /dev/ttyACM0 -b arduino:avr:uno test.ino +--- ``` +--- +--- The resulting file should look like this: +--- +--- ```yaml +--- default_fqbn: arduino:avr:uno +--- default_port: /dev/ttyACM0 +--- ``` +--- +--- Your folder structure should look like this: +--- +--- ``` +--- . +--- ├── test.ino +--- └── sketch.yaml +--- ``` +--- +--- For further instructions about configuration options, run `arduino-language-server --help`. +--- +--- Note that an upstream bug makes keywords in some cases become undefined by the language server. +--- Ref: https://github.com/arduino/arduino-ide/issues/159 + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + filetypes = { 'arduino' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern('*.ino')(fname)) + end, + cmd = { + 'arduino-language-server', + }, + capabilities = { + textDocument = { + ---@diagnostic disable-next-line: assign-type-mismatch + semanticTokens = vim.NIL, + }, + workspace = { + ---@diagnostic disable-next-line: assign-type-mismatch + semanticTokens = vim.NIL, + }, + }, +} diff --git a/.config/nvim/lsp/asm_lsp.lua b/.config/nvim/lsp/asm_lsp.lua new file mode 100644 index 0000000..28678c0 --- /dev/null +++ b/.config/nvim/lsp/asm_lsp.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/bergercookie/asm-lsp +--- +--- Language Server for NASM/GAS/GO Assembly +--- +--- `asm-lsp` can be installed via cargo: +--- cargo install asm-lsp + +---@type vim.lsp.Config +return { + cmd = { 'asm-lsp' }, + filetypes = { 'asm', 'vmasm' }, + root_markers = { '.asm-lsp.toml', '.git' }, +} diff --git a/.config/nvim/lsp/ast_grep.lua b/.config/nvim/lsp/ast_grep.lua new file mode 100644 index 0000000..5ac225f --- /dev/null +++ b/.config/nvim/lsp/ast_grep.lua @@ -0,0 +1,48 @@ +---@brief +--- +--- https://ast-grep.github.io/ +--- +--- ast-grep(sg) is a fast and polyglot tool for code structural search, lint, rewriting at large scale. +--- ast-grep LSP only works in projects that have `sgconfig.y[a]ml` in their root directories. +--- ```sh +--- npm install [-g] @ast-grep/cli +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'ast-grep', 'lsp' }, + workspace_required = true, + reuse_client = function(client, config) + config.cmd_cwd = config.root_dir + return client.config.cmd_cwd == config.cmd_cwd + end, + filetypes = { -- https://ast-grep.github.io/reference/languages.html + 'bash', + 'c', + 'cpp', + 'cs', + 'css', + 'elixir', + 'go', + 'haskell', + 'html', + 'java', + 'javascript', + 'javascriptreact', + 'json', + 'kotlin', + 'lua', + 'nix', + 'php', + 'python', + 'ruby', + 'rust', + 'scala', + 'solidity', + 'swift', + 'typescript', + 'typescriptreact', + 'yaml', + }, + root_markers = { 'sgconfig.yaml', 'sgconfig.yml' }, +} diff --git a/.config/nvim/lsp/astro.lua b/.config/nvim/lsp/astro.lua new file mode 100644 index 0000000..a85aae3 --- /dev/null +++ b/.config/nvim/lsp/astro.lua @@ -0,0 +1,25 @@ +---@brief +--- +--- https://github.com/withastro/language-tools/tree/main/packages/language-server +--- +--- `astro-ls` can be installed via `npm`: +--- ```sh +--- npm install -g @astrojs/language-server +--- ``` + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'astro-ls', '--stdio' }, + filetypes = { 'astro' }, + root_markers = { 'package.json', 'tsconfig.json', 'jsconfig.json', '.git' }, + init_options = { + typescript = {}, + }, + before_init = function(_, config) + if config.init_options and config.init_options.typescript and not config.init_options.typescript.tsdk then + config.init_options.typescript.tsdk = util.get_typescript_server_path(config.root_dir) + end + end, +} diff --git a/.config/nvim/lsp/atlas.lua b/.config/nvim/lsp/atlas.lua new file mode 100644 index 0000000..e54dbea --- /dev/null +++ b/.config/nvim/lsp/atlas.lua @@ -0,0 +1,66 @@ +---@brief +--- +--- https://github.com/ariga/atlas +--- +--- Language server for Atlas config and schema files. +--- +--- You may also need to configure the filetype for *.hcl files: +--- +--- ```vim +--- autocmd BufNewFile,BufRead atlas.hcl set filetype=atlas-config +--- autocmd BufNewFile,BufRead *.my.hcl set filetype=atlas-schema-mysql +--- autocmd BufNewFile,BufRead *.pg.hcl set filetype=atlas-schema-postgresql +--- autocmd BufNewFile,BufRead *.lt.hcl set filetype=atlas-schema-sqlite +--- autocmd BufNewFile,BufRead *.ch.hcl set filetype=atlas-schema-clickhouse +--- autocmd BufNewFile,BufRead *.ms.hcl set filetype=atlas-schema-mssql +--- autocmd BufNewFile,BufRead *.rs.hcl set filetype=atlas-schema-redshift +--- autocmd BufNewFile,BufRead *.test.hcl set filetype=atlas-test +--- autocmd BufNewFile,BufRead *.plan.hcl set filetype=atlas-plan +--- autocmd BufNewFile,BufRead *.rule.hcl set filetype=atlas-rule +--- ``` +--- +--- or +--- +--- ```lua +--- vim.filetype.add({ +--- filename = { +--- ['atlas.hcl'] = 'atlas-config', +--- }, +--- pattern = { +--- ['.*/*.my.hcl'] = 'atlas-schema-mysql', +--- ['.*/*.pg.hcl'] = 'atlas-schema-postgresql', +--- ['.*/*.lt.hcl'] = 'atlas-schema-sqlite', +--- ['.*/*.ch.hcl'] = 'atlas-schema-clickhouse', +--- ['.*/*.ms.hcl'] = 'atlas-schema-mssql', +--- ['.*/*.rs.hcl'] = 'atlas-schema-redshift', +--- ['.*/*.test.hcl'] = 'atlas-test', +--- ['.*/*.plan.hcl'] = 'atlas-plan', +--- ['.*/*.rule.hcl'] = 'atlas-rule', +--- }, +--- }) +--- ``` +--- +--- Optionally, tell treesitter to treat Atlas filetypes as HCL for better syntax highlighting: +--- +--- ```lua +--- vim.treesitter.language.register('hcl', 'atlas-config') +--- vim.treesitter.language.register('hcl', 'atlas-schema-mysql') +--- vim.treesitter.language.register('hcl', 'atlas-schema-postgresql') +--- vim.treesitter.language.register('hcl', 'atlas-schema-sqlite') +--- vim.treesitter.language.register('hcl', 'atlas-schema-clickhouse') +--- vim.treesitter.language.register('hcl', 'atlas-schema-mssql') +--- vim.treesitter.language.register('hcl', 'atlas-schema-redshift') +--- vim.treesitter.language.register('hcl', 'atlas-test') +--- vim.treesitter.language.register('hcl', 'atlas-plan') +--- vim.treesitter.language.register('hcl', 'atlas-rule') +--- ``` +--- + +---@type vim.lsp.Config +return { + cmd = { 'atlas', 'tool', 'lsp', '--stdio' }, + filetypes = { + 'atlas-*', + }, + root_markers = { 'atlas.hcl' }, +} diff --git a/.config/nvim/lsp/atopile.lua b/.config/nvim/lsp/atopile.lua new file mode 100644 index 0000000..6548b7e --- /dev/null +++ b/.config/nvim/lsp/atopile.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://atopile.io/ +--- +--- A language server for atopile Programming Language. +--- +--- It comes with the atopile compiler, for installation see: [Installing atopile](https://docs.atopile.io/atopile/guides/install) + +---@type vim.lsp.Config +return { + cmd = { 'ato', 'lsp', 'start' }, + filetypes = { 'ato' }, + root_markers = { 'ato.yaml', '.ato', '.git' }, +} diff --git a/.config/nvim/lsp/autohotkey_lsp.lua b/.config/nvim/lsp/autohotkey_lsp.lua new file mode 100644 index 0000000..fe11d15 --- /dev/null +++ b/.config/nvim/lsp/autohotkey_lsp.lua @@ -0,0 +1,52 @@ +---@brief +--- +--- https://github.com/thqby/vscode-autohotkey2-lsp +--- +--- AutoHotkey v2.0 LSP implementation +--- +--- NOTE: AutoHotkey is Windows-only. + +local function get_autohotkey_path() + local path = vim.fn.exepath('autohotkey.exe') + return #path > 0 and path or '' +end + +---@type vim.lsp.Config +return { + cmd = { 'autohotkey_lsp', '--stdio' }, + filetypes = { 'autohotkey' }, + root_markers = { 'package.json' }, + ---@diagnostic disable-next-line: missing-fields + flags = { debounce_text_changes = 500 }, + --capabilities = capabilities, + --on_attach = custom_attach, + init_options = { + locale = 'en-us', + InterpreterPath = get_autohotkey_path(), + AutoLibInclude = 'All', + CommentTags = '^;;\\s*(?.+)', + CompleteFunctionParens = false, + SymbolFoldinFromOpenBrace = false, + Diagnostics = { + ClassStaticMemberCheck = true, + ParamsCheck = true, + }, + ActionWhenV1IsDetected = 'Continue', + FormatOptions = { + array_style = 'expand', + break_chained_methods = false, + ignore_comment = false, + indent_string = '\t', + max_preserve_newlines = 2, + brace_style = 'One True Brace', + object_style = 'none', + preserve_newlines = true, + space_after_double_colon = true, + space_before_conditional = true, + space_in_empty_paren = false, + space_in_other = true, + space_in_paren = false, + wrap_line_length = 0, + }, + }, +} diff --git a/.config/nvim/lsp/autotools_ls.lua b/.config/nvim/lsp/autotools_ls.lua new file mode 100644 index 0000000..721c24c --- /dev/null +++ b/.config/nvim/lsp/autotools_ls.lua @@ -0,0 +1,24 @@ +---@brief +--- +--- https://github.com/Freed-Wu/autotools-language-server +--- +--- `autotools-language-server` can be installed via `pip`: +--- ```sh +--- pip install autotools-language-server +--- ``` +--- +--- Language server for autoconf, automake and make using tree sitter in python. + +local util = require 'lspconfig.util' + +local root_files = { 'configure.ac', 'Makefile', 'Makefile.am', '*.mk' } + +---@type vim.lsp.Config +return { + cmd = { 'autotools-language-server' }, + filetypes = { 'config', 'automake', 'make' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern(unpack(root_files))(fname)) + end, +} diff --git a/.config/nvim/lsp/awk_ls.lua b/.config/nvim/lsp/awk_ls.lua new file mode 100644 index 0000000..7932913 --- /dev/null +++ b/.config/nvim/lsp/awk_ls.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/Beaglefoot/awk-language-server/ +--- +--- `awk-language-server` can be installed via `npm`: +--- ```sh +--- npm install -g awk-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'awk-language-server' }, + filetypes = { 'awk' }, +} diff --git a/.config/nvim/lsp/azure_pipelines_ls.lua b/.config/nvim/lsp/azure_pipelines_ls.lua new file mode 100644 index 0000000..2313ca4 --- /dev/null +++ b/.config/nvim/lsp/azure_pipelines_ls.lua @@ -0,0 +1,39 @@ +---@brief +--- +--- https://github.com/microsoft/azure-pipelines-language-server +--- +--- An Azure Pipelines language server +--- +--- `azure-pipelines-ls` can be installed via `npm`: +--- +--- ```sh +--- npm install -g azure-pipelines-language-server +--- ``` +--- +--- By default `azure-pipelines-ls` will only work in files named `azure-pipelines.yml`, this can be changed by providing additional settings like so: +--- ```lua +--- vim.lsp.config('azure_pipelines_ls', { +--- ... -- other configuration +--- settings = { +--- yaml = { +--- schemas = { +--- ["https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json"] = { +--- "/azure-pipeline*.y*l", +--- "/*.azure*", +--- "Azure-Pipelines/**/*.y*l", +--- "Pipelines/*.y*l", +--- }, +--- }, +--- }, +--- }, +--- }) +--- ``` +--- The Azure Pipelines LSP is a fork of `yaml-language-server` and as such the same settings can be passed to it as `yaml-language-server`. + +---@type vim.lsp.Config +return { + cmd = { 'azure-pipelines-language-server', '--stdio' }, + filetypes = { 'yaml' }, + root_markers = { 'azure-pipelines.yml' }, + settings = {}, +} diff --git a/.config/nvim/lsp/bacon_ls.lua b/.config/nvim/lsp/bacon_ls.lua new file mode 100644 index 0000000..44c5697 --- /dev/null +++ b/.config/nvim/lsp/bacon_ls.lua @@ -0,0 +1,47 @@ +---@brief +--- +--- https://github.com/crisidev/bacon-ls +--- +--- A Language Server Protocol wrapper for [bacon](https://dystroy.org/bacon/). +--- It offers textDocument/diagnostic and workspace/diagnostic capabilities for Rust +--- workspaces using the Bacon export locations file. +--- +--- It requires `bacon` and `bacon-ls` to be installed on the system using +--- [mason.nvim](https://github.com/williamboman/mason.nvim) or manually +--- +--- ```sh +--- $ cargo install --locked bacon bacon-ls +--- ``` +--- +--- Settings can be changed using the `init_options` dictionary:util +--- +--- ```lua +--- init_options = { +--- -- Bacon export filename (default: .bacon-locations). +--- locationsFile = ".bacon-locations", +--- -- Try to update diagnostics every time the file is saved (default: true). +--- updateOnSave = true, +--- -- How many milliseconds to wait before updating diagnostics after a save (default: 1000). +--- updateOnSaveWaitMillis = 1000, +--- -- Try to update diagnostics every time the file changes (default: true). +--- updateOnChange = true, +--- -- Try to validate that bacon preferences are setup correctly to work with bacon-ls (default: true). +--- validateBaconPreferences = true, +--- -- f no bacon preferences file is found, create a new preferences file with the bacon-ls job definition (default: true). +--- createBaconPreferencesFile = true, +--- -- Run bacon in background for the bacon-ls job (default: true) +--- runBaconInBackground = true, +--- -- Command line arguments to pass to bacon running in background (default "--headless -j bacon-ls") +--- runBaconInBackgroundCommandArguments = "--headless -j bacon-ls", +--- -- How many milliseconds to wait between background diagnostics check to synchronize all open files (default: 2000). +--- synchronizeAllOpenFilesWaitMillis = 2000, +--- } +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'bacon-ls' }, + filetypes = { 'rust' }, + root_markers = { '.bacon-locations', 'Cargo.toml' }, + init_options = {}, +} diff --git a/.config/nvim/lsp/ballerina.lua b/.config/nvim/lsp/ballerina.lua new file mode 100644 index 0000000..dbe8a7e --- /dev/null +++ b/.config/nvim/lsp/ballerina.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- Ballerina language server +--- +--- The Ballerina language's CLI tool comes with its own language server implementation. +--- The `bal` command line tool must be installed and available in your system's PATH. + +---@type vim.lsp.Config +return { + cmd = { 'bal', 'start-language-server' }, + filetypes = { 'ballerina' }, + root_markers = { 'Ballerina.toml' }, +} diff --git a/.config/nvim/lsp/basedpyright.lua b/.config/nvim/lsp/basedpyright.lua new file mode 100644 index 0000000..8ae1a06 --- /dev/null +++ b/.config/nvim/lsp/basedpyright.lua @@ -0,0 +1,68 @@ +---@brief +--- +--- https://detachhead.github.io/basedpyright +--- +--- `basedpyright`, a static type checker and language server for python + +local function set_python_path(command) + local path = command.args + local clients = vim.lsp.get_clients { + bufnr = vim.api.nvim_get_current_buf(), + name = 'basedpyright', + } + for _, client in ipairs(clients) do + if client.settings then + ---@diagnostic disable-next-line: param-type-mismatch + client.settings.python = vim.tbl_deep_extend('force', client.settings.python or {}, { pythonPath = path }) + else + client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { python = { pythonPath = path } }) + end + client:notify('workspace/didChangeConfiguration', { settings = nil }) + end +end + +---@type vim.lsp.Config +return { + cmd = { 'basedpyright-langserver', '--stdio' }, + filetypes = { 'python' }, + root_markers = { + 'pyrightconfig.json', + 'pyproject.toml', + 'setup.py', + 'setup.cfg', + 'requirements.txt', + 'Pipfile', + '.git', + }, + settings = { + basedpyright = { + analysis = { + autoSearchPaths = true, + useLibraryCodeForTypes = true, + diagnosticMode = 'openFilesOnly', + }, + }, + }, + on_attach = function(client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightOrganizeImports', function() + local params = { + command = 'basedpyright.organizeimports', + arguments = { vim.uri_from_bufnr(bufnr) }, + } + + -- Using client.request() directly because "basedpyright.organizeimports" is private + -- (not advertised via capabilities), which client:exec_cmd() refuses to call. + -- https://github.com/neovim/neovim/blob/c333d64663d3b6e0dd9aa440e433d346af4a3d81/runtime/lua/vim/lsp/client.lua#L1024-L1030 + ---@diagnostic disable-next-line: param-type-mismatch + client.request('workspace/executeCommand', params, nil, bufnr) + end, { + desc = 'Organize Imports', + }) + + vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightSetPythonPath', set_python_path, { + desc = 'Reconfigure basedpyright with the provided python path', + nargs = 1, + complete = 'file', + }) + end, +} diff --git a/.config/nvim/lsp/bashls.lua b/.config/nvim/lsp/bashls.lua new file mode 100644 index 0000000..fbd396a --- /dev/null +++ b/.config/nvim/lsp/bashls.lua @@ -0,0 +1,29 @@ +---@brief +--- +--- https://github.com/bash-lsp/bash-language-server +--- +--- `bash-language-server` can be installed via `npm`: +--- ```sh +--- npm i -g bash-language-server +--- ``` +--- +--- Language server for bash, written using tree sitter in typescript. + +---@type vim.lsp.Config +return { + cmd = { 'bash-language-server', 'start' }, + settings = { + bashIde = { + -- Glob pattern for finding and parsing shell script files in the workspace. + -- Used by the background analysis features across files. + + -- Prevent recursive scanning which will cause issues when opening a file + -- directly in the home directory (e.g. ~/foo.sh). + -- + -- Default upstream pattern is "**/*@(.sh|.inc|.bash|.command)". + globPattern = vim.env.GLOB_PATTERN or '*@(.sh|.inc|.bash|.command)', + }, + }, + filetypes = { 'bash', 'sh' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/basics_ls.lua b/.config/nvim/lsp/basics_ls.lua new file mode 100644 index 0000000..1810a92 --- /dev/null +++ b/.config/nvim/lsp/basics_ls.lua @@ -0,0 +1,27 @@ +---@brief +--- +--- https://github.com/antonk52/basics-language-server/ +--- +--- Buffer, path, and snippet completion +--- +--- ```sh +--- npm install -g basics-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'basics-language-server' }, + settings = { + buffer = { + enable = true, + minCompletionLength = 4, + }, + path = { + enable = true, + }, + snippet = { + enable = false, + sources = {}, + }, + }, +} diff --git a/.config/nvim/lsp/bazelrc_lsp.lua b/.config/nvim/lsp/bazelrc_lsp.lua new file mode 100644 index 0000000..6e6b89f --- /dev/null +++ b/.config/nvim/lsp/bazelrc_lsp.lua @@ -0,0 +1,22 @@ +---@brief +--- +--- https://github.com/salesforce-misc/bazelrc-lsp +--- +--- `bazelrc-lsp` is a LSP for `.bazelrc` configuration files. +--- +--- The `.bazelrc` file type is not detected automatically, you can register it manually (see below) or override the filetypes: +--- +--- ```lua +--- vim.filetype.add { +--- pattern = { +--- ['.*.bazelrc'] = 'bazelrc', +--- }, +--- } +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'bazelrc-lsp', 'lsp' }, + filetypes = { 'bazelrc' }, + root_markers = { 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel' }, +} diff --git a/.config/nvim/lsp/beancount.lua b/.config/nvim/lsp/beancount.lua new file mode 100644 index 0000000..bb53a76 --- /dev/null +++ b/.config/nvim/lsp/beancount.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://github.com/polarmutex/beancount-language-server#installation +--- +--- See https://github.com/polarmutex/beancount-language-server#configuration for configuration options + +---@type vim.lsp.Config +return { + cmd = { 'beancount-language-server', '--stdio' }, + filetypes = { 'beancount', 'bean' }, + root_markers = { '.git' }, + init_options = {}, +} diff --git a/.config/nvim/lsp/bicep.lua b/.config/nvim/lsp/bicep.lua new file mode 100644 index 0000000..4e6e215 --- /dev/null +++ b/.config/nvim/lsp/bicep.lua @@ -0,0 +1,40 @@ +---@brief +--- +--- https://github.com/azure/bicep +--- Bicep language server +--- +--- Bicep language server can be installed by downloading and extracting a release of bicep-langserver.zip from [Bicep GitHub releases](https://github.com/Azure/bicep/releases). +--- +--- Bicep language server requires the [dotnet-sdk](https://dotnet.microsoft.com/download) to be installed. +--- +--- Neovim does not have built-in support for the bicep filetype which is required for lspconfig to automatically launch the language server. +--- +--- Filetype detection can be added via an autocmd: +--- ```lua +--- vim.cmd [[ autocmd BufNewFile,BufRead *.bicep set filetype=bicep ]] +--- ``` +--- +--- **By default, bicep language server does not have a `cmd` set.** This is because nvim-lspconfig does not make assumptions about your path. You must add the following to your init.vim or init.lua to set `cmd` to the absolute path ($HOME and ~ are not expanded) of the unzipped run script or binary. +--- +--- ```lua +--- local bicep_lsp_bin = "/path/to/bicep-langserver/Bicep.LangServer.dll" +--- vim.lsp.config('bicep', { +--- cmd = { "dotnet", bicep_lsp_bin }; +--- ... +--- }) +--- ``` +--- +--- To download the latest release and place in /usr/local/bin/bicep-langserver: +--- ```bash +--- (cd $(mktemp -d) \ +--- && curl -fLO https://github.com/Azure/bicep/releases/latest/download/bicep-langserver.zip \ +--- && rm -rf /usr/local/bin/bicep-langserver \ +--- && unzip -d /usr/local/bin/bicep-langserver bicep-langserver.zip) +--- ``` + +---@type vim.lsp.Config +return { + filetypes = { 'bicep', 'bicep-params' }, + root_markers = { '.git' }, + init_options = {}, +} diff --git a/.config/nvim/lsp/biome.lua b/.config/nvim/lsp/biome.lua new file mode 100644 index 0000000..3ea7918 --- /dev/null +++ b/.config/nvim/lsp/biome.lua @@ -0,0 +1,78 @@ +---@brief +--- https://biomejs.dev +--- +--- Toolchain of the web. [Successor of Rome](https://biomejs.dev/blog/annoucing-biome). +--- +--- ```sh +--- npm install [-g] @biomejs/biome +--- ``` +--- +--- ### Monorepo support +--- +--- `biome` supports monorepos by default. It will automatically find the `biome.json` corresponding to the package you are working on, as described in the [documentation](https://biomejs.dev/guides/big-projects/#monorepo). This works without the need of spawning multiple instances of `biome`, saving memory. + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = function(dispatchers, config) + local cmd = 'biome' + local local_cmd = (config or {}).root_dir and config.root_dir .. '/node_modules/.bin/biome' + if local_cmd and vim.fn.executable(local_cmd) == 1 then + cmd = local_cmd + end + return vim.lsp.rpc.start({ cmd, 'lsp-proxy' }, dispatchers) + end, + filetypes = { + 'astro', + 'css', + 'graphql', + 'html', + 'javascript', + 'javascriptreact', + 'json', + 'jsonc', + 'svelte', + 'typescript', + 'typescript.tsx', + 'typescriptreact', + 'vue', + }, + workspace_required = true, + root_dir = function(bufnr, on_dir) + -- The project root is where the LSP can be started from + -- As stated in the documentation above, this LSP supports monorepos and simple projects. + -- We select then from the project root, which is identified by the presence of a package + -- manager lock file. + local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock' } + -- Give the root markers equal priority by wrapping them in a table + root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } } + or vim.list_extend(root_markers, { '.git' }) + + -- exclude deno + if vim.fs.root(bufnr, { 'deno.json', 'deno.jsonc', 'deno.lock' }) then + return + end + + -- We fallback to the current working directory if no project root is found + local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd() + + -- We know that the buffer is using Biome if it has a config file + -- in its directory tree. + local filename = vim.api.nvim_buf_get_name(bufnr) + local biome_config_files = { 'biome.json', 'biome.jsonc' } + biome_config_files = util.insert_package_json(biome_config_files, 'biomejs', filename) + local is_buffer_using_biome = vim.fs.find(biome_config_files, { + path = filename, + type = 'file', + limit = 1, + upward = true, + stop = vim.fs.dirname(project_root), + })[1] + if not is_buffer_using_biome then + return + end + + on_dir(project_root) + end, +} diff --git a/.config/nvim/lsp/bitbake_language_server.lua b/.config/nvim/lsp/bitbake_language_server.lua new file mode 100644 index 0000000..846db07 --- /dev/null +++ b/.config/nvim/lsp/bitbake_language_server.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/Freed-Wu/bitbake-language-server +--- +--- `bitbake-language-server` can be installed via `pip`: +--- ```sh +--- pip install bitbake-language-server +--- ``` +--- +--- Language server for bitbake. + +---@type vim.lsp.Config +return { + cmd = { 'bitbake-language-server' }, + filetypes = { 'bitbake' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/blueprint_ls.lua b/.config/nvim/lsp/blueprint_ls.lua new file mode 100644 index 0000000..3721f6a --- /dev/null +++ b/.config/nvim/lsp/blueprint_ls.lua @@ -0,0 +1,22 @@ +---@brief +--- +--- https://gitlab.gnome.org/jwestman/blueprint-compiler +--- +--- `blueprint-compiler` can be installed via your system package manager. +--- +--- Language server for the blueprint markup language, written in python and part +--- of the blueprint-compiler. + +---@type vim.lsp.Config +return { + cmd = { 'blueprint-compiler', 'lsp' }, + cmd_env = { + -- Prevent recursive scanning which will cause issues when opening a file + -- directly in the home directory (e.g. ~/foo.sh). + -- + -- Default upstream pattern is "**/*@(.sh|.inc|.bash|.command)". + GLOB_PATTERN = vim.env.GLOB_PATTERN or '*@(.blp)', + }, + filetypes = { 'blueprint' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/bqls.lua b/.config/nvim/lsp/bqls.lua new file mode 100644 index 0000000..cad3cd2 --- /dev/null +++ b/.config/nvim/lsp/bqls.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/kitagry/bqls +--- +--- The `bqls` BigQuery language server can be installed by running: +--- +--- ```sh +--- $ go install github.com/kitagry/bqls@latest +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'bqls' }, + filetypes = { 'sql' }, + root_markers = { '.git' }, + settings = {}, +} diff --git a/.config/nvim/lsp/bright_script.lua b/.config/nvim/lsp/bright_script.lua new file mode 100644 index 0000000..0f56417 --- /dev/null +++ b/.config/nvim/lsp/bright_script.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/RokuCommunity/brighterscript +--- +--- `brightscript` can be installed via `npm`: +--- ```sh +--- npm install -g brighterscript +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'bsc', '--lsp', '--stdio' }, + filetypes = { 'brs' }, + root_markers = { 'makefile', 'Makefile', '.git' }, +} diff --git a/.config/nvim/lsp/brioche.lua b/.config/nvim/lsp/brioche.lua new file mode 100644 index 0000000..24bf7e1 --- /dev/null +++ b/.config/nvim/lsp/brioche.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/brioche-dev/brioche +--- +--- `Brioche Language Server`. + +---@type vim.lsp.Config +return { + cmd = { 'brioche', 'lsp' }, + filetypes = { 'brioche' }, + root_markers = { 'project.bri' }, +} diff --git a/.config/nvim/lsp/bsl_ls.lua b/.config/nvim/lsp/bsl_ls.lua new file mode 100644 index 0000000..1ab35f5 --- /dev/null +++ b/.config/nvim/lsp/bsl_ls.lua @@ -0,0 +1,11 @@ +---@brief +--- +--- https://github.com/1c-syntax/bsl-language-server +--- +--- Language Server Protocol implementation for 1C (BSL) - 1C:Enterprise 8 and OneScript languages. + +---@type vim.lsp.Config +return { + filetypes = { 'bsl', 'os' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/buck2.lua b/.config/nvim/lsp/buck2.lua new file mode 100644 index 0000000..7bc5d25 --- /dev/null +++ b/.config/nvim/lsp/buck2.lua @@ -0,0 +1,18 @@ +---@brief +--- +--- https://github.com/facebook/buck2 +--- +--- Build system, successor to Buck +--- +--- To better detect Buck2 project files, the following can be added: +--- +--- ``` +--- vim.cmd [[ autocmd BufRead,BufNewFile *.bxl,BUCK,TARGETS set filetype=bzl ]] +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'buck2', 'lsp' }, + filetypes = { 'bzl' }, + root_markers = { '.buckconfig' }, +} diff --git a/.config/nvim/lsp/buddy_ls.lua b/.config/nvim/lsp/buddy_ls.lua new file mode 100644 index 0000000..dc82439 --- /dev/null +++ b/.config/nvim/lsp/buddy_ls.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://github.com/buddy-compiler/buddy-mlir#buddy-lsp-server +--- The Language Server for the buddy-mlir, a drop-in replacement for mlir-lsp-server, +--- supporting new dialects defined in buddy-mlir. +--- `buddy-lsp-server` can be installed at the buddy-mlir repository (buddy-compiler/buddy-mlir) + +---@type vim.lsp.Config +return { + cmd = { 'buddy-lsp-server' }, + filetypes = { 'mlir' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/buf_ls.lua b/.config/nvim/lsp/buf_ls.lua new file mode 100644 index 0000000..2d2f5a7 --- /dev/null +++ b/.config/nvim/lsp/buf_ls.lua @@ -0,0 +1,17 @@ +--- @brief +--- https://github.com/bufbuild/buf +--- +--- buf lsp included in the cli itself +--- +--- buf lsp is a Protobuf language server compatible with Buf modules and workspaces + +---@type vim.lsp.Config +return { + cmd = { 'buf', 'lsp', 'serve', '--log-format=text' }, + filetypes = { 'proto' }, + root_markers = { 'buf.yaml', '.git' }, + reuse_client = function(client, config) + -- `buf lsp serve` is meant to be used with multiple workspaces. + return client.name == config.name + end, +} diff --git a/.config/nvim/lsp/bzl.lua b/.config/nvim/lsp/bzl.lua new file mode 100644 index 0000000..7dc1dfe --- /dev/null +++ b/.config/nvim/lsp/bzl.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://bzl.io/ +--- +--- https://docs.stack.build/docs/cli/installation +--- +--- https://docs.stack.build/docs/vscode/starlark-language-server + +---@type vim.lsp.Config +return { + cmd = { 'bzl', 'lsp', 'serve' }, + filetypes = { 'bzl' }, + -- https://docs.bazel.build/versions/5.4.1/build-ref.html#workspace + root_markers = { 'WORKSPACE', 'WORKSPACE.bazel' }, +} diff --git a/.config/nvim/lsp/c3_lsp.lua b/.config/nvim/lsp/c3_lsp.lua new file mode 100644 index 0000000..0ea9522 --- /dev/null +++ b/.config/nvim/lsp/c3_lsp.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/pherrymason/c3-lsp +--- +--- Language Server for c3. + +---@type vim.lsp.Config +return { + cmd = { 'c3lsp' }, + root_markers = { 'project.json', 'manifest.json', '.git' }, + filetypes = { 'c3', 'c3i' }, +} diff --git a/.config/nvim/lsp/cairo_ls.lua b/.config/nvim/lsp/cairo_ls.lua new file mode 100644 index 0000000..7489245 --- /dev/null +++ b/.config/nvim/lsp/cairo_ls.lua @@ -0,0 +1,20 @@ +---@brief +--- +--- [Cairo Language Server](https://github.com/starkware-libs/cairo/tree/main/crates/cairo-lang-language-server) +--- +--- First, install Cairo following [this tutorial](https://book.cairo-lang.org/ch01-01-installation.html) +--- +--- Then enable Cairo Language Server in your Lua configuration. +--- ```lua +--- vim.lsp.enable('cairo_ls') +--- ``` +--- +--- *cairo-language-server is still under active development, some features might not work yet !* + +---@type vim.lsp.Config +return { + init_options = { hostInfo = 'neovim' }, + cmd = { 'scarb', 'cairo-language-server', '/C', '--node-ipc' }, + filetypes = { 'cairo' }, + root_markers = { 'Scarb.toml', 'cairo_project.toml', '.git' }, +} diff --git a/.config/nvim/lsp/ccls.lua b/.config/nvim/lsp/ccls.lua new file mode 100644 index 0000000..44268df --- /dev/null +++ b/.config/nvim/lsp/ccls.lua @@ -0,0 +1,53 @@ +---@brief +--- +--- https://github.com/MaskRay/ccls/wiki +--- +--- ccls relies on a [JSON compilation database](https://clang.llvm.org/docs/JSONCompilationDatabase.html) specified +--- as compile_commands.json or, for simpler projects, a .ccls. +--- For details on how to automatically generate one using CMake look [here](https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html). Alternatively, you can use [Bear](https://github.com/rizsotto/Bear). +--- +--- Customization options are passed to ccls at initialization time via init_options, a list of available options can be found [here](https://github.com/MaskRay/ccls/wiki/Customization#initialization-options). For example: +--- +--- ```lua +--- vim.lsp.config("ccls", { +--- init_options = { +--- compilationDatabaseDirectory = "build"; +--- index = { +--- threads = 0; +--- }; +--- clang = { +--- excludeArgs = { "-frounding-math"} ; +--- }; +--- } +--- }) +--- ``` + +local function switch_source_header(client, bufnr) + local method_name = 'textDocument/switchSourceHeader' + local params = vim.lsp.util.make_text_document_params(bufnr) + client:request(method_name, params, function(err, result) + if err then + error(tostring(err)) + end + if not result then + vim.notify('corresponding file cannot be determined') + return + end + vim.cmd.edit(vim.uri_to_fname(result)) + end, bufnr) +end + +---@type vim.lsp.Config +return { + cmd = { 'ccls' }, + filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, + root_markers = { 'compile_commands.json', '.ccls', '.git' }, + offset_encoding = 'utf-32', + -- ccls does not support sending a null root directory + workspace_required = true, + on_attach = function(client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspCclsSwitchSourceHeader', function() + switch_source_header(client, bufnr) + end, { desc = 'Switch between source/header' }) + end, +} diff --git a/.config/nvim/lsp/cds_lsp.lua b/.config/nvim/lsp/cds_lsp.lua new file mode 100644 index 0000000..12bfab7 --- /dev/null +++ b/.config/nvim/lsp/cds_lsp.lua @@ -0,0 +1,20 @@ +---@brief +--- +--- https://cap.cloud.sap/docs/ +--- +--- `cds-lsp` can be installed via `npm`: +--- +--- ```sh +--- npm i -g @sap/cds-lsp +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'cds-lsp', '--stdio' }, + filetypes = { 'cds' }, + -- init_options = { provideFormatter = true }, -- needed to enable formatting capabilities + root_markers = { 'package.json', 'db', 'srv' }, + settings = { + cds = { validate = true }, + }, +} diff --git a/.config/nvim/lsp/cir_lsp_server.lua b/.config/nvim/lsp/cir_lsp_server.lua new file mode 100644 index 0000000..15b887f --- /dev/null +++ b/.config/nvim/lsp/cir_lsp_server.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://llvm.github.io/clangir +--- +--- The Language Server for the LLVM ClangIR language +--- +--- `cir-lsp-server` can be installed at the llvm-project repository (https://github.com/llvm/llvm-project) + +---@type vim.lsp.Config +return { + cmd = { 'cir-lsp-server' }, + filetypes = { 'cir' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/circom-lsp.lua b/.config/nvim/lsp/circom-lsp.lua new file mode 100644 index 0000000..c3bb8a4 --- /dev/null +++ b/.config/nvim/lsp/circom-lsp.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- [Circom Language Server](https://github.com/rubydusa/circom-lsp) +--- +--- `circom-lsp`, the language server for the Circom language. + +---@type vim.lsp.Config +return { + cmd = { 'circom-lsp' }, + filetypes = { 'circom' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/clangd.lua b/.config/nvim/lsp/clangd.lua new file mode 100644 index 0000000..07ad347 --- /dev/null +++ b/.config/nvim/lsp/clangd.lua @@ -0,0 +1,100 @@ +---@brief +--- +--- https://clangd.llvm.org/installation.html +--- +--- - **NOTE:** Clang >= 11 is recommended! See [#23](https://github.com/neovim/nvim-lspconfig/issues/23). +--- - If `compile_commands.json` lives in a build directory, you should +--- symlink it to the root of your source tree. +--- ``` +--- ln -s /path/to/myproject/build/compile_commands.json /path/to/myproject/ +--- ``` +--- - clangd relies on a [JSON compilation database](https://clang.llvm.org/docs/JSONCompilationDatabase.html) +--- specified as compile_commands.json, see https://clangd.llvm.org/installation#compile_commandsjson + +-- https://clangd.llvm.org/extensions.html#switch-between-sourceheader +local function switch_source_header(bufnr, client) + local method_name = 'textDocument/switchSourceHeader' + ---@diagnostic disable-next-line:param-type-mismatch + if not client or not client:supports_method(method_name) then + return vim.notify(('method %s is not supported by any servers active on the current buffer'):format(method_name)) + end + local params = vim.lsp.util.make_text_document_params(bufnr) + ---@diagnostic disable-next-line:param-type-mismatch + client:request(method_name, params, function(err, result) + if err then + error(tostring(err)) + end + if not result then + vim.notify('corresponding file cannot be determined') + return + end + vim.cmd.edit(vim.uri_to_fname(result)) + end, bufnr) +end + +local function symbol_info(bufnr, client) + local method_name = 'textDocument/symbolInfo' + ---@diagnostic disable-next-line:param-type-mismatch + if not client or not client:supports_method(method_name) then + return vim.notify('Clangd client not found', vim.log.levels.ERROR) + end + local win = vim.api.nvim_get_current_win() + local params = vim.lsp.util.make_position_params(win, client.offset_encoding) + ---@diagnostic disable-next-line:param-type-mismatch + client:request(method_name, params, function(err, res) + if err or #res == 0 then + -- Clangd always returns an error, there is no reason to parse it + return + end + local container = string.format('container: %s', res[1].containerName) ---@type string + local name = string.format('name: %s', res[1].name) ---@type string + vim.lsp.util.open_floating_preview({ name, container }, '', { + height = 2, + width = math.max(string.len(name), string.len(container)), + focusable = false, + focus = false, + title = 'Symbol Info', + }) + end, bufnr) +end + +---@class ClangdInitializeResult: lsp.InitializeResult +---@field offsetEncoding? string + +---@type vim.lsp.Config +return { + cmd = { 'clangd' }, + filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, + root_markers = { + '.clangd', + '.clang-tidy', + '.clang-format', + 'compile_commands.json', + 'compile_flags.txt', + 'configure.ac', -- AutoTools + '.git', + }, + capabilities = { + textDocument = { + completion = { + editsNearCursor = true, + }, + }, + offsetEncoding = { 'utf-8', 'utf-16' }, + }, + ---@param init_result ClangdInitializeResult + on_init = function(client, init_result) + if init_result.offsetEncoding then + client.offset_encoding = init_result.offsetEncoding + end + end, + on_attach = function(client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspClangdSwitchSourceHeader', function() + switch_source_header(bufnr, client) + end, { desc = 'Switch between source/header' }) + + vim.api.nvim_buf_create_user_command(bufnr, 'LspClangdShowSymbolInfo', function() + symbol_info(bufnr, client) + end, { desc = 'Show symbol info' }) + end, +} diff --git a/.config/nvim/lsp/clarinet.lua b/.config/nvim/lsp/clarinet.lua new file mode 100644 index 0000000..be93d8a --- /dev/null +++ b/.config/nvim/lsp/clarinet.lua @@ -0,0 +1,11 @@ +---@brief +--- https://github.com/hirosystems/clarinet +--- +--- Clarinet is the fastest way to build, test, and deploy smart contracts on the Stacks blockchain. + +---@type vim.lsp.Config +return { + cmd = { 'clarinet', 'lsp' }, + filetypes = { 'clar', 'clarity' }, + root_markers = { 'Clarinet.toml' }, +} diff --git a/.config/nvim/lsp/clojure_lsp.lua b/.config/nvim/lsp/clojure_lsp.lua new file mode 100644 index 0000000..f60ee38 --- /dev/null +++ b/.config/nvim/lsp/clojure_lsp.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/clojure-lsp/clojure-lsp +--- +--- Clojure Language Server + +---@type vim.lsp.Config +return { + cmd = { 'clojure-lsp' }, + filetypes = { 'clojure', 'edn' }, + root_markers = { 'project.clj', 'deps.edn', 'build.boot', 'shadow-cljs.edn', '.git', 'bb.edn' }, +} diff --git a/.config/nvim/lsp/cmake.lua b/.config/nvim/lsp/cmake.lua new file mode 100644 index 0000000..38fa06a --- /dev/null +++ b/.config/nvim/lsp/cmake.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/regen100/cmake-language-server +--- +--- CMake LSP Implementation + +---@type vim.lsp.Config +return { + cmd = { 'cmake-language-server' }, + filetypes = { 'cmake' }, + root_markers = { 'CMakePresets.json', 'CTestConfig.cmake', '.git', 'build', 'cmake' }, + init_options = { + buildDirectory = 'build', + }, +} diff --git a/.config/nvim/lsp/cobol_ls.lua b/.config/nvim/lsp/cobol_ls.lua new file mode 100644 index 0000000..a763ed6 --- /dev/null +++ b/.config/nvim/lsp/cobol_ls.lua @@ -0,0 +1,10 @@ +---@brief +--- +--- Cobol language support + +---@type vim.lsp.Config +return { + cmd = { 'cobol-language-support' }, + filetypes = { 'cobol' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/codebook.lua b/.config/nvim/lsp/codebook.lua new file mode 100644 index 0000000..ec8931f --- /dev/null +++ b/.config/nvim/lsp/codebook.lua @@ -0,0 +1,39 @@ +---@brief +--- +--- https://github.com/blopker/codebook +--- +--- An unholy spell checker for code. +--- +--- `codebook-lsp` can be installed by following the instructions [here](https://github.com/blopker/codebook/blob/main/README.md#installation). +--- +--- The default `cmd` assumes that the `codebook-lsp` binary can be found in `$PATH`. +--- + +---@type vim.lsp.Config +return { + cmd = { 'codebook-lsp', 'serve' }, + filetypes = { + 'c', + 'css', + 'gitcommit', + 'go', + 'haskell', + 'html', + 'java', + 'javascript', + 'javascriptreact', + 'lua', + 'markdown', + 'php', + 'python', + 'ruby', + 'rust', + 'swift', + 'toml', + 'text', + 'typescript', + 'typescriptreact', + 'zig', + }, + root_markers = { '.git', 'codebook.toml', '.codebook.toml' }, +} diff --git a/.config/nvim/lsp/coffeesense.lua b/.config/nvim/lsp/coffeesense.lua new file mode 100644 index 0000000..aeaa2c2 --- /dev/null +++ b/.config/nvim/lsp/coffeesense.lua @@ -0,0 +1,16 @@ +---@brief +--- +--- https://github.com/phil294/coffeesense +--- +--- CoffeeSense Language Server +--- `coffeesense-language-server` can be installed via `npm`: +--- ```sh +--- npm install -g coffeesense-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'coffeesense-language-server', '--stdio' }, + filetypes = { 'coffee' }, + root_markers = { 'package.json' }, +} diff --git a/.config/nvim/lsp/contextive.lua b/.config/nvim/lsp/contextive.lua new file mode 100644 index 0000000..3cca333 --- /dev/null +++ b/.config/nvim/lsp/contextive.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/dev-cycles/contextive +--- +--- Language Server for Contextive. +--- +--- Contextive allows you to define terms in a central file and provides auto-completion suggestions and hover panels for these terms wherever they're used. +--- +--- To install the language server, you need to download the appropriate [GitHub release asset](https://github.com/dev-cycles/contextive/releases/) for your operating system and architecture. +--- +--- After the download unzip the Contextive.LanguageServer binary and copy the file into a folder that is included in your system's PATH. + +---@type vim.lsp.Config +return { + cmd = { 'Contextive.LanguageServer' }, + root_markers = { '.contextive', '.git' }, +} diff --git a/.config/nvim/lsp/copilot.lua b/.config/nvim/lsp/copilot.lua new file mode 100644 index 0000000..4aa37f4 --- /dev/null +++ b/.config/nvim/lsp/copilot.lua @@ -0,0 +1,135 @@ +---@brief +--- +--- https://www.npmjs.com/package/@github/copilot-language-server +--- +--- The Copilot Language Server enables any editor or IDE +--- to integrate with GitHub Copilot via +--- [the language server protocol](https://microsoft.github.io/language-server-protocol/). +--- +--- **[GitHub Copilot](https://github.com/features/copilot)** +--- is an AI pair programmer tool that helps you write code faster and smarter. +--- +--- **Sign up for [GitHub Copilot Free](https://github.com/settings/copilot)!** +--- +--- Please see [terms of use for GitHub Copilot](https://docs.github.com/en/site-policy/github-terms/github-terms-for-additional-products-and-features#github-copilot) +--- +--- You need to enable `:help lsp-inline-completion` to receive suggestions. For example, you can enable it in the LspAttach event: +--- +--- ```lua +--- vim.api.nvim_create_autocmd('LspAttach', { +--- callback = function(args) +--- local bufnr = args.buf +--- local client = assert(vim.lsp.get_client_by_id(args.data.client_id)) +--- +--- if client:supports_method(vim.lsp.protocol.Methods.textDocument_inlineCompletion, bufnr) then +--- vim.lsp.inline_completion.enable(true, { bufnr = bufnr }) +--- +--- vim.keymap.set( +--- 'i', +--- '', +--- vim.lsp.inline_completion.get, +--- { desc = 'LSP: accept inline completion', buffer = bufnr } +--- ) +--- vim.keymap.set( +--- 'i', +--- '', +--- vim.lsp.inline_completion.select, +--- { desc = 'LSP: switch inline completion', buffer = bufnr } +--- ) +--- end +--- end +--- }) +--- ``` + +---@param bufnr integer, +---@param client vim.lsp.Client +local function sign_in(bufnr, client) + client:request( + ---@diagnostic disable-next-line: param-type-mismatch + 'signIn', + vim.empty_dict(), + function(err, result) + if err then + vim.notify(err.message, vim.log.levels.ERROR) + return + end + if result.command then + local code = result.userCode + local command = result.command + vim.fn.setreg('+', code) + vim.fn.setreg('*', code) + local continue = vim.fn.confirm( + 'Copied your one-time code to clipboard.\n' .. 'Open the browser to complete the sign-in process?', + '&Yes\n&No' + ) + if continue == 1 then + client:exec_cmd(command, { bufnr = bufnr }, function(cmd_err, cmd_result) + if cmd_err then + vim.notify(cmd_err.message, vim.log.levels.ERROR) + return + end + if cmd_result.status == 'OK' then + vim.notify('Signed in as ' .. cmd_result.user .. '.') + end + end) + end + end + + if result.status == 'PromptUserDeviceFlow' then + vim.notify('Enter your one-time code ' .. result.userCode .. ' in ' .. result.verificationUri) + elseif result.status == 'AlreadySignedIn' then + vim.notify('Already signed in as ' .. result.user .. '.') + end + end + ) +end + +---@param client vim.lsp.Client +local function sign_out(_, client) + client:request( + ---@diagnostic disable-next-line: param-type-mismatch + 'signOut', + vim.empty_dict(), + function(err, result) + if err then + vim.notify(err.message, vim.log.levels.ERROR) + return + end + if result.status == 'NotSignedIn' then + vim.notify('Not signed in.') + end + end + ) +end + +---@type vim.lsp.Config +return { + cmd = { + 'copilot-language-server', + '--stdio', + }, + root_markers = { '.git' }, + init_options = { + editorInfo = { + name = 'Neovim', + version = tostring(vim.version()), + }, + editorPluginInfo = { + name = 'Neovim', + version = tostring(vim.version()), + }, + }, + settings = { + telemetry = { + telemetryLevel = 'all', + }, + }, + on_attach = function(client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspCopilotSignIn', function() + sign_in(bufnr, client) + end, { desc = 'Sign in Copilot with GitHub' }) + vim.api.nvim_buf_create_user_command(bufnr, 'LspCopilotSignOut', function() + sign_out(bufnr, client) + end, { desc = 'Sign out Copilot with GitHub' }) + end, +} diff --git a/.config/nvim/lsp/coq_lsp.lua b/.config/nvim/lsp/coq_lsp.lua new file mode 100644 index 0000000..e8dc76f --- /dev/null +++ b/.config/nvim/lsp/coq_lsp.lua @@ -0,0 +1,10 @@ +---@brief +--- +--- https://github.com/ejgallego/coq-lsp/ + +---@type vim.lsp.Config +return { + cmd = { 'coq-lsp' }, + filetypes = { 'coq' }, + root_markers = { '_CoqProject', '.git' }, +} diff --git a/.config/nvim/lsp/crystalline.lua b/.config/nvim/lsp/crystalline.lua new file mode 100644 index 0000000..f682f7d --- /dev/null +++ b/.config/nvim/lsp/crystalline.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/elbywan/crystalline +--- +--- Crystal language server. + +---@type vim.lsp.Config +return { + cmd = { 'crystalline' }, + filetypes = { 'crystal' }, + root_markers = { 'shard.yml', '.git' }, +} diff --git a/.config/nvim/lsp/csharp_ls.lua b/.config/nvim/lsp/csharp_ls.lua new file mode 100644 index 0000000..dd8c427 --- /dev/null +++ b/.config/nvim/lsp/csharp_ls.lua @@ -0,0 +1,32 @@ +---@brief +--- +--- https://github.com/razzmatazz/csharp-language-server +--- +--- Language Server for C#. +--- +--- csharp-ls requires the [dotnet-sdk](https://dotnet.microsoft.com/download) to be installed. +--- +--- The preferred way to install csharp-ls is with `dotnet tool install --global csharp-ls`. + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = function(dispatchers, config) + return vim.lsp.rpc.start({ 'csharp-ls' }, dispatchers, { + -- csharp-ls attempt to locate sln, slnx or csproj files from cwd, so set cwd to root directory. + -- If cmd_cwd is provided, use it instead. + cwd = config.cmd_cwd or config.root_dir, + env = config.cmd_env, + detached = config.detached, + }) + end, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern '*.sln'(fname) or util.root_pattern '*.slnx'(fname) or util.root_pattern '*.csproj'(fname)) + end, + filetypes = { 'cs' }, + init_options = { + AutomaticWorkspaceInit = true, + }, +} diff --git a/.config/nvim/lsp/cspell_ls.lua b/.config/nvim/lsp/cspell_ls.lua new file mode 100644 index 0000000..d1598dd --- /dev/null +++ b/.config/nvim/lsp/cspell_ls.lua @@ -0,0 +1,24 @@ +---@brief +--- +--- [cspell language server](https://github.com/vlabo/cspell-lsp) +--- + +---@type vim.lsp.Config +return { + cmd = { 'cspell-lsp', '--stdio' }, + root_markers = { + '.git', + 'cspell.json', + '.cspell.json', + 'cspell.json', + '.cSpell.json', + 'cSpell.json', + 'cspell.config.js', + 'cspell.config.cjs', + 'cspell.config.json', + 'cspell.config.yaml', + 'cspell.config.yml', + 'cspell.yaml', + 'cspell.yml', + }, +} diff --git a/.config/nvim/lsp/css_variables.lua b/.config/nvim/lsp/css_variables.lua new file mode 100644 index 0000000..ce63617 --- /dev/null +++ b/.config/nvim/lsp/css_variables.lua @@ -0,0 +1,51 @@ +---@brief +--- +--- https://github.com/vunguyentuan/vscode-css-variables/tree/master/packages/css-variables-language-server +--- +--- CSS variables autocompletion and go-to-definition +--- +--- `css-variables-language-server` can be installed via `npm`: +--- +--- ```sh +--- npm i -g css-variables-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'css-variables-language-server', '--stdio' }, + filetypes = { 'css', 'scss', 'less' }, + + -- Taken from lsp/ts_ls.lua to handle simple projects and monorepos. + root_dir = function(bufnr, on_dir) + local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock' } + -- Give the root markers equal priority by wrapping them in a table + root_markers = vim.fn.has 'nvim-0.11.3' == 1 and { root_markers, { '.git' } } + or vim.list_extend(root_markers, { '.git' }) + -- We fallback to the current working directory if no project root is found + local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd() + + on_dir(project_root) + end, + + -- Same as inlined defaults that don't seem to work without hardcoding them in the lua config + -- https://github.com/vunguyentuan/vscode-css-variables/blob/763a564df763f17aceb5f3d6070e0b444a2f47ff/packages/css-variables-language-server/src/CSSVariableManager.ts#L31-L50 + settings = { + cssVariables = { + lookupFiles = { '**/*.less', '**/*.scss', '**/*.sass', '**/*.css' }, + blacklistFolders = { + '**/.cache', + '**/.DS_Store', + '**/.git', + '**/.hg', + '**/.next', + '**/.svn', + '**/bower_components', + '**/CVS', + '**/dist', + '**/node_modules', + '**/tests', + '**/tmp', + }, + }, + }, +} diff --git a/.config/nvim/lsp/cssls.lua b/.config/nvim/lsp/cssls.lua new file mode 100644 index 0000000..5f825b4 --- /dev/null +++ b/.config/nvim/lsp/cssls.lua @@ -0,0 +1,34 @@ +---@brief +--- +--- https://github.com/hrsh7th/vscode-langservers-extracted +--- +--- `css-languageserver` can be installed via `npm`: +--- +--- ```sh +--- npm i -g vscode-langservers-extracted +--- ``` +--- +--- Neovim does not currently include built-in snippets. `vscode-css-language-server` only provides completions when snippet support is enabled. To enable completion, install a snippet plugin and add the following override to your language client capabilities during setup. +--- +--- ```lua +--- --Enable (broadcasting) snippet capability for completion +--- local capabilities = vim.lsp.protocol.make_client_capabilities() +--- capabilities.textDocument.completion.completionItem.snippetSupport = true +--- +--- vim.lsp.config('cssls', { +--- capabilities = capabilities, +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'vscode-css-language-server', '--stdio' }, + filetypes = { 'css', 'scss', 'less' }, + init_options = { provideFormatter = true }, -- needed to enable formatting capabilities + root_markers = { 'package.json', '.git' }, + settings = { + css = { validate = true }, + scss = { validate = true }, + less = { validate = true }, + }, +} diff --git a/.config/nvim/lsp/cssmodules_ls.lua b/.config/nvim/lsp/cssmodules_ls.lua new file mode 100644 index 0000000..35a5c59 --- /dev/null +++ b/.config/nvim/lsp/cssmodules_ls.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/antonk52/cssmodules-language-server +--- +--- Language server for autocompletion and go-to-definition functionality for CSS modules. +--- +--- You can install cssmodules-language-server via npm: +--- ```sh +--- npm install -g cssmodules-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'cssmodules-language-server' }, + filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact' }, + root_markers = { 'package.json' }, +} diff --git a/.config/nvim/lsp/cucumber_language_server.lua b/.config/nvim/lsp/cucumber_language_server.lua new file mode 100644 index 0000000..82bfcff --- /dev/null +++ b/.config/nvim/lsp/cucumber_language_server.lua @@ -0,0 +1,19 @@ +---@brief +--- +--- https://cucumber.io +--- https://github.com/cucumber/common +--- https://www.npmjs.com/package/@cucumber/language-server +--- +--- Language server for Cucumber. +--- +--- `cucumber-language-server` can be installed via `npm`: +--- ```sh +--- npm install -g @cucumber/language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'cucumber-language-server', '--stdio' }, + filetypes = { 'cucumber' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/cue.lua b/.config/nvim/lsp/cue.lua new file mode 100644 index 0000000..22941a0 --- /dev/null +++ b/.config/nvim/lsp/cue.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/cue-lang/cue +--- +--- CUE makes it easy to validate data, write schemas, and ensure configurations align with policies. + +---@type vim.lsp.Config +return { + cmd = { 'cue', 'lsp' }, + filetypes = { 'cue' }, + root_markers = { 'cue.mod', '.git' }, +} diff --git a/.config/nvim/lsp/custom_elements_ls.lua b/.config/nvim/lsp/custom_elements_ls.lua new file mode 100644 index 0000000..684786b --- /dev/null +++ b/.config/nvim/lsp/custom_elements_ls.lua @@ -0,0 +1,32 @@ +---@brief +--- +--- https://github.com/Matsuuu/custom-elements-language-server +--- +--- `custom-elements-languageserver` depends on `typescript`. Both packages can be installed via `npm`: +--- ```sh +--- npm install -g typescript custom-elements-languageserver +--- ``` +--- To configure typescript language server, add a +--- [`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) or +--- [`jsconfig.json`](https://code.visualstudio.com/docs/languages/jsconfig) to the root of your +--- project. +--- Here's an example that disables type checking in JavaScript files. +--- ```json +--- { +--- "compilerOptions": { +--- "module": "commonjs", +--- "target": "es6", +--- "checkJs": false +--- }, +--- "exclude": [ +--- "node_modules" +--- ] +--- } +--- ``` + +---@type vim.lsp.Config +return { + init_options = { hostInfo = 'neovim' }, + cmd = { 'custom-elements-languageserver', '--stdio' }, + root_markers = { 'tsconfig.json', 'package.json', 'jsconfig.json', '.git' }, +} diff --git a/.config/nvim/lsp/cypher_ls.lua b/.config/nvim/lsp/cypher_ls.lua new file mode 100644 index 0000000..8058b1c --- /dev/null +++ b/.config/nvim/lsp/cypher_ls.lua @@ -0,0 +1,18 @@ +---@brief +--- +--- https://github.com/neo4j/cypher-language-support/tree/main/packages/language-server +--- +--- `cypher-language-server`, language server for Cypher query language. +--- Part of the umbrella project cypher-language-support: https://github.com/neo4j/cypher-language-support +--- +--- `cypher-language-server` can be installed via `npm`: +--- ```sh +--- npm i -g @neo4j-cypher/language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'cypher-language-server', '--stdio' }, + filetypes = { 'cypher' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/daedalus_ls.lua b/.config/nvim/lsp/daedalus_ls.lua new file mode 100644 index 0000000..b3adef8 --- /dev/null +++ b/.config/nvim/lsp/daedalus_ls.lua @@ -0,0 +1,27 @@ +--- @brief +--- +--- DaedalusLanguageServer + +---@type vim.lsp.Config +return { + cmd = { 'DaedalusLanguageServer' }, + filetypes = { 'd' }, + root_markers = { + 'Gothic.src', + 'Camera.src', + 'Menu.src', + 'Music.src', + 'ParticleFX.src', + 'SFX.src', + 'VisualFX.src', + }, + settings = { + DaedalusLanguageServer = { + loglevel = 'debug', + inlayHints = { constants = true }, + numParserThreads = 16, + fileEncoding = 'Windows-1252', + srcFileEncoding = 'Windows-1252', + }, + }, +} diff --git a/.config/nvim/lsp/dafny.lua b/.config/nvim/lsp/dafny.lua new file mode 100644 index 0000000..39e65d9 --- /dev/null +++ b/.config/nvim/lsp/dafny.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- Support for the Dafny language server. + +-- The default `cmd` uses "dafny server", which works on Dafny 4.0.0+. For +-- older versions of Dafny, you can compile the language server from source at +-- [dafny-lang/language-server-csharp](https://github.com/dafny-lang/language-server-csharp) +-- and set `cmd = {"dotnet", ""}`. + +---@type vim.lsp.Config +return { + cmd = { 'dafny', 'server' }, + filetypes = { 'dfy', 'dafny' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/dagger.lua b/.config/nvim/lsp/dagger.lua new file mode 100644 index 0000000..714e79a --- /dev/null +++ b/.config/nvim/lsp/dagger.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/dagger/cuelsp +--- +--- Dagger's lsp server for cuelang. + +---@type vim.lsp.Config +return { + cmd = { 'cuelsp' }, + filetypes = { 'cue' }, + root_markers = { 'cue.mod', '.git' }, +} diff --git a/.config/nvim/lsp/dartls.lua b/.config/nvim/lsp/dartls.lua new file mode 100644 index 0000000..3731d07 --- /dev/null +++ b/.config/nvim/lsp/dartls.lua @@ -0,0 +1,25 @@ +---@brief +--- +--- https://github.com/dart-lang/sdk/tree/master/pkg/analysis_server/tool/lsp_spec +--- +--- Language server for dart. + +---@type vim.lsp.Config +return { + cmd = { 'dart', 'language-server', '--protocol=lsp' }, + filetypes = { 'dart' }, + root_markers = { 'pubspec.yaml' }, + init_options = { + onlyAnalyzeProjectsWithOpenFiles = true, + suggestFromUnimportedLibraries = true, + closingLabels = true, + outline = true, + flutterOutline = true, + }, + settings = { + dart = { + completeFunctionCalls = true, + showTodos = true, + }, + }, +} diff --git a/.config/nvim/lsp/dcmls.lua b/.config/nvim/lsp/dcmls.lua new file mode 100644 index 0000000..90f98db --- /dev/null +++ b/.config/nvim/lsp/dcmls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://dcm.dev/ +--- +--- Language server for DCM analyzer. + +---@type vim.lsp.Config +return { + cmd = { 'dcm', 'start-server', '--client=neovim' }, + filetypes = { 'dart' }, + root_markers = { 'pubspec.yaml' }, +} diff --git a/.config/nvim/lsp/debputy.lua b/.config/nvim/lsp/debputy.lua new file mode 100644 index 0000000..6d7dce5 --- /dev/null +++ b/.config/nvim/lsp/debputy.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://salsa.debian.org/debian/debputy +--- +--- Language Server for Debian packages. + +---@type vim.lsp.Config +return { + cmd = { 'debputy', 'lsp', 'server' }, + filetypes = { 'debcontrol', 'debcopyright', 'debchangelog', 'autopkgtest', 'make', 'yaml' }, + root_markers = { 'debian' }, +} diff --git a/.config/nvim/lsp/denols.lua b/.config/nvim/lsp/denols.lua new file mode 100644 index 0000000..b5d9ffe --- /dev/null +++ b/.config/nvim/lsp/denols.lua @@ -0,0 +1,129 @@ +---@brief +--- +--- https://github.com/denoland/deno +--- +--- Deno's built-in language server +--- +--- To appropriately highlight codefences returned from denols, you will need to augment vim.g.markdown_fenced languages +--- in your init.lua. Example: +--- +--- ```lua +--- vim.g.markdown_fenced_languages = { +--- "ts=typescript" +--- } +--- ``` + +local lsp = vim.lsp + +local function virtual_text_document_handler(uri, res, client) + if not res then + return nil + end + + local lines = vim.split(res.result, '\n') + local bufnr = vim.uri_to_bufnr(uri) + + local current_buf = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) + if #current_buf ~= 0 then + return nil + end + + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines) + vim.api.nvim_set_option_value('readonly', true, { buf = bufnr }) + vim.api.nvim_set_option_value('modified', false, { buf = bufnr }) + vim.api.nvim_set_option_value('modifiable', false, { buf = bufnr }) + lsp.buf_attach_client(bufnr, client.id) +end + +local function virtual_text_document(uri, client) + local params = { + textDocument = { + uri = uri, + }, + } + local result = client:request_sync('deno/virtualTextDocument', params) + virtual_text_document_handler(uri, result, client) +end + +local function denols_handler(err, result, ctx, config) + if not result or vim.tbl_isempty(result) then + return nil + end + + local client = vim.lsp.get_client_by_id(ctx.client_id) + for _, res in pairs(result) do + local uri = res.uri or res.targetUri + if uri:match '^deno:' then + virtual_text_document(uri, client) + res['uri'] = uri + res['targetUri'] = uri + end + end + + lsp.handlers[ctx.method](err, result, ctx, config) +end + +---@type vim.lsp.Config +return { + cmd = { 'deno', 'lsp' }, + cmd_env = { NO_COLOR = true }, + filetypes = { + 'javascript', + 'javascriptreact', + 'javascript.jsx', + 'typescript', + 'typescriptreact', + 'typescript.tsx', + }, + root_dir = function(bufnr, on_dir) + -- The project root is where the LSP can be started from + local root_markers = { 'deno.lock' } + -- Give the root markers equal priority by wrapping them in a table + root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } } + or vim.list_extend(root_markers, { '.git' }) + -- exclude non-deno projects (npm, yarn, pnpm, bun) + local non_deno_path = vim.fs.root( + bufnr, + { 'package.json', 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock' } + ) + local project_root = vim.fs.root(bufnr, root_markers) + if non_deno_path and (not project_root or #non_deno_path >= #project_root) then + return + end + -- We fallback to the current working directory if no project root is found + on_dir(project_root or vim.fn.getcwd()) + end, + settings = { + deno = { + enable = true, + suggest = { + imports = { + hosts = { + ['https://deno.land'] = true, + }, + }, + }, + }, + }, + handlers = { + ['textDocument/definition'] = denols_handler, + ['textDocument/typeDefinition'] = denols_handler, + ['textDocument/references'] = denols_handler, + }, + on_attach = function(client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspDenolsCache', function() + client:exec_cmd({ + title = 'DenolsCache', + command = 'deno.cache', + arguments = { {}, vim.uri_from_bufnr(bufnr) }, + }, { bufnr = bufnr }, function(err, _, ctx) + if err then + local uri = ctx.params.arguments[2] + vim.notify('cache command failed for' .. vim.uri_to_fname(uri), vim.log.levels.ERROR) + end + end) + end, { + desc = 'Cache a module and all of its dependencies.', + }) + end, +} diff --git a/.config/nvim/lsp/dhall_lsp_server.lua b/.config/nvim/lsp/dhall_lsp_server.lua new file mode 100644 index 0000000..4953fba --- /dev/null +++ b/.config/nvim/lsp/dhall_lsp_server.lua @@ -0,0 +1,18 @@ +---@brief +--- +--- https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-lsp-server +--- +--- language server for dhall +--- +--- `dhall-lsp-server` can be installed via cabal: +--- ```sh +--- cabal install dhall-lsp-server +--- ``` +--- prebuilt binaries can be found [here](https://github.com/dhall-lang/dhall-haskell/releases). + +---@type vim.lsp.Config +return { + cmd = { 'dhall-lsp-server' }, + filetypes = { 'dhall' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/diagnosticls.lua b/.config/nvim/lsp/diagnosticls.lua new file mode 100644 index 0000000..8c717ea --- /dev/null +++ b/.config/nvim/lsp/diagnosticls.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/iamcco/diagnostic-languageserver +--- +--- Diagnostic language server integrate with linters. + +---@type vim.lsp.Config +return { + -- Configuration from https://github.com/iamcco/diagnostic-languageserver#config--document + cmd = { 'diagnostic-languageserver', '--stdio' }, + root_markers = { '.git' }, + -- Empty by default, override to add filetypes. + filetypes = {}, +} diff --git a/.config/nvim/lsp/digestif.lua b/.config/nvim/lsp/digestif.lua new file mode 100644 index 0000000..863b772 --- /dev/null +++ b/.config/nvim/lsp/digestif.lua @@ -0,0 +1,16 @@ +---@brief +--- +--- https://github.com/astoff/digestif +--- +--- Digestif is a code analyzer, and a language server, for LaTeX, ConTeXt et caterva. It provides +--- +--- context-sensitive completion, documentation, code navigation, and related functionality to any +--- +--- text editor that speaks the LSP protocol. + +---@type vim.lsp.Config +return { + cmd = { 'digestif' }, + filetypes = { 'tex', 'plaintex', 'context' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/djls.lua b/.config/nvim/lsp/djls.lua new file mode 100644 index 0000000..7ef8d5f --- /dev/null +++ b/.config/nvim/lsp/djls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/joshuadavidthomas/django-language-server +--- +--- `djls`, a language server for the Django web framework. + +---@type vim.lsp.Config +return { + cmd = { 'djls', 'serve' }, + filetypes = { 'htmldjango', 'html', 'python' }, + root_markers = { 'manage.py', 'pyproject.toml', '.git' }, +} diff --git a/.config/nvim/lsp/djlsp.lua b/.config/nvim/lsp/djlsp.lua new file mode 100644 index 0000000..120dbe4 --- /dev/null +++ b/.config/nvim/lsp/djlsp.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://github.com/fourdigits/django-template-lsp +--- +--- `djlsp`, a language server for Django templates. + +---@type vim.lsp.Config +return { + cmd = { 'djlsp' }, + filetypes = { 'html', 'htmldjango' }, + root_markers = { '.git' }, + settings = {}, +} diff --git a/.config/nvim/lsp/docker_compose_language_service.lua b/.config/nvim/lsp/docker_compose_language_service.lua new file mode 100644 index 0000000..f5bbf78 --- /dev/null +++ b/.config/nvim/lsp/docker_compose_language_service.lua @@ -0,0 +1,19 @@ +---@brief +--- +--- https://github.com/microsoft/compose-language-service +--- This project contains a language service for Docker Compose. +--- +--- `compose-language-service` can be installed via `npm`: +--- +--- ```sh +--- npm install @microsoft/compose-language-service +--- ``` +--- +--- Note: If the docker-compose-langserver doesn't startup when entering a `docker-compose.yaml` file, make sure that the filetype is `yaml.docker-compose`. You can set with: `:set filetype=yaml.docker-compose`. + +---@type vim.lsp.Config +return { + cmd = { 'docker-compose-langserver', '--stdio' }, + filetypes = { 'yaml.docker-compose' }, + root_markers = { 'docker-compose.yaml', 'docker-compose.yml', 'compose.yaml', 'compose.yml' }, +} diff --git a/.config/nvim/lsp/docker_language_server.lua b/.config/nvim/lsp/docker_language_server.lua new file mode 100644 index 0000000..695d51a --- /dev/null +++ b/.config/nvim/lsp/docker_language_server.lua @@ -0,0 +1,32 @@ +---@brief +--- +--- https://github.com/docker/docker-language-server +--- +--- `docker-langserver-server` can be installed via `go`: +--- ```sh +--- go install github.com/docker/docker-language-server/cmd/docker-language-server@latest +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'docker-language-server', 'start', '--stdio' }, + filetypes = { 'dockerfile', 'yaml.docker-compose' }, + get_language_id = function(_, ftype) + if ftype == 'yaml.docker-compose' or ftype:lower():find('ya?ml') then + return 'dockercompose' + else + return ftype + end + end, + root_markers = { + 'Dockerfile', + 'docker-compose.yaml', + 'docker-compose.yml', + 'compose.yaml', + 'compose.yml', + 'docker-bake.json', + 'docker-bake.hcl', + 'docker-bake.override.json', + 'docker-bake.override.hcl', + }, +} diff --git a/.config/nvim/lsp/dockerls.lua b/.config/nvim/lsp/dockerls.lua new file mode 100644 index 0000000..ee17ed1 --- /dev/null +++ b/.config/nvim/lsp/dockerls.lua @@ -0,0 +1,30 @@ +---@brief +--- +--- https://github.com/rcjsuen/dockerfile-language-server-nodejs +--- +--- `docker-langserver` can be installed via `npm`: +--- ```sh +--- npm install -g dockerfile-language-server-nodejs +--- ``` +--- +--- Additional configuration can be applied in the following way: +--- ```lua +--- vim.lsp.config('dockerls', { +--- settings = { +--- docker = { +--- languageserver = { +--- formatter = { +--- ignoreMultilineInstructions = true, +--- }, +--- }, +--- } +--- } +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'docker-langserver', '--stdio' }, + filetypes = { 'dockerfile' }, + root_markers = { 'Dockerfile' }, +} diff --git a/.config/nvim/lsp/dolmenls.lua b/.config/nvim/lsp/dolmenls.lua new file mode 100644 index 0000000..de240da --- /dev/null +++ b/.config/nvim/lsp/dolmenls.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/Gbury/dolmen/blob/master/doc/lsp.md +--- +--- `dolmenls` can be installed via `opam` +--- ```sh +--- opam install dolmen_lsp +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'dolmenls' }, + filetypes = { 'smt2', 'tptp', 'p', 'cnf', 'icnf', 'zf' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/dotls.lua b/.config/nvim/lsp/dotls.lua new file mode 100644 index 0000000..51fca6e --- /dev/null +++ b/.config/nvim/lsp/dotls.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/nikeee/dot-language-server +--- +--- `dot-language-server` can be installed via `npm`: +--- ```sh +--- npm install -g dot-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'dot-language-server', '--stdio' }, + filetypes = { 'dot' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/dprint.lua b/.config/nvim/lsp/dprint.lua new file mode 100644 index 0000000..31acacd --- /dev/null +++ b/.config/nvim/lsp/dprint.lua @@ -0,0 +1,26 @@ +---@brief +--- +--- https://github.com/dprint/dprint +--- +--- Pluggable and configurable code formatting platform written in Rust. + +---@type vim.lsp.Config +return { + cmd = { 'dprint', 'lsp' }, + filetypes = { + 'javascript', + 'javascriptreact', + 'typescript', + 'typescriptreact', + 'json', + 'jsonc', + 'markdown', + 'python', + 'toml', + 'rust', + 'roslyn', + 'graphql', + }, + root_markers = { 'dprint.json', '.dprint.json', 'dprint.jsonc', '.dprint.jsonc' }, + settings = {}, +} diff --git a/.config/nvim/lsp/ds_pinyin_lsp.lua b/.config/nvim/lsp/ds_pinyin_lsp.lua new file mode 100644 index 0000000..84bf67e --- /dev/null +++ b/.config/nvim/lsp/ds_pinyin_lsp.lua @@ -0,0 +1,69 @@ +---@brief +--- +--- https://github.com/iamcco/ds-pinyin-lsp +--- Dead simple Pinyin language server for input Chinese without IME(input method). +--- To install, download the latest [release](https://github.com/iamcco/ds-pinyin-lsp/releases) and ensure `ds-pinyin-lsp` is on your path. +--- And make ensure the database file `dict.db3` is also downloaded. And put the path to `dict.dbs` in the following code. +--- +--- ```lua +--- +--- vim.lsp.config('ds_pinyin_lsp', { +--- init_options = { +--- db_path = "your_path_to_database" +--- } +--- }) +--- +--- ``` + +local bin_name = 'ds-pinyin-lsp' +if vim.fn.has 'win32' == 1 then + bin_name = bin_name .. '.exe' +end + +local function ds_pinyin_lsp_off(bufnr) + local ds_pinyin_lsp_client = vim.lsp.get_clients({ bufnr = bufnr, name = 'ds_pinyin_lsp' })[1] + if ds_pinyin_lsp_client then + ---@diagnostic disable-next-line: param-type-mismatch + ds_pinyin_lsp_client:notify('$/turn/completion', { + ['completion_on'] = false, + }) + else + vim.notify 'notification $/turn/completion is not supported by any servers active on the current buffer' + end +end + +local function ds_pinyin_lsp_on(bufnr) + local ds_pinyin_lsp_client = vim.lsp.get_clients({ bufnr = bufnr, name = 'ds_pinyin_lsp' })[1] + if ds_pinyin_lsp_client then + ---@diagnostic disable-next-line: param-type-mismatch + ds_pinyin_lsp_client:notify('$/turn/completion', { + ['completion_on'] = true, + }) + else + vim.notify 'notification $/turn/completion is not supported by any servers active on the current buffer' + end +end + +---@type vim.lsp.Config +return { + cmd = { bin_name }, + filetypes = { 'markdown', 'org' }, + root_markers = { '.git' }, + init_options = { + completion_on = true, + show_symbols = true, + show_symbols_only_follow_by_hanzi = false, + show_symbols_by_n_times = 0, + match_as_same_as_input = true, + match_long_input = true, + max_suggest = 15, + }, + on_attach = function(_, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspDsPinyinCompletionOff', function() + ds_pinyin_lsp_off(bufnr) + end, { desc = 'Turn off the ds-pinyin-lsp completion' }) + vim.api.nvim_buf_create_user_command(bufnr, 'LspDsPinyinCompletionOn', function() + ds_pinyin_lsp_on(bufnr) + end, { desc = 'Turn on the ds-pinyin-lsp completion' }) + end, +} diff --git a/.config/nvim/lsp/dts_lsp.lua b/.config/nvim/lsp/dts_lsp.lua new file mode 100644 index 0000000..dd9c4a8 --- /dev/null +++ b/.config/nvim/lsp/dts_lsp.lua @@ -0,0 +1,22 @@ +---@brief +--- +--- `dts-lsp` is an LSP for Devicetree files built on top of tree-sitter-devicetree grammar. +--- Language servers can be used in many editors, such as Visual Studio Code, Emacs +--- or Vim +--- +--- Install `dts-lsp` from https://github.com/igor-prusov/dts-lsp and add it to path +--- +--- `dts-lsp` doesn't require any configuration. +--- +--- More about Devicetree: +--- https://www.devicetree.org/ +--- https://docs.zephyrproject.org/latest/build/dts/index.html + +---@type vim.lsp.Config +return { + name = 'dts_lsp', + cmd = { 'dts-lsp' }, + filetypes = { 'dts', 'dtsi', 'overlay' }, + root_markers = { '.git' }, + settings = {}, +} diff --git a/.config/nvim/lsp/earthlyls.lua b/.config/nvim/lsp/earthlyls.lua new file mode 100644 index 0000000..3beb399 --- /dev/null +++ b/.config/nvim/lsp/earthlyls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/glehmann/earthlyls +--- +--- A fast language server for earthly. + +---@type vim.lsp.Config +return { + cmd = { 'earthlyls' }, + filetypes = { 'earthfile' }, + root_markers = { 'Earthfile' }, +} diff --git a/.config/nvim/lsp/ecsact.lua b/.config/nvim/lsp/ecsact.lua new file mode 100644 index 0000000..b59aad4 --- /dev/null +++ b/.config/nvim/lsp/ecsact.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/ecsact-dev/ecsact_lsp_server +--- +--- Language server for Ecsact. +--- +--- The default cmd assumes `ecsact_lsp_server` is in your PATH. Typically from the +--- Ecsact SDK: https://ecsact.dev/start + +---@type vim.lsp.Config +return { + cmd = { 'ecsact_lsp_server', '--stdio' }, + filetypes = { 'ecsact' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/efm.lua b/.config/nvim/lsp/efm.lua new file mode 100644 index 0000000..d421669 --- /dev/null +++ b/.config/nvim/lsp/efm.lua @@ -0,0 +1,25 @@ +--- @brief +--- +--- https://github.com/mattn/efm-langserver +--- +--- General purpose Language Server that can use specified error message format generated from specified command. +--- +--- Requires at minimum EFM version [v0.0.38](https://github.com/mattn/efm-langserver/releases/tag/v0.0.38) to support +--- launching the language server on single files. +--- +--- Note: In order for neovim's built-in language server client to send the appropriate `languageId` to EFM, **you must +--- specify `filetypes` in your call to `vim.lsp.config`**. Otherwise the server will be launch on the `BufEnter` instead +--- of the `FileType` autocommand, and the `filetype` variable used to populate the `languageId` will not yet be set. +--- +--- ```lua +--- vim.lsp.config('efm', { +--- filetypes = { 'python','cpp','lua' } +--- settings = ..., -- You must populate this according to the EFM readme +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'efm-langserver' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/elixirls.lua b/.config/nvim/lsp/elixirls.lua new file mode 100644 index 0000000..c5f21c0 --- /dev/null +++ b/.config/nvim/lsp/elixirls.lua @@ -0,0 +1,47 @@ +---@brief +--- +--- https://github.com/elixir-lsp/elixir-ls +--- +--- `elixir-ls` can be installed by following the instructions [here](https://github.com/elixir-lsp/elixir-ls#building-and-running). +--- +--- 1. Download the zip from https://github.com/elixir-lsp/elixir-ls/releases/latest/ +--- 2. Unzip it and make it executable. +--- ```bash +--- unzip elixir-ls.zip -d /path/to/elixir-ls +--- # Unix +--- chmod +x /path/to/elixir-ls/language_server.sh +--- ``` +--- +--- **By default, elixir-ls doesn't have a `cmd` set.** This is because nvim-lspconfig does not make assumptions about +--- your path. You must add the following to your init.vim or init.lua to set `cmd` to the absolute path ($HOME and +--- ~ are not expanded) of your unzipped elixir-ls. +--- +--- ```lua +--- vim.lsp.config('elixirls', { +--- -- Unix +--- cmd = { "/path/to/elixir-ls/language_server.sh" }; +--- -- Windows +--- cmd = { "/path/to/elixir-ls/language_server.bat" }; +--- ... +--- }) +--- ``` +--- +--- 'root_dir' is chosen like this: if two or more directories containing `mix.exs` were found when searching +--- directories upward, the second one (higher up) is chosen, with the assumption that it is the root of an umbrella +--- app. Otherwise the directory containing the single mix.exs that was found is chosen. + +---@type vim.lsp.Config +return { + cmd = { 'elixir-ls' }, + filetypes = { 'elixir', 'eelixir', 'heex', 'surface' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + --- Elixir workspaces may have multiple `mix.exs` files, for an "umbrella" layout or monorepo. + --- So we specify `limit=2` and treat the highest one (if any) as the root of an umbrella app. + local matches = vim.fs.find({ 'mix.exs' }, { upward = true, limit = 2, path = fname }) + local child_or_root_path, maybe_umbrella_path = unpack(matches) + local root_dir = vim.fs.dirname(maybe_umbrella_path or child_or_root_path) + + on_dir(root_dir) + end, +} diff --git a/.config/nvim/lsp/elmls.lua b/.config/nvim/lsp/elmls.lua new file mode 100644 index 0000000..8a76f81 --- /dev/null +++ b/.config/nvim/lsp/elmls.lua @@ -0,0 +1,35 @@ +---@brief +--- +--- https://github.com/elm-tooling/elm-language-server#installation +--- +--- If you don't want to use Nvim to install it, then you can use: +--- ```sh +--- npm install -g elm elm-test elm-format @elm-tooling/elm-language-server +--- ``` + +local api = vim.api + +---@type vim.lsp.Config +return { + cmd = { 'elm-language-server' }, + -- TODO(ashkan) if we comment this out, it will allow elmls to operate on elm.json. It seems like it could do that, but no other editor allows it right now. + filetypes = { 'elm' }, + root_dir = function(bufnr, on_dir) + local fname = api.nvim_buf_get_name(bufnr) + local filetype = vim.bo[bufnr].filetype + if filetype == 'elm' or (filetype == 'json' and fname:match 'elm%.json$') then + on_dir(vim.fs.root(fname, 'elm.json')) + return + end + on_dir(nil) + end, + init_options = { + elmReviewDiagnostics = 'off', -- 'off' | 'warning' | 'error' + skipInstallPackageConfirmation = false, + disableElmLSDiagnostics = false, + onlyUpdateDiagnosticsOnSave = false, + }, + capabilities = { + offsetEncoding = { 'utf-8', 'utf-16' }, + }, +} diff --git a/.config/nvim/lsp/elp.lua b/.config/nvim/lsp/elp.lua new file mode 100644 index 0000000..38c0716 --- /dev/null +++ b/.config/nvim/lsp/elp.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://whatsapp.github.io/erlang-language-platform +--- +--- ELP integrates Erlang into modern IDEs via the language server protocol and was +--- inspired by rust-analyzer. + +---@type vim.lsp.Config +return { + cmd = { 'elp', 'server' }, + filetypes = { 'erlang' }, + root_markers = { 'rebar.config', 'erlang.mk', '.git' }, +} diff --git a/.config/nvim/lsp/ember.lua b/.config/nvim/lsp/ember.lua new file mode 100644 index 0000000..9d1ec2a --- /dev/null +++ b/.config/nvim/lsp/ember.lua @@ -0,0 +1,16 @@ +---@brief +--- +--- https://github.com/ember-tooling/ember-language-server +--- +--- `ember-language-server` can be installed via `npm`: +--- +--- ```sh +--- npm install -g @ember-tooling/ember-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'ember-language-server', '--stdio' }, + filetypes = { 'handlebars', 'typescript', 'javascript', 'typescript.glimmer', 'javascript.glimmer' }, + root_markers = { 'ember-cli-build.js', '.git' }, +} diff --git a/.config/nvim/lsp/emmet_language_server.lua b/.config/nvim/lsp/emmet_language_server.lua new file mode 100644 index 0000000..89c5f4b --- /dev/null +++ b/.config/nvim/lsp/emmet_language_server.lua @@ -0,0 +1,31 @@ +---@brief +--- +--- https://github.com/olrtg/emmet-language-server +--- +--- Package can be installed via `npm`: +--- ```sh +--- npm install -g @olrtg/emmet-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'emmet-language-server', '--stdio' }, + filetypes = { + 'astro', + 'css', + 'eruby', + 'html', + 'htmlangular', + 'htmldjango', + 'javascriptreact', + 'less', + 'pug', + 'sass', + 'scss', + 'svelte', + 'templ', + 'typescriptreact', + 'vue', + }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/emmet_ls.lua b/.config/nvim/lsp/emmet_ls.lua new file mode 100644 index 0000000..7bfede0 --- /dev/null +++ b/.config/nvim/lsp/emmet_ls.lua @@ -0,0 +1,31 @@ +---@brief +--- +--- https://github.com/aca/emmet-ls +--- +--- Package can be installed via `npm`: +--- ```sh +--- npm install -g emmet-ls +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'emmet-ls', '--stdio' }, + filetypes = { + 'astro', + 'css', + 'eruby', + 'html', + 'htmlangular', + 'htmldjango', + 'javascriptreact', + 'less', + 'pug', + 'sass', + 'scss', + 'svelte', + 'templ', + 'typescriptreact', + 'vue', + }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/emmylua_ls.lua b/.config/nvim/lsp/emmylua_ls.lua new file mode 100644 index 0000000..5621469 --- /dev/null +++ b/.config/nvim/lsp/emmylua_ls.lua @@ -0,0 +1,24 @@ +---@brief +--- +--- https://github.com/EmmyLuaLs/emmylua-analyzer-rust +--- +--- Emmylua Analyzer Rust. Language Server for Lua. +--- +--- `emmylua_ls` can be installed using `cargo` by following the instructions[here] +--- (https://github.com/EmmyLuaLs/emmylua-analyzer-rust?tab=readme-ov-file#install). +--- +--- The default `cmd` assumes that the `emmylua_ls` binary can be found in `$PATH`. +--- It might require you to provide cargo binaries installation path in it. + +---@type vim.lsp.Config +return { + cmd = { 'emmylua_ls' }, + filetypes = { 'lua' }, + root_markers = { + '.luarc.json', + '.emmyrc.json', + '.luacheckrc', + '.git', + }, + workspace_required = false, +} diff --git a/.config/nvim/lsp/erg_language_server.lua b/.config/nvim/lsp/erg_language_server.lua new file mode 100644 index 0000000..4537072 --- /dev/null +++ b/.config/nvim/lsp/erg_language_server.lua @@ -0,0 +1,19 @@ +---@brief +--- +--- https://github.com/erg-lang/erg#flags ELS +--- +--- ELS (erg-language-server) is a language server for the Erg programming language. +--- +--- erg-language-server can be installed via `cargo` and used as follows: +--- +--- ```sh +--- cargo install erg --features els +--- erg --language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'erg', '--language-server' }, + filetypes = { 'erg' }, + root_markers = { 'package.er', '.git' }, +} diff --git a/.config/nvim/lsp/erlangls.lua b/.config/nvim/lsp/erlangls.lua new file mode 100644 index 0000000..d209d83 --- /dev/null +++ b/.config/nvim/lsp/erlangls.lua @@ -0,0 +1,21 @@ +---@brief +--- +--- https://erlang-ls.github.io +--- +--- Language Server for Erlang. +--- +--- Clone [erlang_ls](https://github.com/erlang-ls/erlang_ls) +--- Compile the project with `make` and copy resulting binaries somewhere in your $PATH eg. `cp _build/*/bin/* ~/local/bin` +--- +--- Installation instruction can be found [here](https://github.com/erlang-ls/erlang_ls). +--- +--- Installation requirements: +--- - [Erlang OTP 21+](https://github.com/erlang/otp) +--- - [rebar3 3.9.1+](https://github.com/erlang/rebar3) + +---@type vim.lsp.Config +return { + cmd = { 'erlang_ls' }, + filetypes = { 'erlang' }, + root_markers = { 'rebar.config', 'erlang.mk', '.git' }, +} diff --git a/.config/nvim/lsp/esbonio.lua b/.config/nvim/lsp/esbonio.lua new file mode 100644 index 0000000..3b1fcee --- /dev/null +++ b/.config/nvim/lsp/esbonio.lua @@ -0,0 +1,51 @@ +---@brief +--- +--- https://github.com/swyddfa/esbonio +--- +--- Esbonio is a language server for [Sphinx](https://www.sphinx-doc.org/en/master/) documentation projects. +--- The language server can be installed via pip +--- +--- ``` +--- pip install esbonio +--- ``` +--- +--- Since Sphinx is highly extensible you will get best results if you install the language server in the same +--- Python environment as the one used to build your documentation. To ensure that the correct Python environment +--- is picked up, you can either launch `nvim` with the correct environment activated. +--- +--- ``` +--- source env/bin/activate +--- nvim +--- ``` +--- +--- Or you can modify the default `cmd` to include the full path to the Python interpreter. +--- +--- ```lua +--- vim.lsp.config('esbonio', { +--- cmd = { '/path/to/virtualenv/bin/python', '-m', 'esbonio' } +--- }) +--- ``` +--- +--- Esbonio supports a number of config values passed as `init_options` on startup, for example. +--- +--- ```lua +--- vim.lsp.config('esbonio', { +--- init_options = { +--- server = { +--- logLevel = "debug" +--- }, +--- sphinx = { +--- confDir = "/path/to/docs", +--- srcDir = "${confDir}/../docs-src" +--- } +--- }) +--- ``` +--- +--- A full list and explanation of the available options can be found [here](https://docs.esbon.io/en/esbonio-language-server-v0.16.4/lsp/getting-started.html?editor=neovim-lspconfig#configuration) + +---@type vim.lsp.Config +return { + cmd = { 'python3', '-m', 'esbonio' }, + filetypes = { 'rst' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/eslint.lua b/.config/nvim/lsp/eslint.lua new file mode 100644 index 0000000..a30c349 --- /dev/null +++ b/.config/nvim/lsp/eslint.lua @@ -0,0 +1,231 @@ +--- @brief +--- +--- https://github.com/hrsh7th/vscode-langservers-extracted +--- +--- `vscode-eslint-language-server` is a linting engine for JavaScript / Typescript. +--- It can be installed via `npm`: +--- +--- ```sh +--- npm i -g vscode-langservers-extracted +--- ``` +--- +--- The default `on_attach` config provides the `LspEslintFixAll` command that can be used to format a document on save: +--- ```lua +--- local base_on_attach = vim.lsp.config.eslint.on_attach +--- vim.lsp.config("eslint", { +--- on_attach = function(client, bufnr) +--- if not base_on_attach then return end +--- +--- base_on_attach(client, bufnr) +--- vim.api.nvim_create_autocmd("BufWritePre", { +--- buffer = bufnr, +--- command = "LspEslintFixAll", +--- }) +--- end, +--- }) +--- ``` +--- +--- See [vscode-eslint](https://github.com/microsoft/vscode-eslint/blob/55871979d7af184bf09af491b6ea35ebd56822cf/server/src/eslintServer.ts#L216-L229) for configuration options. +--- +--- Messages handled in lspconfig: `eslint/openDoc`, `eslint/confirmESLintExecution`, `eslint/probeFailed`, `eslint/noLibrary` +--- +--- Additional messages you can handle: `eslint/noConfig` +--- +--- ### Monorepo support +--- +--- `vscode-eslint-language-server` supports monorepos by default. It will automatically find the config file corresponding to the package you are working on. You can use different configs in different packages. +--- This works without the need of spawning multiple instances of `vscode-eslint-language-server`. +--- You can use a different version of ESLint in each package, but it is recommended to use the same version of ESLint in all packages. The location of the ESLint binary will be determined automatically. +--- +--- /!\ When using flat config files, you need to use them across all your packages in your monorepo, as it's a global setting for the server. + +local util = require 'lspconfig.util' +local lsp = vim.lsp + +local eslint_config_files = { + '.eslintrc', + '.eslintrc.js', + '.eslintrc.cjs', + '.eslintrc.yaml', + '.eslintrc.yml', + '.eslintrc.json', + 'eslint.config.js', + 'eslint.config.mjs', + 'eslint.config.cjs', + 'eslint.config.ts', + 'eslint.config.mts', + 'eslint.config.cts', +} + +---@type vim.lsp.Config +return { + cmd = { 'vscode-eslint-language-server', '--stdio' }, + filetypes = { + 'javascript', + 'javascriptreact', + 'javascript.jsx', + 'typescript', + 'typescriptreact', + 'typescript.tsx', + 'vue', + 'svelte', + 'astro', + 'htmlangular', + }, + workspace_required = true, + on_attach = function(client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspEslintFixAll', function() + client:request_sync('workspace/executeCommand', { + command = 'eslint.applyAllFixes', + arguments = { + { + uri = vim.uri_from_bufnr(bufnr), + version = lsp.util.buf_versions[bufnr], + }, + }, + }, nil, bufnr) + end, {}) + end, + root_dir = function(bufnr, on_dir) + -- The project root is where the LSP can be started from + -- As stated in the documentation above, this LSP supports monorepos and simple projects. + -- We select then from the project root, which is identified by the presence of a package + -- manager lock file. + local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock' } + -- Give the root markers equal priority by wrapping them in a table + root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } } + or vim.list_extend(root_markers, { '.git' }) + + -- exclude deno + if vim.fs.root(bufnr, { 'deno.json', 'deno.jsonc', 'deno.lock' }) then + return + end + + -- We fallback to the current working directory if no project root is found + local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd() + + -- We know that the buffer is using ESLint if it has a config file + -- in its directory tree. + -- + -- Eslint used to support package.json files as config files, but it doesn't anymore. + -- We keep this for backward compatibility. + local filename = vim.api.nvim_buf_get_name(bufnr) + local eslint_config_files_with_package_json = + util.insert_package_json(eslint_config_files, 'eslintConfig', filename) + local is_buffer_using_eslint = vim.fs.find(eslint_config_files_with_package_json, { + path = filename, + type = 'file', + limit = 1, + upward = true, + stop = vim.fs.dirname(project_root), + })[1] + if not is_buffer_using_eslint then + return + end + + on_dir(project_root) + end, + -- Refer to https://github.com/Microsoft/vscode-eslint#settings-options for documentation. + settings = { + validate = 'on', + ---@diagnostic disable-next-line: assign-type-mismatch + packageManager = nil, + useESLintClass = false, + experimental = { + useFlatConfig = false, + }, + codeActionOnSave = { + enable = false, + mode = 'all', + }, + format = true, + quiet = false, + onIgnoredFiles = 'off', + rulesCustomizations = {}, + run = 'onType', + problems = { + shortenToSingleLine = false, + }, + -- nodePath configures the directory in which the eslint server should start its node_modules resolution. + -- This path is relative to the workspace folder (root dir) of the server instance. + nodePath = '', + -- use the workspace folder location or the file location (if no workspace folder is open) as the working directory + workingDirectory = { mode = 'auto' }, + codeAction = { + disableRuleComment = { + enable = true, + location = 'separateLine', + }, + showDocumentation = { + enable = true, + }, + }, + }, + before_init = function(_, config) + -- The "workspaceFolder" is a VSCode concept. It limits how far the + -- server will traverse the file system when locating the ESLint config + -- file (e.g., .eslintrc). + local root_dir = config.root_dir + + if root_dir then + config.settings = config.settings or {} + config.settings.workspaceFolder = { + uri = root_dir, + name = vim.fn.fnamemodify(root_dir, ':t'), + } + + -- Support flat config files + -- They contain 'config' in the file name + local flat_config_files = vim.tbl_filter(function(file) + return file:match('config') + end, eslint_config_files) + + for _, file in ipairs(flat_config_files) do + local found_files = vim.fn.globpath(root_dir, file, true, true) + + -- Filter out files inside node_modules + local filtered_files = {} + for _, found_file in ipairs(found_files) do + if string.find(found_file, '[/\\]node_modules[/\\]') == nil then + table.insert(filtered_files, found_file) + end + end + + if #filtered_files > 0 then + config.settings.experimental = config.settings.experimental or {} + config.settings.experimental.useFlatConfig = true + break + end + end + + -- Support Yarn2 (PnP) projects + local pnp_cjs = root_dir .. '/.pnp.cjs' + local pnp_js = root_dir .. '/.pnp.js' + if type(config.cmd) == 'table' and (vim.uv.fs_stat(pnp_cjs) or vim.uv.fs_stat(pnp_js)) then + config.cmd = vim.list_extend({ 'yarn', 'exec' }, config.cmd --[[@as table]]) + end + end + end, + handlers = { + ['eslint/openDoc'] = function(_, result) + if result then + vim.ui.open(result.url) + end + return {} + end, + ['eslint/confirmESLintExecution'] = function(_, result) + if not result then + return + end + return 4 -- approved + end, + ['eslint/probeFailed'] = function() + vim.notify('[lspconfig] ESLint probe failed.', vim.log.levels.WARN) + return {} + end, + ['eslint/noLibrary'] = function() + vim.notify('[lspconfig] Unable to find ESLint library.', vim.log.levels.WARN) + return {} + end, + }, +} diff --git a/.config/nvim/lsp/expert.lua b/.config/nvim/lsp/expert.lua new file mode 100644 index 0000000..83141ed --- /dev/null +++ b/.config/nvim/lsp/expert.lua @@ -0,0 +1,26 @@ +---@brief +--- +--- https://github.com/elixir-lang/expert +--- +--- Expert is the official language server implementation for the Elixir programming language. +--- +--- 'root_dir' is chosen like this: if two or more directories containing `mix.exs` were found when +--- searching directories upward, the second one (higher up) is chosen, with the assumption that it +--- is the root of an umbrella app. Otherwise the directory containing the single mix.exs that was +--- found is chosen. + +---@type vim.lsp.Config +return { + filetypes = { 'elixir', 'eelixir', 'heex', 'surface' }, + cmd = { 'expert', '--stdio' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + --- Elixir workspaces may have multiple `mix.exs` files, for an "umbrella" layout or monorepo. + --- So we specify `limit=2` and treat the highest one (if any) as the root of an umbrella app. + local matches = vim.fs.find({ 'mix.exs' }, { upward = true, limit = 2, path = fname }) + local child_or_root_path, maybe_umbrella_path = unpack(matches) + local root_dir = vim.fs.dirname(maybe_umbrella_path or child_or_root_path) + + on_dir(root_dir) + end, +} diff --git a/.config/nvim/lsp/facility_language_server.lua b/.config/nvim/lsp/facility_language_server.lua new file mode 100644 index 0000000..7a03b87 --- /dev/null +++ b/.config/nvim/lsp/facility_language_server.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/FacilityApi/FacilityLanguageServer +--- +--- Facility language server protocol (LSP) support. + +---@type vim.lsp.Config +return { + cmd = { 'facility-language-server' }, + filetypes = { 'fsd' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/fennel_language_server.lua b/.config/nvim/lsp/fennel_language_server.lua new file mode 100644 index 0000000..8ddf799 --- /dev/null +++ b/.config/nvim/lsp/fennel_language_server.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://github.com/rydesun/fennel-language-server +--- +--- Fennel language server protocol (LSP) support. + +---@type vim.lsp.Config +return { + cmd = { 'fennel-language-server' }, + filetypes = { 'fennel' }, + root_markers = { '.git' }, + settings = {}, +} diff --git a/.config/nvim/lsp/fennel_ls.lua b/.config/nvim/lsp/fennel_ls.lua new file mode 100644 index 0000000..acd9341 --- /dev/null +++ b/.config/nvim/lsp/fennel_ls.lua @@ -0,0 +1,26 @@ +---@brief +--- +--- https://sr.ht/~xerool/fennel-ls/ +--- +--- A language server for fennel. +--- +--- fennel-ls is configured using the closest file to your working directory named `flsproject.fnl`. +--- All fennel-ls configuration options [can be found here](https://git.sr.ht/~xerool/fennel-ls/tree/HEAD/docs/manual.md#configuration). + +---@type vim.lsp.Config +return { + cmd = { 'fennel-ls' }, + filetypes = { 'fennel' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + local has_fls_project_cfg = function(path) + local fnlpath = vim.fs.joinpath(path, 'flsproject.fnl') + return (vim.uv.fs_stat(fnlpath) or {}).type == 'file' + end + on_dir(vim.iter(vim.fs.parents(fname)):find(has_fls_project_cfg) or vim.fs.root(0, '.git')) + end, + settings = {}, + capabilities = { + offsetEncoding = { 'utf-8', 'utf-16' }, + }, +} diff --git a/.config/nvim/lsp/fish_lsp.lua b/.config/nvim/lsp/fish_lsp.lua new file mode 100644 index 0000000..05d5cf9 --- /dev/null +++ b/.config/nvim/lsp/fish_lsp.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/ndonfris/fish-lsp +--- +--- A Language Server Protocol (LSP) tailored for the fish shell. +--- This project aims to enhance the coding experience for fish, +--- by introducing a suite of intelligent features like auto-completion, +--- scope aware symbol analysis, per-token hover generation, and many others. +--- +--- [homepage](https://www.fish-lsp.dev/) + +---@type vim.lsp.Config +return { + cmd = { 'fish-lsp', 'start' }, + filetypes = { 'fish' }, + root_markers = { 'config.fish', '.git' }, +} diff --git a/.config/nvim/lsp/flow.lua b/.config/nvim/lsp/flow.lua new file mode 100644 index 0000000..9274381 --- /dev/null +++ b/.config/nvim/lsp/flow.lua @@ -0,0 +1,29 @@ +---@brief +--- +--- https://flow.org/ +--- https://github.com/facebook/flow +--- +--- See below for how to setup Flow itself. +--- https://flow.org/en/docs/install/ +--- +--- See below for lsp command options. +--- +--- ```sh +--- npx flow lsp --help +--- ``` + +---@type vim.lsp.Config +return { + cmd = function(dispatchers) + local cmd = nil + if vim.fn.executable('flow') then + cmd = { 'flow', 'lsp' } + else + cmd = { 'npx', '--no-install', 'flow', 'lsp' } + end + + return vim.lsp.rpc.start(cmd, dispatchers) + end, + filetypes = { 'javascript', 'javascriptreact', 'javascript.jsx' }, + root_markers = { '.flowconfig' }, +} diff --git a/.config/nvim/lsp/flux_lsp.lua b/.config/nvim/lsp/flux_lsp.lua new file mode 100644 index 0000000..c21319a --- /dev/null +++ b/.config/nvim/lsp/flux_lsp.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/influxdata/flux-lsp +--- `flux-lsp` can be installed via `cargo`: +--- ```sh +--- cargo install --git https://github.com/influxdata/flux-lsp +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'flux-lsp' }, + filetypes = { 'flux' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/foam_ls.lua b/.config/nvim/lsp/foam_ls.lua new file mode 100644 index 0000000..636b066 --- /dev/null +++ b/.config/nvim/lsp/foam_ls.lua @@ -0,0 +1,29 @@ +---@brief +--- +--- https://github.com/FoamScience/foam-language-server +--- +--- `foam-language-server` can be installed via `npm` +--- ```sh +--- npm install -g foam-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'foam-ls', '--stdio' }, + filetypes = { 'foam', 'OpenFOAM' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + for path in vim.fs.parents(fname) do + if vim.uv.fs_stat(path .. '/system/controlDict') then + on_dir(path) + return + end + end + local git_root = vim.fs.root(bufnr, { '.git' }) + if git_root then + on_dir(git_root) + return + end + on_dir(vim.fs.dirname(fname)) + end, +} diff --git a/.config/nvim/lsp/fortls.lua b/.config/nvim/lsp/fortls.lua new file mode 100644 index 0000000..c85f4a5 --- /dev/null +++ b/.config/nvim/lsp/fortls.lua @@ -0,0 +1,27 @@ +---@brief +--- +--- https://fortls.fortran-lang.org/index.html +--- +--- fortls is a Fortran Language Server, the server can be installed via pip +--- +--- ```sh +--- pip install fortls +--- ``` +--- +--- Settings to the server can be passed either through the `cmd` option or through +--- a local configuration file e.g. `.fortls`. For more information +--- see the `fortls` [documentation](https://fortls.fortran-lang.org/options.html). + +---@type vim.lsp.Config +return { + cmd = { + 'fortls', + '--notify_init', + '--hover_signature', + '--hover_language=fortran', + '--use_signature_help', + }, + filetypes = { 'fortran' }, + root_markers = { '.fortls', '.git' }, + settings = {}, +} diff --git a/.config/nvim/lsp/fsautocomplete.lua b/.config/nvim/lsp/fsautocomplete.lua new file mode 100644 index 0000000..7e0376b --- /dev/null +++ b/.config/nvim/lsp/fsautocomplete.lua @@ -0,0 +1,54 @@ +---@brief +--- +--- https://github.com/fsharp/FsAutoComplete +--- +--- Language Server for F# provided by FsAutoComplete (FSAC). +--- +--- FsAutoComplete requires the [dotnet-sdk](https://dotnet.microsoft.com/download) to be installed. +--- +--- The preferred way to install FsAutoComplete is with `dotnet tool install --global fsautocomplete`. +--- +--- Instructions to compile from source are found on the main [repository](https://github.com/fsharp/FsAutoComplete). +--- +--- You may also need to configure the filetype as Vim defaults to Forth for `*.fs` files: +--- +--- `autocmd BufNewFile,BufRead *.fs,*.fsx,*.fsi set filetype=fsharp` +--- +--- This is automatically done by plugins such as [PhilT/vim-fsharp](https://github.com/PhilT/vim-fsharp), [fsharp/vim-fsharp](https://github.com/fsharp/vim-fsharp), and [adelarsq/neofsharp.vim](https://github.com/adelarsq/neofsharp.vim). +--- + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'fsautocomplete', '--adaptive-lsp-server-enabled' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern('*.sln', '*.fsproj', '.git')(fname)) + end, + filetypes = { 'fsharp' }, + init_options = { + AutomaticWorkspaceInit = true, + }, + -- this recommended settings values taken from https://github.com/ionide/FsAutoComplete?tab=readme-ov-file#settings + settings = { + FSharp = { + keywordsAutocomplete = true, + ExternalAutocomplete = false, + Linter = true, + UnionCaseStubGeneration = true, + UnionCaseStubGenerationBody = 'failwith "Not Implemented"', + RecordStubGeneration = true, + RecordStubGenerationBody = 'failwith "Not Implemented"', + InterfaceStubGeneration = true, + InterfaceStubGenerationObjectIdentifier = 'this', + InterfaceStubGenerationMethodBody = 'failwith "Not Implemented"', + UnusedOpensAnalyzer = true, + UnusedDeclarationsAnalyzer = true, + UseSdkScripts = true, + SimplifyNameAnalyzer = true, + ResolveNamespaces = true, + EnableReferenceCodeLens = true, + }, + }, +} diff --git a/.config/nvim/lsp/fsharp_language_server.lua b/.config/nvim/lsp/fsharp_language_server.lua new file mode 100644 index 0000000..b1de1f7 --- /dev/null +++ b/.config/nvim/lsp/fsharp_language_server.lua @@ -0,0 +1,30 @@ +---@brief +--- +--- F# Language Server +--- https://github.com/faldor20/fsharp-language-server +--- +--- An implementation of the language server protocol using the F# Compiler Service. +--- +--- Build the project from source and override the command path to location of DLL. +--- +--- If filetype determination is not already performed by an available plugin ([PhilT/vim-fsharp](https://github.com/PhilT/vim-fsharp), [fsharp/vim-fsharp](https://github.com/fsharp/vim-fsharp), and [adelarsq/neofsharp.vim](https://github.com/adelarsq/neofsharp.vim). +--- ), then the following must be added to initialization configuration: +--- +--- +--- `autocmd BufNewFile,BufRead *.fs,*.fsx,*.fsi set filetype=fsharp` + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'dotnet', 'FSharpLanguageServer.dll' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern('*.sln', '*.fsproj', '.git')(fname)) + end, + filetypes = { 'fsharp' }, + init_options = { + AutomaticWorkspaceInit = true, + }, + settings = {}, +} diff --git a/.config/nvim/lsp/fstar.lua b/.config/nvim/lsp/fstar.lua new file mode 100644 index 0000000..749460f --- /dev/null +++ b/.config/nvim/lsp/fstar.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/FStarLang/FStar +--- +--- LSP support is included in FStar. Make sure `fstar.exe` is in your PATH. + +---@type vim.lsp.Config +return { + cmd = { 'fstar.exe', '--lsp' }, + filetypes = { 'fstar' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/futhark_lsp.lua b/.config/nvim/lsp/futhark_lsp.lua new file mode 100644 index 0000000..351dda3 --- /dev/null +++ b/.config/nvim/lsp/futhark_lsp.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/diku-dk/futhark +--- +--- Futhark Language Server +--- +--- This language server comes with the futhark compiler and is run with the command +--- ``` +--- futhark lsp +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'futhark', 'lsp' }, + filetypes = { 'futhark', 'fut' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/gdscript.lua b/.config/nvim/lsp/gdscript.lua new file mode 100644 index 0000000..d0d25b2 --- /dev/null +++ b/.config/nvim/lsp/gdscript.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/godotengine/godot +--- +--- Language server for GDScript, used by Godot Engine. + +local port = os.getenv 'GDScript_Port' or '6005' +local cmd = vim.lsp.rpc.connect('127.0.0.1', tonumber(port)) + +---@type vim.lsp.Config +return { + cmd = cmd, + filetypes = { 'gd', 'gdscript', 'gdscript3' }, + root_markers = { 'project.godot', '.git' }, +} diff --git a/.config/nvim/lsp/gdshader_lsp.lua b/.config/nvim/lsp/gdshader_lsp.lua new file mode 100644 index 0000000..38a5637 --- /dev/null +++ b/.config/nvim/lsp/gdshader_lsp.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/godofavacyn/gdshader-lsp +--- +--- A language server for the Godot Shading language. + +---@type vim.lsp.Config +return { + cmd = { 'gdshader-lsp', '--stdio' }, + filetypes = { 'gdshader', 'gdshaderinc' }, + root_markers = { 'project.godot' }, +} diff --git a/.config/nvim/lsp/gh_actions_ls.lua b/.config/nvim/lsp/gh_actions_ls.lua new file mode 100644 index 0000000..f029ea7 --- /dev/null +++ b/.config/nvim/lsp/gh_actions_ls.lua @@ -0,0 +1,57 @@ +---@brief +--- https://github.com/lttb/gh-actions-language-server +--- +--- Language server for GitHub Actions. +--- +--- The projects [forgejo](https://forgejo.org/) and [gitea](https://about.gitea.com/) +--- design their actions to be as compatible to github as possible +--- with only [a few differences](https://docs.gitea.com/usage/actions/comparison#unsupported-workflows-syntax) between the systems. +--- The `gh_actions_ls` is therefore enabled for those `yaml` files as well. +--- +--- The `gh-actions-language-server` can be installed via `npm`: +--- +--- ```sh +--- npm install -g gh-actions-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'gh-actions-language-server', '--stdio' }, + filetypes = { 'yaml' }, + + -- `root_dir` ensures that the LSP does not attach to all yaml files + root_dir = function(bufnr, on_dir) + local parent = vim.fs.dirname(vim.api.nvim_buf_get_name(bufnr)) + if + vim.endswith(parent, '/.github/workflows') + or vim.endswith(parent, '/.forgejo/workflows') + or vim.endswith(parent, '/.gitea/workflows') + then + on_dir(parent) + end + end, + handlers = { + ['actions/readFile'] = function(_, result) + if type(result.path) ~= 'string' then + return nil, nil + end + local file_path = vim.uri_to_fname(result.path) + if vim.fn.filereadable(file_path) == 1 then + local f = assert(io.open(file_path, 'r')) + local text = f:read('*a') + f:close() + + return text, nil + end + return nil, nil + end, + }, + init_options = {}, -- needs to be present https://github.com/neovim/nvim-lspconfig/pull/3713#issuecomment-2857394868 + capabilities = { + workspace = { + didChangeWorkspaceFolders = { + dynamicRegistration = true, + }, + }, + }, +} diff --git a/.config/nvim/lsp/ghcide.lua b/.config/nvim/lsp/ghcide.lua new file mode 100644 index 0000000..39d4e47 --- /dev/null +++ b/.config/nvim/lsp/ghcide.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://github.com/digital-asset/ghcide +--- +--- A library for building Haskell IDE tooling. +--- "ghcide" isn't for end users now. Use "haskell-language-server" instead of "ghcide". + +---@type vim.lsp.Config +return { + cmd = { 'ghcide', '--lsp' }, + filetypes = { 'haskell', 'lhaskell' }, + root_markers = { 'stack.yaml', 'hie-bios', 'BUILD.bazel', 'cabal.config', 'package.yaml' }, +} diff --git a/.config/nvim/lsp/ghdl_ls.lua b/.config/nvim/lsp/ghdl_ls.lua new file mode 100644 index 0000000..3927cfe --- /dev/null +++ b/.config/nvim/lsp/ghdl_ls.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/ghdl/ghdl-language-server +--- +--- A language server for VHDL, using ghdl as its backend. +--- +--- `ghdl-ls` is part of pyghdl, for installation instructions see +--- [the upstream README](https://github.com/ghdl/ghdl/tree/master/pyGHDL/lsp). + +---@type vim.lsp.Config +return { + cmd = { 'ghdl-ls' }, + filetypes = { 'vhdl' }, + root_markers = { 'hdl-prj.json', '.git' }, +} diff --git a/.config/nvim/lsp/ginko_ls.lua b/.config/nvim/lsp/ginko_ls.lua new file mode 100644 index 0000000..d9d95df --- /dev/null +++ b/.config/nvim/lsp/ginko_ls.lua @@ -0,0 +1,17 @@ +---@brief +--- +---`ginko_ls` is meant to be a feature-complete language server for device-trees. +--- Language servers can be used in many editors, such as Visual Studio Code, Emacs +--- or Vim +--- +--- Install `ginko_ls` from https://github.com/Schottkyc137/ginko and add it to path +--- +--- `ginko_ls` doesn't require any configuration. + +---@type vim.lsp.Config +return { + cmd = { 'ginko_ls' }, + filetypes = { 'dts' }, + root_markers = { '.git' }, + settings = {}, +} diff --git a/.config/nvim/lsp/gitlab_ci_ls.lua b/.config/nvim/lsp/gitlab_ci_ls.lua new file mode 100644 index 0000000..d2f80ab --- /dev/null +++ b/.config/nvim/lsp/gitlab_ci_ls.lua @@ -0,0 +1,26 @@ +---@brief +--- +--- https://github.com/alesbrelih/gitlab-ci-ls +--- +--- Language Server for Gitlab CI +--- +--- `gitlab-ci-ls` can be installed via cargo: +--- cargo install gitlab-ci-ls + +local util = require 'lspconfig.util' + +local cache_dir = vim.uv.os_homedir() .. '/.cache/gitlab-ci-ls/' + +---@type vim.lsp.Config +return { + cmd = { 'gitlab-ci-ls' }, + filetypes = { 'yaml.gitlab' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern('.git', '.gitlab*')(fname)) + end, + init_options = { + cache_path = cache_dir, + log_path = cache_dir .. '/log/gitlab-ci-ls.log', + }, +} diff --git a/.config/nvim/lsp/gitlab_duo.lua b/.config/nvim/lsp/gitlab_duo.lua new file mode 100644 index 0000000..08439f6 --- /dev/null +++ b/.config/nvim/lsp/gitlab_duo.lua @@ -0,0 +1,448 @@ +---@brief +--- +--- GitLab Duo Language Server Configuration for Neovim +--- +--- https://gitlab.com/gitlab-org/editor-extensions/gitlab-lsp +--- +--- The GitLab LSP enables any editor or IDE to integrate with GitLab Duo +--- for AI-powered code suggestions via the Language Server Protocol. +--- +--- Prerequisites: +--- - Node.js and npm installed +--- - GitLab account with Duo Pro license +--- - Internet connection for OAuth device flow +--- +--- Setup: +--- 1. Run :LspGitLabDuoSignIn to start OAuth authentication +--- 2. Follow the browser prompts to authorize +--- 3. Enable inline completion in LspAttach event (see example below) +--- +--- Inline Completion Example: +--- ```lua +--- vim.api.nvim_create_autocmd('LspAttach', { +--- callback = function(args) +--- local bufnr = args.buf +--- local client = assert(vim.lsp.get_client_by_id(args.data.client_id)) +--- +--- if vim.lsp.inline_completion and +--- client:supports_method(vim.lsp.protocol.Methods.textDocument_inlineCompletion, bufnr) then +--- vim.lsp.inline_completion.enable(true, { bufnr = bufnr }) +--- +--- -- Tab to accept suggestion +--- vim.keymap.set('i', '', function() +--- if vim.lsp.inline_completion.is_visible() then +--- return vim.lsp.inline_completion.accept() +--- else +--- return '' +--- end +--- end, { expr = true, buffer = bufnr, desc = 'GitLab Duo: Accept suggestion' }) +--- +--- -- Alt/Option+[ for previous suggestion +--- vim.keymap.set('i', '', vim.lsp.inline_completion.select_prev, +--- { buffer = bufnr, desc = 'GitLab Duo: Previous suggestion' }) +--- +--- -- Alt/Option+] for next suggestion +--- vim.keymap.set('i', '', vim.lsp.inline_completion.select_next, +--- { buffer = bufnr, desc = 'GitLab Duo: Next suggestion' }) +--- end +--- end +--- }) +--- ``` + +-- Configuration +local config = { + gitlab_url = 'https://gitlab.com', + -- This is a oauth application created from tachyons-gitlab account with `api` scope + client_id = '00bb391f527d2e77b3467b0b6b900151cc6a28dcfb18fa1249871e43bc3e5832', + scopes = 'api', + token_file = vim.fn.stdpath('data') .. '/gitlab_duo_oauth.json', +} + +-- Helper function to make POST requests with curl via vim.system +local function curl_post(url, data, headers) + local curl_args = { + 'curl', + '-s', + '-w', + '\n%{http_code}', + '-X', + 'POST', + url, + } + + -- Add headers + for key, value in pairs(headers or {}) do + table.insert(curl_args, '-H') + table.insert(curl_args, key .. ': ' .. value) + end + + -- Add data + if data then + table.insert(curl_args, '-d') + table.insert(curl_args, data) + end + + local result = vim.system(curl_args, { text = true }):wait() + + -- Split body and status code + local output = result.stdout or '' + local body_end = output:match('.*\n()%d+$') + + local body = '' + local status = 0 + + if body_end then + body = output:sub(1, body_end - 2) -- -2 to remove trailing newline + status = tonumber(output:match('\n(%d+)$')) or 0 + else + body = output + end + + return { + status = status, + body = body, + } +end + +-- Token management +local function save_token(token_data) + token_data.saved_at = os.time() + local file = io.open(config.token_file, 'w') + if file then + file:write(vim.json.encode(token_data)) + file:close() + return true + end + return false +end + +local function load_token() + if vim.fn.filereadable(config.token_file) == 0 then + return nil + end + + local blob = vim.fn.readblob(config.token_file) + return vim.json.decode(blob) +end + +local function is_token_expired(token_data) + if not token_data or not token_data.saved_at or not token_data.expires_in then + return true + end + local token_age = os.time() - token_data.saved_at + return token_age >= (token_data.expires_in - 60) -- 60 second buffer +end + +local function refresh_access_token(refresh_token) + vim.notify('Refreshing GitLab OAuth token...', vim.log.levels.INFO) + + local response = curl_post( + config.gitlab_url .. '/oauth/token', + string.format('client_id=%s&refresh_token=%s&grant_type=refresh_token', config.client_id, refresh_token), + { ['Content-Type'] = 'application/x-www-form-urlencoded' } + ) + + if response.status ~= 200 then + vim.notify('Failed to refresh token: ' .. (response.body or 'Unknown error'), vim.log.levels.ERROR) + return nil + end + + local ok, body = pcall(vim.json.decode, response.body) + if not ok or not body.access_token then + vim.notify('Invalid refresh response', vim.log.levels.ERROR) + return nil + end + + save_token(body) + vim.notify('Token refreshed successfully', vim.log.levels.INFO) + return body +end + +local function get_valid_token() + local token_data = load_token() + + if not token_data then + return nil, 'no_token' + end + + if is_token_expired(token_data) then + if token_data.refresh_token then + local new_token_data = refresh_access_token(token_data.refresh_token) + if new_token_data then + return new_token_data.access_token, 'refreshed' + end + return nil, 'refresh_failed' + end + return nil, 'expired' + end + + return token_data.access_token, 'valid' +end + +-- OAuth Device Flow +local function device_authorization() + local response = curl_post( + config.gitlab_url .. '/oauth/authorize_device', + string.format('client_id=%s&scope=%s', config.client_id, config.scopes), + { ['Content-Type'] = 'application/x-www-form-urlencoded' } + ) + + if response.status ~= 200 then + vim.notify('Device authorization failed: ' .. response.status, vim.log.levels.ERROR) + return nil + end + + local data = vim.json.decode(response.body) + + return data +end + +local function poll_for_token(device_code, interval, client) + local max_attempts = 60 + local attempts = 0 + + local function poll() + attempts = attempts + 1 + + local response = curl_post( + config.gitlab_url .. '/oauth/token', + string.format( + 'client_id=%s&device_code=%s&grant_type=urn:ietf:params:oauth:grant-type:device_code', + config.client_id, + device_code + ), + { ['Content-Type'] = 'application/x-www-form-urlencoded' } + ) + + local ok, body = pcall(vim.json.decode, response.body) + if not ok then + vim.notify('Failed to parse token response', vim.log.levels.ERROR) + return + end + + if response.status == 200 and body.access_token then + save_token(body) + vim.notify('GitLab Duo authentication successful!', vim.log.levels.INFO) + + -- Update LSP with new token + vim.schedule(function() + client:notify('workspace/didChangeConfiguration', { + settings = { + token = body.access_token, + baseUrl = config.gitlab_url, + }, + }) + end) + return + end + + if body.error == 'authorization_pending' then + if attempts < max_attempts then + vim.defer_fn(poll, interval * 1000) + else + vim.notify('Authorization timed out', vim.log.levels.ERROR) + end + elseif body.error == 'slow_down' then + vim.defer_fn(poll, (interval + 5) * 1000) + elseif body.error == 'access_denied' then + vim.notify('Authorization denied', vim.log.levels.ERROR) + elseif body.error == 'expired_token' then + vim.notify('Device code expired. Please run :LspGitLabDuoSignIn again', vim.log.levels.ERROR) + else + vim.notify('OAuth error: ' .. (body.error or 'unknown'), vim.log.levels.ERROR) + end + end + + poll() +end + +---@param client vim.lsp.Client +local function sign_in(client) + vim.notify('Starting GitLab device authorization...', vim.log.levels.INFO) + + local auth_data = device_authorization() + if not auth_data then + return + end + + vim.ui.open(auth_data.verification_uri .. '?user_code=' .. auth_data.user_code) + + poll_for_token(auth_data.device_code, auth_data.interval or 5, client) +end + +---@param client vim.lsp.Client +local function sign_out(client) + local ok = os.remove(config.token_file) + if ok then + vim.notify('Signed out. Token removed.', vim.log.levels.INFO) + client:notify('workspace/didChangeConfiguration', { + settings = { token = '' }, + }) + else + vim.notify('Failed to remove token file', vim.log.levels.ERROR) + end +end + +local function show_status() + local token_data = load_token() + + if not token_data then + vim.notify('Not signed in. Run :LspGitLabDuoSignIn to authenticate.', vim.log.levels.INFO) + return + end + + local info = { + 'GitLab Duo Status:', + '', + 'Instance: ' .. config.gitlab_url, + 'Signed in: Yes', + 'Has refresh token: ' .. (token_data.refresh_token and 'Yes' or 'No'), + } + + if token_data.saved_at and token_data.expires_in then + local time_left = token_data.expires_in - (os.time() - token_data.saved_at) + if time_left > 0 then + local hours = math.floor(time_left / 3600) + local minutes = math.floor((time_left % 3600) / 60) + table.insert(info, string.format('Token expires in: %dh %dm', hours, minutes)) + else + table.insert(info, 'Token status: EXPIRED') + end + end + + vim.notify(table.concat(info, '\n'), vim.log.levels.INFO) +end + +---@type vim.lsp.Config +return { + cmd = { + 'npx', + '--registry=https://gitlab.com/api/v4/packages/npm/', + '@gitlab-org/gitlab-lsp', + '--stdio', + }, + root_markers = { '.git' }, + filetypes = { + 'ruby', + 'go', + 'javascript', + 'typescript', + 'typescriptreact', + 'javascriptreact', + 'rust', + 'lua', + 'python', + 'java', + 'cpp', + 'c', + 'php', + 'cs', + 'kotlin', + 'swift', + 'scala', + 'vue', + 'svelte', + 'html', + 'css', + 'scss', + 'json', + 'yaml', + }, + init_options = { + editorInfo = { + name = 'Neovim', + version = tostring(vim.version()), + }, + editorPluginInfo = { + name = 'Neovim LSP', + version = tostring(vim.version()), + }, + ide = { + name = 'Neovim', + version = tostring(vim.version()), + vendor = 'Neovim', + }, + extension = { + name = 'Neovim LSP Client', + version = tostring(vim.version()), + }, + }, + settings = { + baseUrl = config.gitlab_url, + logLevel = 'info', + codeCompletion = { + enableSecretRedaction = true, + }, + telemetry = { + enabled = false, + }, + featureFlags = { + streamCodeGenerations = false, + }, + }, + on_init = function(client) + -- Handle token validation errors + client.handlers['$/gitlab/token/check'] = function(_, result) + if result and result.reason then + vim.notify(string.format('GitLab Duo: %s - %s', result.reason, result.message or ''), vim.log.levels.ERROR) + + -- Try to refresh if possible + local token_data = load_token() + if token_data and token_data.refresh_token then + vim.schedule(function() + local new_token_data = refresh_access_token(token_data.refresh_token) + if new_token_data then + client:notify('workspace/didChangeConfiguration', { + settings = { token = new_token_data.access_token, baseUrl = config.gitlab_url }, + }) + else + vim.notify('Run :LspGitLabDuoSignIn to re-authenticate', vim.log.levels.WARN) + end + end) + else + vim.notify('Run :LspGitLabDuoSignIn to authenticate', vim.log.levels.WARN) + end + end + end + + -- Handle feature state changes + client.handlers['$/gitlab/featureStateChange'] = function(_, result) + if result and result.state == 'disabled' and result.checks then + for _, check in ipairs(result.checks) do + vim.notify(string.format('GitLab Duo: %s', check.message or check.id), vim.log.levels.WARN) + end + end + end + + -- Check authentication status + local token, status = get_valid_token() + + if token then + client:notify('workspace/didChangeConfiguration', { + settings = { + token = token, + baseUrl = config.gitlab_url, + }, + }) + end + + if not token then + vim.notify('GitLab Duo: Not authenticated. Run :LspGitLabDuoSignIn to sign in.', vim.log.levels.WARN) + elseif status == 'refreshed' then + vim.notify('GitLab Duo: Token refreshed automatically', vim.log.levels.INFO) + end + end, + on_attach = function(client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspGitLabDuoSignIn', function() + sign_in(client) + end, { desc = 'Sign in to GitLab Duo with OAuth' }) + + vim.api.nvim_buf_create_user_command(bufnr, 'LspGitLabDuoSignOut', function() + sign_out(client) + end, { desc = 'Sign out from GitLab Duo' }) + + vim.api.nvim_buf_create_user_command(bufnr, 'LspGitLabDuoStatus', function() + show_status() + end, { desc = 'Show GitLab Duo authentication status' }) + end, +} diff --git a/.config/nvim/lsp/glasgow.lua b/.config/nvim/lsp/glasgow.lua new file mode 100644 index 0000000..5f003b5 --- /dev/null +++ b/.config/nvim/lsp/glasgow.lua @@ -0,0 +1,30 @@ +---@brief +--- +--- https://github.com/nolanderc/glasgow +--- +--- Provides language features for WGSL (WebGPU Shading Language): +--- - Completions: +--- - Local functions/variables/types. +--- - Fields and swizzles. +--- - Builtin types and functions (`dot`, `reflect`, `textureSample`, `vec3`, `mat4x2`, etc.) +--- - Hover Documentation: +--- - Function signatures. +--- - Variable types. +--- - Includes builtin types and functions. Text is taken from the WGSL specification. +--- - Goto Definition +--- - Find all References +--- - Rename +--- - Formatter +--- +--- `glasgow` can be installed via `cargo`: +--- ```sh +--- cargo install glasgow +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'glasgow' }, + filetypes = { 'wgsl' }, + root_markers = { '.git' }, + settings = {}, +} diff --git a/.config/nvim/lsp/gleam.lua b/.config/nvim/lsp/gleam.lua new file mode 100644 index 0000000..6a560e8 --- /dev/null +++ b/.config/nvim/lsp/gleam.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/gleam-lang/gleam +--- +--- A language server for Gleam Programming Language. +--- +--- It comes with the Gleam compiler, for installation see: [Installing Gleam](https://gleam.run/getting-started/installing/) + +---@type vim.lsp.Config +return { + cmd = { 'gleam', 'lsp' }, + filetypes = { 'gleam' }, + root_markers = { 'gleam.toml', '.git' }, +} diff --git a/.config/nvim/lsp/glint.lua b/.config/nvim/lsp/glint.lua new file mode 100644 index 0000000..4485a85 --- /dev/null +++ b/.config/nvim/lsp/glint.lua @@ -0,0 +1,55 @@ +---@brief +--- +--- https://github.com/typed-ember/glint +--- https://typed-ember.gitbook.io/glint/ +--- `glint-language-server` is installed when adding `@glint/core` to your project's devDependencies: +--- +--- ```sh +--- npm install @glint/core --save-dev +--- yarn add -D @glint/core +--- +--- This configuration uses the local installation of `glint-language-server` +--- (found in the `node_modules` directory of your project). +--- +--- To use a global installation of `glint-language-server`, +--- set the `init_options.glint.useGlobal` to `true`. +--- +--- vim.lsp.config('glint', { +--- init_options = { +--- glint = { +--- useGlobal = true, +--- }, +--- }, +--- }) + +---@type vim.lsp.Config +return { + cmd = function(dispatchers, config) + ---@diagnostic disable-next-line: undefined-field + local cmd = (config.init_options.glint.useGlobal or not config.root_dir) and { 'glint-language-server' } + or { config.root_dir .. '/node_modules/.bin/glint-language-server' } + return vim.lsp.rpc.start(cmd, dispatchers) + end, + init_options = { + glint = { + useGlobal = false, + }, + }, + filetypes = { + 'html.handlebars', + 'handlebars', + 'typescript', + 'typescript.glimmer', + 'javascript', + 'javascript.glimmer', + }, + root_markers = { + '.glintrc.yml', + '.glintrc', + '.glintrc.json', + '.glintrc.js', + 'glint.config.js', + 'package.json', + }, + workspace_required = true, +} diff --git a/.config/nvim/lsp/glsl_analyzer.lua b/.config/nvim/lsp/glsl_analyzer.lua new file mode 100644 index 0000000..5cb96d2 --- /dev/null +++ b/.config/nvim/lsp/glsl_analyzer.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://github.com/nolanderc/glsl_analyzer +--- +--- Language server for GLSL + +---@type vim.lsp.Config +return { + cmd = { 'glsl_analyzer' }, + filetypes = { 'glsl', 'vert', 'tesc', 'tese', 'frag', 'geom', 'comp' }, + root_markers = { '.git' }, + capabilities = {}, +} diff --git a/.config/nvim/lsp/glslls.lua b/.config/nvim/lsp/glslls.lua new file mode 100644 index 0000000..d5a0af5 --- /dev/null +++ b/.config/nvim/lsp/glslls.lua @@ -0,0 +1,23 @@ +---@brief +--- +--- https://github.com/svenstaro/glsl-language-server +--- +--- Language server implementation for GLSL +--- +--- `glslls` can be compiled and installed manually, or, if your distribution has access to the AUR, +--- via the `glsl-language-server` AUR package + +---@type vim.lsp.Config +return { + cmd = { 'glslls', '--stdin' }, + filetypes = { 'glsl', 'vert', 'tesc', 'tese', 'frag', 'geom', 'comp' }, + root_markers = { '.git' }, + capabilities = { + textDocument = { + completion = { + editsNearCursor = true, + }, + }, + offsetEncoding = { 'utf-8', 'utf-16' }, + }, +} diff --git a/.config/nvim/lsp/gn_language_server.lua b/.config/nvim/lsp/gn_language_server.lua new file mode 100644 index 0000000..2bf80a0 --- /dev/null +++ b/.config/nvim/lsp/gn_language_server.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://github.com/google/gn-language-server +--- +--- A language server for GN, the build configuration language used in Chromium, +--- Fuchsia, and other projects. + +---@type vim.lsp.Config +return { + cmd = { 'gn-language-server', '--stdio' }, + filetypes = { 'gn' }, + root_markers = { '.gn', '.git' }, +} diff --git a/.config/nvim/lsp/gnls.lua b/.config/nvim/lsp/gnls.lua new file mode 100644 index 0000000..be39e44 --- /dev/null +++ b/.config/nvim/lsp/gnls.lua @@ -0,0 +1,21 @@ +---@brief +--- +--- https://github.com/microsoft/gnls +--- +--- Microsoft's language server for GN build files. +--- +--- Assuming there is a `gnls` script somewhere in your `$PATH`, containing +--- for example: +--- +--- ```shell +--- GNLS_SRC_DIR= +--- +--- exec node ${GNLS_SRC_DIR}/build/server.js $@ +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'gnls', '--stdio' }, + filetypes = { 'gn' }, + root_markers = { '.gn', '.git' }, +} diff --git a/.config/nvim/lsp/golangci_lint_ls.lua b/.config/nvim/lsp/golangci_lint_ls.lua new file mode 100644 index 0000000..8a95035 --- /dev/null +++ b/.config/nvim/lsp/golangci_lint_ls.lua @@ -0,0 +1,52 @@ +---@brief +--- +--- Combination of both lint server and client +--- +--- https://github.com/nametake/golangci-lint-langserver +--- https://github.com/golangci/golangci-lint +--- +--- +--- Installation of binaries needed is done via +--- +--- ``` +--- go install github.com/nametake/golangci-lint-langserver@latest +--- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'golangci-lint-langserver' }, + filetypes = { 'go', 'gomod' }, + init_options = { + command = { 'golangci-lint', 'run', '--output.json.path=stdout', '--show-stats=false' }, + }, + root_markers = { + '.golangci.yml', + '.golangci.yaml', + '.golangci.toml', + '.golangci.json', + 'go.work', + 'go.mod', + '.git', + }, + before_init = function(_, config) + -- Add support for golangci-lint V1 (in V2 `--out-format=json` was replaced by + -- `--output.json.path=stdout`). + local v1, v2 = false, false + -- PERF: `golangci-lint version` is very slow (about 0.1 sec) so let's find + -- version using `go version -m $(which golangci-lint) | grep '^\smod'`. + if vim.fn.executable 'go' == 1 then + local exe = vim.fn.exepath 'golangci-lint' + local version = vim.system({ 'go', 'version', '-m', exe }):wait() + v1 = string.match(version.stdout, '\tmod\tgithub.com/golangci/golangci%-lint\t') + v2 = string.match(version.stdout, '\tmod\tgithub.com/golangci/golangci%-lint/v2\t') + end + if not v1 and not v2 then + local version = vim.system({ 'golangci-lint', 'version' }):wait() + v1 = string.match(version.stdout, 'version v?1%.') + end + if v1 then + config.init_options.command = { 'golangci-lint', 'run', '--out-format', 'json' } + end + end, +} diff --git a/.config/nvim/lsp/gopls.lua b/.config/nvim/lsp/gopls.lua new file mode 100644 index 0000000..558f0a9 --- /dev/null +++ b/.config/nvim/lsp/gopls.lua @@ -0,0 +1,99 @@ +---@brief +--- +--- https://github.com/golang/tools/tree/master/gopls +--- +--- Google's lsp server for golang. + +--- @class go_dir_custom_args +--- +--- @field envvar_id string +--- +--- @field custom_subdir string? + +local mod_cache = nil +local std_lib = nil + +---@param custom_args go_dir_custom_args +---@param on_complete fun(dir: string | nil) +local function identify_go_dir(custom_args, on_complete) + local cmd = { 'go', 'env', custom_args.envvar_id } + vim.system(cmd, { text = true }, function(output) + local res = vim.trim(output.stdout or '') + if output.code == 0 and res ~= '' then + if custom_args.custom_subdir and custom_args.custom_subdir ~= '' then + res = res .. custom_args.custom_subdir + end + on_complete(res) + else + vim.schedule(function() + vim.notify( + ('[gopls] identify ' .. custom_args.envvar_id .. ' dir cmd failed with code %d: %s\n%s'):format( + output.code, + vim.inspect(cmd), + output.stderr + ) + ) + end) + on_complete(nil) + end + end) +end + +---@return string? +local function get_std_lib_dir() + if std_lib and std_lib ~= '' then + return std_lib + end + + identify_go_dir({ envvar_id = 'GOROOT', custom_subdir = '/src' }, function(dir) + if dir then + std_lib = dir + end + end) + return std_lib +end + +---@return string? +local function get_mod_cache_dir() + if mod_cache and mod_cache ~= '' then + return mod_cache + end + + identify_go_dir({ envvar_id = 'GOMODCACHE' }, function(dir) + if dir then + mod_cache = dir + end + end) + return mod_cache +end + +---@param fname string +---@return string? +local function get_root_dir(fname) + if mod_cache and fname:sub(1, #mod_cache) == mod_cache then + local clients = vim.lsp.get_clients({ name = 'gopls' }) + if #clients > 0 then + return clients[#clients].config.root_dir + end + end + if std_lib and fname:sub(1, #std_lib) == std_lib then + local clients = vim.lsp.get_clients({ name = 'gopls' }) + if #clients > 0 then + return clients[#clients].config.root_dir + end + end + return vim.fs.root(fname, 'go.work') or vim.fs.root(fname, 'go.mod') or vim.fs.root(fname, '.git') +end + +---@type vim.lsp.Config +return { + cmd = { 'gopls' }, + filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + get_mod_cache_dir() + get_std_lib_dir() + -- see: https://github.com/neovim/nvim-lspconfig/issues/804 + on_dir(get_root_dir(fname)) + end, +} diff --git a/.config/nvim/lsp/gradle_ls.lua b/.config/nvim/lsp/gradle_ls.lua new file mode 100644 index 0000000..1974d77 --- /dev/null +++ b/.config/nvim/lsp/gradle_ls.lua @@ -0,0 +1,28 @@ +---@brief +--- +--- https://github.com/microsoft/vscode-gradle +--- +--- Microsoft's lsp server for gradle files +--- +--- If you're setting this up manually, build vscode-gradle using `./gradlew installDist` and point `cmd` to the `gradle-language-server` generated in the build directory + +local bin_name = 'gradle-language-server' +if vim.fn.has 'win32' == 1 then + bin_name = bin_name .. '.bat' +end + +---@type vim.lsp.Config +return { + filetypes = { 'groovy' }, + root_markers = { + 'settings.gradle', -- Gradle (multi-project) + 'build.gradle', -- Gradle + }, + cmd = { bin_name }, + -- gradle-language-server expects init_options.settings to be defined + init_options = { + settings = { + gradleWrapperEnabled = true, + }, + }, +} diff --git a/.config/nvim/lsp/grammarly.lua b/.config/nvim/lsp/grammarly.lua new file mode 100644 index 0000000..a8ebcd0 --- /dev/null +++ b/.config/nvim/lsp/grammarly.lua @@ -0,0 +1,26 @@ +---@brief +--- +--- https://github.com/znck/grammarly +--- +--- `grammarly-languageserver` can be installed via `npm`: +--- +--- ```sh +--- npm i -g grammarly-languageserver +--- ``` +--- +--- WARNING: Since this language server uses Grammarly's API, any document you open with it running is shared with them. Please evaluate their [privacy policy](https://www.grammarly.com/privacy-policy) before using this. + +---@type vim.lsp.Config +return { + cmd = { 'grammarly-languageserver', '--stdio' }, + filetypes = { 'markdown' }, + root_markers = { '.git' }, + handlers = { + ['$/updateDocumentState'] = function() + return '' + end, + }, + init_options = { + clientId = 'client_BaDkMgx4X19X9UxxYRCXZo', + }, +} diff --git a/.config/nvim/lsp/graphql.lua b/.config/nvim/lsp/graphql.lua new file mode 100644 index 0000000..27a8603 --- /dev/null +++ b/.config/nvim/lsp/graphql.lua @@ -0,0 +1,23 @@ +---@brief +--- +--- https://github.com/graphql/graphiql/tree/main/packages/graphql-language-service-cli +--- +--- `graphql-lsp` can be installed via `npm`: +--- +--- ```sh +--- npm install -g graphql-language-service-cli +--- ``` +--- +--- Note that you must also have [the graphql package](https://github.com/graphql/graphql-js) installed within your project and create a [GraphQL config file](https://the-guild.dev/graphql/config/docs). + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'graphql-lsp', 'server', '-m', 'stream' }, + filetypes = { 'graphql', 'typescriptreact', 'javascriptreact' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern('.graphqlrc*', '.graphql.config.*', 'graphql.config.*')(fname)) + end, +} diff --git a/.config/nvim/lsp/groovyls.lua b/.config/nvim/lsp/groovyls.lua new file mode 100644 index 0000000..e1cb8f6 --- /dev/null +++ b/.config/nvim/lsp/groovyls.lua @@ -0,0 +1,30 @@ +---@brief +--- +--- https://github.com/prominic/groovy-language-server.git +--- +--- Requirements: +--- - Linux/macOS (for now) +--- - Java 11+ +--- +--- `groovyls` can be installed by following the instructions [here](https://github.com/prominic/groovy-language-server.git#build). +--- +--- If you have installed groovy language server, you can set the `cmd` custom path as follow: +--- +--- ```lua +--- vim.lsp.config('groovyls', { +--- -- Unix +--- cmd = { "java", "-jar", "path/to/groovyls/groovy-language-server-all.jar" }, +--- ... +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { + 'java', + '-jar', + 'groovy-language-server-all.jar', + }, + filetypes = { 'groovy' }, + root_markers = { 'Jenkinsfile', '.git' }, +} diff --git a/.config/nvim/lsp/guile_ls.lua b/.config/nvim/lsp/guile_ls.lua new file mode 100644 index 0000000..58bb6c7 --- /dev/null +++ b/.config/nvim/lsp/guile_ls.lua @@ -0,0 +1,21 @@ +---@brief +--- +--- https://codeberg.org/rgherdt/scheme-lsp-server +--- +--- The recommended way is to install guile-lsp-server is using Guix. Unfortunately it is still not available at the official Guix channels, but you can use the provided channel guix.scm in the repo: +--- ```sh +--- guix package -f guix.scm +--- ``` +--- +--- Checkout the repo for more info. +--- +--- Note: This LSP will start on `scheme.guile` filetype. You can set this file type using `:help modeline` or adding https://gitlab.com/HiPhish/guile.vim to your plugins to automatically set it. + +---@type vim.lsp.Config +return { + cmd = { 'guile-lsp-server' }, + filetypes = { + 'scheme.guile', + }, + root_markers = { 'guix.scm', '.git' }, +} diff --git a/.config/nvim/lsp/harper_ls.lua b/.config/nvim/lsp/harper_ls.lua new file mode 100644 index 0000000..42bdf94 --- /dev/null +++ b/.config/nvim/lsp/harper_ls.lua @@ -0,0 +1,52 @@ +---@brief +--- +--- https://github.com/automattic/harper +--- +--- The language server for Harper, the slim, clean language checker for developers. +--- +--- See our [documentation](https://writewithharper.com/docs/integrations/neovim) for more information on settings. +--- +--- In short, they should look something like this: +--- ```lua +--- vim.lsp.config('harper_ls', { +--- settings = { +--- ["harper-ls"] = { +--- userDictPath = "~/dict.txt" +--- } +--- }, +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'harper-ls', '--stdio' }, + filetypes = { + 'asciidoc', + 'c', + 'cpp', + 'cs', + 'gitcommit', + 'go', + 'html', + 'java', + 'javascript', + 'lua', + 'markdown', + 'nix', + 'python', + 'ruby', + 'rust', + 'swift', + 'toml', + 'typescript', + 'typescriptreact', + 'haskell', + 'cmake', + 'typst', + 'php', + 'dart', + 'clojure', + 'sh', + }, + root_markers = { '.harper-dictionary.txt', '.git' }, +} diff --git a/.config/nvim/lsp/hdl_checker.lua b/.config/nvim/lsp/hdl_checker.lua new file mode 100644 index 0000000..bd0912c --- /dev/null +++ b/.config/nvim/lsp/hdl_checker.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/suoto/hdl_checker +--- Language server for hdl-checker. +--- Install using: `pip install hdl-checker --upgrade` + +---@type vim.lsp.Config +return { + cmd = { 'hdl_checker', '--lsp' }, + filetypes = { 'vhdl', 'verilog', 'systemverilog' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/helm_ls.lua b/.config/nvim/lsp/helm_ls.lua new file mode 100644 index 0000000..a2deb89 --- /dev/null +++ b/.config/nvim/lsp/helm_ls.lua @@ -0,0 +1,25 @@ +---@brief +--- +--- https://github.com/mrjosh/helm-ls +--- +--- Helm Language server. (This LSP is in early development) +--- +--- `helm Language server` can be installed by following the instructions [here](https://github.com/mrjosh/helm-ls). +--- +--- The default `cmd` assumes that the `helm_ls` binary can be found in `$PATH`. +--- +--- If need Helm file highlight use [vim-helm](https://github.com/towolf/vim-helm) plugin. + +---@type vim.lsp.Config +return { + cmd = { 'helm_ls', 'serve' }, + filetypes = { 'helm', 'yaml.helm-values' }, + root_markers = { 'Chart.yaml' }, + capabilities = { + workspace = { + didChangeWatchedFiles = { + dynamicRegistration = true, + }, + }, + }, +} diff --git a/.config/nvim/lsp/herb_ls.lua b/.config/nvim/lsp/herb_ls.lua new file mode 100644 index 0000000..637eb56 --- /dev/null +++ b/.config/nvim/lsp/herb_ls.lua @@ -0,0 +1,29 @@ +---@brief +--- +--- https://www.npmjs.com/package/@herb-tools/language-server +--- https://github.com/marcoroth/herb +--- +--- HTML+ERB (HTML + Embedded Ruby) +--- Powerful and seamless HTML-aware ERB parsing and tooling. +--- +--- Herb is designed from the ground up to deeply understand `.html.erb` files, +--- preserving both HTML and embedded Ruby structure without losing any details. +--- +--- `herb-language-server` can be installed via `npm`: +--- +--- ```sh +--- npm install -g @herb-tools/language-server +--- ``` +--- +--- or via `yarn`: +--- +--- ```sh +--- yarn global add @herb-tools/language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'herb-language-server', '--stdio' }, + filetypes = { 'html', 'eruby' }, + root_markers = { 'Gemfile', '.git' }, +} diff --git a/.config/nvim/lsp/hhvm.lua b/.config/nvim/lsp/hhvm.lua new file mode 100644 index 0000000..2016614 --- /dev/null +++ b/.config/nvim/lsp/hhvm.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- Language server for programs written in Hack +--- https://hhvm.com/ +--- https://github.com/facebook/hhvm +--- See below for how to setup HHVM & typechecker: +--- https://docs.hhvm.com/hhvm/getting-started/getting-started + +---@type vim.lsp.Config +return { + cmd = { 'hh_client', 'lsp' }, + filetypes = { 'php', 'hack' }, + root_markers = { '.hhconfig' }, +} diff --git a/.config/nvim/lsp/hie.lua b/.config/nvim/lsp/hie.lua new file mode 100644 index 0000000..8d6acac --- /dev/null +++ b/.config/nvim/lsp/hie.lua @@ -0,0 +1,25 @@ +---@brief +--- +--- https://github.com/haskell/haskell-ide-engine +--- +--- the following init_options are supported (see https://github.com/haskell/haskell-ide-engine#configuration): +--- ```lua +--- init_options = { +--- languageServerHaskell = { +--- hlintOn = bool; +--- maxNumberOfProblems = number; +--- diagnosticsDebounceDuration = number; +--- liquidOn = bool (default false); +--- completionSnippetsOn = bool (default true); +--- formatOnImportOn = bool (default true); +--- formattingProvider = string (default "brittany", alternate "floskell"); +--- } +--- } +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'hie-wrapper', '--lsp' }, + filetypes = { 'haskell' }, + root_markers = { 'stack.yaml', 'package.yaml', '.git' }, +} diff --git a/.config/nvim/lsp/hlasm.lua b/.config/nvim/lsp/hlasm.lua new file mode 100644 index 0000000..9ca794d --- /dev/null +++ b/.config/nvim/lsp/hlasm.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- `hlasm_language_server` is a language server for the High Level Assembler language used on IBM SystemZ mainframes. +--- +--- To learn how to configure the HLASM language server, see the [HLASM Language Support documentation](https://github.com/eclipse-che4z/che-che4z-lsp-for-hlasm). + +---@type vim.lsp.Config +return { + cmd = { 'hlasm_language_server' }, + filetypes = { 'hlasm' }, + root_markers = { '.hlasmplugin' }, +} diff --git a/.config/nvim/lsp/hls.lua b/.config/nvim/lsp/hls.lua new file mode 100644 index 0000000..5b2ec86 --- /dev/null +++ b/.config/nvim/lsp/hls.lua @@ -0,0 +1,31 @@ +---@brief +--- +--- https://github.com/haskell/haskell-language-server +--- +--- Haskell Language Server +--- +--- If you are using HLS 1.9.0.0, enable the language server to launch on Cabal files as well: +--- +--- ```lua +--- vim.lsp.config('hls', { +--- filetypes = { 'haskell', 'lhaskell', 'cabal' }, +--- }) +--- ``` + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'haskell-language-server-wrapper', '--lsp' }, + filetypes = { 'haskell', 'lhaskell' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project', '*.cabal', 'package.yaml')(fname)) + end, + settings = { + haskell = { + formattingProvider = 'ormolu', + cabalFormattingProvider = 'cabal-fmt', + }, + }, +} diff --git a/.config/nvim/lsp/home_assistant.lua b/.config/nvim/lsp/home_assistant.lua new file mode 100644 index 0000000..80a9354 --- /dev/null +++ b/.config/nvim/lsp/home_assistant.lua @@ -0,0 +1,18 @@ +---@brief +--- +--- https://github.com/keesschollaart81/vscode-home-assistant +--- +--- `vscode-home-assistant` can be installed via from source or by downloading +--- and extracting the VSCode "Home Assistant Config Helper" extension +--- +--- `vscode-home-assistant` is a language server for Home Assistant ported from the VSCode "Home Assistant Config Helper" extension. + +---@type vim.lsp.Config +return { + cmd = { 'vscode-home-assistant', '--stdio' }, + filetypes = { 'yaml' }, + root_markers = { + 'configuration.yaml', + 'configuration.yml', + }, +} diff --git a/.config/nvim/lsp/hoon_ls.lua b/.config/nvim/lsp/hoon_ls.lua new file mode 100644 index 0000000..165c803 --- /dev/null +++ b/.config/nvim/lsp/hoon_ls.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/urbit/hoon-language-server +--- +--- A language server for Hoon. +--- +--- The language server can be installed via `npm install -g @hoon-language-server` +--- +--- Start a fake ~zod with `urbit -F zod`. +--- Start the language server at the Urbit Dojo prompt with: `|start %language-server` + +---@type vim.lsp.Config +return { + cmd = { 'hoon-language-server' }, + filetypes = { 'hoon' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/html.lua b/.config/nvim/lsp/html.lua new file mode 100644 index 0000000..2b53d32 --- /dev/null +++ b/.config/nvim/lsp/html.lua @@ -0,0 +1,36 @@ +---@brief +--- +--- https://github.com/hrsh7th/vscode-langservers-extracted +--- +--- `vscode-html-language-server` can be installed via `npm`: +--- ```sh +--- npm i -g vscode-langservers-extracted +--- ``` +--- +--- Neovim does not currently include built-in snippets. `vscode-html-language-server` only provides completions when snippet support is enabled. +--- To enable completion, install a snippet plugin and add the following override to your language client capabilities during setup. +--- +--- The code-formatting feature of the lsp can be controlled with the `provideFormatter` option. +--- +--- ```lua +--- --Enable (broadcasting) snippet capability for completion +--- local capabilities = vim.lsp.protocol.make_client_capabilities() +--- capabilities.textDocument.completion.completionItem.snippetSupport = true +--- +--- vim.lsp.config('html', { +--- capabilities = capabilities, +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'vscode-html-language-server', '--stdio' }, + filetypes = { 'html', 'templ' }, + root_markers = { 'package.json', '.git' }, + settings = {}, + init_options = { + provideFormatter = true, + embeddedLanguages = { css = true, javascript = true }, + configurationSection = { 'html', 'css', 'javascript' }, + }, +} diff --git a/.config/nvim/lsp/htmx.lua b/.config/nvim/lsp/htmx.lua new file mode 100644 index 0000000..87b0429 --- /dev/null +++ b/.config/nvim/lsp/htmx.lua @@ -0,0 +1,64 @@ +---@brief +--- +--- https://github.com/ThePrimeagen/htmx-lsp +--- +--- `htmx-lsp` can be installed via `cargo`: +--- ```sh +--- cargo install htmx-lsp +--- ``` +--- +--- Lsp is still very much work in progress and experimental. Use at your own risk. + +---@type vim.lsp.Config +return { + cmd = { 'htmx-lsp' }, + filetypes = { -- filetypes copied and adjusted from tailwindcss-intellisense + -- html + 'aspnetcorerazor', + 'astro', + 'astro-markdown', + 'blade', + 'clojure', + 'django-html', + 'htmldjango', + 'edge', + 'eelixir', -- vim ft + 'elixir', + 'ejs', + 'erb', + 'eruby', -- vim ft + 'gohtml', + 'gohtmltmpl', + 'haml', + 'handlebars', + 'hbs', + 'html', + 'htmlangular', + 'html-eex', + 'heex', + 'jade', + 'leaf', + 'liquid', + 'markdown', + 'mdx', + 'mustache', + 'njk', + 'nunjucks', + 'php', + 'razor', + 'slim', + 'twig', + -- js + 'javascript', + 'javascriptreact', + 'reason', + 'rescript', + 'typescript', + 'typescriptreact', + -- mixed + 'vue', + 'svelte', + 'templ', + }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/hydra_lsp.lua b/.config/nvim/lsp/hydra_lsp.lua new file mode 100644 index 0000000..b443433 --- /dev/null +++ b/.config/nvim/lsp/hydra_lsp.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/Retsediv/hydra-lsp +--- +--- LSP for Hydra Python package config files. + +---@type vim.lsp.Config +return { + cmd = { 'hydra-lsp' }, + filetypes = { 'yaml' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/hylo_ls.lua b/.config/nvim/lsp/hylo_ls.lua new file mode 100644 index 0000000..682cddb --- /dev/null +++ b/.config/nvim/lsp/hylo_ls.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://github.com/hylo-lang/hylo-language-server +--- +--- A language server for the Hylo programming language. + +---@type vim.lsp.Config +return { + cmd = { 'hylo-language-server', '--stdio' }, + filetypes = { 'hylo' }, + root_markers = { '.git' }, + settings = {}, +} diff --git a/.config/nvim/lsp/hyprls.lua b/.config/nvim/lsp/hyprls.lua new file mode 100644 index 0000000..64d7cda --- /dev/null +++ b/.config/nvim/lsp/hyprls.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/hyprland-community/hyprls +--- +--- `hyprls` can be installed via `go`: +--- ```sh +--- go install github.com/hyprland-community/hyprls/cmd/hyprls@latest +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'hyprls', '--stdio' }, + filetypes = { 'hyprlang' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/idris2_lsp.lua b/.config/nvim/lsp/idris2_lsp.lua new file mode 100644 index 0000000..d7f153e --- /dev/null +++ b/.config/nvim/lsp/idris2_lsp.lua @@ -0,0 +1,42 @@ +---@brief +--- +--- https://github.com/idris-community/idris2-lsp +--- +--- The Idris 2 language server. +--- +--- Plugins for the Idris 2 filetype include +--- [Idris2-Vim](https://github.com/edwinb/idris2-vim) (fewer features, stable) and +--- [Nvim-Idris2](https://github.com/ShinKage/nvim-idris2) (cutting-edge, +--- experimental). +--- +--- Idris2-Lsp requires a build of Idris 2 that includes the "Idris 2 API" package. +--- Package managers with known support for this build include the +--- [AUR](https://aur.archlinux.org/packages/idris2/) and +--- [Homebrew](https://formulae.brew.sh/formula/idris2#default). +--- +--- If your package manager does not support the Idris 2 API, you will need to build +--- Idris 2 from source. Refer to the +--- [the Idris 2 installation instructions](https://github.com/idris-lang/Idris2/blob/main/INSTALL.md) +--- for details. Steps 5 and 8 are listed as "optional" in that guide, but they are +--- necessary in order to make the Idris 2 API available. +--- +--- You need to install a version of Idris2-Lsp that is compatible with your +--- version of Idris 2. There should be a branch corresponding to every released +--- Idris 2 version after v0.4.0. Use the latest commit on that branch. For example, +--- if you have Idris v0.5.1, you should use the v0.5.1 branch of Idris2-Lsp. +--- +--- If your Idris 2 version is newer than the newest Idris2-Lsp branch, use the +--- latest commit on the `master` branch, and set a reminder to check the Idris2-Lsp +--- repo for the release of a compatible versioned branch. + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'idris2-lsp' }, + filetypes = { 'idris2' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern '*.ipkg'(fname)) + end, +} diff --git a/.config/nvim/lsp/intelephense.lua b/.config/nvim/lsp/intelephense.lua new file mode 100644 index 0000000..8a91c40 --- /dev/null +++ b/.config/nvim/lsp/intelephense.lua @@ -0,0 +1,33 @@ +---@brief +--- +--- https://intelephense.com/ +--- +--- `intelephense` can be installed via `npm`: +--- ```sh +--- npm install -g intelephense +--- ``` +--- +--- ```lua +--- -- See https://github.com/bmewburn/intelephense-docs/blob/master/installation.md#initialisation-options +--- init_options = { +--- storagePath = …, -- Optional absolute path to storage dir. Defaults to os.tmpdir(). +--- globalStoragePath = …, -- Optional absolute path to a global storage dir. Defaults to os.homedir(). +--- licenceKey = …, -- Optional licence key or absolute path to a text file containing the licence key. +--- clearCache = …, -- Optional flag to clear server state. State can also be cleared by deleting {storagePath}/intelephense +--- } +--- -- See https://github.com/bmewburn/intelephense-docs +--- settings = { +--- intelephense = { +--- files = { +--- maxSize = 1000000; +--- }; +--- }; +--- } +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'intelephense', '--stdio' }, + filetypes = { 'php' }, + root_markers = { '.git', 'composer.json' }, +} diff --git a/.config/nvim/lsp/janet_lsp.lua b/.config/nvim/lsp/janet_lsp.lua new file mode 100644 index 0000000..7d444e4 --- /dev/null +++ b/.config/nvim/lsp/janet_lsp.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/CFiggers/janet-lsp +--- +--- A Language Server Protocol implementation for Janet. + +---@type vim.lsp.Config +return { + cmd = { + 'janet-lsp', + '--stdio', + }, + filetypes = { 'janet' }, + root_markers = { 'project.janet', '.git' }, +} diff --git a/.config/nvim/lsp/java_language_server.lua b/.config/nvim/lsp/java_language_server.lua new file mode 100644 index 0000000..06f08d0 --- /dev/null +++ b/.config/nvim/lsp/java_language_server.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/georgewfraser/java-language-server +--- +--- Java language server +--- +--- Point `cmd` to `lang_server_linux.sh` or the equivalent script for macOS/Windows provided by java-language-server + +---@type vim.lsp.Config +return { + cmd = { 'java-language-server' }, + filetypes = { 'java' }, + root_markers = { 'build.gradle', 'build.gradle.kts', 'pom.xml', '.git' }, + settings = {}, +} diff --git a/.config/nvim/lsp/jdtls.lua b/.config/nvim/lsp/jdtls.lua new file mode 100644 index 0000000..ed20613 --- /dev/null +++ b/.config/nvim/lsp/jdtls.lua @@ -0,0 +1,102 @@ +---@brief +--- +--- https://projects.eclipse.org/projects/eclipse.jdt.ls +--- +--- Language server for Java. +--- +--- IMPORTANT: If you want all the features jdtls has to offer, [nvim-jdtls](https://github.com/mfussenegger/nvim-jdtls) +--- is highly recommended. If all you need is diagnostics, completion, imports, gotos and formatting and some code actions +--- you can keep reading here. +--- +--- For manual installation you can download precompiled binaries from the +--- [official downloads site](http://download.eclipse.org/jdtls/snapshots/?d) +--- and ensure that the `PATH` variable contains the `bin` directory of the extracted archive. +--- +--- ```lua +--- -- init.lua +--- vim.lsp.enable('jdtls') +--- ``` +--- +--- You can also pass extra custom jvm arguments with the JDTLS_JVM_ARGS environment variable as a space separated list of arguments, +--- that will be converted to multiple --jvm-arg= args when passed to the jdtls script. This will allow for example tweaking +--- the jvm arguments or integration with external tools like lombok: +--- +--- ```sh +--- export JDTLS_JVM_ARGS="-javaagent:$HOME/.local/share/java/lombok.jar" +--- ``` +--- +--- For automatic installation you can use the following unofficial installers/launchers under your own risk: +--- - [jdtls-launcher](https://github.com/eruizc-dev/jdtls-launcher) (Includes lombok support by default) +--- ```lua +--- -- init.lua +--- vim.lsp.config('jdtls', { cmd = { 'jdtls' } }) +--- ``` + +local function get_jdtls_cache_dir() + return vim.fn.stdpath('cache') .. '/jdtls' +end + +local function get_jdtls_workspace_dir() + return get_jdtls_cache_dir() .. '/workspace' +end + +local function get_jdtls_jvm_args() + local env = os.getenv('JDTLS_JVM_ARGS') + local args = {} + for a in string.gmatch((env or ''), '%S+') do + local arg = string.format('--jvm-arg=%s', a) + table.insert(args, arg) + end + return unpack(args) +end + +local root_markers1 = { + -- Multi-module projects + 'mvnw', -- Maven + 'gradlew', -- Gradle + 'settings.gradle', -- Gradle + 'settings.gradle.kts', -- Gradle + -- Use git directory as last resort for multi-module maven projects + -- In multi-module maven projects it is not really possible to determine what is the parent directory + -- and what is submodule directory. And jdtls does not break if the parent directory is at higher level than + -- actual parent pom.xml so propagating all the way to root git directory is fine + '.git', +} +local root_markers2 = { + -- Single-module projects + 'build.xml', -- Ant + 'pom.xml', -- Maven + 'build.gradle', -- Gradle + 'build.gradle.kts', -- Gradle +} + +---@type vim.lsp.Config +return { + ---@param dispatchers? vim.lsp.rpc.Dispatchers + ---@param config vim.lsp.ClientConfig + cmd = function(dispatchers, config) + local workspace_dir = get_jdtls_workspace_dir() + local data_dir = workspace_dir + + if config.root_dir then + data_dir = data_dir .. '/' .. vim.fn.fnamemodify(config.root_dir, ':p:h:t') + end + + local config_cmd = { + 'jdtls', + '-data', + data_dir, + get_jdtls_jvm_args(), + } + + return vim.lsp.rpc.start(config_cmd, dispatchers, { + cwd = config.cmd_cwd, + env = config.cmd_env, + detached = config.detached, + }) + end, + filetypes = { 'java' }, + root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers1, root_markers2 } + or vim.list_extend(root_markers1, root_markers2), + init_options = {}, +} diff --git a/.config/nvim/lsp/jedi_language_server.lua b/.config/nvim/lsp/jedi_language_server.lua new file mode 100644 index 0000000..99427a4 --- /dev/null +++ b/.config/nvim/lsp/jedi_language_server.lua @@ -0,0 +1,19 @@ +---@brief +--- +--- https://github.com/pappasam/jedi-language-server +--- +--- `jedi-language-server`, a language server for Python, built on top of jedi + +---@type vim.lsp.Config +return { + cmd = { 'jedi-language-server' }, + filetypes = { 'python' }, + root_markers = { + 'pyproject.toml', + 'setup.py', + 'setup.cfg', + 'requirements.txt', + 'Pipfile', + '.git', + }, +} diff --git a/.config/nvim/lsp/jinja_lsp.lua b/.config/nvim/lsp/jinja_lsp.lua new file mode 100644 index 0000000..c3a034f --- /dev/null +++ b/.config/nvim/lsp/jinja_lsp.lua @@ -0,0 +1,23 @@ +---@brief +--- +--- jinja-lsp enhances minijinja development experience by providing Helix/Nvim users with advanced features such as autocomplete, syntax highlighting, hover, goto definition, code actions and linting. +--- +--- The file types are not detected automatically, you can register them manually (see below) or override the filetypes: +--- +--- ```lua +--- vim.filetype.add { +--- extension = { +--- jinja = 'jinja', +--- jinja2 = 'jinja', +--- j2 = 'jinja', +--- }, +--- } +--- ``` + +---@type vim.lsp.Config +return { + name = 'jinja_lsp', + cmd = { 'jinja-lsp' }, + filetypes = { 'jinja' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/jqls.lua b/.config/nvim/lsp/jqls.lua new file mode 100644 index 0000000..2fcdeb3 --- /dev/null +++ b/.config/nvim/lsp/jqls.lua @@ -0,0 +1,24 @@ +---@brief +--- +--- https://github.com/wader/jq-lsp +--- Language server for jq, written using Go. +--- You can install the server easily using go install: +--- ```sh +--- # install directly +--- go install github.com/wader/jq-lsp@master +--- # copy binary to $PATH +--- cp $(go env GOPATH)/bin/jq-lsp /usr/local/bin +--- +--- ``` +--- Note: To activate properly nvim needs to know the jq filetype. +--- You can add it via: +--- ```lua +--- vim.cmd([[au BufRead,BufNewFile *.jq setfiletype jq]]) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'jq-lsp' }, + filetypes = { 'jq' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/jsonls.lua b/.config/nvim/lsp/jsonls.lua new file mode 100644 index 0000000..93ae1db --- /dev/null +++ b/.config/nvim/lsp/jsonls.lua @@ -0,0 +1,32 @@ +---@brief +--- +--- https://github.com/hrsh7th/vscode-langservers-extracted +--- +--- vscode-json-language-server, a language server for JSON and JSON schema +--- +--- `vscode-json-language-server` can be installed via `npm`: +--- ```sh +--- npm i -g vscode-langservers-extracted +--- ``` +--- +--- `vscode-json-language-server` only provides completions when snippet support is enabled. If you use Neovim older than v0.10 you need to enable completion, install a snippet plugin and add the following override to your language client capabilities during setup. +--- +--- ```lua +--- --Enable (broadcasting) snippet capability for completion +--- local capabilities = vim.lsp.protocol.make_client_capabilities() +--- capabilities.textDocument.completion.completionItem.snippetSupport = true +--- +--- vim.lsp.config('jsonls', { +--- capabilities = capabilities, +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'vscode-json-language-server', '--stdio' }, + filetypes = { 'json', 'jsonc' }, + init_options = { + provideFormatter = true, + }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/jsonnet_ls.lua b/.config/nvim/lsp/jsonnet_ls.lua new file mode 100644 index 0000000..c5b0dee --- /dev/null +++ b/.config/nvim/lsp/jsonnet_ls.lua @@ -0,0 +1,20 @@ +--- @brief +--- +--- https://github.com/grafana/jsonnet-language-server +--- +--- A Language Server Protocol (LSP) server for Jsonnet. +--- +--- The language server can be installed with `go`: +--- ```sh +--- go install github.com/grafana/jsonnet-language-server@latest +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'jsonnet-language-server' }, + filetypes = { + 'jsonnet', + 'libsonnet', + }, + root_markers = { 'jsonnetfile.json', '.git' }, +} diff --git a/.config/nvim/lsp/julials.lua b/.config/nvim/lsp/julials.lua new file mode 100644 index 0000000..a181bfb --- /dev/null +++ b/.config/nvim/lsp/julials.lua @@ -0,0 +1,132 @@ +---@brief +--- +--- https://github.com/julia-vscode/julia-vscode +--- +--- LanguageServer.jl, SymbolServer.jl and StaticLint.jl can be installed with `julia` and `Pkg`: +--- ```sh +--- julia --project=~/.julia/environments/nvim-lspconfig -e 'using Pkg; Pkg.add("LanguageServer"); Pkg.add("SymbolServer"); Pkg.add("StaticLint")' +--- ``` +--- where `~/.julia/environments/nvim-lspconfig` is the location where +--- the default configuration expects LanguageServer.jl, SymbolServer.jl and StaticLint.jl to be installed. +--- +--- To update an existing install, use the following command: +--- ```sh +--- julia --project=~/.julia/environments/nvim-lspconfig -e 'using Pkg; Pkg.update()' +--- ``` +--- +--- Note: In order to have LanguageServer.jl pick up installed packages or dependencies in a +--- Julia project, you must make sure that the project is instantiated: +--- ```sh +--- julia --project=/path/to/my/project -e 'using Pkg; Pkg.instantiate()' +--- ``` +--- +--- Note: The julia programming language searches for global environments within the `environments/` +--- folder of `$JULIA_DEPOT_PATH` entries. By default this simply `~/.julia/environments` + +local root_files = { 'Project.toml', 'JuliaProject.toml' } + +local function activate_env(path) + assert(vim.fn.has 'nvim-0.10' == 1, 'requires Nvim 0.10 or newer') + local bufnr = vim.api.nvim_get_current_buf() + local julials_clients = vim.lsp.get_clients { bufnr = bufnr, name = 'julials' } + assert( + #julials_clients > 0, + 'method julia/activateenvironment is not supported by any servers active on the current buffer' + ) + local function _activate_env(environment) + if environment then + for _, julials_client in ipairs(julials_clients) do + ---@diagnostic disable-next-line: param-type-mismatch + julials_client:notify('julia/activateenvironment', { envPath = environment }) + end + vim.notify('Julia environment activated: \n`' .. environment .. '`', vim.log.levels.INFO) + end + end + if path then + path = vim.fs.normalize(vim.fn.fnamemodify(vim.fn.expand(path), ':p')) + local found_env = false + for _, project_file in ipairs(root_files) do + local file = vim.uv.fs_stat(vim.fs.joinpath(path, project_file)) + if file and file.type then + found_env = true + break + end + end + if not found_env then + vim.notify('Path is not a julia environment: \n`' .. path .. '`', vim.log.levels.WARN) + return + end + _activate_env(path) + else + local depot_paths = vim.env.JULIA_DEPOT_PATH + and vim.split(vim.env.JULIA_DEPOT_PATH, vim.fn.has 'win32' == 1 and ';' or ':') + or { vim.fn.expand '~/.julia' } + local environments = {} + vim.list_extend(environments, vim.fs.find(root_files, { type = 'file', upward = true, limit = math.huge })) + for _, depot_path in ipairs(depot_paths) do + local depot_env = vim.fs.joinpath(vim.fs.normalize(depot_path), 'environments') + vim.list_extend( + environments, + vim.fs.find(function(name, env_path) + return vim.tbl_contains(root_files, name) and string.sub(env_path, #depot_env + 1):match '^/[^/]*$' + end, { path = depot_env, type = 'file', limit = math.huge }) + ) + end + environments = vim.tbl_map(vim.fs.dirname, environments) + vim.ui.select(environments, { prompt = 'Select a Julia environment' }, _activate_env) + end +end + +local cmd = { + 'julia', + '--startup-file=no', + '--history-file=no', + '-e', + [[ + # Load LanguageServer.jl: attempt to load from ~/.julia/environments/nvim-lspconfig + # with the regular load path as a fallback + ls_install_path = joinpath( + get(DEPOT_PATH, 1, joinpath(homedir(), ".julia")), + "environments", "nvim-lspconfig" + ) + pushfirst!(LOAD_PATH, ls_install_path) + using LanguageServer, SymbolServer, StaticLint + popfirst!(LOAD_PATH) + depot_path = get(ENV, "JULIA_DEPOT_PATH", "") + project_path = let + dirname(something( + ## 1. Finds an explicitly set project (JULIA_PROJECT) + Base.load_path_expand(( + p = get(ENV, "JULIA_PROJECT", nothing); + p === nothing ? nothing : isempty(p) ? nothing : p + )), + ## 2. Look for a Project.toml file in the current working directory, + ## or parent directories, with $HOME as an upper boundary + Base.current_project(), + ## 3. First entry in the load path + get(Base.load_path(), 1, nothing), + ## 4. Fallback to default global environment, + ## this is more or less unreachable + Base.load_path_expand("@v#.#"), + )) + end + @info "Running language server" VERSION pwd() project_path depot_path + server = LanguageServer.LanguageServerInstance(stdin, stdout, project_path, depot_path) + server.runlinter = true + run(server) + ]], +} + +---@type vim.lsp.Config +return { + cmd = cmd, + filetypes = { 'julia' }, + root_markers = root_files, + on_attach = function(_, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspJuliaActivateEnv', activate_env, { + desc = 'Activate a Julia environment', + nargs = '?', + complete = 'file', + }) + end, +} diff --git a/.config/nvim/lsp/just.lua b/.config/nvim/lsp/just.lua new file mode 100644 index 0000000..a5db058 --- /dev/null +++ b/.config/nvim/lsp/just.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/terror/just-lsp +--- +--- `just-lsp` is an LSP for just built on top of the tree-sitter-just parser. + +---@type vim.lsp.Config +return { + cmd = { 'just-lsp' }, + filetypes = { 'just' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/kcl.lua b/.config/nvim/lsp/kcl.lua new file mode 100644 index 0000000..08041fc --- /dev/null +++ b/.config/nvim/lsp/kcl.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://github.com/kcl-lang/kcl.nvim +--- +--- Language server for the KCL configuration and policy language. +--- + +---@type vim.lsp.Config +return { + cmd = { 'kcl-language-server' }, + filetypes = { 'kcl' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/koka.lua b/.config/nvim/lsp/koka.lua new file mode 100644 index 0000000..c5a3df3 --- /dev/null +++ b/.config/nvim/lsp/koka.lua @@ -0,0 +1,11 @@ +---@brief +--- +--- https://koka-lang.github.io/koka/doc/index.html +--- Koka is a functional programming language with effect types and handlers. + +---@type vim.lsp.Config +return { + cmd = { 'koka', '--language-server', '--lsstdio' }, + filetypes = { 'koka' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/kotlin_language_server.lua b/.config/nvim/lsp/kotlin_language_server.lua new file mode 100644 index 0000000..ee18f32 --- /dev/null +++ b/.config/nvim/lsp/kotlin_language_server.lua @@ -0,0 +1,42 @@ +---@brief +--- +--- A kotlin language server which was developed for internal usage and +--- released afterwards. Maintaining is not done by the original author, +--- but by fwcd. +--- +--- It is built via gradle and developed on github. +--- Source and additional description: +--- https://github.com/fwcd/kotlin-language-server +--- +--- This server requires vim to be aware of the kotlin-filetype. +--- You could refer for this capability to: +--- https://github.com/udalov/kotlin-vim (recommended) +--- Note that there is no LICENSE specified yet. +--- +--- For faster startup, you can setup caching by specifying a storagePath +--- in the init_options. The default is your home directory. + +--- The presence of one of these files indicates a project root directory +-- +-- These are configuration files for the various build systems supported by +-- Kotlin. I am not sure whether the language server supports Ant projects, +-- but I'm keeping it here as well since Ant does support Kotlin. +local root_files = { + 'settings.gradle', -- Gradle (multi-project) + 'settings.gradle.kts', -- Gradle (multi-project) + 'build.xml', -- Ant + 'pom.xml', -- Maven + 'build.gradle', -- Gradle + 'build.gradle.kts', -- Gradle +} + +---@type vim.lsp.Config +return { + filetypes = { 'kotlin' }, + root_markers = root_files, + cmd = { 'kotlin-language-server' }, + init_options = { + -- Enables caching and use project root to store cache data. + storagePath = vim.fs.root(vim.fn.expand '%:p:h', root_files) --[[@as string]], + }, +} diff --git a/.config/nvim/lsp/kotlin_lsp.lua b/.config/nvim/lsp/kotlin_lsp.lua new file mode 100644 index 0000000..cd9e772 --- /dev/null +++ b/.config/nvim/lsp/kotlin_lsp.lua @@ -0,0 +1,23 @@ +---@brief +---Pre-alpha official Kotlin support for Visual Studio Code and an implementation of Language Server Protocol for the Kotlin language. +--- +---The server is based on IntelliJ IDEA and the IntelliJ IDEA Kotlin Plugin implementation. + +--- The presence of one of these files indicates a project root directory +-- +-- These are configuration files for the various build systems supported by +-- Kotlin. + +---@type vim.lsp.Config +return { + filetypes = { 'kotlin' }, + cmd = { 'kotlin-lsp', '--stdio' }, + root_markers = { + 'settings.gradle', -- Gradle (multi-project) + 'settings.gradle.kts', -- Gradle (multi-project) + 'pom.xml', -- Maven + 'build.gradle', -- Gradle + 'build.gradle.kts', -- Gradle + 'workspace.json', -- Used to integrate your own build system + }, +} diff --git a/.config/nvim/lsp/kulala_ls.lua b/.config/nvim/lsp/kulala_ls.lua new file mode 100644 index 0000000..e56a2cf --- /dev/null +++ b/.config/nvim/lsp/kulala_ls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/mistweaverco/kulala-ls +--- +--- A minimal language server for HTTP syntax. + +---@type vim.lsp.Config +return { + cmd = { 'kulala-ls', '--stdio' }, + filetypes = { 'http' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/laravel_ls.lua b/.config/nvim/lsp/laravel_ls.lua new file mode 100644 index 0000000..59d986f --- /dev/null +++ b/.config/nvim/lsp/laravel_ls.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/laravel-ls/laravel-ls +--- +--- `laravel-ls`, language server for laravel +--- +--- The default `cmd` assumes that the `laravel-ls` binary can be found in `$PATH`. + +---@type vim.lsp.Config +return { + cmd = { 'laravel-ls' }, + filetypes = { 'php', 'blade' }, + root_markers = { 'artisan' }, +} diff --git a/.config/nvim/lsp/lean3ls.lua b/.config/nvim/lsp/lean3ls.lua new file mode 100644 index 0000000..aefbbe9 --- /dev/null +++ b/.config/nvim/lsp/lean3ls.lua @@ -0,0 +1,40 @@ +---@brief +--- +--- https://github.com/leanprover/lean-client-js/tree/master/lean-language-server +--- +--- Lean installation instructions can be found +--- [here](https://leanprover-community.github.io/get_started.html#regular-install). +--- +--- Once Lean is installed, you can install the Lean 3 language server by running +--- ```sh +--- npm install -g lean-language-server +--- ``` +--- +--- Note: that if you're using [lean.nvim](https://github.com/Julian/lean.nvim), +--- that plugin fully handles the setup of the Lean language server, +--- and you shouldn't set up `lean3ls` both with it and `lspconfig`. + +---@type vim.lsp.Config +return { + cmd = { 'lean-language-server', '--stdio', '--', '-M', '4096', '-T', '100000' }, + filetypes = { 'lean3' }, + offset_encoding = 'utf-32', + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + fname = vim.fs.normalize(fname) + -- check if inside elan stdlib + local stdlib_dir + do + local _, endpos = fname:find '/lean/library' + if endpos then + stdlib_dir = fname:sub(1, endpos) + end + end + + on_dir( + vim.fs.root(fname, { 'leanpkg.toml', 'leanpkg.path' }) + or stdlib_dir + or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1]) + ) + end, +} diff --git a/.config/nvim/lsp/lelwel_ls.lua b/.config/nvim/lsp/lelwel_ls.lua new file mode 100644 index 0000000..0b04eb1 --- /dev/null +++ b/.config/nvim/lsp/lelwel_ls.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/0x2a-42/lelwel +--- +--- Language server for lelwel grammars. +--- +--- You can install `lelwel-ls` via cargo: +--- ```sh +--- cargo install --features="lsp" lelwel +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'lelwel-ls' }, + filetypes = { 'llw' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/lemminx.lua b/.config/nvim/lsp/lemminx.lua new file mode 100644 index 0000000..4aac3a8 --- /dev/null +++ b/.config/nvim/lsp/lemminx.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/eclipse/lemminx +--- +--- The easiest way to install the server is to get a binary from https://github.com/redhat-developer/vscode-xml/releases and place it on your PATH. +--- +--- NOTE to macOS users: Binaries from unidentified developers are blocked by default. If you trust the downloaded binary, run it once, cancel the prompt, then remove the binary from Gatekeeper quarantine with `xattr -d com.apple.quarantine lemminx`. It should now run without being blocked. + +---@type vim.lsp.Config +return { + cmd = { 'lemminx' }, + filetypes = { 'xml', 'xsd', 'xsl', 'xslt', 'svg' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/lexical.lua b/.config/nvim/lsp/lexical.lua new file mode 100644 index 0000000..6968a5e --- /dev/null +++ b/.config/nvim/lsp/lexical.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/lexical-lsp/lexical +--- +--- Lexical is a next-generation language server for the Elixir programming language. +--- +--- To install from source, follow the [Detailed Installation Instructions](https://github.com/lexical-lsp/lexical/blob/main/pages/installation.md). +--- Ensure to point `cmd` to the generated `_build/dev/package/lexical/start_lexical.sh` executable. + +---@type vim.lsp.Config +return { + cmd = { 'lexical' }, + filetypes = { 'elixir', 'eelixir', 'heex', 'surface' }, + root_markers = { 'mix.exs', '.git' }, +} diff --git a/.config/nvim/lsp/lsp_ai.lua b/.config/nvim/lsp/lsp_ai.lua new file mode 100644 index 0000000..ef853e2 --- /dev/null +++ b/.config/nvim/lsp/lsp_ai.lua @@ -0,0 +1,24 @@ +---@brief +--- +--- https://github.com/SilasMarvin/lsp-ai +--- +--- LSP-AI is an open source language server that serves as a backend for AI-powered functionality in your favorite code +--- editors. It offers features like in-editor chatting with LLMs and code completions. +--- +--- +--- You will need to provide configuration for the inference backends and models you want to use, as well as configure +--- completion/code actions. See the [wiki docs](https://github.com/SilasMarvin/lsp-ai/wiki/Configuration) and +--- [examples](https://github.com/SilasMarvin/lsp-ai/blob/main/examples/nvim) for more information. + +---@type vim.lsp.Config +return { + cmd = { 'lsp-ai' }, + filetypes = {}, + root_dir = nil, + init_options = { + memory = { + file_store = vim.empty_dict(), + }, + models = vim.empty_dict(), + }, +} diff --git a/.config/nvim/lsp/ltex.lua b/.config/nvim/lsp/ltex.lua new file mode 100644 index 0000000..9b3bb24 --- /dev/null +++ b/.config/nvim/lsp/ltex.lua @@ -0,0 +1,85 @@ +---@brief +--- +--- https://github.com/valentjn/ltex-ls +--- +--- LTeX Language Server: LSP language server for LanguageTool 🔍✔️ with support for LaTeX 🎓, Markdown 📝, and others +--- +--- To install, download the latest [release](https://github.com/valentjn/ltex-ls/releases) and ensure `ltex-ls` is on your path. +--- +--- This server accepts configuration via the `settings` key. +--- +--- ```lua +--- settings = { +--- ltex = { +--- language = "en-GB", +--- }, +--- }, +--- ``` +--- +--- To support org files or R sweave, users can define a custom filetype autocommand (or use a plugin which defines these filetypes): +--- +--- ```lua +--- vim.cmd [[ autocmd BufRead,BufNewFile *.org set filetype=org ]] +--- ``` + +local language_id_mapping = { + bib = 'bibtex', + plaintex = 'tex', + rnoweb = 'rsweave', + rst = 'restructuredtext', + tex = 'latex', + pandoc = 'markdown', + text = 'plaintext', +} + +local filetypes = { + 'bib', + 'gitcommit', + 'markdown', + 'org', + 'plaintex', + 'rst', + 'rnoweb', + 'tex', + 'pandoc', + 'quarto', + 'rmd', + 'context', + 'html', + 'xhtml', + 'mail', + 'text', +} + +local function get_language_id(_, filetype) + local language_id = language_id_mapping[filetype] + if language_id then + return language_id + else + return filetype + end +end +local enabled_ids = {} +do + local enabled_keys = {} + for _, ft in ipairs(filetypes) do + local id = get_language_id({}, ft) + if not enabled_keys[id] then + enabled_keys[id] = true + table.insert(enabled_ids, id) + end + end +end + +---@type vim.lsp.Config +return { + cmd = { 'ltex-ls' }, + filetypes = filetypes, + root_markers = { '.git' }, + get_language_id = get_language_id, + settings = { + ltex = { + enabled = enabled_ids, + }, + }, +} diff --git a/.config/nvim/lsp/ltex_plus.lua b/.config/nvim/lsp/ltex_plus.lua new file mode 100644 index 0000000..d9b9941 --- /dev/null +++ b/.config/nvim/lsp/ltex_plus.lua @@ -0,0 +1,89 @@ +---@brief +--- +--- https://github.com/ltex-plus/ltex-ls-plus +--- +--- LTeX Language Server: LSP language server for LanguageTool 🔍✔️ with support for LaTeX 🎓, Markdown 📝, and others +--- +--- To install, download the latest [release](https://github.com/ltex-plus/ltex-ls-plus) and ensure `ltex-ls-plus` is on your path. +--- +--- This server accepts configuration via the `settings` key. +--- +--- ```lua +--- settings = { +--- ltex = { +--- language = "en-GB", +--- }, +--- }, +--- ``` +--- +--- To support org files or R sweave, users can define a custom filetype autocommand (or use a plugin which defines these filetypes): +--- +--- ```lua +--- vim.cmd [[ autocmd BufRead,BufNewFile *.org set filetype=org ]] +--- ``` + +local language_id_mapping = { + bib = 'bibtex', + pandoc = 'markdown', + plaintex = 'tex', + rnoweb = 'rsweave', + rst = 'restructuredtext', + tex = 'latex', + text = 'plaintext', +} + +---@type vim.lsp.Config +return { + cmd = { 'ltex-ls-plus' }, + filetypes = { + 'asciidoc', + 'bib', + 'context', + 'gitcommit', + 'html', + 'markdown', + 'org', + 'pandoc', + 'plaintex', + 'quarto', + 'mail', + 'mdx', + 'rmd', + 'rnoweb', + 'rst', + 'tex', + 'text', + 'typst', + 'xhtml', + }, + root_markers = { '.git' }, + get_language_id = function(_, filetype) + return language_id_mapping[filetype] or filetype + end, + settings = { + ltex = { + enabled = { + 'asciidoc', + 'bib', + 'context', + 'gitcommit', + 'html', + 'markdown', + 'org', + 'pandoc', + 'plaintex', + 'quarto', + 'mail', + 'mdx', + 'rmd', + 'rnoweb', + 'rst', + 'tex', + 'latex', + 'text', + 'typst', + 'xhtml', + }, + }, + }, +} diff --git a/.config/nvim/lsp/lua_ls.lua b/.config/nvim/lsp/lua_ls.lua new file mode 100644 index 0000000..c2d7ec9 --- /dev/null +++ b/.config/nvim/lsp/lua_ls.lua @@ -0,0 +1,93 @@ +---@brief +--- +--- https://github.com/luals/lua-language-server +--- +--- Lua language server. +--- +--- `lua-language-server` can be installed by following the instructions [here](https://luals.github.io/#neovim-install). +--- +--- The default `cmd` assumes that the `lua-language-server` binary can be found in `$PATH`. +--- +--- If you primarily use `lua-language-server` for Neovim, and want to provide completions, +--- analysis, and location handling for plugins on runtime path, you can use the following +--- settings. +--- +--- ```lua +--- vim.lsp.config('lua_ls', { +--- on_init = function(client) +--- if client.workspace_folders then +--- local path = client.workspace_folders[1].name +--- if +--- path ~= vim.fn.stdpath('config') +--- and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc')) +--- then +--- return +--- end +--- end +--- +--- client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { +--- runtime = { +--- -- Tell the language server which version of Lua you're using (most +--- -- likely LuaJIT in the case of Neovim) +--- version = 'LuaJIT', +--- -- Tell the language server how to find Lua modules same way as Neovim +--- -- (see `:h lua-module-load`) +--- path = { +--- 'lua/?.lua', +--- 'lua/?/init.lua', +--- }, +--- }, +--- -- Make the server aware of Neovim runtime files +--- workspace = { +--- checkThirdParty = false, +--- library = { +--- vim.env.VIMRUNTIME +--- -- Depending on the usage, you might want to add additional paths +--- -- here. +--- -- '${3rd}/luv/library' +--- -- '${3rd}/busted/library' +--- } +--- -- Or pull in all of 'runtimepath'. +--- -- NOTE: this is a lot slower and will cause issues when working on +--- -- your own configuration. +--- -- See https://github.com/neovim/nvim-lspconfig/issues/3189 +--- -- library = { +--- -- vim.api.nvim_get_runtime_file('', true), +--- -- } +--- } +--- }) +--- end, +--- settings = { +--- Lua = {} +--- } +--- }) +--- ``` +--- +--- See `lua-language-server`'s [documentation](https://luals.github.io/wiki/settings/) for an explanation of the above fields: +--- * [Lua.runtime.path](https://luals.github.io/wiki/settings/#runtimepath) +--- * [Lua.workspace.library](https://luals.github.io/wiki/settings/#workspacelibrary) +--- + +---@type vim.lsp.Config +return { + cmd = { 'lua-language-server' }, + filetypes = { 'lua' }, + root_markers = { + '.emmyrc.json', + '.luarc.json', + '.luarc.jsonc', + '.luacheckrc', + '.stylua.toml', + 'stylua.toml', + 'selene.toml', + 'selene.yml', + '.git', + }, + settings = { + Lua = { + codeLens = { enable = true }, + hint = { enable = true, semicolon = 'Disable' }, + workspace = { library = vim.api.nvim_get_runtime_file("lua", true) }, + }, + }, +} diff --git a/.config/nvim/lsp/luau_lsp.lua b/.config/nvim/lsp/luau_lsp.lua new file mode 100644 index 0000000..8686501 --- /dev/null +++ b/.config/nvim/lsp/luau_lsp.lua @@ -0,0 +1,20 @@ +---@brief +--- +--- https://github.com/JohnnyMorganz/luau-lsp +--- +--- Language server for the [Luau](https://luau-lang.org/) language. +--- +--- `luau-lsp` can be installed by downloading one of the release assets available at https://github.com/JohnnyMorganz/luau-lsp. +--- +--- You might also have to set up automatic filetype detection for Luau files, for example like so: +--- +--- ```vim +--- autocmd BufRead,BufNewFile *.luau setf luau +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'luau-lsp', 'lsp' }, + filetypes = { 'luau' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/lwc_ls.lua b/.config/nvim/lsp/lwc_ls.lua new file mode 100644 index 0000000..2e4ded3 --- /dev/null +++ b/.config/nvim/lsp/lwc_ls.lua @@ -0,0 +1,30 @@ +---@brief +--- +--- https://github.com/forcedotcom/lightning-language-server/ +--- +--- Language server for Lightning Web Components. +--- +--- For manual installation, utilize the official [NPM package](https://www.npmjs.com/package/@salesforce/lwc-language-server). +--- Then, configure `cmd` to run the Node script at the unpacked location: +--- +--- ```lua +--- vim.lsp.config('lwc_ls', { +--- cmd = { +--- 'node', +--- '/path/to/node_modules/@salesforce/lwc-language-server/bin/lwc-language-server.js', +--- '--stdio' +--- } +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'lwc-language-server', '--stdio' }, + filetypes = { 'javascript', 'html' }, + root_markers = { 'sfdx-project.json' }, + init_options = { + embeddedLanguages = { + javascript = true, + }, + }, +} diff --git a/.config/nvim/lsp/m68k.lua b/.config/nvim/lsp/m68k.lua new file mode 100644 index 0000000..e54559a --- /dev/null +++ b/.config/nvim/lsp/m68k.lua @@ -0,0 +1,24 @@ +---@brief +--- +--- https://github.com/grahambates/m68k-lsp +--- +--- Language server for Motorola 68000 family assembly +--- +--- `m68k-lsp-server` can be installed via `npm`: +--- +--- ```sh +--- npm install -g m68k-lsp-server +--- ``` +--- +--- Ensure you are using the 68k asm syntax variant in Neovim. +--- +--- ```lua +--- vim.g.asmsyntax = 'asm68k' +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'm68k-lsp-server', '--stdio' }, + filetypes = { 'asm68k' }, + root_markers = { 'Makefile', '.git' }, +} diff --git a/.config/nvim/lsp/markdown_oxide.lua b/.config/nvim/lsp/markdown_oxide.lua new file mode 100644 index 0000000..cb61d23 --- /dev/null +++ b/.config/nvim/lsp/markdown_oxide.lua @@ -0,0 +1,37 @@ +---@brief +--- +--- https://github.com/Feel-ix-343/markdown-oxide +--- +--- Editor Agnostic PKM: you bring the text editor and we +--- bring the PKM. +--- +--- Inspired by and compatible with Obsidian. +--- +--- Check the readme to see how to properly setup. + +---@param client vim.lsp.Client +---@param bufnr integer +---@param cmd string +local function command_factory(client, bufnr, cmd) + return client:exec_cmd({ + title = ('Markdown-Oxide-%s'):format(cmd), + command = 'jump', + arguments = { cmd }, + }, { bufnr = bufnr }) +end + +---@type vim.lsp.Config +return { + root_markers = { '.git', '.obsidian', '.moxide.toml' }, + filetypes = { 'markdown' }, + cmd = { 'markdown-oxide' }, + on_attach = function(client, bufnr) + for _, cmd in ipairs({ 'today', 'tomorrow', 'yesterday' }) do + vim.api.nvim_buf_create_user_command(bufnr, 'Lsp' .. ('%s'):format(cmd:gsub('^%l', string.upper)), function() + command_factory(client, bufnr, cmd) + end, { + desc = ('Open %s daily note'):format(cmd), + }) + end + end, +} diff --git a/.config/nvim/lsp/marko-js.lua b/.config/nvim/lsp/marko-js.lua new file mode 100644 index 0000000..fba69bd --- /dev/null +++ b/.config/nvim/lsp/marko-js.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/marko-js/language-server +--- +--- Using the Language Server Protocol to improve Marko's developer experience. +--- +--- Can be installed via npm: +--- ``` +--- npm i -g @marko/language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'marko-language-server', '--stdio' }, + filetypes = { 'marko' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/marksman.lua b/.config/nvim/lsp/marksman.lua new file mode 100644 index 0000000..fc1e048 --- /dev/null +++ b/.config/nvim/lsp/marksman.lua @@ -0,0 +1,16 @@ +---@brief +--- +--- https://github.com/artempyanykh/marksman +--- +--- Marksman is a Markdown LSP server providing completion, cross-references, diagnostics, and more. +--- +--- Marksman works on MacOS, Linux, and Windows and is distributed as a self-contained binary for each OS. +--- +--- Pre-built binaries can be downloaded from https://github.com/artempyanykh/marksman/releases + +---@type vim.lsp.Config +return { + cmd = { 'marksman', 'server' }, + filetypes = { 'markdown', 'markdown.mdx' }, + root_markers = { '.marksman.toml', '.git' }, +} diff --git a/.config/nvim/lsp/matlab_ls.lua b/.config/nvim/lsp/matlab_ls.lua new file mode 100644 index 0000000..6da14a0 --- /dev/null +++ b/.config/nvim/lsp/matlab_ls.lua @@ -0,0 +1,34 @@ +---@brief +--- +--- https://github.com/mathworks/MATLAB-language-server +--- +--- MATLAB® language server implements the Microsoft® Language Server Protocol for the MATLAB language. +--- +--- Make sure to set `MATLAB.installPath` to your MATLAB path, e.g.: +--- ```lua +--- settings = { +--- MATLAB = { +--- ... +--- installPath = '/usr/local/MATLAB/R2023a', +--- ... +--- }, +--- }, +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'matlab-language-server', '--stdio' }, + filetypes = { 'matlab' }, + root_dir = function(bufnr, on_dir) + local root_dir = vim.fs.root(bufnr, '.git') + on_dir(root_dir or vim.fn.getcwd()) + end, + settings = { + MATLAB = { + indexWorkspace = true, + installPath = '', -- NOTE: Set this to your MATLAB installation path. + matlabConnectionTiming = 'onStart', + telemetry = true, + }, + }, +} diff --git a/.config/nvim/lsp/mdx_analyzer.lua b/.config/nvim/lsp/mdx_analyzer.lua new file mode 100644 index 0000000..3ff8136 --- /dev/null +++ b/.config/nvim/lsp/mdx_analyzer.lua @@ -0,0 +1,22 @@ +---@brief +--- https://github.com/mdx-js/mdx-analyzer +--- +--- `mdx-analyzer`, a language server for MDX + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'mdx-language-server', '--stdio' }, + filetypes = { 'mdx' }, + root_markers = { 'package.json' }, + settings = {}, + init_options = { + typescript = {}, + }, + before_init = function(_, config) + if config.init_options and config.init_options.typescript and not config.init_options.typescript.tsdk then + config.init_options.typescript.tsdk = util.get_typescript_server_path(config.root_dir) + end + end, +} diff --git a/.config/nvim/lsp/mesonlsp.lua b/.config/nvim/lsp/mesonlsp.lua new file mode 100644 index 0000000..dc10550 --- /dev/null +++ b/.config/nvim/lsp/mesonlsp.lua @@ -0,0 +1,38 @@ +---@brief +--- +--- https://github.com/JCWasmx86/mesonlsp +--- +--- An unofficial, unendorsed language server for meson written in C++ + +---Checks if a given path contains a valid Meson project root file +---Looks for 'meson.build' file which contains 'project()' function +local meson_matcher = function(_, path) + local pattern = 'meson.build' + local f = vim.fn.glob(table.concat({ path, pattern }, '/')) + if f == '' then + return false + end + for line in io.lines(f) do + -- skip meson comments + if not line:match '^%s*#.*' then + local str = line:gsub('%s+', '') + if str ~= '' then + if str:match '^project%(' then + return true + else + break + end + end + end + end + return false +end + +---@type vim.lsp.Config +return { + cmd = { 'mesonlsp', '--lsp' }, + filetypes = { 'meson' }, + root_dir = function(bufnr, on_dir) + on_dir(vim.fs.root(bufnr, meson_matcher) or vim.fs.root(bufnr, '.git')) + end, +} diff --git a/.config/nvim/lsp/metals.lua b/.config/nvim/lsp/metals.lua new file mode 100644 index 0000000..c76ce64 --- /dev/null +++ b/.config/nvim/lsp/metals.lua @@ -0,0 +1,32 @@ +---@brief +--- +--- https://scalameta.org/metals/ +--- +--- Scala language server with rich IDE features. +--- +--- See full instructions in the Metals documentation: +--- +--- https://scalameta.org/metals/docs/editors/vim#using-an-alternative-lsp-client +--- +--- Note: that if you're using [nvim-metals](https://github.com/scalameta/nvim-metals), that plugin fully handles the setup and installation of Metals, and you shouldn't set up Metals both with it and `lspconfig`. +--- +--- To install Metals, make sure to have [coursier](https://get-coursier.io/docs/cli-installation) installed, and once you do you can install the latest Metals with `cs install metals`. + +---@type vim.lsp.Config +return { + cmd = { 'metals' }, + filetypes = { 'scala' }, + root_markers = { 'build.sbt', 'build.sc', 'build.gradle', 'pom.xml' }, + init_options = { + statusBarProvider = 'show-message', + isHttpEnabled = true, + compilerOptions = { + snippetAutoIndent = false, + }, + }, + capabilities = { + workspace = { + configuration = false, + }, + }, +} diff --git a/.config/nvim/lsp/millet.lua b/.config/nvim/lsp/millet.lua new file mode 100644 index 0000000..87207b1 --- /dev/null +++ b/.config/nvim/lsp/millet.lua @@ -0,0 +1,19 @@ +---@brief +--- +--- https://github.com/azdavis/millet +--- +--- Millet, a language server for Standard ML +--- +--- To use with nvim: +--- +--- 1. Install a Rust toolchain: https://rustup.rs +--- 2. Clone the repo +--- 3. Run `cargo build --release --bin millet-ls` +--- 4. Move `target/release/millet-ls` to somewhere on your $PATH as `millet` + +---@type vim.lsp.Config +return { + cmd = { 'millet' }, + filetypes = { 'sml' }, + root_markers = { 'millet.toml' }, +} diff --git a/.config/nvim/lsp/mint.lua b/.config/nvim/lsp/mint.lua new file mode 100644 index 0000000..fdcc238 --- /dev/null +++ b/.config/nvim/lsp/mint.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://www.mint-lang.com +--- +--- Install Mint using the [instructions](https://www.mint-lang.com/install). +--- The language server is included since version 0.12.0. + +---@type vim.lsp.Config +return { + cmd = { 'mint', 'ls' }, + filetypes = { 'mint' }, + root_markers = { 'mint.json', '.git' }, +} diff --git a/.config/nvim/lsp/mlir_lsp_server.lua b/.config/nvim/lsp/mlir_lsp_server.lua new file mode 100644 index 0000000..65365f2 --- /dev/null +++ b/.config/nvim/lsp/mlir_lsp_server.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://mlir.llvm.org/docs/Tools/MLIRLSP/#mlir-lsp-language-server--mlir-lsp-server= +--- +--- The Language Server for the LLVM MLIR language +--- +--- `mlir-lsp-server` can be installed at the llvm-project repository (https://github.com/llvm/llvm-project) + +---@type vim.lsp.Config +return { + cmd = { 'mlir-lsp-server' }, + filetypes = { 'mlir' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/mlir_pdll_lsp_server.lua b/.config/nvim/lsp/mlir_pdll_lsp_server.lua new file mode 100644 index 0000000..a3b6d88 --- /dev/null +++ b/.config/nvim/lsp/mlir_pdll_lsp_server.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://mlir.llvm.org/docs/Tools/MLIRLSP/#pdll-lsp-language-server--mlir-pdll-lsp-server +--- +--- The Language Server for the LLVM PDLL language +--- +--- `mlir-pdll-lsp-server` can be installed at the llvm-project repository (https://github.com/llvm/llvm-project) + +---@type vim.lsp.Config +return { + cmd = { 'mlir-pdll-lsp-server' }, + filetypes = { 'pdll' }, + root_markers = { 'pdll_compile_commands.yml', '.git' }, +} diff --git a/.config/nvim/lsp/mm0_ls.lua b/.config/nvim/lsp/mm0_ls.lua new file mode 100644 index 0000000..079a08d --- /dev/null +++ b/.config/nvim/lsp/mm0_ls.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/digama0/mm0 +--- +--- Language Server for the metamath-zero theorem prover. +--- +--- Requires [mm0-rs](https://github.com/digama0/mm0/tree/master/mm0-rs) to be installed +--- and available on the `PATH`. + +---@type vim.lsp.Config +return { + cmd = { 'mm0-rs', 'server' }, + root_markers = { '.git' }, + filetypes = { 'metamath-zero' }, +} diff --git a/.config/nvim/lsp/mojo.lua b/.config/nvim/lsp/mojo.lua new file mode 100644 index 0000000..b0a9af9 --- /dev/null +++ b/.config/nvim/lsp/mojo.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/modularml/mojo +--- +--- `mojo-lsp-server` can be installed [via Modular](https://developer.modular.com/download) +--- +--- Mojo is a new programming language that bridges the gap between research and production by combining Python syntax and ecosystem with systems programming and metaprogramming features. + +---@type vim.lsp.Config +return { + cmd = { 'mojo-lsp-server' }, + filetypes = { 'mojo' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/motoko_lsp.lua b/.config/nvim/lsp/motoko_lsp.lua new file mode 100644 index 0000000..f4cd7e4 --- /dev/null +++ b/.config/nvim/lsp/motoko_lsp.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/dfinity/vscode-motoko +--- +--- Language server for the Motoko programming language. + +---@type vim.lsp.Config +return { + cmd = { 'motoko-lsp', '--stdio' }, + filetypes = { 'motoko' }, + root_markers = { 'dfx.json', '.git' }, + init_options = { + formatter = 'auto', + }, +} diff --git a/.config/nvim/lsp/move_analyzer.lua b/.config/nvim/lsp/move_analyzer.lua new file mode 100644 index 0000000..6670882 --- /dev/null +++ b/.config/nvim/lsp/move_analyzer.lua @@ -0,0 +1,20 @@ +---@brief +--- +--- https://github.com/move-language/move/tree/main/language/move-analyzer +--- +--- Language server for Move +--- +--- The `move-analyzer` can be installed by running: +--- +--- ``` +--- cargo install --git https://github.com/move-language/move move-analyzer +--- ``` +--- +--- See [`move-analyzer`'s doc](https://github.com/move-language/move/blob/1b258a06e3c7d2bc9174578aac92cca3ac19de71/language/move-analyzer/editors/code/README.md#how-to-install) for details. + +---@type vim.lsp.Config +return { + cmd = { 'move-analyzer' }, + filetypes = { 'move' }, + root_markers = { 'Move.toml' }, +} diff --git a/.config/nvim/lsp/msbuild_project_tools_server.lua b/.config/nvim/lsp/msbuild_project_tools_server.lua new file mode 100644 index 0000000..0f85e51 --- /dev/null +++ b/.config/nvim/lsp/msbuild_project_tools_server.lua @@ -0,0 +1,47 @@ +---@brief +--- +--- https://github.com/tintoy/msbuild-project-tools-server/ +--- +--- MSBuild Project Tools Server can be installed by following the README.MD on the above repository. +--- +--- Example config: +--- ```lua +--- vim.lsp.config('msbuild_project_tools_server', { +--- cmd = {'dotnet', '/path/to/server/MSBuildProjectTools.LanguageServer.Host.dll'} +--- }) +--- ``` +--- +--- There's no builtin filetypes for msbuild files, would require some filetype aliases: +--- +--- ```lua +--- vim.filetype.add({ +--- extension = { +--- props = 'msbuild', +--- tasks = 'msbuild', +--- targets = 'msbuild', +--- }, +--- pattern = { +--- [ [[.*\..*proj]] ] = 'msbuild', +--- }, +--- }) +--- ``` +--- +--- Optionally tell treesitter to treat `msbuild` as `xml` so you can get syntax highlighting if you have the treesitter-xml-parser installed. +--- +--- ```lua +--- vim.treesitter.language.register('xml', { 'msbuild' }) +--- ``` + +local host_dll_name = 'MSBuildProjectTools.LanguageServer.Host.dll' +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + filetypes = { 'msbuild' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern('*.sln', '*.slnx', '*.*proj', '.git')(fname)) + end, + init_options = {}, + cmd = { 'dotnet', host_dll_name }, +} diff --git a/.config/nvim/lsp/muon.lua b/.config/nvim/lsp/muon.lua new file mode 100644 index 0000000..160878c --- /dev/null +++ b/.config/nvim/lsp/muon.lua @@ -0,0 +1,25 @@ +---@brief +--- +--- https://muon.build + +---@type vim.lsp.Config +return { + cmd = { 'muon', 'analyze', 'lsp' }, + filetypes = { 'meson' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + local cmd = { 'muon', 'analyze', 'root-for', fname } + vim.system(cmd, { text = true }, function(output) + if output.code == 0 then + if output.stdout then + on_dir(vim.trim(output.stdout)) + return + end + + on_dir(nil) + else + vim.notify(('[muon] cmd failed with code %d: %s\n%s'):format(output.code, cmd, output.stderr)) + end + end) + end, +} diff --git a/.config/nvim/lsp/mutt_ls.lua b/.config/nvim/lsp/mutt_ls.lua new file mode 100644 index 0000000..050b411 --- /dev/null +++ b/.config/nvim/lsp/mutt_ls.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/neomutt/mutt-language-server +--- +--- A language server for (neo)mutt's muttrc. It can be installed via pip. +--- +--- ```sh +--- pip install mutt-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'mutt-language-server' }, + filetypes = { 'muttrc', 'neomuttrc' }, + root_markers = { '.git' }, + settings = {}, +} diff --git a/.config/nvim/lsp/nelua_lsp.lua b/.config/nvim/lsp/nelua_lsp.lua new file mode 100644 index 0000000..e0feff5 --- /dev/null +++ b/.config/nvim/lsp/nelua_lsp.lua @@ -0,0 +1,31 @@ +--- @brief +--- +--- https://github.com/codehz/nelua-lsp +--- +--- nelua-lsp is an experimental nelua language server. +--- +--- You need [nelua.vim](https://github.com/stefanos82/nelua.vim/blob/main/ftdetect/nelua.vim) for nelua files to be recognized or add this to your config: +--- +--- in vimscript: +--- ```vimscript +--- au BufNewFile,BufRead *.nelua setf nelua +--- ``` +--- +--- in lua: +--- ```lua +--- vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, { pattern = { "*.nelua" }, command = "setf nelua"}) +--- ``` +--- +--- **By default, nelua-lsp doesn't have a `cmd` set.** This is because nvim-lspconfig does not make assumptions about your path. You must add the following to your init.vim or init.lua to set `cmd` to the absolute path ($HOME and ~ are not expanded) of the unzipped run script or binary. +--- +--- ```lua +--- vim.lsp.config('nelua_lsp', { +--- cmd = { "nelua", "-L", "/path/to/nelua-lsp/", "--script", "/path/to/nelua-lsp/nelua-lsp.lua" }, +--- }) +--- ``` + +---@type vim.lsp.Config +return { + filetypes = { 'nelua' }, + root_markers = { 'Makefile', '.git', '*.nelua' }, +} diff --git a/.config/nvim/lsp/neocmake.lua b/.config/nvim/lsp/neocmake.lua new file mode 100644 index 0000000..34f8dac --- /dev/null +++ b/.config/nvim/lsp/neocmake.lua @@ -0,0 +1,24 @@ +---@brief +--- +--- https://github.com/neocmakelsp/neocmakelsp +--- +--- CMake LSP Implementation +--- +--- Neovim does not currently include built-in snippets. `neocmakelsp` only provides completions when snippet support is enabled. To enable completion, install a snippet plugin and add the following override to your language client capabilities during setup. +--- +--- ```lua +--- --Enable (broadcasting) snippet capability for completion +--- local capabilities = vim.lsp.protocol.make_client_capabilities() +--- capabilities.textDocument.completion.completionItem.snippetSupport = true +--- +--- vim.lsp.config('neocmake', { +--- capabilities = capabilities, +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'neocmakelsp', 'stdio' }, + filetypes = { 'cmake' }, + root_markers = { '.git', 'build', 'cmake' }, +} diff --git a/.config/nvim/lsp/nextflow_ls.lua b/.config/nvim/lsp/nextflow_ls.lua new file mode 100644 index 0000000..f263511 --- /dev/null +++ b/.config/nvim/lsp/nextflow_ls.lua @@ -0,0 +1,38 @@ +---@brief +--- +--- https://github.com/nextflow-io/language-server +--- +--- Requirements: +--- - Java 17+ +--- +--- `nextflow_ls` can be installed by following the instructions [here](https://github.com/nextflow-io/language-server#development). +--- +--- If you have installed nextflow language server, you can set the `cmd` custom path as follow: +--- +--- ```lua +--- vim.lsp.config('nextflow_ls', { +--- cmd = { 'java', '-jar', 'nextflow-language-server-all.jar' }, +--- filetypes = { 'nextflow' }, +--- settings = { +--- nextflow = { +--- files = { +--- exclude = { '.git', '.nf-test', 'work' }, +--- }, +--- }, +--- }, +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'java', '-jar', 'nextflow-language-server-all.jar' }, + filetypes = { 'nextflow' }, + root_markers = { 'nextflow.config', '.git' }, + settings = { + nextflow = { + files = { + exclude = { '.git', '.nf-test', 'work' }, + }, + }, + }, +} diff --git a/.config/nvim/lsp/nextls.lua b/.config/nvim/lsp/nextls.lua new file mode 100644 index 0000000..c243dfb --- /dev/null +++ b/.config/nvim/lsp/nextls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/elixir-tools/next-ls +--- +--- **Please see the following [detailed instructions](https://www.elixir-tools.dev/docs/next-ls/installation/) for possible installation methods.** + +---@type vim.lsp.Config +return { + cmd = { 'nextls', '--stdio' }, + filetypes = { 'elixir', 'eelixir', 'heex', 'surface' }, + root_markers = { 'mix.exs', '.git' }, +} diff --git a/.config/nvim/lsp/nginx_language_server.lua b/.config/nvim/lsp/nginx_language_server.lua new file mode 100644 index 0000000..4a8c0e8 --- /dev/null +++ b/.config/nvim/lsp/nginx_language_server.lua @@ -0,0 +1,16 @@ +---@brief +--- +--- https://pypi.org/project/nginx-language-server/ +--- +--- `nginx-language-server` can be installed via pip: +--- +--- ```sh +--- pip install -U nginx-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'nginx-language-server' }, + filetypes = { 'nginx' }, + root_markers = { 'nginx.conf', '.git' }, +} diff --git a/.config/nvim/lsp/nickel_ls.lua b/.config/nvim/lsp/nickel_ls.lua new file mode 100644 index 0000000..74fe33c --- /dev/null +++ b/.config/nvim/lsp/nickel_ls.lua @@ -0,0 +1,32 @@ +---@brief +--- +--- Nickel Language Server +--- +--- https://github.com/tweag/nickel +--- +--- `nls` can be installed with nix, or cargo, from the Nickel repository. +--- ```sh +--- git clone https://github.com/tweag/nickel.git +--- ``` +--- +--- Nix: +--- ```sh +--- cd nickel +--- nix-env -f . -i +--- ``` +--- +--- cargo: +--- ```sh +--- cd nickel/lsp/nls +--- cargo install --path . +--- ``` +--- +--- In order to have lspconfig detect Nickel filetypes (a prerequisite for autostarting a server), +--- install the [Nickel vim plugin](https://github.com/nickel-lang/vim-nickel). + +---@type vim.lsp.Config +return { + cmd = { 'nls' }, + filetypes = { 'ncl', 'nickel' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/nil_ls.lua b/.config/nvim/lsp/nil_ls.lua new file mode 100644 index 0000000..da8ee63 --- /dev/null +++ b/.config/nvim/lsp/nil_ls.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/oxalica/nil +--- +--- A new language server for Nix Expression Language. +--- +--- If you are using Nix with Flakes support, run `nix profile install github:oxalica/nil` to install. +--- Check the repository README for more information. +--- +--- _See an example config at https://github.com/oxalica/nil/blob/main/dev/nvim-lsp.nix._ + +---@type vim.lsp.Config +return { + cmd = { 'nil' }, + filetypes = { 'nix' }, + root_markers = { 'flake.nix', '.git' }, +} diff --git a/.config/nvim/lsp/nim_langserver.lua b/.config/nvim/lsp/nim_langserver.lua new file mode 100644 index 0000000..441ee24 --- /dev/null +++ b/.config/nvim/lsp/nim_langserver.lua @@ -0,0 +1,23 @@ +---@brief +--- +--- https://github.com/nim-lang/langserver +--- +--- +--- `nim-langserver` can be installed via the `nimble` package manager: +--- ```sh +--- nimble install nimlangserver +--- ``` + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'nimlangserver' }, + filetypes = { 'nim' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir( + util.root_pattern '*.nimble'(fname) or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1]) + ) + end, +} diff --git a/.config/nvim/lsp/nimls.lua b/.config/nvim/lsp/nimls.lua new file mode 100644 index 0000000..ad5b7a0 --- /dev/null +++ b/.config/nvim/lsp/nimls.lua @@ -0,0 +1,23 @@ +---@brief +--- +--- https://github.com/PMunch/nimlsp +--- +--- `nimlsp` can be installed via the `nimble` package manager: +--- +--- ```sh +--- nimble install nimlsp +--- ``` + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'nimlsp' }, + filetypes = { 'nim' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir( + util.root_pattern '*.nimble'(fname) or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1]) + ) + end, +} diff --git a/.config/nvim/lsp/nixd.lua b/.config/nvim/lsp/nixd.lua new file mode 100644 index 0000000..64ff08e --- /dev/null +++ b/.config/nvim/lsp/nixd.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/nix-community/nixd +--- +--- Nix language server, based on nix libraries. +--- +--- If you are using Nix with Flakes support, run `nix profile install github:nix-community/nixd` to install. +--- Check the repository README for more information. + +---@type vim.lsp.Config +return { + cmd = { 'nixd' }, + filetypes = { 'nix' }, + root_markers = { 'flake.nix', '.git' }, +} diff --git a/.config/nvim/lsp/nomad_lsp.lua b/.config/nvim/lsp/nomad_lsp.lua new file mode 100644 index 0000000..2388683 --- /dev/null +++ b/.config/nvim/lsp/nomad_lsp.lua @@ -0,0 +1,34 @@ +---@brief +--- +--- https://github.com/juliosueiras/nomad-lsp +--- +--- Written in Go, compilation is needed for `nomad_lsp` to be used. Please see the [original repository](https://github.com/juliosuieras/nomad-lsp). +--- +--- Add the executable to your system or vim PATH and it will be set to go. +--- +--- No configuration option is needed unless you choose not to add `nomad-lsp` executable to the PATH. You should know what you are doing if you choose so. +--- +--- ```lua +--- vim.lsp.enable('nomad_lsp') +--- ``` +--- +--- However, a `hcl.nomad` or `nomad` filetype should be defined. +--- +--- Description of your jobs should be written in `.nomad` files for the LSP client to configure the server's `root_dir` configuration option. + +local util = require 'lspconfig.util' +local bin_name = 'nomad-lsp' + +if vim.fn.has 'win32' == 1 then + bin_name = bin_name .. '.exe' +end + +---@type vim.lsp.Config +return { + cmd = { bin_name }, + filetypes = { 'hcl.nomad', 'nomad' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern '*.nomad'(fname)) + end, +} diff --git a/.config/nvim/lsp/ntt.lua b/.config/nvim/lsp/ntt.lua new file mode 100644 index 0000000..6fcbb28 --- /dev/null +++ b/.config/nvim/lsp/ntt.lua @@ -0,0 +1,20 @@ +---@brief +--- +--- https://github.com/nokia/ntt +--- Installation instructions can be found [here](https://github.com/nokia/ntt#Install). +--- Can be configured by passing a "settings" object to vim.lsp.config('ntt'): +--- ```lua +--- vim.lsp.config('ntt', { +--- settings = { +--- ntt = { +--- } +--- } +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'ntt', 'langserver' }, + filetypes = { 'ttcn' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/nushell.lua b/.config/nvim/lsp/nushell.lua new file mode 100644 index 0000000..0cd85e7 --- /dev/null +++ b/.config/nvim/lsp/nushell.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/nushell/nushell +--- +--- Nushell built-in language server. + +---@type vim.lsp.Config +return { + cmd = { 'nu', '--lsp' }, + filetypes = { 'nu' }, + root_dir = function(bufnr, on_dir) + on_dir(vim.fs.root(bufnr, { '.git' }) or vim.fs.dirname(vim.api.nvim_buf_get_name(bufnr))) + end, +} diff --git a/.config/nvim/lsp/nxls.lua b/.config/nvim/lsp/nxls.lua new file mode 100644 index 0000000..1fb9755 --- /dev/null +++ b/.config/nvim/lsp/nxls.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/nrwl/nx-console/tree/master/apps/nxls +--- +--- nxls, a language server for Nx Workspaces +--- +--- `nxls` can be installed via `npm`: +--- ```sh +--- npm i -g nxls +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'nxls', '--stdio' }, + filetypes = { 'json', 'jsonc' }, + root_markers = { 'nx.json', '.git' }, +} diff --git a/.config/nvim/lsp/ocamllsp.lua b/.config/nvim/lsp/ocamllsp.lua new file mode 100644 index 0000000..d7a2726 --- /dev/null +++ b/.config/nvim/lsp/ocamllsp.lua @@ -0,0 +1,88 @@ +---@brief +--- +--- https://github.com/ocaml/ocaml-lsp +--- +--- `ocaml-lsp` can be installed as described in [installation guide](https://github.com/ocaml/ocaml-lsp#installation). +--- +--- To install the lsp server in a particular opam switch: +--- ```sh +--- opam install ocaml-lsp-server +--- ``` + +-- https://github.com/ocaml/ocaml-lsp/blob/master/ocaml-lsp-server/docs/ocamllsp/switchImplIntf-spec.md +local function switch_impl_intf(bufnr, client) + local method_name = 'ocamllsp/switchImplIntf' + ---@diagnostic disable-next-line:param-type-mismatch + if not client or not client:supports_method(method_name) then + return vim.notify(('method %s is not supported by any servers active on the current buffer'):format(method_name)) + end + local uri = vim.lsp.util.make_given_range_params(nil, nil, bufnr, client.offset_encoding).textDocument.uri + if not uri then + return vim.notify('could not get URI for current buffer') + end + local params = { uri } + ---@diagnostic disable-next-line:param-type-mismatch + client:request(method_name, params, function(err, result) + if err then + error(tostring(err)) + end + if not result or #result == 0 then + vim.notify('corresponding file cannot be determined') + elseif #result == 1 then + vim.cmd.edit(vim.uri_to_fname(result[1])) + else + vim.ui.select( + result, + { prompt = 'Select an implementation/interface:', format_item = vim.uri_to_fname }, + function(choice) + if choice then + vim.cmd.edit(vim.uri_to_fname(choice)) + end + end + ) + end + end, bufnr) +end + +local language_id_of = { + menhir = 'ocaml.menhir', + ocaml = 'ocaml', + ocamlinterface = 'ocaml.interface', + ocamllex = 'ocaml.ocamllex', + reason = 'reason', + dune = 'dune', +} + +local language_id_of_ext = { + mll = language_id_of.ocamllex, + mly = language_id_of.menhir, + mli = language_id_of.ocamlinterface, +} + +local get_language_id = function(bufnr, ftype) + if ftype == 'ocaml' then + local path = vim.api.nvim_buf_get_name(bufnr) + local ext = vim.fn.fnamemodify(path, ':e') + return language_id_of_ext[ext] or language_id_of.ocaml + else + return language_id_of[ftype] + end +end + +local root_markers1 = { 'dune-project', 'dune-workspace' } +local root_markers2 = { '*.opam', 'opam', 'esy.json', 'package.json' } +local root_markers3 = { '.git' } + +---@type vim.lsp.Config +return { + cmd = { 'ocamllsp' }, + filetypes = { 'ocaml', 'menhir', 'ocamlinterface', 'ocamllex', 'reason', 'dune' }, + root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers1, root_markers2, root_markers3 } + or vim.list_extend(vim.list_extend(root_markers1, root_markers2), root_markers3), + get_language_id = get_language_id, + on_attach = function(client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspOcamllspSwitchImplIntf', function() + switch_impl_intf(bufnr, client) + end, { desc = 'Switch between implementation/interface' }) + end, +} diff --git a/.config/nvim/lsp/ols.lua b/.config/nvim/lsp/ols.lua new file mode 100644 index 0000000..aad2a5e --- /dev/null +++ b/.config/nvim/lsp/ols.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/DanielGavin/ols +--- +--- `Odin Language Server`. + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'ols' }, + filetypes = { 'odin' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern('ols.json', '.git', '*.odin')(fname)) + end, +} diff --git a/.config/nvim/lsp/omnisharp.lua b/.config/nvim/lsp/omnisharp.lua new file mode 100644 index 0000000..adaf4d7 --- /dev/null +++ b/.config/nvim/lsp/omnisharp.lua @@ -0,0 +1,91 @@ +---@brief +--- +--- https://github.com/omnisharp/omnisharp-roslyn +--- OmniSharp server based on Roslyn workspaces +--- +--- `omnisharp-roslyn` can be installed by downloading and extracting a release from [here](https://github.com/OmniSharp/omnisharp-roslyn/releases). +--- OmniSharp can also be built from source by following the instructions [here](https://github.com/omnisharp/omnisharp-roslyn#downloading-omnisharp). +--- +--- OmniSharp requires the [dotnet-sdk](https://dotnet.microsoft.com/download) to be installed. +--- +--- For `go_to_definition` to work fully, extended `textDocument/definition` handler is needed, for example see [omnisharp-extended-lsp.nvim](https://github.com/Hoffs/omnisharp-extended-lsp.nvim) +--- +--- + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { + vim.fn.executable('OmniSharp') == 1 and 'OmniSharp' or 'omnisharp', + '-z', -- https://github.com/OmniSharp/omnisharp-vscode/pull/4300 + '--hostPID', + tostring(vim.fn.getpid()), + 'DotNet:enablePackageRestore=false', + '--encoding', + 'utf-8', + '--languageserver', + }, + filetypes = { 'cs', 'vb' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir( + util.root_pattern '*.slnx'(fname) + or util.root_pattern '*.sln'(fname) + or util.root_pattern '*.csproj'(fname) + or util.root_pattern 'omnisharp.json'(fname) + or util.root_pattern 'function.json'(fname) + ) + end, + init_options = {}, + capabilities = { + workspace = { + workspaceFolders = false, -- https://github.com/OmniSharp/omnisharp-roslyn/issues/909 + }, + }, + settings = { + FormattingOptions = { + -- Enables support for reading code style, naming convention and analyzer + -- settings from .editorconfig. + EnableEditorConfigSupport = true, + -- Specifies whether 'using' directives should be grouped and sorted during + -- document formatting. + OrganizeImports = nil, + }, + MsBuild = { + -- If true, MSBuild project system will only load projects for files that + -- were opened in the editor. This setting is useful for big C# codebases + -- and allows for faster initialization of code navigation features only + -- for projects that are relevant to code that is being edited. With this + -- setting enabled OmniSharp may load fewer projects and may thus display + -- incomplete reference lists for symbols. + LoadProjectsOnDemand = nil, + }, + RoslynExtensionsOptions = { + -- Enables support for roslyn analyzers, code fixes and rulesets. + EnableAnalyzersSupport = nil, + -- Enables support for showing unimported types and unimported extension + -- methods in completion lists. When committed, the appropriate using + -- directive will be added at the top of the current file. This option can + -- have a negative impact on initial completion responsiveness, + -- particularly for the first few completion sessions after opening a + -- solution. + EnableImportCompletion = nil, + -- Only run analyzers against open files when 'enableRoslynAnalyzers' is + -- true + AnalyzeOpenDocumentsOnly = nil, + -- Enables the possibility to see the code in external nuget dependencies + EnableDecompilationSupport = nil, + }, + RenameOptions = { + RenameInComments = nil, + RenameOverloads = nil, + RenameInStrings = nil, + }, + Sdk = { + -- Specifies whether to include preview versions of the .NET SDK when + -- determining which version to use for project loading. + IncludePrereleases = true, + }, + }, +} diff --git a/.config/nvim/lsp/opencl_ls.lua b/.config/nvim/lsp/opencl_ls.lua new file mode 100644 index 0000000..53cf67e --- /dev/null +++ b/.config/nvim/lsp/opencl_ls.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/Galarius/opencl-language-server +--- +--- Build instructions can be found [here](https://github.com/Galarius/opencl-language-server/blob/main/_dev/build.md). +--- +--- Prebuilt binaries are available for Linux, macOS and Windows [here](https://github.com/Galarius/opencl-language-server/releases). + +---@type vim.lsp.Config +return { + cmd = { 'opencl-language-server' }, + filetypes = { 'opencl' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/openscad_ls.lua b/.config/nvim/lsp/openscad_ls.lua new file mode 100644 index 0000000..f0f4e1b --- /dev/null +++ b/.config/nvim/lsp/openscad_ls.lua @@ -0,0 +1,27 @@ +---@brief +--- +--- https://github.com/dzhu/openscad-language-server +--- +--- A Language Server Protocol server for OpenSCAD +--- +--- You can build and install `openscad-language-server` binary with `cargo`: +--- ```sh +--- cargo install openscad-language-server +--- ``` +--- +--- Vim does not have built-in syntax for the `openscad` filetype currently. +--- +--- This can be added via an autocmd: +--- +--- ```lua +--- vim.cmd [[ autocmd BufRead,BufNewFile *.scad set filetype=openscad ]] +--- ``` +--- +--- or by installing a filetype plugin such as https://github.com/sirtaj/vim-openscad + +---@type vim.lsp.Config +return { + cmd = { 'openscad-language-server' }, + filetypes = { 'openscad' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/openscad_lsp.lua b/.config/nvim/lsp/openscad_lsp.lua new file mode 100644 index 0000000..a9b8da0 --- /dev/null +++ b/.config/nvim/lsp/openscad_lsp.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/Leathong/openscad-LSP +--- +--- A Language Server Protocol server for OpenSCAD +--- +--- You can build and install `openscad-lsp` binary with `cargo`: +--- ```sh +--- cargo install openscad-lsp +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'openscad-lsp', '--stdio' }, + filetypes = { 'openscad' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/oxlint.lua b/.config/nvim/lsp/oxlint.lua new file mode 100644 index 0000000..4585a98 --- /dev/null +++ b/.config/nvim/lsp/oxlint.lua @@ -0,0 +1,31 @@ +--- @brief +--- +--- https://github.com/oxc-project/oxc +--- +--- `oxc` is a linter / formatter for JavaScript / Typescript supporting over 500 rules from ESLint and its popular plugins +--- It can be installed via `npm`: +--- +--- ```sh +--- npm i -g oxlint +--- ``` + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'oxc_language_server' }, + filetypes = { + 'javascript', + 'javascriptreact', + 'javascript.jsx', + 'typescript', + 'typescriptreact', + 'typescript.tsx', + }, + workspace_required = true, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + local root_markers = util.insert_package_json({ '.oxlintrc.json' }, 'oxlint', fname) + on_dir(vim.fs.dirname(vim.fs.find(root_markers, { path = fname, upward = true })[1])) + end, +} diff --git a/.config/nvim/lsp/pact_ls.lua b/.config/nvim/lsp/pact_ls.lua new file mode 100644 index 0000000..bb5c392 --- /dev/null +++ b/.config/nvim/lsp/pact_ls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/kadena-io/pact-lsp +--- +--- The Pact language server + +---@type vim.lsp.Config +return { + cmd = { 'pact-lsp' }, + filetypes = { 'pact' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/pasls.lua b/.config/nvim/lsp/pasls.lua new file mode 100644 index 0000000..14f9c80 --- /dev/null +++ b/.config/nvim/lsp/pasls.lua @@ -0,0 +1,28 @@ +---@brief +--- +--- https://github.com/genericptr/pascal-language-server +--- +--- An LSP server implementation for Pascal variants that are supported by Free Pascal, including Object Pascal. It uses CodeTools from Lazarus as backend. +--- +--- First set `cmd` to the Pascal lsp binary. +--- +--- Customization options are passed to pasls as environment variables for example in your `.bashrc`: +--- ```bash +--- export FPCDIR='/usr/lib/fpc/src' # FPC source directory (This is the only required option for the server to work). +--- export PP='/usr/lib/fpc/3.2.2/ppcx64' # Path to the Free Pascal compiler executable. +--- export LAZARUSDIR='/usr/lib/lazarus' # Path to the Lazarus sources. +--- export FPCTARGET='' # Target operating system for cross compiling. +--- export FPCTARGETCPU='x86_64' # Target CPU for cross compiling. +--- ``` + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'pasls' }, + filetypes = { 'pascal' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern('*.lpi', '*.lpk', '.git')(fname)) + end, +} diff --git a/.config/nvim/lsp/pbls.lua b/.config/nvim/lsp/pbls.lua new file mode 100644 index 0000000..d6dba22 --- /dev/null +++ b/.config/nvim/lsp/pbls.lua @@ -0,0 +1,19 @@ +---@brief +--- +--- https://git.sr.ht/~rrc/pbls +--- +--- Prerequisites: Ensure protoc is on your $PATH. +--- +--- `pbls` can be installed via `cargo install`: +--- ```sh +--- cargo install --git https://git.sr.ht/~rrc/pbls +--- ``` +--- +--- pbls is a Language Server for protobuf + +---@type vim.lsp.Config +return { + cmd = { 'pbls' }, + filetypes = { 'proto' }, + root_markers = { '.pbls.toml', '.git' }, +} diff --git a/.config/nvim/lsp/perlls.lua b/.config/nvim/lsp/perlls.lua new file mode 100644 index 0000000..9c664af --- /dev/null +++ b/.config/nvim/lsp/perlls.lua @@ -0,0 +1,30 @@ +---@brief +--- +--- https://github.com/richterger/Perl-LanguageServer/tree/master/clients/vscode/perl +--- +--- `Perl-LanguageServer`, a language server for Perl. +--- +--- To use the language server, ensure that you have Perl::LanguageServer installed and perl command is on your path. + +---@type vim.lsp.Config +return { + cmd = { + 'perl', + '-MPerl::LanguageServer', + '-e', + 'Perl::LanguageServer::run', + '--', + '--port 13603', + '--nostdio 0', + }, + settings = { + perl = { + perlCmd = 'perl', + perlInc = ' ', + fileFilter = { '.pm', '.pl' }, + ignoreDirs = '.git', + }, + }, + filetypes = { 'perl' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/perlnavigator.lua b/.config/nvim/lsp/perlnavigator.lua new file mode 100644 index 0000000..e33b48e --- /dev/null +++ b/.config/nvim/lsp/perlnavigator.lua @@ -0,0 +1,28 @@ +---@brief +--- +--- https://github.com/bscan/PerlNavigator +--- +--- A Perl language server. It can be installed via npm: +--- +--- ```sh +--- npm i -g perlnavigator-server +--- ``` +--- +--- At minimum, you will need `perl` in your path. If you want to use a non-standard `perl` you will need to set your configuration like so: +--- ```lua +--- settings = { +--- perlnavigator = { +--- perlPath = '/some/odd/location/my-perl' +--- } +--- } +--- ``` +--- +--- The `contributes.configuration.properties` section of `perlnavigator`'s `package.json` has all available configuration settings. All +--- settings have a reasonable default, but, at minimum, you may want to point `perlnavigator` at your `perltidy` and `perlcritic` configurations. + +---@type vim.lsp.Config +return { + cmd = { 'perlnavigator' }, + filetypes = { 'perl' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/perlpls.lua b/.config/nvim/lsp/perlpls.lua new file mode 100644 index 0000000..00be114 --- /dev/null +++ b/.config/nvim/lsp/perlpls.lua @@ -0,0 +1,21 @@ +---@brief +--- +--- https://github.com/FractalBoy/perl-language-server +--- https://metacpan.org/pod/PLS +--- +--- `PLS`, another language server for Perl. +--- +--- To use the language server, ensure that you have PLS installed and that it is in your path + +---@type vim.lsp.Config +return { + cmd = { 'pls' }, + settings = { + perl = { + perlcritic = { enabled = false }, + syntax = { enabled = true }, + }, + }, + filetypes = { 'perl' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/pest_ls.lua b/.config/nvim/lsp/pest_ls.lua new file mode 100644 index 0000000..6da7f92 --- /dev/null +++ b/.config/nvim/lsp/pest_ls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/pest-parser/pest-ide-tools +--- +--- Language server for pest grammars. + +---@type vim.lsp.Config +return { + cmd = { 'pest-language-server' }, + filetypes = { 'pest' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/phan.lua b/.config/nvim/lsp/phan.lua new file mode 100644 index 0000000..b9e6ce3 --- /dev/null +++ b/.config/nvim/lsp/phan.lua @@ -0,0 +1,32 @@ +---@brief +--- +--- https://github.com/phan/phan +--- +--- Installation: https://github.com/phan/phan#getting-started + +local cmd = { + 'phan', + '-m', + 'json', + '--no-color', + '--no-progress-bar', + '-x', + '-u', + '-S', + '--language-server-on-stdin', + '--allow-polyfill-parser', +} + +---@type vim.lsp.Config +return { + cmd = cmd, + filetypes = { 'php' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + local cwd = assert(vim.uv.cwd()) + local root = vim.fs.root(fname, { 'composer.json', '.git' }) + + -- prefer cwd if root is a descendant + on_dir(root and vim.fs.relpath(cwd, root) and cwd) + end, +} diff --git a/.config/nvim/lsp/phpactor.lua b/.config/nvim/lsp/phpactor.lua new file mode 100644 index 0000000..5832f54 --- /dev/null +++ b/.config/nvim/lsp/phpactor.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://github.com/phpactor/phpactor +--- +--- Installation: https://phpactor.readthedocs.io/en/master/usage/standalone.html#global-installation + +---@type vim.lsp.Config +return { + cmd = { 'phpactor', 'language-server' }, + filetypes = { 'php' }, + root_markers = { '.git', 'composer.json', '.phpactor.json', '.phpactor.yml' }, + workspace_required = true, +} diff --git a/.config/nvim/lsp/phptools.lua b/.config/nvim/lsp/phptools.lua new file mode 100644 index 0000000..e20e00a --- /dev/null +++ b/.config/nvim/lsp/phptools.lua @@ -0,0 +1,36 @@ +---@brief +--- +--- https://www.devsense.com/ +--- +--- `devsense-php-ls` can be installed via `npm`: +--- ```sh +--- npm install -g devsense-php-ls +--- ``` +--- +--- ```lua +--- -- See https://www.npmjs.com/package/devsense-php-ls +--- init_options = { +--- } +--- -- See https://docs.devsense.com/vscode/configuration/ +--- settings = { +--- php = { +--- }; +--- } +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'devsense-php-ls', '--stdio' }, + filetypes = { 'php' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + local cwd = assert(vim.uv.cwd()) + local root = vim.fs.root(fname, { 'composer.json', '.git' }) + + -- prefer cwd if root is a descendant + on_dir(root and vim.fs.relpath(cwd, root) and cwd) + end, + init_options = { + ['0'] = '{}', --optional premium license validation from https://www.devsense.com/purchase/validation + }, +} diff --git a/.config/nvim/lsp/pico8_ls.lua b/.config/nvim/lsp/pico8_ls.lua new file mode 100644 index 0000000..85bb0b2 --- /dev/null +++ b/.config/nvim/lsp/pico8_ls.lua @@ -0,0 +1,18 @@ +---@brief +--- +--- https://github.com/japhib/pico8-ls +--- +--- Full language support for the PICO-8 dialect of Lua. + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'pico8-ls', '--stdio' }, + filetypes = { 'p8' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern('*.p8')(fname)) + end, + settings = {}, +} diff --git a/.config/nvim/lsp/please.lua b/.config/nvim/lsp/please.lua new file mode 100644 index 0000000..1d25c44 --- /dev/null +++ b/.config/nvim/lsp/please.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/thought-machine/please +--- +--- High-performance extensible build system for reproducible multi-language builds. +--- +--- The `plz` binary will automatically install the LSP for you on first run + +---@type vim.lsp.Config +return { + cmd = { 'plz', 'tool', 'lps' }, + filetypes = { 'bzl' }, + root_markers = { '.plzconfig' }, +} diff --git a/.config/nvim/lsp/pli.lua b/.config/nvim/lsp/pli.lua new file mode 100644 index 0000000..e7e72ca --- /dev/null +++ b/.config/nvim/lsp/pli.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- `pli_language_server` is a language server for the PL/I language used on IBM SystemZ mainframes. +--- +--- To learn how to configure the PL/I language server, see the [PL/I Language Support documentation](https://github.com/zowe/zowe-pli-language-support). + +---@type vim.lsp.Config +return { + cmd = { 'pli_language_server' }, + filetypes = { 'pli' }, + root_markers = { '.pliplugin' }, +} diff --git a/.config/nvim/lsp/pony_language_server.lua b/.config/nvim/lsp/pony_language_server.lua new file mode 100644 index 0000000..88a55e9 --- /dev/null +++ b/.config/nvim/lsp/pony_language_server.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/ponylang/pony-language-server +--- +--- Language server for the Pony programming language + +---@type vim.lsp.Config +return { + cmd = { 'pony-lsp' }, + filetypes = { 'pony' }, + root_markers = { 'corral.json', '.git' }, +} diff --git a/.config/nvim/lsp/poryscript_pls.lua b/.config/nvim/lsp/poryscript_pls.lua new file mode 100644 index 0000000..e8e59b0 --- /dev/null +++ b/.config/nvim/lsp/poryscript_pls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/huderlem/poryscript-pls +--- +--- Language server for poryscript (a high level scripting language for GBA-era Pokémon decompilation projects) + +---@type vim.lsp.Config +return { + cmd = { 'poryscript-pls' }, + filetypes = { 'pory' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/postgres_lsp.lua b/.config/nvim/lsp/postgres_lsp.lua new file mode 100644 index 0000000..36b062d --- /dev/null +++ b/.config/nvim/lsp/postgres_lsp.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://pg-language-server.com +--- +--- A collection of language tools and a Language Server Protocol (LSP) implementation for Postgres, focusing on developer experience and reliable SQL tooling. + +---@type vim.lsp.Config +return { + cmd = { 'postgres-language-server', 'lsp-proxy' }, + filetypes = { + 'sql', + }, + root_markers = { 'postgres-language-server.jsonc' }, + workspace_required = true, +} diff --git a/.config/nvim/lsp/powershell_es.lua b/.config/nvim/lsp/powershell_es.lua new file mode 100644 index 0000000..a011d59 --- /dev/null +++ b/.config/nvim/lsp/powershell_es.lua @@ -0,0 +1,56 @@ +--- @brief +--- +--- https://github.com/PowerShell/PowerShellEditorServices +--- +--- Language server for PowerShell. +--- +--- To install, download and extract PowerShellEditorServices.zip +--- from the [releases](https://github.com/PowerShell/PowerShellEditorServices/releases). +--- To configure the language server, set the property `bundle_path` to the root +--- of the extracted PowerShellEditorServices.zip. +--- +--- ```lua +--- vim.lsp.config('powershell_es', { +--- bundle_path = 'c:/w/PowerShellEditorServices', +--- }) +--- ``` +--- +--- By default the language server is started in `pwsh` (PowerShell Core). This can be changed by specifying `shell`. +--- +--- ```lua +--- vim.lsp.config('powershell_es', { +--- bundle_path = 'c:/w/PowerShellEditorServices', +--- shell = 'powershell.exe', +--- }) +--- ``` +--- +--- Note that the execution policy needs to be set to `Unrestricted` for the languageserver run under PowerShell +--- +--- If necessary, specific `cmd` can be defined instead of `bundle_path`. +--- See [PowerShellEditorServices](https://github.com/PowerShell/PowerShellEditorServices#standard-input-and-output) +--- to learn more. +--- +--- ```lua +--- vim.lsp.config('powershell_es', { +--- cmd = {'pwsh', '-NoLogo', '-NoProfile', '-Command', "c:/PSES/Start-EditorServices.ps1 ..."}, +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = function(dispatchers) + local temp_path = vim.fn.stdpath('cache') + local bundle_path = vim.lsp.config.powershell_es.bundle_path + + local shell = vim.lsp.config.powershell_es.shell or 'pwsh' + + local command_fmt = + [[& '%s/PowerShellEditorServices/Start-EditorServices.ps1' -BundledModulesPath '%s' -LogPath '%s/powershell_es.log' -SessionDetailsPath '%s/powershell_es.session.json' -FeatureFlags @() -AdditionalModules @() -HostName nvim -HostProfileId 0 -HostVersion 1.0.0 -Stdio -LogLevel Normal]] + local command = command_fmt:format(bundle_path, bundle_path, temp_path, temp_path) + local cmd = { shell, '-NoLogo', '-NoProfile', '-Command', command } + + return vim.lsp.rpc.start(cmd, dispatchers) + end, + filetypes = { 'ps1' }, + root_markers = { 'PSScriptAnalyzerSettings.psd1', '.git' }, +} diff --git a/.config/nvim/lsp/prismals.lua b/.config/nvim/lsp/prismals.lua new file mode 100644 index 0000000..ff234da --- /dev/null +++ b/.config/nvim/lsp/prismals.lua @@ -0,0 +1,20 @@ +---@brief +--- +--- Language Server for the Prisma JavaScript and TypeScript ORM +--- +--- `@prisma/language-server` can be installed via npm +--- ```sh +--- npm install -g @prisma/language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'prisma-language-server', '--stdio' }, + filetypes = { 'prisma' }, + settings = { + prisma = { + prismaFmtBinPath = '', + }, + }, + root_markers = { '.git', 'package.json' }, +} diff --git a/.config/nvim/lsp/prolog_ls.lua b/.config/nvim/lsp/prolog_ls.lua new file mode 100644 index 0000000..aa70d8c --- /dev/null +++ b/.config/nvim/lsp/prolog_ls.lua @@ -0,0 +1,22 @@ +---@brief +--- +--- https://github.com/jamesnvc/lsp_server +--- +--- Language Server Protocol server for SWI-Prolog + +---@type vim.lsp.Config +return { + cmd = { + 'swipl', + '-g', + 'use_module(library(lsp_server)).', + '-g', + 'lsp_server:main', + '-t', + 'halt', + '--', + 'stdio', + }, + filetypes = { 'prolog' }, + root_markers = { 'pack.pl' }, +} diff --git a/.config/nvim/lsp/prosemd_lsp.lua b/.config/nvim/lsp/prosemd_lsp.lua new file mode 100644 index 0000000..32d1d64 --- /dev/null +++ b/.config/nvim/lsp/prosemd_lsp.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/kitten/prosemd-lsp +--- +--- An experimental LSP for Markdown. +--- +--- Please see the manual installation instructions: https://github.com/kitten/prosemd-lsp#manual-installation + +---@type vim.lsp.Config +return { + cmd = { 'prosemd-lsp', '--stdio' }, + filetypes = { 'markdown' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/protols.lua b/.config/nvim/lsp/protols.lua new file mode 100644 index 0000000..87dc084 --- /dev/null +++ b/.config/nvim/lsp/protols.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/coder3101/protols +--- +--- `protols` can be installed via `cargo`: +--- ```sh +--- cargo install protols +--- ``` +--- +--- A Language Server for proto3 files. It uses tree-sitter and runs in single file mode. + +---@type vim.lsp.Config +return { + cmd = { 'protols' }, + filetypes = { 'proto' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/psalm.lua b/.config/nvim/lsp/psalm.lua new file mode 100644 index 0000000..8764981 --- /dev/null +++ b/.config/nvim/lsp/psalm.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/vimeo/psalm +--- +--- Can be installed with composer. +--- ```sh +--- composer global require vimeo/psalm +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'psalm', '--language-server' }, + filetypes = { 'php' }, + root_markers = { 'psalm.xml', 'psalm.xml.dist' }, +} diff --git a/.config/nvim/lsp/pug.lua b/.config/nvim/lsp/pug.lua new file mode 100644 index 0000000..d04f48f --- /dev/null +++ b/.config/nvim/lsp/pug.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/opa-oz/pug-lsp +--- +--- An implementation of the Language Protocol Server for [Pug.js](http://pugjs.org) +--- +--- PugLSP can be installed via `go install github.com/opa-oz/pug-lsp@latest`, or manually downloaded from [releases page](https://github.com/opa-oz/pug-lsp/releases) + +---@type vim.lsp.Config +return { + cmd = { 'pug-lsp' }, + filetypes = { 'pug' }, + root_markers = { 'package.json' }, +} diff --git a/.config/nvim/lsp/puppet.lua b/.config/nvim/lsp/puppet.lua new file mode 100644 index 0000000..85cd93a --- /dev/null +++ b/.config/nvim/lsp/puppet.lua @@ -0,0 +1,28 @@ +---@brief +--- +--- LSP server for Puppet. +--- +--- Installation: +--- +--- - Clone the editor-services repository: +--- https://github.com/puppetlabs/puppet-editor-services +--- +--- - Navigate into that directory and run: `bundle install` +--- +--- - Install the 'puppet-lint' gem: `gem install puppet-lint` +--- +--- - Add that repository to $PATH. +--- +--- - Ensure you can run `puppet-languageserver` from outside the editor-services directory. + +---@type vim.lsp.Config +return { + cmd = { 'puppet-languageserver', '--stdio' }, + filetypes = { 'puppet' }, + root_markers = { + 'manifests', + '.puppet-lint.rc', + 'hiera.yaml', + '.git', + }, +} diff --git a/.config/nvim/lsp/purescriptls.lua b/.config/nvim/lsp/purescriptls.lua new file mode 100644 index 0000000..acbd338 --- /dev/null +++ b/.config/nvim/lsp/purescriptls.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/nwolverson/purescript-language-server +--- +--- The `purescript-language-server` can be added to your project and `$PATH` via +--- +--- * JavaScript package manager such as npm, pnpm, Yarn, et al. +--- * Nix under the `nodePackages` and `nodePackages_latest` package sets + +---@type vim.lsp.Config +return { + cmd = { 'purescript-language-server', '--stdio' }, + filetypes = { 'purescript' }, + root_markers = { 'bower.json', 'flake.nix', 'psc-package.json', 'shell.nix', 'spago.dhall', 'spago.yaml' }, +} diff --git a/.config/nvim/lsp/pylsp.lua b/.config/nvim/lsp/pylsp.lua new file mode 100644 index 0000000..a17f767 --- /dev/null +++ b/.config/nvim/lsp/pylsp.lua @@ -0,0 +1,41 @@ +---@brief +--- +--- https://github.com/python-lsp/python-lsp-server +--- +--- A Python 3.6+ implementation of the Language Server Protocol. +--- +--- See the [project's README](https://github.com/python-lsp/python-lsp-server) for installation instructions. +--- +--- Configuration options are documented [here](https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md). +--- In order to configure an option, it must be translated to a nested Lua table and included in the `settings` argument to the `config('pylsp', {})` function. +--- For example, in order to set the `pylsp.plugins.pycodestyle.ignore` option: +--- ```lua +--- vim.lsp.config('pylsp', { +--- settings = { +--- pylsp = { +--- plugins = { +--- pycodestyle = { +--- ignore = {'W391'}, +--- maxLineLength = 100 +--- } +--- } +--- } +--- } +--- }) +--- ``` +--- +--- Note: This is a community fork of `pyls`. + +---@type vim.lsp.Config +return { + cmd = { 'pylsp' }, + filetypes = { 'python' }, + root_markers = { + 'pyproject.toml', + 'setup.py', + 'setup.cfg', + 'requirements.txt', + 'Pipfile', + '.git', + }, +} diff --git a/.config/nvim/lsp/pylyzer.lua b/.config/nvim/lsp/pylyzer.lua new file mode 100644 index 0000000..e0086a6 --- /dev/null +++ b/.config/nvim/lsp/pylyzer.lua @@ -0,0 +1,35 @@ +---@brief +--- +--- https://github.com/mtshiba/pylyzer +--- +--- `pylyzer`, a fast static code analyzer & language server for Python. +--- +--- `pylyzer` requires Erg as dependency, and finds it via `ERG_PATH` environment variable. +--- This config sets `ERG_PATH="~/.erg"`. Set `cmd_env` if you want to change it. +--- To install Erg, simply extract tarball/zip from [Erg releases](https://github.com/erg-lang/erg/releases/latest) +--- to the the path where you want to install it, e.g. `~/.erg`. + +---@type vim.lsp.Config +return { + cmd = { 'pylyzer', '--server' }, + filetypes = { 'python' }, + root_markers = { + 'setup.py', + 'tox.ini', + 'requirements.txt', + 'Pipfile', + 'pyproject.toml', + '.git', + }, + settings = { + python = { + diagnostics = true, + inlayHints = true, + smartCompletion = true, + checkOnType = false, + }, + }, + cmd_env = { + ERG_PATH = vim.env.ERG_PATH or vim.fs.joinpath(vim.uv.os_homedir(), '.erg'), + }, +} diff --git a/.config/nvim/lsp/pyre.lua b/.config/nvim/lsp/pyre.lua new file mode 100644 index 0000000..a25c8e1 --- /dev/null +++ b/.config/nvim/lsp/pyre.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://pyre-check.org/ +--- +--- `pyre` a static type checker for Python 3. +--- +--- `pyre` offers an extremely limited featureset. It currently only supports diagnostics, +--- which are triggered on save. +--- +--- Do not report issues for missing features in `pyre` to `lspconfig`. + +---@type vim.lsp.Config +return { + cmd = { 'pyre', 'persistent' }, + filetypes = { 'python' }, + root_markers = { '.pyre_configuration' }, +} diff --git a/.config/nvim/lsp/pyrefly.lua b/.config/nvim/lsp/pyrefly.lua new file mode 100644 index 0000000..e4758d1 --- /dev/null +++ b/.config/nvim/lsp/pyrefly.lua @@ -0,0 +1,26 @@ +---@brief +--- +--- https://pyrefly.org/ +--- +---`pyrefly`, a faster Python type checker written in Rust. +-- +-- `pyrefly` is still in development, so please report any errors to +-- our issues page at https://github.com/facebook/pyrefly/issues. + +---@type vim.lsp.Config +return { + cmd = { 'pyrefly', 'lsp' }, + filetypes = { 'python' }, + root_markers = { + 'pyrefly.toml', + 'pyproject.toml', + 'setup.py', + 'setup.cfg', + 'requirements.txt', + 'Pipfile', + '.git', + }, + on_exit = function(code, _, _) + vim.notify('Closing Pyrefly LSP exited with code: ' .. code, vim.log.levels.INFO) + end, +} diff --git a/.config/nvim/lsp/pyright.lua b/.config/nvim/lsp/pyright.lua new file mode 100644 index 0000000..b73407c --- /dev/null +++ b/.config/nvim/lsp/pyright.lua @@ -0,0 +1,67 @@ +---@brief +--- +--- https://github.com/microsoft/pyright +--- +--- `pyright`, a static type checker and language server for python + +local function set_python_path(command) + local path = command.args + local clients = vim.lsp.get_clients { + bufnr = vim.api.nvim_get_current_buf(), + name = 'pyright', + } + for _, client in ipairs(clients) do + if client.settings then + client.settings.python = + vim.tbl_deep_extend('force', client.settings.python --[[@as table]], { pythonPath = path }) + else + client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { python = { pythonPath = path } }) + end + client:notify('workspace/didChangeConfiguration', { settings = nil }) + end +end + +---@type vim.lsp.Config +return { + cmd = { 'pyright-langserver', '--stdio' }, + filetypes = { 'python' }, + root_markers = { + 'pyrightconfig.json', + 'pyproject.toml', + 'setup.py', + 'setup.cfg', + 'requirements.txt', + 'Pipfile', + '.git', + }, + settings = { + python = { + analysis = { + autoSearchPaths = true, + useLibraryCodeForTypes = true, + diagnosticMode = 'openFilesOnly', + }, + }, + }, + on_attach = function(client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightOrganizeImports', function() + local params = { + command = 'pyright.organizeimports', + arguments = { vim.uri_from_bufnr(bufnr) }, + } + + -- Using client.request() directly because "pyright.organizeimports" is private + -- (not advertised via capabilities), which client:exec_cmd() refuses to call. + -- https://github.com/neovim/neovim/blob/c333d64663d3b6e0dd9aa440e433d346af4a3d81/runtime/lua/vim/lsp/client.lua#L1024-L1030 + ---@diagnostic disable-next-line: param-type-mismatch + client.request('workspace/executeCommand', params, nil, bufnr) + end, { + desc = 'Organize Imports', + }) + vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightSetPythonPath', set_python_path, { + desc = 'Reconfigure pyright with the provided python path', + nargs = 1, + complete = 'file', + }) + end, +} diff --git a/.config/nvim/lsp/qmlls.lua b/.config/nvim/lsp/qmlls.lua new file mode 100644 index 0000000..ef5d5c1 --- /dev/null +++ b/.config/nvim/lsp/qmlls.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://doc.qt.io/qt-6/qtqml-tooling-qmlls.html +--- +--- > QML Language Server is a tool shipped with Qt that helps you write code in your favorite (LSP-supporting) editor. +--- +--- Source in the [QtDeclarative repository](https://code.qt.io/cgit/qt/qtdeclarative.git/) + +---@type vim.lsp.Config +return { + cmd = { 'qmlls' }, + filetypes = { 'qml', 'qmljs' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/quick_lint_js.lua b/.config/nvim/lsp/quick_lint_js.lua new file mode 100644 index 0000000..d1cf87d --- /dev/null +++ b/.config/nvim/lsp/quick_lint_js.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://quick-lint-js.com/ +--- +--- quick-lint-js finds bugs in JavaScript programs. +--- +--- See installation [instructions](https://quick-lint-js.com/install/) + +---@type vim.lsp.Config +return { + cmd = { 'quick-lint-js', '--lsp-server' }, + filetypes = { 'javascript', 'typescript' }, + root_markers = { 'package.json', 'jsconfig.json', '.git' }, +} diff --git a/.config/nvim/lsp/r_language_server.lua b/.config/nvim/lsp/r_language_server.lua new file mode 100644 index 0000000..d393e37 --- /dev/null +++ b/.config/nvim/lsp/r_language_server.lua @@ -0,0 +1,20 @@ +---@brief +--- +--- [languageserver](https://github.com/REditorSupport/languageserver) is an +--- implementation of the Microsoft's Language Server Protocol for the R +--- language. +--- +--- It is released on CRAN and can be easily installed by +--- +--- ```r +--- install.packages("languageserver") +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'R', '--no-echo', '-e', 'languageserver::run()' }, + filetypes = { 'r', 'rmd', 'quarto' }, + root_dir = function(bufnr, on_dir) + on_dir(vim.fs.root(bufnr, '.git') or vim.uv.os_homedir()) + end, +} diff --git a/.config/nvim/lsp/racket_langserver.lua b/.config/nvim/lsp/racket_langserver.lua new file mode 100644 index 0000000..f7b98ba --- /dev/null +++ b/.config/nvim/lsp/racket_langserver.lua @@ -0,0 +1,16 @@ +---@brief +--- +--- [https://github.com/jeapostrophe/racket-langserver](https://github.com/jeapostrophe/racket-langserver) +--- +--- The Racket language server. This project seeks to use +--- [DrRacket](https://github.com/racket/drracket)'s public API to provide +--- functionality that mimics DrRacket's code tools as closely as possible. +--- +--- Install via `raco`: `raco pkg install racket-langserver` + +---@type vim.lsp.Config +return { + cmd = { 'racket', '--lib', 'racket-langserver' }, + filetypes = { 'racket', 'scheme' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/raku_navigator.lua b/.config/nvim/lsp/raku_navigator.lua new file mode 100644 index 0000000..4ffbe94 --- /dev/null +++ b/.config/nvim/lsp/raku_navigator.lua @@ -0,0 +1,28 @@ +---@brief +--- +--- https://github.com/bscan/RakuNavigator +--- A Raku language server +--- **By default, raku_navigator doesn't have a `cmd` set.** This is because nvim-lspconfig does not make assumptions about your path. +--- You have to install the language server manually. +--- Clone the RakuNavigator repo, install based on the [instructions](https://github.com/bscan/raku_Navigator#installation-for-other-editors), +--- and point `cmd` to `server.js` inside the `server/out` directory: +--- ```lua +--- cmd = {'node', '/server/out/server.js', '--stdio'} +--- ``` +--- At minimum, you will need `raku` in your path. If you want to use a non-standard `raku` you will need to set your configuration like so: +--- ```lua +--- settings = { +--- raku_navigator = { +--- rakuPath = '/some/odd/location/my-raku' +--- } +--- } +--- ``` +--- The `contributes.configuration.properties` section of `raku_navigator`'s `package.json` has all available configuration settings. All +--- settings have a reasonable default, but, at minimum, you may want to point `raku_navigator` at your `raku_tidy` and `raku_critic` configurations. + +---@type vim.lsp.Config +return { + cmd = {}, + filetypes = { 'raku' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/reason_ls.lua b/.config/nvim/lsp/reason_ls.lua new file mode 100644 index 0000000..c2ac030 --- /dev/null +++ b/.config/nvim/lsp/reason_ls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- Reason language server +--- +--- You can install reason language server from [reason-language-server](https://github.com/jaredly/reason-language-server) repository. + +---@type vim.lsp.Config +return { + cmd = { 'reason-language-server' }, + filetypes = { 'reason' }, + root_markers = { 'bsconfig.json', '.git' }, +} diff --git a/.config/nvim/lsp/regal.lua b/.config/nvim/lsp/regal.lua new file mode 100644 index 0000000..f55b07e --- /dev/null +++ b/.config/nvim/lsp/regal.lua @@ -0,0 +1,22 @@ +---@brief +--- +--- https://github.com/StyraInc/regal +--- +--- A linter for Rego, with support for running as an LSP server. +--- +--- `regal` can be installed by running: +--- ```sh +--- go install github.com/StyraInc/regal@latest +--- ``` + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'regal', 'language-server' }, + filetypes = { 'rego' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern '*.rego'(fname) or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1])) + end, +} diff --git a/.config/nvim/lsp/regols.lua b/.config/nvim/lsp/regols.lua new file mode 100644 index 0000000..e695f3b --- /dev/null +++ b/.config/nvim/lsp/regols.lua @@ -0,0 +1,22 @@ +---@brief +--- +--- https://github.com/kitagry/regols +--- +--- OPA Rego language server. +--- +--- `regols` can be installed by running: +--- ```sh +--- go install github.com/kitagry/regols@latest +--- ``` + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'regols' }, + filetypes = { 'rego' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern '*.rego'(fname) or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1])) + end, +} diff --git a/.config/nvim/lsp/remark_ls.lua b/.config/nvim/lsp/remark_ls.lua new file mode 100644 index 0000000..97541d9 --- /dev/null +++ b/.config/nvim/lsp/remark_ls.lua @@ -0,0 +1,46 @@ +---@brief +--- +--- https://github.com/remarkjs/remark-language-server +--- +--- `remark-language-server` can be installed via `npm`: +--- ```sh +--- npm install -g remark-language-server +--- ``` +--- +--- `remark-language-server` uses the same +--- [configuration files](https://github.com/remarkjs/remark/tree/main/packages/remark-cli#example-config-files-json-yaml-js) +--- as `remark-cli`. +--- +--- This uses a plugin based system. Each plugin needs to be installed locally using `npm` or `yarn`. +--- +--- For example, given the following `.remarkrc.json`: +--- +--- ```json +--- { +--- "presets": [ +--- "remark-preset-lint-recommended" +--- ] +--- } +--- ``` +--- +--- `remark-preset-lint-recommended` needs to be installed in the local project: +--- +--- ```sh +--- npm install remark-preset-lint-recommended +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'remark-language-server', '--stdio' }, + filetypes = { 'markdown' }, + root_markers = { + '.remarkrc', + '.remarkrc.json', + '.remarkrc.js', + '.remarkrc.cjs', + '.remarkrc.mjs', + '.remarkrc.yml', + '.remarkrc.yaml', + '.remarkignore', + }, +} diff --git a/.config/nvim/lsp/rescriptls.lua b/.config/nvim/lsp/rescriptls.lua new file mode 100644 index 0000000..f099d03 --- /dev/null +++ b/.config/nvim/lsp/rescriptls.lua @@ -0,0 +1,58 @@ +---@brief +--- +--- https://github.com/rescript-lang/rescript-vscode/tree/master/server +--- +--- ReScript Language Server can be installed via npm: +--- ```sh +--- npm install -g @rescript/language-server +--- ``` +--- +--- See [package.json](https://github.com/rescript-lang/rescript-vscode/blob/master/package.json#L139) +--- for init_options supported. +--- +--- For example, in order to disable the `inlayHints` option: +--- ```lua +--- vim.lsp.config('rescriptls', { +--- settings = { +--- rescript = { +--- settings = { +--- inlayHints = { enable = false }, +--- }, +--- }, +--- }) +--- } +--- ``` +--- +--- Detect file changes: While using @rescript/language-server >= 1.63.0 you have to detect file changes by registering the didChangeWatchedFiles hook. +--- ```lua +--- capabilities = { +--- workspace = { +--- didChangeWatchedFiles = { +--- dynamicRegistration = true, +--- }, +--- }, +--- } +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'rescript-language-server', '--stdio' }, + filetypes = { 'rescript' }, + root_markers = { 'bsconfig.json', 'rescript.json', '.git' }, + settings = {}, + init_options = { + extensionConfiguration = { + -- buggy, prompts much too often, superseded by incrementalTypechecking, below + askToStartBuild = false, + + allowBuiltInFormatter = true, -- lower latency + incrementalTypechecking = { -- removes the need for external build process + enabled = true, + acrossFiles = true, + }, + cache = { projectConfig = { enabled = true } }, -- speed up latency dramatically + codeLens = true, + inlayHints = { enable = true }, + }, + }, +} diff --git a/.config/nvim/lsp/rls.lua b/.config/nvim/lsp/rls.lua new file mode 100644 index 0000000..3c48254 --- /dev/null +++ b/.config/nvim/lsp/rls.lua @@ -0,0 +1,35 @@ +---@brief +--- +--- https://github.com/rust-lang/rls +--- +--- rls, a language server for Rust +--- +--- See https://github.com/rust-lang/rls#setup to setup rls itself. +--- See https://github.com/rust-lang/rls#configuration for rls-specific settings. +--- All settings listed on the rls configuration section of the readme +--- must be set under settings.rust as follows: +--- +--- ```lua +--- vim.lsp.config('rls', { +--- settings = { +--- rust = { +--- unstable_features = true, +--- build_on_save = false, +--- all_features = true, +--- }, +--- }, +--- }) +--- ``` +--- +--- If you want to use rls for a particular build, eg nightly, set cmd as follows: +--- +--- ```lua +--- cmd = {"rustup", "run", "nightly", "rls"} +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'rls' }, + filetypes = { 'rust' }, + root_markers = { 'Cargo.toml' }, +} diff --git a/.config/nvim/lsp/rnix.lua b/.config/nvim/lsp/rnix.lua new file mode 100644 index 0000000..0260e68 --- /dev/null +++ b/.config/nvim/lsp/rnix.lua @@ -0,0 +1,20 @@ +---@brief +--- +--- https://github.com/nix-community/rnix-lsp +--- +--- A language server for Nix providing basic completion and formatting via nixpkgs-fmt. +--- +--- To install manually, run `cargo install rnix-lsp`. If you are using nix, rnix-lsp is in nixpkgs. +--- +--- This server accepts configuration via the `settings` key. + +---@type vim.lsp.Config +return { + cmd = { 'rnix-lsp' }, + filetypes = { 'nix' }, + root_dir = function(bufnr, on_dir) + on_dir(vim.fs.root(bufnr, '.git') or vim.uv.os_homedir()) + end, + settings = {}, + init_options = {}, +} diff --git a/.config/nvim/lsp/robotcode.lua b/.config/nvim/lsp/robotcode.lua new file mode 100644 index 0000000..a30722e --- /dev/null +++ b/.config/nvim/lsp/robotcode.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://robotcode.io +--- +--- RobotCode - Language Server Protocol implementation for Robot Framework. + +---@type vim.lsp.Config +return { + cmd = { 'robotcode', 'language-server' }, + filetypes = { 'robot', 'resource' }, + root_markers = { 'robot.toml', 'pyproject.toml', 'Pipfile', '.git' }, + get_language_id = function(_, _) + return 'robotframework' + end, +} diff --git a/.config/nvim/lsp/robotframework_ls.lua b/.config/nvim/lsp/robotframework_ls.lua new file mode 100644 index 0000000..53a9f4f --- /dev/null +++ b/.config/nvim/lsp/robotframework_ls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/robocorp/robotframework-lsp +--- +--- Language Server Protocol implementation for Robot Framework. + +---@type vim.lsp.Config +return { + cmd = { 'robotframework_ls' }, + filetypes = { 'robot' }, + root_markers = { 'robotidy.toml', 'pyproject.toml', 'conda.yaml', 'robot.yaml', '.git' }, +} diff --git a/.config/nvim/lsp/roc_ls.lua b/.config/nvim/lsp/roc_ls.lua new file mode 100644 index 0000000..fd0c00b --- /dev/null +++ b/.config/nvim/lsp/roc_ls.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://github.com/roc-lang/roc/tree/main/crates/language_server#roc_language_server +--- +--- The built-in language server for the Roc programming language. +--- [Installation](https://github.com/roc-lang/roc/tree/main/crates/language_server#installing) + +---@type vim.lsp.Config +return { + cmd = { 'roc_language_server' }, + filetypes = { 'roc' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/rome.lua b/.config/nvim/lsp/rome.lua new file mode 100644 index 0000000..d6c787e --- /dev/null +++ b/.config/nvim/lsp/rome.lua @@ -0,0 +1,25 @@ +---@brief +--- +--- https://rome.tools +--- +--- Language server for the Rome Frontend Toolchain. +--- +--- (Unmaintained, use [Biome](https://biomejs.dev/blog/annoucing-biome) instead.) +--- +--- ```sh +--- npm install [-g] rome +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'rome', 'lsp-proxy' }, + filetypes = { + 'javascript', + 'javascriptreact', + 'json', + 'typescript', + 'typescript.tsx', + 'typescriptreact', + }, + root_markers = { 'package.json', 'node_modules', '.git' }, +} diff --git a/.config/nvim/lsp/roslyn_ls.lua b/.config/nvim/lsp/roslyn_ls.lua new file mode 100644 index 0000000..6bc9cad --- /dev/null +++ b/.config/nvim/lsp/roslyn_ls.lua @@ -0,0 +1,250 @@ +---@brief +--- +--- https://github.com/dotnet/roslyn +-- +-- To install the server, compile from source or download as nuget package. +-- Go to `https://dev.azure.com/azure-public/vside/_artifacts/feed/vs-impl/NuGet/Microsoft.CodeAnalysis.LanguageServer./overview` +-- replace `` with one of the following `linux-x64`, `osx-x64`, `win-x64`, `neutral` (for more info on the download location see https://github.com/dotnet/roslyn/issues/71474#issuecomment-2177303207). +-- Download and extract it (nuget's are zip files). +-- - if you chose `neutral` nuget version, then you have to change the `cmd` like so: +-- ```lua +-- cmd = { +-- 'dotnet', +-- '/Microsoft.CodeAnalysis.LanguageServer.dll', +-- '--logLevel', -- this property is required by the server +-- 'Information', +-- '--extensionLogDirectory', -- this property is required by the server +-- fs.joinpath(uv.os_tmpdir(), 'roslyn_ls/logs'), +-- '--stdio', +-- }, +-- ``` +-- where `` has to be the folder you extracted the nuget package to. +-- - for all other platforms put the extracted folder to neovim's PATH (`vim.env.PATH`) + +local uv = vim.uv +local fs = vim.fs + +local group = vim.api.nvim_create_augroup('lspconfig.roslyn_ls', { clear = true }) + +---@param client vim.lsp.Client +---@param target string +local function on_init_sln(client, target) + vim.notify('Initializing: ' .. target, vim.log.levels.TRACE, { title = 'roslyn_ls' }) + ---@diagnostic disable-next-line: param-type-mismatch + client:notify('solution/open', { + solution = vim.uri_from_fname(target), + }) +end + +---@param client vim.lsp.Client +---@param project_files string[] +local function on_init_project(client, project_files) + vim.notify('Initializing: projects', vim.log.levels.TRACE, { title = 'roslyn_ls' }) + ---@diagnostic disable-next-line: param-type-mismatch + client:notify('project/open', { + projects = vim.tbl_map(function(file) + return vim.uri_from_fname(file) + end, project_files), + }) +end + +---@param client vim.lsp.Client +local function refresh_diagnostics(client) + for buf, _ in pairs(vim.lsp.get_client_by_id(client.id).attached_buffers) do + if vim.api.nvim_buf_is_loaded(buf) then + client:request( + vim.lsp.protocol.Methods.textDocument_diagnostic, + { textDocument = vim.lsp.util.make_text_document_params(buf) }, + nil, + buf + ) + end + end +end + +local function roslyn_handlers() + return { + ['workspace/projectInitializationComplete'] = function(_, _, ctx) + vim.notify('Roslyn project initialization complete', vim.log.levels.INFO, { title = 'roslyn_ls' }) + local client = assert(vim.lsp.get_client_by_id(ctx.client_id)) + refresh_diagnostics(client) + return vim.NIL + end, + ['workspace/_roslyn_projectNeedsRestore'] = function(_, result, ctx) + local client = assert(vim.lsp.get_client_by_id(ctx.client_id)) + + ---@diagnostic disable-next-line: param-type-mismatch + client:request('workspace/_roslyn_restore', result, function(err, response) + if err then + vim.notify(err.message, vim.log.levels.ERROR, { title = 'roslyn_ls' }) + end + if response then + for _, v in ipairs(response) do + vim.notify(v.message, vim.log.levels.INFO, { title = 'roslyn_ls' }) + end + end + end) + + return vim.NIL + end, + ['razor/provideDynamicFileInfo'] = function(_, _, _) + vim.notify( + 'Razor is not supported.\nPlease use https://github.com/tris203/rzls.nvim', + vim.log.levels.WARN, + { title = 'roslyn_ls' } + ) + return vim.NIL + end, + } +end + +---@type vim.lsp.Config +return { + name = 'roslyn_ls', + offset_encoding = 'utf-8', + cmd = { + 'Microsoft.CodeAnalysis.LanguageServer', + '--logLevel', + 'Information', + '--extensionLogDirectory', + fs.joinpath(uv.os_tmpdir(), 'roslyn_ls/logs'), + '--stdio', + }, + filetypes = { 'cs' }, + handlers = roslyn_handlers(), + + commands = { + ['roslyn.client.completionComplexEdit'] = function(command, ctx) + local client = assert(vim.lsp.get_client_by_id(ctx.client_id)) + local args = command.arguments or {} + local uri, edit = args[1], args[2] + + ---@diagnostic disable: undefined-field + if uri and edit and edit.newText and edit.range then + local workspace_edit = { + changes = { + [uri.uri] = { + { + range = edit.range, + newText = edit.newText, + }, + }, + }, + } + vim.lsp.util.apply_workspace_edit(workspace_edit, client.offset_encoding) + ---@diagnostic enable: undefined-field + else + vim.notify('roslyn_ls: completionComplexEdit args not understood: ' .. vim.inspect(args), vim.log.levels.WARN) + end + end, + }, + + root_dir = function(bufnr, cb) + local bufname = vim.api.nvim_buf_get_name(bufnr) + -- don't try to find sln or csproj for files from libraries + -- outside of the project + if not bufname:match('^' .. fs.joinpath('/tmp/MetadataAsSource/')) then + -- try find solutions root first + local root_dir = fs.root(bufnr, function(fname, _) + return fname:match('%.sln[x]?$') ~= nil + end) + + if not root_dir then + -- try find projects root + root_dir = fs.root(bufnr, function(fname, _) + return fname:match('%.csproj$') ~= nil + end) + end + + if root_dir then + cb(root_dir) + end + else + -- Decompiled code (example: "/tmp/MetadataAsSource/f2bfba/DecompilationMetadataAsSourceFileProvider/d5782a/Console.cs") + local prev_buf = vim.fn.bufnr('#') + local client = vim.lsp.get_clients({ + name = 'roslyn_ls', + bufnr = prev_buf ~= 1 and prev_buf or nil, + })[1] + if client then + cb(client.config.root_dir) + end + end + end, + on_init = { + function(client) + local root_dir = client.config.root_dir + + -- try load first solution we find + for entry, type in fs.dir(root_dir) do + if type == 'file' and (vim.endswith(entry, '.sln') or vim.endswith(entry, '.slnx')) then + on_init_sln(client, fs.joinpath(root_dir, entry)) + return + end + end + + -- if no solution is found load project + for entry, type in fs.dir(root_dir) do + if type == 'file' and vim.endswith(entry, '.csproj') then + on_init_project(client, { fs.joinpath(root_dir, entry) }) + end + end + end, + }, + + on_attach = function(client, bufnr) + -- avoid duplicate autocmds for same buffer + if vim.api.nvim_get_autocmds({ buffer = bufnr, group = group })[1] then + return + end + + vim.api.nvim_create_autocmd({ 'BufWritePost', 'InsertLeave' }, { + group = group, + buffer = bufnr, + callback = function() + refresh_diagnostics(client) + end, + desc = 'roslyn_ls: refresh diagnostics', + }) + end, + + capabilities = { + -- HACK: Doesn't show any diagnostics if we do not set this to true + textDocument = { + diagnostic = { + dynamicRegistration = true, + }, + }, + }, + settings = { + ['csharp|background_analysis'] = { + dotnet_analyzer_diagnostics_scope = 'fullSolution', + dotnet_compiler_diagnostics_scope = 'fullSolution', + }, + ['csharp|inlay_hints'] = { + csharp_enable_inlay_hints_for_implicit_object_creation = true, + csharp_enable_inlay_hints_for_implicit_variable_types = true, + csharp_enable_inlay_hints_for_lambda_parameter_types = true, + csharp_enable_inlay_hints_for_types = true, + dotnet_enable_inlay_hints_for_indexer_parameters = true, + dotnet_enable_inlay_hints_for_literal_parameters = true, + dotnet_enable_inlay_hints_for_object_creation_parameters = true, + dotnet_enable_inlay_hints_for_other_parameters = true, + dotnet_enable_inlay_hints_for_parameters = true, + dotnet_suppress_inlay_hints_for_parameters_that_differ_only_by_suffix = true, + dotnet_suppress_inlay_hints_for_parameters_that_match_argument_name = true, + dotnet_suppress_inlay_hints_for_parameters_that_match_method_intent = true, + }, + ['csharp|symbol_search'] = { + dotnet_search_reference_assemblies = true, + }, + ['csharp|completion'] = { + dotnet_show_name_completion_suggestions = true, + dotnet_show_completion_items_from_unimported_namespaces = true, + dotnet_provide_regex_completions = true, + }, + ['csharp|code_lens'] = { + dotnet_enable_references_code_lens = true, + }, + }, +} diff --git a/.config/nvim/lsp/rpmspec.lua b/.config/nvim/lsp/rpmspec.lua new file mode 100644 index 0000000..b953f75 --- /dev/null +++ b/.config/nvim/lsp/rpmspec.lua @@ -0,0 +1,19 @@ +---@brief +--- +--- https://github.com/dcermak/rpm-spec-language-server +--- +--- Language server protocol (LSP) support for RPM Spec files. +--- +--- `rpm-spec-language-server` can be installed by running, +--- +--- ```sh +--- pip install rpm-spec-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'rpm_lsp_server', '--stdio' }, + filetypes = { 'spec' }, + root_markers = { '.git' }, + settings = {}, +} diff --git a/.config/nvim/lsp/rubocop.lua b/.config/nvim/lsp/rubocop.lua new file mode 100644 index 0000000..e24e616 --- /dev/null +++ b/.config/nvim/lsp/rubocop.lua @@ -0,0 +1,10 @@ +---@brief +--- +--- https://github.com/rubocop/rubocop + +---@type vim.lsp.Config +return { + cmd = { 'rubocop', '--lsp' }, + filetypes = { 'ruby' }, + root_markers = { 'Gemfile', '.git' }, +} diff --git a/.config/nvim/lsp/ruby_lsp.lua b/.config/nvim/lsp/ruby_lsp.lua new file mode 100644 index 0000000..87e2f59 --- /dev/null +++ b/.config/nvim/lsp/ruby_lsp.lua @@ -0,0 +1,27 @@ +---@brief +--- +--- https://shopify.github.io/ruby-lsp/ +--- +--- This gem is an implementation of the language server protocol specification for +--- Ruby, used to improve editor features. +--- +--- Install the gem. There's no need to require it, since the server is used as a +--- standalone executable. +--- +--- ```sh +--- gem install ruby-lsp +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'ruby-lsp' }, + filetypes = { 'ruby', 'eruby' }, + root_markers = { 'Gemfile', '.git' }, + init_options = { + formatter = 'auto', + }, + reuse_client = function(client, config) + config.cmd_cwd = config.root_dir + return client.config.cmd_cwd == config.cmd_cwd + end, +} diff --git a/.config/nvim/lsp/ruff.lua b/.config/nvim/lsp/ruff.lua new file mode 100644 index 0000000..7fb61ea --- /dev/null +++ b/.config/nvim/lsp/ruff.lua @@ -0,0 +1,35 @@ +---@brief +--- +--- https://github.com/astral-sh/ruff +--- +--- A Language Server Protocol implementation for Ruff, an extremely fast Python linter and code formatter, written in Rust. It can be installed via `pip`. +--- +--- ```sh +--- pip install ruff +--- ``` +--- +--- **Available in Ruff `v0.4.5` in beta and stabilized in Ruff `v0.5.3`.** +--- +--- This is the new built-in language server written in Rust. It supports the same feature set as `ruff-lsp`, but with superior performance and no installation required. Note that the `ruff-lsp` server will continue to be maintained until further notice. +--- +--- Server settings can be provided via: +--- +--- ```lua +--- vim.lsp.config('ruff', { +--- init_options = { +--- settings = { +--- -- Server settings should go here +--- } +--- } +--- }) +--- ``` +--- +--- Refer to the [documentation](https://docs.astral.sh/ruff/editors/) for more details. + +---@type vim.lsp.Config +return { + cmd = { 'ruff', 'server' }, + filetypes = { 'python' }, + root_markers = { 'pyproject.toml', 'ruff.toml', '.ruff.toml', '.git' }, + settings = {}, +} diff --git a/.config/nvim/lsp/ruff_lsp.lua b/.config/nvim/lsp/ruff_lsp.lua new file mode 100644 index 0000000..59b093e --- /dev/null +++ b/.config/nvim/lsp/ruff_lsp.lua @@ -0,0 +1,30 @@ +---@brief +--- +--- https://github.com/astral-sh/ruff-lsp +--- +--- A Language Server Protocol implementation for Ruff, an extremely fast Python linter and code transformation tool, written in Rust. It can be installed via pip. +--- +--- ```sh +--- pip install ruff-lsp +--- ``` +--- +--- Extra CLI arguments for `ruff` can be provided via +--- +--- ```lua +--- vim.lsp.config('ruff_lsp', { +--- init_options = { +--- settings = { +--- -- Any extra CLI arguments for `ruff` go here. +--- args = {}, +--- } +--- } +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'ruff-lsp' }, + filetypes = { 'python' }, + root_markers = { 'pyproject.toml', 'ruff.toml', '.git' }, + settings = {}, +} diff --git a/.config/nvim/lsp/rumdl.lua b/.config/nvim/lsp/rumdl.lua new file mode 100644 index 0000000..29322f2 --- /dev/null +++ b/.config/nvim/lsp/rumdl.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/rvben/rumdl +--- +--- Markdown Linter and Formatter written in Rust. + +---@type vim.lsp.Config +return { + cmd = { 'rumdl', 'server' }, + filetypes = { 'markdown' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/rune_languageserver.lua b/.config/nvim/lsp/rune_languageserver.lua new file mode 100644 index 0000000..d893375 --- /dev/null +++ b/.config/nvim/lsp/rune_languageserver.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://crates.io/crates/rune-languageserver +--- +--- A language server for the [Rune](https://rune-rs.github.io/) Language, +--- an embeddable dynamic programming language for Rust + +---@type vim.lsp.Config +return { + cmd = { 'rune-languageserver' }, + filetypes = { 'rune' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/rust_analyzer.lua b/.config/nvim/lsp/rust_analyzer.lua new file mode 100644 index 0000000..c5eed51 --- /dev/null +++ b/.config/nvim/lsp/rust_analyzer.lua @@ -0,0 +1,163 @@ +---@brief +--- +--- https://github.com/rust-lang/rust-analyzer +--- +--- rust-analyzer (aka rls 2.0), a language server for Rust +--- +--- +--- See [docs](https://rust-analyzer.github.io/book/configuration.html) for extra settings. The settings can be used like this: +--- ```lua +--- vim.lsp.config('rust_analyzer', { +--- settings = { +--- ['rust-analyzer'] = { +--- diagnostics = { +--- enable = false; +--- } +--- } +--- } +--- }) +--- ``` +--- +--- Note: do not set `init_options` for this LS config, it will be automatically populated by the contents of settings["rust-analyzer"] per +--- https://github.com/rust-lang/rust-analyzer/blob/eb5da56d839ae0a9e9f50774fa3eb78eb0964550/docs/dev/lsp-extensions.md?plain=1#L26. + +local function reload_workspace(bufnr) + local clients = vim.lsp.get_clients { bufnr = bufnr, name = 'rust_analyzer' } + for _, client in ipairs(clients) do + vim.notify 'Reloading Cargo Workspace' + ---@diagnostic disable-next-line:param-type-mismatch + client:request('rust-analyzer/reloadWorkspace', nil, function(err) + if err then + error(tostring(err)) + end + vim.notify 'Cargo workspace reloaded' + end, 0) + end +end + +local function is_library(fname) + local user_home = vim.fs.normalize(vim.env.HOME) + local cargo_home = os.getenv 'CARGO_HOME' or user_home .. '/.cargo' + local registry = cargo_home .. '/registry/src' + local git_registry = cargo_home .. '/git/checkouts' + + local rustup_home = os.getenv 'RUSTUP_HOME' or user_home .. '/.rustup' + local toolchains = rustup_home .. '/toolchains' + + for _, item in ipairs { toolchains, registry, git_registry } do + if vim.fs.relpath(item, fname) then + local clients = vim.lsp.get_clients { name = 'rust_analyzer' } + return #clients > 0 and clients[#clients].config.root_dir or nil + end + end +end + +---@type vim.lsp.Config +return { + cmd = { 'rust-analyzer' }, + filetypes = { 'rust' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + local reused_dir = is_library(fname) + if reused_dir then + on_dir(reused_dir) + return + end + + local cargo_crate_dir = vim.fs.root(fname, { 'Cargo.toml' }) + local cargo_workspace_root + + if cargo_crate_dir == nil then + on_dir( + vim.fs.root(fname, { 'rust-project.json' }) + or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1]) + ) + return + end + + local cmd = { + 'cargo', + 'metadata', + '--no-deps', + '--format-version', + '1', + '--manifest-path', + cargo_crate_dir .. '/Cargo.toml', + } + + vim.system(cmd, { text = true }, function(output) + if output.code == 0 then + if output.stdout then + local result = vim.json.decode(output.stdout) + if result['workspace_root'] then + cargo_workspace_root = vim.fs.normalize(result['workspace_root']) + end + end + + on_dir(cargo_workspace_root or cargo_crate_dir) + else + vim.schedule(function() + vim.notify(('[rust_analyzer] cmd failed with code %d: %s\n%s'):format(output.code, cmd, output.stderr)) + end) + end + end) + end, + capabilities = { + experimental = { + serverStatusNotification = true, + commands = { + commands = { + 'rust-analyzer.showReferences', + 'rust-analyzer.runSingle', + 'rust-analyzer.debugSingle', + }, + }, + }, + }, + settings = { + ['rust-analyzer'] = { + lens = { + debug = { enable = true }, + enable = true, + implementations = { enable = true }, + references = { + adt = { enable = true }, + enumVariant = { enable = true }, + method = { enable = true }, + trait = { enable = true }, + }, + run = { enable = true }, + updateTest = { enable = true }, + }, + }, + }, + before_init = function(init_params, config) + -- See https://github.com/rust-lang/rust-analyzer/blob/eb5da56d839ae0a9e9f50774fa3eb78eb0964550/docs/dev/lsp-extensions.md?plain=1#L26 + if config.settings and config.settings['rust-analyzer'] then + init_params.initializationOptions = config.settings['rust-analyzer'] + end + ---@param command table{ title: string, command: string, arguments: any[] } + vim.lsp.commands['rust-analyzer.runSingle'] = function(command) + local r = command.arguments[1] + local cmd = { 'cargo', unpack(r.args.cargoArgs) } + if r.args.executableArgs and #r.args.executableArgs > 0 then + vim.list_extend(cmd, { '--', unpack(r.args.executableArgs) }) + end + + local proc = vim.system(cmd, { cwd = r.args.cwd }) + + local result = proc:wait() + + if result.code == 0 then + vim.notify(result.stdout, vim.log.levels.INFO) + else + vim.notify(result.stderr, vim.log.levels.ERROR) + end + end + end, + on_attach = function(_, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspCargoReload', function() + reload_workspace(bufnr) + end, { desc = 'Reload current cargo workspace' }) + end, +} diff --git a/.config/nvim/lsp/salt_ls.lua b/.config/nvim/lsp/salt_ls.lua new file mode 100644 index 0000000..6bbb1d2 --- /dev/null +++ b/.config/nvim/lsp/salt_ls.lua @@ -0,0 +1,16 @@ +---@brief +--- +--- Language server for Salt configuration files. +--- https://github.com/dcermak/salt-lsp +--- +--- The language server can be installed with `pip`: +--- ```sh +--- pip install salt-lsp +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'salt_lsp_server' }, + filetypes = { 'sls' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/scheme_langserver.lua b/.config/nvim/lsp/scheme_langserver.lua new file mode 100644 index 0000000..131dcd6 --- /dev/null +++ b/.config/nvim/lsp/scheme_langserver.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/ufo5260987423/scheme-langserver +--- `scheme-langserver`, a language server protocol implementation for scheme. +--- And for nvim user, please add .sls to scheme file extension list. + +---@type vim.lsp.Config +return { + cmd = { 'scheme-langserver', '~/.scheme-langserver.log', 'enable', 'disable' }, + filetypes = { 'scheme' }, + root_markers = { + 'Akku.manifest', + '.git', + }, +} diff --git a/.config/nvim/lsp/scry.lua b/.config/nvim/lsp/scry.lua new file mode 100644 index 0000000..77431d7 --- /dev/null +++ b/.config/nvim/lsp/scry.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/crystal-lang-tools/scry +--- +--- Crystal language server. + +---@type vim.lsp.Config +return { + cmd = { 'scry' }, + filetypes = { 'crystal' }, + root_markers = { 'shard.yml', '.git' }, +} diff --git a/.config/nvim/lsp/selene3p_ls.lua b/.config/nvim/lsp/selene3p_ls.lua new file mode 100644 index 0000000..0413b11 --- /dev/null +++ b/.config/nvim/lsp/selene3p_ls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/antonk52/lua-3p-language-servers +--- +--- 3rd party Language Server for Selene lua linter + +---@type vim.lsp.Config +return { + cmd = { 'selene-3p-language-server' }, + filetypes = { 'lua' }, + root_markers = { 'selene.toml' }, +} diff --git a/.config/nvim/lsp/serve_d.lua b/.config/nvim/lsp/serve_d.lua new file mode 100644 index 0000000..d0e00c6 --- /dev/null +++ b/.config/nvim/lsp/serve_d.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://github.com/Pure-D/serve-d +--- +--- Microsoft language server protocol implementation for D using workspace-d. +--- Download a binary from https://github.com/Pure-D/serve-d/releases and put it in your $PATH. + +---@type vim.lsp.Config +return { + cmd = { 'serve-d' }, + filetypes = { 'd' }, + root_markers = { 'dub.json', 'dub.sdl', '.git' }, +} diff --git a/.config/nvim/lsp/shopify_theme_ls.lua b/.config/nvim/lsp/shopify_theme_ls.lua new file mode 100644 index 0000000..8dc7b47 --- /dev/null +++ b/.config/nvim/lsp/shopify_theme_ls.lua @@ -0,0 +1,26 @@ +---@brief +--- +--- https://shopify.dev/docs/api/shopify-cli +--- +--- [Language Server](https://shopify.dev/docs/themes/tools/cli/language-server) and Theme Check (linter) for Shopify themes. +--- +--- `shopify` can be installed via npm `npm install -g @shopify/cli`. +--- +--- Note: This LSP already includes Theme Check so you don't need to use the `theme_check` server configuration as well. + +---@type vim.lsp.Config +return { + cmd = { + 'shopify', + 'theme', + 'language-server', + }, + filetypes = { 'liquid' }, + root_markers = { + '.shopifyignore', + '.theme-check.yml', + '.theme-check.yaml', + 'shopify.theme.toml', + }, + settings = {}, +} diff --git a/.config/nvim/lsp/sixtyfps.lua b/.config/nvim/lsp/sixtyfps.lua new file mode 100644 index 0000000..90cf478 --- /dev/null +++ b/.config/nvim/lsp/sixtyfps.lua @@ -0,0 +1,25 @@ +---@brief +--- +--- https://github.com/sixtyfpsui/sixtyfps +--- `SixtyFPS`'s language server +--- +--- You can build and install `sixtyfps-lsp` binary with `cargo`: +--- ```sh +--- cargo install sixtyfps-lsp +--- ``` +--- +--- Vim does not have built-in syntax for the `sixtyfps` filetype currently. +--- +--- This can be added via an autocmd: +--- +--- ```lua +--- vim.cmd [[ autocmd BufRead,BufNewFile *.60 set filetype=sixtyfps ]] +--- ``` +--- +--- or by installing a filetype plugin such as https://github.com/RustemB/sixtyfps-vim + +---@type vim.lsp.Config +return { + cmd = { 'sixtyfps-lsp' }, + filetypes = { 'sixtyfps' }, +} diff --git a/.config/nvim/lsp/slangd.lua b/.config/nvim/lsp/slangd.lua new file mode 100644 index 0000000..3208e3c --- /dev/null +++ b/.config/nvim/lsp/slangd.lua @@ -0,0 +1,31 @@ +---@brief +--- +--- https://github.com/shader-slang/slang +--- +--- The `slangd` binary can be downloaded as part of [slang releases](https://github.com/shader-slang/slang/releases) or +--- by [building `slang` from source](https://github.com/shader-slang/slang/blob/master/docs/building.md). +--- +--- The server can be configured by passing a "settings" object to vim.lsp.config('slangd'): +--- +--- ```lua +--- vim.lsp.config('slangd', { +--- settings = { +--- slang = { +--- predefinedMacros = {"MY_VALUE_MACRO=1"}, +--- inlayHints = { +--- deducedTypes = true, +--- parameterNames = true, +--- } +--- } +--- } +--- }) +--- ``` +--- Available options are documented [here](https://github.com/shader-slang/slang-vscode-extension/tree/main?tab=readme-ov-file#configurations) +--- or in more detail [here](https://github.com/shader-slang/slang-vscode-extension/blob/main/package.json#L70). + +---@type vim.lsp.Config +return { + cmd = { 'slangd' }, + filetypes = { 'hlsl', 'shaderslang' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/slint_lsp.lua b/.config/nvim/lsp/slint_lsp.lua new file mode 100644 index 0000000..dedc147 --- /dev/null +++ b/.config/nvim/lsp/slint_lsp.lua @@ -0,0 +1,24 @@ +---@brief +--- +--- https://github.com/slint-ui/slint +--- `Slint`'s language server +--- +--- You can build and install `slint-lsp` binary with `cargo`: +--- ```sh +--- cargo install slint-lsp +--- ``` +--- +--- Vim does not have built-in syntax for the `slint` filetype at this time. +--- +--- This can be added via an autocmd: +--- +--- ```lua +--- vim.cmd [[ autocmd BufRead,BufNewFile *.slint set filetype=slint ]] +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'slint-lsp' }, + filetypes = { 'slint' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/smarty_ls.lua b/.config/nvim/lsp/smarty_ls.lua new file mode 100644 index 0000000..26ddba7 --- /dev/null +++ b/.config/nvim/lsp/smarty_ls.lua @@ -0,0 +1,36 @@ +---@brief +--- +--- https://github.com/landeaux/vscode-smarty-langserver-extracted +--- +--- Language server for Smarty. +--- +--- `smarty-language-server` can be installed via `npm`: +--- +--- ```sh +--- npm i -g vscode-smarty-langserver-extracted +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'smarty-language-server', '--stdio' }, + filetypes = { 'smarty' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + local cwd = assert(vim.uv.cwd()) + local root = vim.fs.root(fname, { 'composer.json', '.git' }) + + -- prefer cwd if root is a descendant + on_dir(root and vim.fs.relpath(cwd, root) and cwd) + end, + settings = { + smarty = { + pluginDirs = {}, + }, + css = { + validate = true, + }, + }, + init_options = { + storageDir = vim.NIL, + }, +} diff --git a/.config/nvim/lsp/smithy_ls.lua b/.config/nvim/lsp/smithy_ls.lua new file mode 100644 index 0000000..7118e05 --- /dev/null +++ b/.config/nvim/lsp/smithy_ls.lua @@ -0,0 +1,44 @@ +---@brief +--- +--- https://github.com/awslabs/smithy-language-server +--- +--- "Smithy Language Server", a Language server for the Smithy IDL. +--- +--- smithy-language-server has no docs that say how to actually install it(?), so look at: +--- https://github.com/smithy-lang/smithy-vscode/blob/600cfcf0db65edce85f02e6d50f5fa2b0862bc8d/src/extension.ts#L78 +--- +--- Maven package: https://central.sonatype.com/artifact/software.amazon.smithy/smithy-language-server +--- +--- Installation: +--- 1. Install coursier, or any tool that can install maven packages. +--- ``` +--- brew install coursier +--- ``` +--- 2. The LS is auto-installed and launched by: +--- ``` +--- coursier launch software.amazon.smithy:smithy-language-server:0.7.0 +--- ``` + +---@type vim.lsp.Config +return { + -- pass 0 as the first argument to use STDIN/STDOUT for communication + cmd = { + 'coursier', + 'launch', + 'software.amazon.smithy:smithy-language-server:0.7.0', + '-M', + 'software.amazon.smithy.lsp.Main', + '--', + '0', + }, + filetypes = { 'smithy' }, + root_markers = { 'smithy-build.json', 'build.gradle', 'build.gradle.kts', '.git' }, + message_level = vim.lsp.protocol.MessageType.Log, + init_options = { + statusBarProvider = 'show-message', + isHttpEnabled = true, + compilerOptions = { + snippetAutoIndent = false, + }, + }, +} diff --git a/.config/nvim/lsp/snakeskin_ls.lua b/.config/nvim/lsp/snakeskin_ls.lua new file mode 100644 index 0000000..82a3eef --- /dev/null +++ b/.config/nvim/lsp/snakeskin_ls.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://www.npmjs.com/package/@snakeskin/cli +--- +--- `snakeskin cli` can be installed via `npm`: +--- ```sh +--- npm install -g @snakeskin/cli +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'snakeskin-cli', 'lsp', '--stdio' }, + filetypes = { 'ss' }, + root_markers = { 'package.json' }, +} diff --git a/.config/nvim/lsp/snyk_ls.lua b/.config/nvim/lsp/snyk_ls.lua new file mode 100644 index 0000000..32d0183 --- /dev/null +++ b/.config/nvim/lsp/snyk_ls.lua @@ -0,0 +1,29 @@ +---@brief +--- +--- https://github.com/snyk/snyk-ls +--- +--- LSP for Snyk Open Source, Snyk Infrastructure as Code, and Snyk Code. + +---@type vim.lsp.Config +return { + cmd = { 'snyk-ls' }, + root_markers = { '.git', '.snyk' }, + filetypes = { + 'go', + 'gomod', + 'javascript', + 'typescript', + 'json', + 'python', + 'requirements', + 'helm', + 'yaml', + 'terraform', + 'terraform-vars', + }, + settings = {}, + -- Configuration from https://github.com/snyk/snyk-ls#configuration-1 + init_options = { + activateSnykCode = 'true', + }, +} diff --git a/.config/nvim/lsp/solang.lua b/.config/nvim/lsp/solang.lua new file mode 100644 index 0000000..ab65531 --- /dev/null +++ b/.config/nvim/lsp/solang.lua @@ -0,0 +1,19 @@ +---@brief +--- +---A language server for Solidity +--- +--- See the [documentation](https://solang.readthedocs.io/en/latest/installing.html) for installation instructions. +--- +--- The language server only provides the following capabilities: +--- * Syntax highlighting +--- * Diagnostics +--- * Hover +--- +--- There is currently no support for completion, goto definition, references, or other functionality. + +---@type vim.lsp.Config +return { + cmd = { 'solang', 'language-server', '--target', 'evm' }, + filetypes = { 'solidity' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/solargraph.lua b/.config/nvim/lsp/solargraph.lua new file mode 100644 index 0000000..6f52195 --- /dev/null +++ b/.config/nvim/lsp/solargraph.lua @@ -0,0 +1,24 @@ +---@brief +--- +--- https://solargraph.org/ +--- +--- solargraph, a language server for Ruby +--- +--- You can install solargraph via gem install. +--- +--- ```sh +--- gem install --user-install solargraph +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'solargraph', 'stdio' }, + settings = { + solargraph = { + diagnostics = true, + }, + }, + init_options = { formatting = true }, + filetypes = { 'ruby' }, + root_markers = { 'Gemfile', '.git' }, +} diff --git a/.config/nvim/lsp/solc.lua b/.config/nvim/lsp/solc.lua new file mode 100644 index 0000000..aaa2dd1 --- /dev/null +++ b/.config/nvim/lsp/solc.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://docs.soliditylang.org/en/latest/installing-solidity.html +--- +--- solc is the native language server for the Solidity language. + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'solc', '--lsp' }, + filetypes = { 'solidity' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern('hardhat.config.*', '.git')(fname)) + end, +} diff --git a/.config/nvim/lsp/solidity.lua b/.config/nvim/lsp/solidity.lua new file mode 100644 index 0000000..cdcdbb5 --- /dev/null +++ b/.config/nvim/lsp/solidity.lua @@ -0,0 +1,42 @@ +---@brief +--- +--- https://github.com/qiuxiang/solidity-ls +--- +--- npm i solidity-ls -g +--- +--- Make sure that solc is installed and it's the same version of the file. solc-select is recommended. +--- +--- Solidity language server is a LSP with autocomplete, go to definition and diagnostics. +--- +--- If you use brownie, use this root_markers: +--- root_markers = { 'brownie-config.yaml', '.git' } +--- +--- on includePath, you can add an extra path to search for external libs, on remapping you can remap lib <> path, like: +--- +--- ```lua +--- { solidity = { includePath = '/Users/your_user/.brownie/packages/', remapping = { ["@OpenZeppelin/"] = 'OpenZeppelin/openzeppelin-contracts@4.6.0/' } } } +--- ``` +--- +--- **For brownie users** +--- Change the root_markers to: +--- +--- ```lua +--- root_markers = { 'brownie-config.yaml', '.git' } +--- ``` +--- +--- The best way of using it is to have a package.json in your project folder with the packages that you will use. +--- After installing with package.json, just create a `remappings.txt` with: +--- +--- ``` +--- @OpenZeppelin/=node_modules/OpenZeppelin/openzeppelin-contracts@4.6.0/ +--- ``` +--- +--- You can omit the node_modules as well. + +---@type vim.lsp.Config +return { + cmd = { 'solidity-ls', '--stdio' }, + filetypes = { 'solidity' }, + root_markers = { '.git', 'package.json' }, + settings = { solidity = { includePath = '', remapping = {} } }, +} diff --git a/.config/nvim/lsp/solidity_ls.lua b/.config/nvim/lsp/solidity_ls.lua new file mode 100644 index 0000000..207ff9b --- /dev/null +++ b/.config/nvim/lsp/solidity_ls.lua @@ -0,0 +1,28 @@ +---@brief +--- +--- https://github.com/juanfranblanco/vscode-solidity +--- +--- `vscode-solidity-server` can be installed via `npm`: +--- +--- ```sh +--- npm install -g vscode-solidity-server +--- ``` +--- +--- `vscode-solidity-server` is a language server for the Solidity language ported from the VSCode "solidity" extension. + +---@type vim.lsp.Config +return { + cmd = { 'vscode-solidity-server', '--stdio' }, + filetypes = { 'solidity' }, + root_markers = { + 'hardhat.config.js', + 'hardhat.config.ts', + 'foundry.toml', + 'remappings.txt', + 'truffle.js', + 'truffle-config.js', + 'ape-config.yaml', + '.git', + 'package.json', + }, +} diff --git a/.config/nvim/lsp/solidity_ls_nomicfoundation.lua b/.config/nvim/lsp/solidity_ls_nomicfoundation.lua new file mode 100644 index 0000000..7b14c13 --- /dev/null +++ b/.config/nvim/lsp/solidity_ls_nomicfoundation.lua @@ -0,0 +1,28 @@ +---@brief +--- +--- https://github.com/NomicFoundation/hardhat-vscode/blob/development/server/README.md +--- +--- `nomicfoundation-solidity-language-server` can be installed via `npm`: +--- +--- ```sh +--- npm install -g @nomicfoundation/solidity-language-server +--- ``` +--- +--- A language server for the Solidity programming language, built by the Nomic Foundation for the Ethereum community. + +---@type vim.lsp.Config +return { + cmd = { 'nomicfoundation-solidity-language-server', '--stdio' }, + filetypes = { 'solidity' }, + root_markers = { + 'hardhat.config.js', + 'hardhat.config.ts', + 'foundry.toml', + 'remappings.txt', + 'truffle.js', + 'truffle-config.js', + 'ape-config.yaml', + '.git', + 'package.json', + }, +} diff --git a/.config/nvim/lsp/somesass_ls.lua b/.config/nvim/lsp/somesass_ls.lua new file mode 100644 index 0000000..6f17952 --- /dev/null +++ b/.config/nvim/lsp/somesass_ls.lua @@ -0,0 +1,30 @@ +---@brief +--- +--- https://github.com/wkillerud/some-sass/tree/main/packages/language-server +--- +--- `some-sass-language-server` can be installed via `npm`: +--- +--- ```sh +--- npm i -g some-sass-language-server +--- ``` +--- +--- The language server provides: +--- +--- - Full support for @use and @forward, including aliases, prefixes and hiding. +--- - Workspace-wide code navigation and refactoring, such as Rename Symbol. +--- - Rich documentation through SassDoc. +--- - Language features for %placeholder-selectors, both when using them and writing them. +--- - Suggestions and hover info for built-in Sass modules, when used with @use. + +---@type vim.lsp.Config +return { + name = 'somesass_ls', + cmd = { 'some-sass-language-server', '--stdio' }, + filetypes = { 'scss', 'sass' }, + root_markers = { '.git', '.package.json' }, + settings = { + somesass = { + suggestAllFromOpenDocument = true, + }, + }, +} diff --git a/.config/nvim/lsp/sorbet.lua b/.config/nvim/lsp/sorbet.lua new file mode 100644 index 0000000..fe4dee6 --- /dev/null +++ b/.config/nvim/lsp/sorbet.lua @@ -0,0 +1,19 @@ +---@brief +--- +--- https://sorbet.org +--- +--- Sorbet is a fast, powerful type checker designed for Ruby. +--- +--- You can install Sorbet via gem install. You might also be interested in how to set +--- Sorbet up for new projects: https://sorbet.org/docs/adopting. +--- +--- ```sh +--- gem install sorbet +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'srb', 'tc', '--lsp' }, + filetypes = { 'ruby' }, + root_markers = { 'Gemfile', '.git' }, +} diff --git a/.config/nvim/lsp/sourcekit.lua b/.config/nvim/lsp/sourcekit.lua new file mode 100644 index 0000000..65e8555 --- /dev/null +++ b/.config/nvim/lsp/sourcekit.lua @@ -0,0 +1,40 @@ +---@brief +--- +--- https://github.com/swiftlang/sourcekit-lsp +--- +--- Language server for Swift and C/C++/Objective-C. + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'sourcekit-lsp' }, + filetypes = { 'swift', 'objc', 'objcpp', 'c', 'cpp' }, + root_dir = function(bufnr, on_dir) + local filename = vim.api.nvim_buf_get_name(bufnr) + on_dir( + util.root_pattern('buildServer.json', '.bsp')(filename) + or util.root_pattern('*.xcodeproj', '*.xcworkspace')(filename) + -- better to keep it at the end, because some modularized apps contain multiple Package.swift files + or util.root_pattern('compile_commands.json', 'Package.swift')(filename) + or vim.fs.dirname(vim.fs.find('.git', { path = filename, upward = true })[1]) + ) + end, + get_language_id = function(_, ftype) + local t = { objc = 'objective-c', objcpp = 'objective-cpp' } + return t[ftype] or ftype + end, + capabilities = { + workspace = { + didChangeWatchedFiles = { + dynamicRegistration = true, + }, + }, + textDocument = { + diagnostic = { + dynamicRegistration = true, + relatedDocumentSupport = true, + }, + }, + }, +} diff --git a/.config/nvim/lsp/spectral.lua b/.config/nvim/lsp/spectral.lua new file mode 100644 index 0000000..599a773 --- /dev/null +++ b/.config/nvim/lsp/spectral.lua @@ -0,0 +1,22 @@ +---@brief +--- +--- https://github.com/luizcorreia/spectral-language-server +--- `A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v2 & v3.` +--- +--- `spectral-language-server` can be installed via `npm`: +--- ```sh +--- npm i -g spectral-language-server +--- ``` +--- See [vscode-spectral](https://github.com/stoplightio/vscode-spectral#extension-settings) for configuration options. + +---@type vim.lsp.Config +return { + cmd = { 'spectral-language-server', '--stdio' }, + filetypes = { 'yaml', 'json', 'yml' }, + root_markers = { '.spectral.yaml', '.spectral.yml', '.spectral.json', '.spectral.js' }, + settings = { + enable = true, + run = 'onType', + validateLanguages = { 'yaml', 'json', 'yml' }, + }, +} diff --git a/.config/nvim/lsp/spyglassmc_language_server.lua b/.config/nvim/lsp/spyglassmc_language_server.lua new file mode 100644 index 0000000..61d7205 --- /dev/null +++ b/.config/nvim/lsp/spyglassmc_language_server.lua @@ -0,0 +1,24 @@ +---@brief +--- +--- https://github.com/SpyglassMC/Spyglass/tree/main/packages/language-server +--- +--- Language server for Minecraft datapacks. +--- +--- `spyglassmc-language-server` can be installed via `npm`: +--- +--- ```sh +--- npm i -g @spyglassmc/language-server +--- ``` +--- +--- You may also need to configure the filetype: +--- +--- `autocmd BufNewFile,BufRead *.mcfunction set filetype=mcfunction` +--- +--- This is automatically done by [CrystalAlpha358/vim-mcfunction](https://github.com/CrystalAlpha358/vim-mcfunction), which also provide syntax highlight. + +---@type vim.lsp.Config +return { + cmd = { 'spyglassmc-language-server', '--stdio' }, + filetypes = { 'mcfunction' }, + root_markers = { 'pack.mcmeta' }, +} diff --git a/.config/nvim/lsp/sqlls.lua b/.config/nvim/lsp/sqlls.lua new file mode 100644 index 0000000..04e6d61 --- /dev/null +++ b/.config/nvim/lsp/sqlls.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://github.com/joe-re/sql-language-server +--- +--- This LSP can be installed via `npm`. Find further instructions on manual installation of the sql-language-server at [joe-re/sql-language-server](https://github.com/joe-re/sql-language-server). + +---@type vim.lsp.Config +return { + cmd = { 'sql-language-server', 'up', '--method', 'stdio' }, + filetypes = { 'sql', 'mysql' }, + root_markers = { '.sqllsrc.json' }, + settings = {}, +} diff --git a/.config/nvim/lsp/sqls.lua b/.config/nvim/lsp/sqls.lua new file mode 100644 index 0000000..994c45e --- /dev/null +++ b/.config/nvim/lsp/sqls.lua @@ -0,0 +1,19 @@ +---@brief +--- +--- https://github.com/sqls-server/sqls +--- +--- ```lua +--- vim.lsp.config('sqls', { +--- cmd = {"path/to/command", "-config", "path/to/config.yml"}; +--- ... +--- }) +--- ``` +--- Sqls can be installed via `go install github.com/sqls-server/sqls@latest`. Instructions for compiling Sqls from the source can be found at [sqls-server/sqls](https://github.com/sqls-server/sqls). + +---@type vim.lsp.Config +return { + cmd = { 'sqls' }, + filetypes = { 'sql', 'mysql' }, + root_markers = { 'config.yml' }, + settings = {}, +} diff --git a/.config/nvim/lsp/sqruff.lua b/.config/nvim/lsp/sqruff.lua new file mode 100644 index 0000000..5f87919 --- /dev/null +++ b/.config/nvim/lsp/sqruff.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://github.com/quarylabs/sqruff +--- +--- `sqruff` can be installed by following the instructions [here](https://github.com/quarylabs/sqruff?tab=readme-ov-file#installation) +--- + +---@type vim.lsp.Config +return { + cmd = { 'sqruff', 'lsp' }, + filetypes = { 'sql' }, + root_markers = { '.sqruff', '.git' }, +} diff --git a/.config/nvim/lsp/standardrb.lua b/.config/nvim/lsp/standardrb.lua new file mode 100644 index 0000000..25a94aa --- /dev/null +++ b/.config/nvim/lsp/standardrb.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/testdouble/standard +--- +--- Ruby Style Guide, with linter & automatic code fixer. + +---@type vim.lsp.Config +return { + cmd = { 'standardrb', '--lsp' }, + filetypes = { 'ruby' }, + root_markers = { 'Gemfile', '.git' }, +} diff --git a/.config/nvim/lsp/starlark_rust.lua b/.config/nvim/lsp/starlark_rust.lua new file mode 100644 index 0000000..78980db --- /dev/null +++ b/.config/nvim/lsp/starlark_rust.lua @@ -0,0 +1,16 @@ +---@brief +--- +--- https://github.com/facebookexperimental/starlark-rust/ +--- The LSP part of `starlark-rust` is not currently documented, +--- but the implementation works well for linting. +--- This gives valuable warnings for potential issues in the code, +--- but does not support refactorings. +--- +--- It can be installed with cargo: https://crates.io/crates/starlark + +---@type vim.lsp.Config +return { + cmd = { 'starlark', '--lsp' }, + filetypes = { 'star', 'bzl', 'BUILD.bazel' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/starpls.lua b/.config/nvim/lsp/starpls.lua new file mode 100644 index 0000000..921ed71 --- /dev/null +++ b/.config/nvim/lsp/starpls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/withered-magic/starpls +--- +--- `starpls` is an LSP implementation for Starlark. Installation instructions can be found in the project's README. + +---@type vim.lsp.Config +return { + cmd = { 'starpls' }, + filetypes = { 'bzl' }, + root_markers = { 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel' }, +} diff --git a/.config/nvim/lsp/statix.lua b/.config/nvim/lsp/statix.lua new file mode 100644 index 0000000..5c1ef32 --- /dev/null +++ b/.config/nvim/lsp/statix.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/nerdypepper/statix +--- +--- lints and suggestions for the nix programming language + +---@type vim.lsp.Config +return { + cmd = { 'statix', 'check', '--stdin' }, + filetypes = { 'nix' }, + root_markers = { 'flake.nix', '.git' }, +} diff --git a/.config/nvim/lsp/steep.lua b/.config/nvim/lsp/steep.lua new file mode 100644 index 0000000..a617101 --- /dev/null +++ b/.config/nvim/lsp/steep.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/soutaro/steep +--- +--- `steep` is a static type checker for Ruby. +--- +--- You need `Steepfile` to make it work. Generate it with `steep init`. + +---@type vim.lsp.Config +return { + cmd = { 'steep', 'langserver' }, + filetypes = { 'ruby', 'eruby' }, + root_markers = { 'Steepfile', '.git' }, +} diff --git a/.config/nvim/lsp/stimulus_ls.lua b/.config/nvim/lsp/stimulus_ls.lua new file mode 100644 index 0000000..8319334 --- /dev/null +++ b/.config/nvim/lsp/stimulus_ls.lua @@ -0,0 +1,22 @@ +---@brief +--- +--- https://www.npmjs.com/package/stimulus-language-server +--- +--- `stimulus-lsp` can be installed via `npm`: +--- +--- ```sh +--- npm install -g stimulus-language-server +--- ``` +--- +--- or via `yarn`: +--- +--- ```sh +--- yarn global add stimulus-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'stimulus-language-server', '--stdio' }, + filetypes = { 'html', 'ruby', 'eruby', 'blade', 'php' }, + root_markers = { 'Gemfile', '.git' }, +} diff --git a/.config/nvim/lsp/stylelint_lsp.lua b/.config/nvim/lsp/stylelint_lsp.lua new file mode 100644 index 0000000..d17d295 --- /dev/null +++ b/.config/nvim/lsp/stylelint_lsp.lua @@ -0,0 +1,55 @@ +---@brief +--- +--- https://github.com/bmatcuk/stylelint-lsp +--- +--- `stylelint-lsp` can be installed via `npm`: +--- +--- ```sh +--- npm i -g stylelint-lsp +--- ``` +--- +--- Can be configured by passing a `settings.stylelintplus` object to vim.lsp.config('stylelint_lsp'): +--- +--- ```lua +--- vim.lsp.config('stylelint_lsp', { +--- settings = { +--- stylelintplus = { +--- -- see available options in stylelint-lsp documentation +--- } +--- } +--- }) +--- ``` + +local util = require 'lspconfig.util' + +local root_file = { + '.stylelintrc', + '.stylelintrc.mjs', + '.stylelintrc.cjs', + '.stylelintrc.js', + '.stylelintrc.json', + '.stylelintrc.yaml', + '.stylelintrc.yml', + 'stylelint.config.mjs', + 'stylelint.config.cjs', + 'stylelint.config.js', +} + +root_file = util.insert_package_json(root_file, 'stylelint') + +---@type vim.lsp.Config +return { + cmd = { 'stylelint-lsp', '--stdio' }, + filetypes = { + 'astro', + 'css', + 'html', + 'less', + 'scss', + 'sugarss', + 'vue', + 'wxss', + }, + root_markers = root_file, + settings = {}, +} diff --git a/.config/nvim/lsp/stylua.lua b/.config/nvim/lsp/stylua.lua new file mode 100644 index 0000000..33f7608 --- /dev/null +++ b/.config/nvim/lsp/stylua.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/JohnnyMorganz/StyLua +--- +--- A deterministic code formatter for Lua 5.1, 5.2, 5.3, 5.4, LuaJIT, Luau and CfxLua/FiveM Lua + +---@type vim.lsp.Config +return { + cmd = { 'stylua', '--lsp' }, + filetypes = { 'lua' }, + root_markers = { '.stylua.toml', 'stylua.toml', '.editorconfig' }, +} diff --git a/.config/nvim/lsp/stylua3p_ls.lua b/.config/nvim/lsp/stylua3p_ls.lua new file mode 100644 index 0000000..693e792 --- /dev/null +++ b/.config/nvim/lsp/stylua3p_ls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/antonk52/lua-3p-language-servers +--- +--- 3rd party Language Server for Stylua lua formatter + +---@type vim.lsp.Config +return { + cmd = { 'stylua-3p-language-server' }, + filetypes = { 'lua' }, + root_markers = { '.stylua.toml', 'stylua.toml' }, +} diff --git a/.config/nvim/lsp/superhtml.lua b/.config/nvim/lsp/superhtml.lua new file mode 100644 index 0000000..522b62b --- /dev/null +++ b/.config/nvim/lsp/superhtml.lua @@ -0,0 +1,24 @@ +---@brief +--- +--- https://github.com/kristoff-it/superhtml +--- +--- HTML Language Server & Templating Language Library +--- +--- This LSP is designed to tightly adhere to the HTML spec as well as enforcing +--- some additional rules that ensure HTML clarity. +--- +--- If you want to disable HTML support for another HTML LSP, add the following +--- to your configuration: +--- +--- ```lua +--- vim.lsp.config('superhtml', { +--- filetypes = { 'superhtml' } +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'superhtml', 'lsp' }, + filetypes = { 'superhtml', 'html' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/svelte.lua b/.config/nvim/lsp/svelte.lua new file mode 100644 index 0000000..bf56236 --- /dev/null +++ b/.config/nvim/lsp/svelte.lua @@ -0,0 +1,48 @@ +---@brief +--- +--- https://github.com/sveltejs/language-tools/tree/master/packages/language-server +--- +--- Note: assuming that [ts_ls](#ts_ls) is setup, full JavaScript/TypeScript support (find references, rename, etc of symbols in Svelte files when working in JS/TS files) requires per-project installation and configuration of [typescript-svelte-plugin](https://github.com/sveltejs/language-tools/tree/master/packages/typescript-plugin#usage). +--- +--- `svelte-language-server` can be installed via `npm`: +--- ```sh +--- npm install -g svelte-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'svelteserver', '--stdio' }, + filetypes = { 'svelte' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + -- Svelte LSP only supports file:// schema. https://github.com/sveltejs/language-tools/issues/2777 + if vim.uv.fs_stat(fname) ~= nil then + local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock', 'deno.lock' } + root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } } + or vim.list_extend(root_markers, { '.git' }) + -- We fallback to the current working directory if no project root is found + local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd() + on_dir(project_root) + end + end, + on_attach = function(client, bufnr) + -- Workaround to trigger reloading JS/TS files + -- See https://github.com/sveltejs/language-tools/issues/2008 + vim.api.nvim_create_autocmd('BufWritePost', { + pattern = { '*.js', '*.ts' }, + group = vim.api.nvim_create_augroup('lspconfig.svelte', {}), + callback = function(ctx) + -- internal API to sync changes that have not yet been saved to the file system + ---@diagnostic disable-next-line: param-type-mismatch + client:notify('$/onDidChangeTsOrJsFile', { uri = ctx.match }) + end, + }) + vim.api.nvim_buf_create_user_command(bufnr, 'LspMigrateToSvelte5', function() + client:exec_cmd({ + title = 'Migrate Component to Svelte 5 Syntax', + command = 'migrate_to_svelte_5', + arguments = { vim.uri_from_bufnr(bufnr) }, + }) + end, { desc = 'Migrate Component to Svelte 5 Syntax' }) + end, +} diff --git a/.config/nvim/lsp/svlangserver.lua b/.config/nvim/lsp/svlangserver.lua new file mode 100644 index 0000000..83fc35b --- /dev/null +++ b/.config/nvim/lsp/svlangserver.lua @@ -0,0 +1,42 @@ +---@brief +--- +--- https://github.com/imc-trading/svlangserver +--- +--- Language server for SystemVerilog. +--- +--- `svlangserver` can be installed via `npm`: +--- +--- ```sh +--- $ npm install -g @imc-trading/svlangserver +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'svlangserver' }, + filetypes = { 'verilog', 'systemverilog' }, + root_markers = { '.svlangserver', '.git' }, + settings = { + systemverilog = { + includeIndexing = { '*.{v,vh,sv,svh}', '**/*.{v,vh,sv,svh}' }, + }, + }, + on_attach = function(client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspSvlangserverBuildIndex', function() + client:exec_cmd({ + title = 'Build Index', + command = 'systemverilog.build_index', + }, { bufnr = bufnr }) + end, { + desc = 'Instructs language server to rerun indexing', + }) + vim.api.nvim_buf_create_user_command(bufnr, 'LspSvlangserverReportHierarchy', function() + client:exec_cmd({ + title = 'Build Index', + command = 'systemverilog.build_index', + arguments = { vim.fn.expand '' }, + }, { bufnr = bufnr }) + end, { + desc = 'Generates hierarchy for the given module', + }) + end, +} diff --git a/.config/nvim/lsp/svls.lua b/.config/nvim/lsp/svls.lua new file mode 100644 index 0000000..4fea117 --- /dev/null +++ b/.config/nvim/lsp/svls.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/dalance/svls +--- +--- Language server for verilog and SystemVerilog +--- +--- `svls` can be installed via `cargo`: +--- ```sh +--- cargo install svls +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'svls' }, + filetypes = { 'verilog', 'systemverilog' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/swift_mesonls.lua b/.config/nvim/lsp/swift_mesonls.lua new file mode 100644 index 0000000..f2670d7 --- /dev/null +++ b/.config/nvim/lsp/swift_mesonls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/JCWasmx86/Swift-MesonLSP +--- +--- Meson language server written in Swift + +---@type vim.lsp.Config +return { + cmd = { 'Swift-MesonLSP', '--lsp' }, + filetypes = { 'meson' }, + root_markers = { 'meson.build', 'meson_options.txt', 'meson.options', '.git' }, +} diff --git a/.config/nvim/lsp/syntax_tree.lua b/.config/nvim/lsp/syntax_tree.lua new file mode 100644 index 0000000..ece52e4 --- /dev/null +++ b/.config/nvim/lsp/syntax_tree.lua @@ -0,0 +1,21 @@ +---@brief +--- +--- https://ruby-syntax-tree.github.io/syntax_tree/ +--- +--- A fast Ruby parser and formatter. +--- +--- Syntax Tree is a suite of tools built on top of the internal CRuby parser. It +--- provides the ability to generate a syntax tree from source, as well as the +--- tools necessary to inspect and manipulate that syntax tree. It can be used to +--- build formatters, linters, language servers, and more. +--- +--- ```sh +--- gem install syntax_tree +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'stree', 'lsp' }, + filetypes = { 'ruby' }, + root_markers = { '.streerc', 'Gemfile', '.git' }, +} diff --git a/.config/nvim/lsp/systemd_ls.lua b/.config/nvim/lsp/systemd_ls.lua new file mode 100644 index 0000000..9bea066 --- /dev/null +++ b/.config/nvim/lsp/systemd_ls.lua @@ -0,0 +1,8 @@ +---@brief +--- +--- Renamed to [systemd_lsp](#systemd_lsp) + +vim.deprecate('systemd_ls', 'systemd_lsp', '2.0.0', 'nvim-lspconfig', false) + +---@type vim.lsp.Config +return vim.lsp.config.systemd_lsp diff --git a/.config/nvim/lsp/systemd_lsp.lua b/.config/nvim/lsp/systemd_lsp.lua new file mode 100644 index 0000000..61a6639 --- /dev/null +++ b/.config/nvim/lsp/systemd_lsp.lua @@ -0,0 +1,20 @@ +---@brief +--- +--- https://github.com/JFryy/systemd-lsp +--- +--- A Language Server Protocol (LSP) implementation for Systemd unit files, +--- providing editing support with syntax highlighting, +--- diagnostics, autocompletion, and documentation. +--- +--- `systemd-lsp` can be installed via `cargo`: +--- ```sh +--- cargo install systemd-lsp +--- ``` +--- +--- A language server implementation for Systemd unit files made in Rust. + +---@type vim.lsp.Config +return { + cmd = { 'systemd-lsp' }, + filetypes = { 'systemd' }, +} diff --git a/.config/nvim/lsp/tabby_ml.lua b/.config/nvim/lsp/tabby_ml.lua new file mode 100644 index 0000000..e21db46 --- /dev/null +++ b/.config/nvim/lsp/tabby_ml.lua @@ -0,0 +1,18 @@ +---@brief +--- +--- https://tabby.tabbyml.com/blog/running-tabby-as-a-language-server +--- +--- Language server for Tabby, an opensource, self-hosted AI coding assistant. +--- +--- `tabby-agent` can be installed via `npm`: +--- +--- ```sh +--- npm install --global tabby-agent +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'tabby-agent', '--lsp', '--stdio' }, + filetypes = {}, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/tailwindcss.lua b/.config/nvim/lsp/tailwindcss.lua new file mode 100644 index 0000000..b34d86e --- /dev/null +++ b/.config/nvim/lsp/tailwindcss.lua @@ -0,0 +1,142 @@ +---@brief +--- https://github.com/tailwindlabs/tailwindcss-intellisense +--- +--- Tailwind CSS Language Server can be installed via npm: +--- +--- npm install -g @tailwindcss/language-server +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'tailwindcss-language-server', '--stdio' }, + -- filetypes copied and adjusted from tailwindcss-intellisense + filetypes = { + -- html + 'aspnetcorerazor', + 'astro', + 'astro-markdown', + 'blade', + 'clojure', + 'django-html', + 'htmldjango', + 'edge', + 'eelixir', -- vim ft + 'elixir', + 'ejs', + 'erb', + 'eruby', -- vim ft + 'gohtml', + 'gohtmltmpl', + 'haml', + 'handlebars', + 'hbs', + 'html', + 'htmlangular', + 'html-eex', + 'heex', + 'jade', + 'leaf', + 'liquid', + 'markdown', + 'mdx', + 'mustache', + 'njk', + 'nunjucks', + 'php', + 'razor', + 'slim', + 'twig', + -- css + 'css', + 'less', + 'postcss', + 'sass', + 'scss', + 'stylus', + 'sugarss', + -- js + 'javascript', + 'javascriptreact', + 'reason', + 'rescript', + 'typescript', + 'typescriptreact', + -- mixed + 'vue', + 'svelte', + 'templ', + }, + capabilities = { + workspace = { + didChangeWatchedFiles = { + dynamicRegistration = true, + }, + }, + }, + settings = { + tailwindCSS = { + validate = true, + lint = { + cssConflict = 'warning', + invalidApply = 'error', + invalidScreen = 'error', + invalidVariant = 'error', + invalidConfigPath = 'error', + invalidTailwindDirective = 'error', + recommendedVariantOrder = 'warning', + }, + classAttributes = { + 'class', + 'className', + 'class:list', + 'classList', + 'ngClass', + }, + includeLanguages = { + eelixir = 'html-eex', + elixir = 'phoenix-heex', + eruby = 'erb', + heex = 'phoenix-heex', + htmlangular = 'html', + templ = 'html', + }, + }, + }, + before_init = function(_, config) + if not config.settings then + config.settings = {} + end + if not config.settings.editor then + config.settings.editor = {} + end + if not config.settings.editor.tabSize then + config.settings.editor.tabSize = vim.lsp.util.get_effective_tabstop() + end + end, + workspace_required = true, + root_dir = function(bufnr, on_dir) + local root_files = { + -- Generic + 'tailwind.config.js', + 'tailwind.config.cjs', + 'tailwind.config.mjs', + 'tailwind.config.ts', + 'postcss.config.js', + 'postcss.config.cjs', + 'postcss.config.mjs', + 'postcss.config.ts', + -- Django + 'theme/static_src/tailwind.config.js', + 'theme/static_src/tailwind.config.cjs', + 'theme/static_src/tailwind.config.mjs', + 'theme/static_src/tailwind.config.ts', + 'theme/static_src/postcss.config.js', + -- Fallback for tailwind v4, where tailwind.config.* is not required anymore + '.git', + } + local fname = vim.api.nvim_buf_get_name(bufnr) + root_files = util.insert_package_json(root_files, 'tailwindcss', fname) + root_files = util.root_markers_with_field(root_files, { 'mix.lock', 'Gemfile.lock' }, 'tailwind', fname) + on_dir(vim.fs.dirname(vim.fs.find(root_files, { path = fname, upward = true })[1])) + end, +} diff --git a/.config/nvim/lsp/taplo.lua b/.config/nvim/lsp/taplo.lua new file mode 100644 index 0000000..694fafa --- /dev/null +++ b/.config/nvim/lsp/taplo.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://taplo.tamasfe.dev/cli/usage/language-server.html +--- +--- Language server for Taplo, a TOML toolkit. +--- +--- `taplo-cli` can be installed via `cargo`: +--- ```sh +--- cargo install --features lsp --locked taplo-cli +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'taplo', 'lsp', 'stdio' }, + filetypes = { 'toml' }, + root_markers = { '.taplo.toml', 'taplo.toml', '.git' }, +} diff --git a/.config/nvim/lsp/tblgen_lsp_server.lua b/.config/nvim/lsp/tblgen_lsp_server.lua new file mode 100644 index 0000000..fff3196 --- /dev/null +++ b/.config/nvim/lsp/tblgen_lsp_server.lua @@ -0,0 +1,28 @@ +---@brief +--- +--- https://mlir.llvm.org/docs/Tools/MLIRLSP/#tablegen-lsp-language-server--tblgen-lsp-server +--- +--- The Language Server for the LLVM TableGen language +--- +--- `tblgen-lsp-server` can be installed at the llvm-project repository (https://github.com/llvm/llvm-project) + +local function get_command() + local cmd = { 'tblgen-lsp-server' } + local files = vim.fs.find( + { 'tablegen_compile_commands.yml', 'build/tablegen_compile_commands.yml' }, + { path = vim.fn.expand('%:p:h'), upward = true, type = 'file' } + ) + if #files > 0 then + local file = files[1] + table.insert(cmd, '--tablegen-compilation-database=' .. file) + end + + return cmd +end + +---@type vim.lsp.Config +return { + cmd = get_command(), + filetypes = { 'tablegen' }, + root_markers = { 'tablegen_compile_commands.yml', '.git' }, +} diff --git a/.config/nvim/lsp/tclsp.lua b/.config/nvim/lsp/tclsp.lua new file mode 100644 index 0000000..7560ea6 --- /dev/null +++ b/.config/nvim/lsp/tclsp.lua @@ -0,0 +1,22 @@ +---@brief +--- +--- https://github.com/nmoroze/tclint +--- +--- `tclsp`, a language server for Tcl +--- +--- `tclsp` can be installed via `pipx`: +--- ```sh +--- pipx install tclint +--- ``` +--- +--- Or via `pip`: +--- ```sh +--- pip install tclint +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'tclsp' }, + filetypes = { 'tcl', 'sdc', 'xdc', 'upf' }, + root_markers = { 'tclint.toml', '.tclint', 'pyproject.toml', '.git' }, +} diff --git a/.config/nvim/lsp/teal_ls.lua b/.config/nvim/lsp/teal_ls.lua new file mode 100644 index 0000000..f68a5a7 --- /dev/null +++ b/.config/nvim/lsp/teal_ls.lua @@ -0,0 +1,24 @@ +---@brief +--- +--- https://github.com/teal-language/teal-language-server +--- +--- Install with: +--- ``` +--- luarocks install teal-language-server +--- ``` +--- +--- Optional Command Args: +--- * "--log-mode=by_date" - Enable logging in $HOME/.cache/teal-language-server. Log name will be date + pid of process +--- * "--log-mode=by_proj_path" - Enable logging in $HOME/.cache/teal-language-server. Log name will be project path + pid of process +--- * "--verbose=true" - Increases log level. Does nothing unless log-mode is set + +---@type vim.lsp.Config +return { + cmd = { + 'teal-language-server', + }, + filetypes = { + 'teal', + }, + root_markers = { 'tlconfig.lua' }, +} diff --git a/.config/nvim/lsp/templ.lua b/.config/nvim/lsp/templ.lua new file mode 100644 index 0000000..f5333cd --- /dev/null +++ b/.config/nvim/lsp/templ.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://templ.guide +--- +--- The official language server for the templ HTML templating language. + +---@type vim.lsp.Config +return { + cmd = { 'templ', 'lsp' }, + filetypes = { 'templ' }, + root_markers = { 'go.work', 'go.mod', '.git' }, +} diff --git a/.config/nvim/lsp/termux_language_server.lua b/.config/nvim/lsp/termux_language_server.lua new file mode 100644 index 0000000..3294ae0 --- /dev/null +++ b/.config/nvim/lsp/termux_language_server.lua @@ -0,0 +1,33 @@ +---@brief +--- +--- https://github.com/termux/termux-language-server +--- +--- Language server for various bash scripts such as Arch PKGBUILD, Gentoo ebuild, Termux build.sh, etc. + +local util = require('lspconfig').util + +---@type vim.lsp.Config +return { + cmd = { 'termux-language-server' }, + root_dir = function(bufnr, on_dir) + local patterns = { + -- Termux + 'build.sh', + '*.subpackage.sh', + -- Arch/MSYS2 + 'PKGBUILD', + 'makepkg.conf', + '*.install', + -- Gentoo + 'make.conf', + 'color.map', + '*.ebuild', + '*.eclass', + } + local fname = vim.api.nvim_buf_get_name(bufnr) + local match = util.root_pattern(patterns)(fname) + if match then + on_dir(vim.fs.root(match, '.git') or match) + end + end, +} diff --git a/.config/nvim/lsp/terraform_lsp.lua b/.config/nvim/lsp/terraform_lsp.lua new file mode 100644 index 0000000..bd25157 --- /dev/null +++ b/.config/nvim/lsp/terraform_lsp.lua @@ -0,0 +1,36 @@ +---@brief +--- +--- https://github.com/juliosueiras/terraform-lsp +--- +--- Terraform language server +--- Download a released binary from +--- https://github.com/juliosueiras/terraform-lsp/releases. +--- +--- From https://github.com/hashicorp/terraform-ls#terraform-ls-vs-terraform-lsp: +--- +--- Both HashiCorp and the maintainer of terraform-lsp expressed interest in +--- collaborating on a language server and are working towards a _long-term_ +--- goal of a single stable and feature-complete implementation. +--- +--- For the time being both projects continue to exist, giving users the +--- choice: +--- +--- - `terraform-ls` providing +--- - overall stability (by relying only on public APIs) +--- - compatibility with any provider and any Terraform >=0.12.0 currently +--- less features +--- - due to project being younger and relying on public APIs which may +--- not offer the same functionality yet +--- +--- - `terraform-lsp` providing +--- - currently more features +--- - compatibility with a single particular Terraform (0.12.20 at time of writing) +--- - configs designed for other 0.12 versions may work, but interpretation may be inaccurate +--- - less stability (due to reliance on Terraform's own internal packages) + +---@type vim.lsp.Config +return { + cmd = { 'terraform-lsp' }, + filetypes = { 'terraform', 'hcl' }, + root_markers = { '.terraform', '.git' }, +} diff --git a/.config/nvim/lsp/terraformls.lua b/.config/nvim/lsp/terraformls.lua new file mode 100644 index 0000000..f5897f2 --- /dev/null +++ b/.config/nvim/lsp/terraformls.lua @@ -0,0 +1,40 @@ +---@brief +--- +--- https://github.com/hashicorp/terraform-ls +--- +--- Terraform language server +--- Download a released binary from https://github.com/hashicorp/terraform-ls/releases. +--- +--- From https://github.com/hashicorp/terraform-ls#terraform-ls-vs-terraform-lsp: +--- +--- Both HashiCorp and the maintainer of terraform-lsp expressed interest in +--- collaborating on a language server and are working towards a _long-term_ +--- goal of a single stable and feature-complete implementation. +--- +--- For the time being both projects continue to exist, giving users the +--- choice: +--- +--- - `terraform-ls` providing +--- - overall stability (by relying only on public APIs) +--- - compatibility with any provider and any Terraform >=0.12.0 currently +--- less features +--- - due to project being younger and relying on public APIs which may +--- not offer the same functionality yet +--- +--- - `terraform-lsp` providing +--- - currently more features +--- - compatibility with a single particular Terraform (0.12.20 at time of writing) +--- - configs designed for other 0.12 versions may work, but interpretation may be inaccurate +--- - less stability (due to reliance on Terraform's own internal packages) +--- +--- Note, that the `settings` configuration option uses the `workspace/didChangeConfiguration` event, +--- [which is not supported by terraform-ls](https://github.com/hashicorp/terraform-ls/blob/main/docs/features.md). +--- Instead you should use `init_options` which passes the settings as part of the LSP initialize call +--- [as is required by terraform-ls](https://github.com/hashicorp/terraform-ls/blob/main/docs/SETTINGS.md#how-to-pass-settings). + +---@type vim.lsp.Config +return { + cmd = { 'terraform-ls', 'serve' }, + filetypes = { 'terraform', 'terraform-vars' }, + root_markers = { '.terraform', '.git' }, +} diff --git a/.config/nvim/lsp/texlab.lua b/.config/nvim/lsp/texlab.lua new file mode 100644 index 0000000..18a359d --- /dev/null +++ b/.config/nvim/lsp/texlab.lua @@ -0,0 +1,185 @@ +---@brief +--- +--- https://github.com/latex-lsp/texlab +--- +--- A completion engine built from scratch for (La)TeX. +--- +--- See https://github.com/latex-lsp/texlab/wiki/Configuration for configuration options. +--- +--- There are some non standard commands supported, namely: +--- `LspTexlabBuild`, `LspTexlabForward`, `LspTexlabCancelBuild`, +--- `LspTexlabDependencyGraph`, `LspTexlabCleanArtifacts`, +--- `LspTexlabCleanAuxiliary`, `LspTexlabFindEnvironments`, +--- and `LspTexlabChangeEnvironment`. + +local function buf_build(client, bufnr) + local win = vim.api.nvim_get_current_win() + local params = vim.lsp.util.make_position_params(win, client.offset_encoding) + client:request('textDocument/build', params, function(err, result) + if err then + error(tostring(err)) + end + local texlab_build_status = { + [0] = 'Success', + [1] = 'Error', + [2] = 'Failure', + [3] = 'Cancelled', + } + vim.notify('Build ' .. texlab_build_status[result.status], vim.log.levels.INFO) + end, bufnr) +end + +local function buf_search(client, bufnr) + local win = vim.api.nvim_get_current_win() + local params = vim.lsp.util.make_position_params(win, client.offset_encoding) + client:request('textDocument/forwardSearch', params, function(err, result) + if err then + error(tostring(err)) + end + local texlab_forward_status = { + [0] = 'Success', + [1] = 'Error', + [2] = 'Failure', + [3] = 'Unconfigured', + } + vim.notify('Search ' .. texlab_forward_status[result.status], vim.log.levels.INFO) + end, bufnr) +end + +local function buf_cancel_build(client, bufnr) + return client:exec_cmd({ + title = 'cancel', + command = 'texlab.cancelBuild', + }, { bufnr = bufnr }) +end + +local function dependency_graph(client) + client:exec_cmd({ command = 'texlab.showDependencyGraph' }, { bufnr = 0 }, function(err, result) + if err then + return vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR) + end + vim.notify('The dependency graph has been generated:\n' .. result, vim.log.levels.INFO) + end) +end + +local function command_factory(cmd) + local cmd_tbl = { + Auxiliary = 'texlab.cleanAuxiliary', + Artifacts = 'texlab.cleanArtifacts', + } + return function(client, bufnr) + return client:exec_cmd({ + title = ('clean_%s'):format(cmd), + command = cmd_tbl[cmd], + arguments = { { uri = vim.uri_from_bufnr(bufnr) } }, + }, { bufnr = bufnr }, function(err, _) + if err then + vim.notify(('Failed to clean %s files: %s'):format(cmd, err.message), vim.log.levels.ERROR) + else + vim.notify(('Command %s executed successfully'):format(cmd), vim.log.levels.INFO) + end + end) + end +end + +local function buf_find_envs(client, bufnr) + local win = vim.api.nvim_get_current_win() + client:exec_cmd({ + command = 'texlab.findEnvironments', + arguments = { vim.lsp.util.make_position_params(win, client.offset_encoding) }, + }, { bufnr = bufnr }, function(err, result) + if err then + return vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR) + end + local env_names = {} + local max_length = 1 + for _, env in ipairs(result) do + table.insert(env_names, env.name.text) + max_length = math.max(max_length, string.len(env.name.text)) + end + for i, name in ipairs(env_names) do + env_names[i] = string.rep(' ', i - 1) .. name + end + vim.lsp.util.open_floating_preview(env_names, '', { + height = #env_names, + width = math.max((max_length + #env_names - 1), (string.len 'Environments')), + focusable = false, + focus = false, + title = 'Environments', + }) + end) +end + +local function buf_change_env(client, bufnr) + vim.ui.input({ prompt = 'New environment name: ' }, function(input) + if not input or input == '' then + return vim.notify('No environment name provided', vim.log.levels.WARN) + end + local pos = vim.api.nvim_win_get_cursor(0) + return client:exec_cmd({ + title = 'change_environment', + command = 'texlab.changeEnvironment', + arguments = { + { + textDocument = { uri = vim.uri_from_bufnr(bufnr) }, + position = { line = pos[1] - 1, character = pos[2] }, + newName = tostring(input), + }, + }, + }, { bufnr = bufnr }) + end) +end + +---@type vim.lsp.Config +return { + cmd = { 'texlab' }, + filetypes = { 'tex', 'plaintex', 'bib' }, + root_markers = { '.git', '.latexmkrc', 'latexmkrc', '.texlabroot', 'texlabroot', 'Tectonic.toml' }, + settings = { + texlab = { + rootDirectory = nil, + build = { + executable = 'latexmk', + args = { '-lualatex', '-interaction=nonstopmode', '-synctex=1', '%f' }, + onSave = false, + forwardSearchAfter = true, + }, + forwardSearch = { + executable = 'zathura', + args = { + '--synctex-forward', + '%l:1:%f', + '%p' + }, + }, + chktex = { + onOpenAndSave = false, + onEdit = false, + }, + diagnosticsDelay = 300, + latexFormatter = 'latexindent', + latexindent = { + ['local'] = nil, -- local is a reserved keyword + modifyLineBreaks = false, + }, + bibtexFormatter = 'texlab', + formatterLineLength = 80, + }, + }, + on_attach = function(client, bufnr) + for _, cmd in ipairs({ + { name = 'TexlabBuild', fn = buf_build, desc = 'Build the current buffer' }, + { name = 'TexlabForward', fn = buf_search, desc = 'Forward search from current position' }, + { name = 'TexlabCancelBuild', fn = buf_cancel_build, desc = 'Cancel the current build' }, + { name = 'TexlabDependencyGraph', fn = dependency_graph, desc = 'Show the dependency graph' }, + { name = 'TexlabCleanArtifacts', fn = command_factory('Artifacts'), desc = 'Clean the artifacts' }, + { name = 'TexlabCleanAuxiliary', fn = command_factory('Auxiliary'), desc = 'Clean the auxiliary files' }, + { name = 'TexlabFindEnvironments', fn = buf_find_envs, desc = 'Find the environments at current position' }, + { name = 'TexlabChangeEnvironment', fn = buf_change_env, desc = 'Change the environment at current position' }, + }) do + vim.api.nvim_buf_create_user_command(bufnr, 'Lsp' .. cmd.name, function() + cmd.fn(client, bufnr) + end, { desc = cmd.desc }) + end + end, +} diff --git a/.config/nvim/lsp/textlsp.lua b/.config/nvim/lsp/textlsp.lua new file mode 100644 index 0000000..0a2b5ed --- /dev/null +++ b/.config/nvim/lsp/textlsp.lua @@ -0,0 +1,45 @@ +---@brief +--- +--- https://github.com/hangyav/textLSP +--- +--- `textLSP` is an LSP server for text spell and grammar checking with various AI tools. +--- It supports multiple text file formats, such as LaTeX, Org or txt. +--- +--- For the available text analyzer tools and their configuration, see the [GitHub](https://github.com/hangyav/textLSP) page. +--- By default, all analyzers are disabled in textLSP, since most of them need special settings. +--- For quick testing, LanguageTool is enabled in the default `nvim-lspconfig` configuration. +--- +--- To install run: `pip install textLSP` + +---@type vim.lsp.Config +return { + cmd = { 'textlsp' }, + filetypes = { 'text', 'tex', 'org' }, + root_markers = { '.git' }, + settings = { + textLSP = { + analysers = { + -- by default all analysers are disabled in textLSP, since many of them + -- need custom settings. See github page. LanguageTool is enaled here + -- only for a quick test. + languagetool = { + enabled = true, + check_text = { + on_open = true, + on_save = true, + on_change = false, + }, + }, + }, + documents = { + org = { + org_todo_keywords = { + 'TODO', + 'IN_PROGRESS', + 'DONE', + }, + }, + }, + }, + }, +} diff --git a/.config/nvim/lsp/tflint.lua b/.config/nvim/lsp/tflint.lua new file mode 100644 index 0000000..60af7a8 --- /dev/null +++ b/.config/nvim/lsp/tflint.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://github.com/terraform-linters/tflint +--- +--- A pluggable Terraform linter that can act as lsp server. +--- Installation instructions can be found in https://github.com/terraform-linters/tflint#installation. + +---@type vim.lsp.Config +return { + cmd = { 'tflint', '--langserver' }, + filetypes = { 'terraform' }, + root_markers = { '.terraform', '.git', '.tflint.hcl' }, +} diff --git a/.config/nvim/lsp/theme_check.lua b/.config/nvim/lsp/theme_check.lua new file mode 100644 index 0000000..7d8dc88 --- /dev/null +++ b/.config/nvim/lsp/theme_check.lua @@ -0,0 +1,24 @@ +---@brief +--- +--- https://github.com/Shopify/shopify-cli +--- +--- `theme-check-language-server` is bundled with `shopify-cli` or it can also be installed via +--- +--- https://github.com/Shopify/theme-check#installation +--- +--- **NOTE:** +--- If installed via Homebrew, `cmd` must be set to 'theme-check-liquid-server' +--- +--- ```lua +--- vim.lsp.config('theme_check, { +--- cmd = { 'theme-check-liquid-server' } +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'theme-check-language-server', '--stdio' }, + filetypes = { 'liquid' }, + root_markers = { '.theme-check.yml' }, + settings = {}, +} diff --git a/.config/nvim/lsp/thriftls.lua b/.config/nvim/lsp/thriftls.lua new file mode 100644 index 0000000..234378b --- /dev/null +++ b/.config/nvim/lsp/thriftls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/joyme123/thrift-ls +--- +--- you can install thriftls by mason or download binary here: https://github.com/joyme123/thrift-ls/releases + +---@type vim.lsp.Config +return { + cmd = { 'thriftls' }, + filetypes = { 'thrift' }, + root_markers = { '.thrift' }, +} diff --git a/.config/nvim/lsp/tilt_ls.lua b/.config/nvim/lsp/tilt_ls.lua new file mode 100644 index 0000000..bc91d2f --- /dev/null +++ b/.config/nvim/lsp/tilt_ls.lua @@ -0,0 +1,18 @@ +---@brief +--- +--- https://github.com/tilt-dev/tilt +--- +--- Tilt language server. +--- +--- You might need to add filetype detection manually: +--- +--- ```vim +--- autocmd BufRead Tiltfile setf=tiltfile +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'tilt', 'lsp', 'start' }, + filetypes = { 'tiltfile' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/tinymist.lua b/.config/nvim/lsp/tinymist.lua new file mode 100644 index 0000000..44598c6 --- /dev/null +++ b/.config/nvim/lsp/tinymist.lua @@ -0,0 +1,69 @@ +---@brief +--- +--- https://github.com/Myriad-Dreamin/tinymist +--- An integrated language service for Typst [taɪpst]. You can also call it "微霭" [wēi ǎi] in Chinese. +--- +--- Currently some of Tinymist's workspace commands are supported, namely: +--- `LspTinymistExportSvg`, `LspTinymistExportPng`, `LspTinymistExportPdf`, +--- `LspTinymistExportMarkdown`, `LspTinymistExportText`, `LspTinymistExportQuery`, +--- `LspTinymistExportAnsiHighlight`, `LspTinymistGetServerInfo`, +--- `LspTinymistGetDocumentTrace`, `LspTinymistGetWorkspaceLabels`, +--- `LspTinymistGetDocumentMetrics`, and `LspTinymistPinMain`. + +---@param command_name string +---@param client vim.lsp.Client +---@param bufnr integer +---@return fun():nil run_tinymist_command, string cmd_name, string cmd_desc +local function create_tinymist_command(command_name, client, bufnr) + local export_type = command_name:match 'tinymist%.export(%w+)' + local info_type = command_name:match 'tinymist%.(%w+)' + local cmd_display = export_type or info_type:gsub('^get', 'Get'):gsub('^pin', 'Pin') + ---@return nil + local function run_tinymist_command() + local arguments = { vim.api.nvim_buf_get_name(bufnr) } + local title_str = export_type and ('Export ' .. cmd_display) or cmd_display + ---@type lsp.Handler + local function handler(err, res) + if err then + return vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR) + end + vim.notify(vim.inspect(res), vim.log.levels.INFO) + end + return client:exec_cmd({ + title = title_str, + command = command_name, + arguments = arguments, + }, { bufnr = bufnr }, handler) + end + -- Construct a readable command name/desc + local cmd_name = export_type and ('TinymistExport' .. cmd_display) or ('Tinymist' .. cmd_display) ---@type string + local cmd_desc = export_type and ('Export to ' .. cmd_display) or ('Get ' .. cmd_display) ---@type string + return run_tinymist_command, cmd_name, cmd_desc +end + +---@type vim.lsp.Config +return { + cmd = { 'tinymist' }, + filetypes = { 'typst' }, + root_markers = { '.git' }, + on_attach = function(client, bufnr) + for _, command in ipairs { + 'tinymist.exportSvg', + 'tinymist.exportPng', + 'tinymist.exportPdf', + -- 'tinymist.exportHtml', -- Use typst 0.13 + 'tinymist.exportMarkdown', + 'tinymist.exportText', + 'tinymist.exportQuery', + 'tinymist.exportAnsiHighlight', + 'tinymist.getServerInfo', + 'tinymist.getDocumentTrace', + 'tinymist.getWorkspaceLabels', + 'tinymist.getDocumentMetrics', + 'tinymist.pinMain', + } do + local cmd_func, cmd_name, cmd_desc = create_tinymist_command(command, client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'Lsp' .. cmd_name, cmd_func, { nargs = 0, desc = cmd_desc }) + end + end, +} diff --git a/.config/nvim/lsp/tofu_ls.lua b/.config/nvim/lsp/tofu_ls.lua new file mode 100644 index 0000000..7f8617f --- /dev/null +++ b/.config/nvim/lsp/tofu_ls.lua @@ -0,0 +1,11 @@ +---@brief +--- +--- [OpenTofu Language Server](https://github.com/opentofu/tofu-ls) +--- + +---@type vim.lsp.Config +return { + cmd = { 'tofu-ls', 'serve' }, + filetypes = { 'opentofu', 'opentofu-vars', 'terraform' }, + root_markers = { '.terraform', '.git' }, +} diff --git a/.config/nvim/lsp/tombi.lua b/.config/nvim/lsp/tombi.lua new file mode 100644 index 0000000..1f91ba7 --- /dev/null +++ b/.config/nvim/lsp/tombi.lua @@ -0,0 +1,13 @@ +---@brief +--- +--- https://tombi-toml.github.io/tombi/ +--- +--- Language server for Tombi, a TOML toolkit. +--- + +---@type vim.lsp.Config +return { + cmd = { 'tombi', 'lsp' }, + filetypes = { 'toml' }, + root_markers = { 'tombi.toml', 'pyproject.toml', '.git' }, +} diff --git a/.config/nvim/lsp/ts_ls.lua b/.config/nvim/lsp/ts_ls.lua new file mode 100644 index 0000000..23ac144 --- /dev/null +++ b/.config/nvim/lsp/ts_ls.lua @@ -0,0 +1,155 @@ +---@brief +--- +--- https://github.com/typescript-language-server/typescript-language-server +--- +--- `ts_ls`, aka `typescript-language-server`, is a Language Server Protocol implementation for TypeScript wrapping `tsserver`. Note that `ts_ls` is not `tsserver`. +--- +--- `typescript-language-server` depends on `typescript`. Both packages can be installed via `npm`: +--- ```sh +--- npm install -g typescript typescript-language-server +--- ``` +--- +--- To configure typescript language server, add a +--- [`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) or +--- [`jsconfig.json`](https://code.visualstudio.com/docs/languages/jsconfig) to the root of your +--- project. +--- +--- Here's an example that disables type checking in JavaScript files. +--- +--- ```json +--- { +--- "compilerOptions": { +--- "module": "commonjs", +--- "target": "es6", +--- "checkJs": false +--- }, +--- "exclude": [ +--- "node_modules" +--- ] +--- } +--- ``` +--- +--- Use the `:LspTypescriptSourceAction` command to see "whole file" ("source") code-actions such as: +--- - organize imports +--- - remove unused code +--- +--- Use the `:LspTypescriptGoToSourceDefinition` command to navigate to the source definition of a symbol (e.g., jump to the original implementation instead of type definitions). +--- +--- ### Monorepo support +--- +--- `ts_ls` supports monorepos by default. It will automatically find the `tsconfig.json` or `jsconfig.json` corresponding to the package you are working on. +--- This works without the need of spawning multiple instances of `ts_ls`, saving memory. +--- +--- It is recommended to use the same version of TypeScript in all packages, and therefore have it available in your workspace root. The location of the TypeScript binary will be determined automatically, but only once. +--- + +---@type vim.lsp.Config +return { + init_options = { hostInfo = 'neovim' }, + cmd = { 'typescript-language-server', '--stdio' }, + filetypes = { + 'javascript', + 'javascriptreact', + 'javascript.jsx', + 'typescript', + 'typescriptreact', + 'typescript.tsx', + }, + root_dir = function(bufnr, on_dir) + -- The project root is where the LSP can be started from + -- As stated in the documentation above, this LSP supports monorepos and simple projects. + -- We select then from the project root, which is identified by the presence of a package + -- manager lock file. + local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock' } + -- Give the root markers equal priority by wrapping them in a table + root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } } + or vim.list_extend(root_markers, { '.git' }) + -- exclude deno + local deno_path = vim.fs.root(bufnr, { 'deno.json', 'deno.jsonc', 'deno.lock' }) + local project_root = vim.fs.root(bufnr, root_markers) + if deno_path and (not project_root or #deno_path >= #project_root) then + return + end + -- We fallback to the current working directory if no project root is found + on_dir(project_root or vim.fn.getcwd()) + end, + handlers = { + -- handle rename request for certain code actions like extracting functions / types + ['_typescript.rename'] = function(_, result, ctx) + local client = assert(vim.lsp.get_client_by_id(ctx.client_id)) + vim.lsp.util.show_document({ + uri = result.textDocument.uri, + range = { + start = result.position, + ['end'] = result.position, + }, + }, client.offset_encoding) + vim.lsp.buf.rename() + return vim.NIL + end, + }, + commands = { + ['editor.action.showReferences'] = function(command, ctx) + local client = assert(vim.lsp.get_client_by_id(ctx.client_id)) + local file_uri, position, references = unpack(command.arguments) + + local quickfix_items = vim.lsp.util.locations_to_items(references --[[@as any]], client.offset_encoding) + vim.fn.setqflist({}, ' ', { + title = command.title, + items = quickfix_items, + context = { + command = command, + bufnr = ctx.bufnr, + }, + }) + + vim.lsp.util.show_document({ + uri = file_uri --[[@as string]], + range = { + start = position --[[@as lsp.Position]], + ['end'] = position --[[@as lsp.Position]], + }, + }, client.offset_encoding) + ---@diagnostic enable: assign-type-mismatch + + vim.cmd('botright copen') + end, + }, + on_attach = function(client, bufnr) + -- ts_ls provides `source.*` code actions that apply to the whole file. These only appear in + -- `vim.lsp.buf.code_action()` if specified in `context.only`. + vim.api.nvim_buf_create_user_command(bufnr, 'LspTypescriptSourceAction', function() + local source_actions = vim.tbl_filter(function(action) + return vim.startswith(action, 'source.') + end, client.server_capabilities.codeActionProvider.codeActionKinds) + + vim.lsp.buf.code_action({ + context = { + only = source_actions, + diagnostics = {}, + }, + }) + end, {}) + + -- Go to source definition command + vim.api.nvim_buf_create_user_command(bufnr, 'LspTypescriptGoToSourceDefinition', function() + local win = vim.api.nvim_get_current_win() + local params = vim.lsp.util.make_position_params(win, client.offset_encoding) + client:exec_cmd({ + command = '_typescript.goToSourceDefinition', + title = 'Go to source definition', + arguments = { params.textDocument.uri, params.position }, + }, { bufnr = bufnr }, function(err, result) + if err then + vim.notify('Go to source definition failed: ' .. err.message, vim.log.levels.ERROR) + return + end + if not result or vim.tbl_isempty(result) then + vim.notify('No source definition found', vim.log.levels.INFO) + return + end + vim.lsp.util.show_document(result[1], client.offset_encoding, { focus = true }) + end) + end, { desc = 'Go to source definition' }) + end, +} diff --git a/.config/nvim/lsp/ts_query_ls.lua b/.config/nvim/lsp/ts_query_ls.lua new file mode 100644 index 0000000..665b2d8 --- /dev/null +++ b/.config/nvim/lsp/ts_query_ls.lua @@ -0,0 +1,43 @@ +---@brief +--- +--- https://github.com/ribru17/ts_query_ls +--- Can be configured by passing a "settings" object to `vim.lsp.config('ts_query_ls', {})`: +--- ```lua +--- vim.lsp.config('ts_query_ls', { +--- init_options = { +--- parser_install_directories = { +--- '/my/parser/install/dir', +--- }, +--- -- This setting is provided by default +--- parser_aliases = { +--- ecma = 'javascript', +--- jsx = 'javascript', +--- php_only = 'php', +--- }, +--- }, +--- }) +--- ``` + +-- Disable the (slow) built-in query linter, which will show duplicate diagnostics. This must be done before the query +-- ftplugin is sourced. +vim.g.query_lint_on = {} + +---@type vim.lsp.Config +return { + cmd = { 'ts_query_ls' }, + filetypes = { 'query' }, + root_markers = { '.tsqueryrc.json', '.git' }, + init_options = { + parser_aliases = { + ecma = 'javascript', + jsx = 'javascript', + php_only = 'php', + }, + parser_install_directories = { + vim.fn.stdpath('data') .. '/site/parser', + }, + }, + on_attach = function(_, buf) + vim.bo[buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + end, +} diff --git a/.config/nvim/lsp/tsgo.lua b/.config/nvim/lsp/tsgo.lua new file mode 100644 index 0000000..e51971d --- /dev/null +++ b/.config/nvim/lsp/tsgo.lua @@ -0,0 +1,55 @@ +---@brief +--- +--- https://github.com/microsoft/typescript-go +--- +--- `typescript-go` is experimental port of the TypeScript compiler (tsc) and language server (tsserver) to the Go programming language. +--- +--- `tsgo` can be installed via npm `npm install @typescript/native-preview`. +--- +--- ### Monorepo support +--- +--- `tsgo` supports monorepos by default. It will automatically find the `tsconfig.json` or `jsconfig.json` corresponding to the package you are working on. +--- This works without the need of spawning multiple instances of `tsgo`, saving memory. +--- +--- It is recommended to use the same version of TypeScript in all packages, and therefore have it available in your workspace root. The location of the TypeScript binary will be determined automatically, but only once. +--- + +---@type vim.lsp.Config +return { + cmd = function(dispatchers, config) + local cmd = 'tsgo' + local local_cmd = (config or {}).root_dir and config.root_dir .. '/node_modules/.bin/tsgo' + if local_cmd and vim.fn.executable(local_cmd) == 1 then + cmd = local_cmd + end + return vim.lsp.rpc.start({ cmd, '--lsp', '--stdio' }, dispatchers) + end, + filetypes = { + 'javascript', + 'javascriptreact', + 'javascript.jsx', + 'typescript', + 'typescriptreact', + 'typescript.tsx', + }, + root_dir = function(bufnr, on_dir) + -- The project root is where the LSP can be started from + -- As stated in the documentation above, this LSP supports monorepos and simple projects. + -- We select then from the project root, which is identified by the presence of a package + -- manager lock file. + local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock' } + -- Give the root markers equal priority by wrapping them in a table + root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } } + or vim.list_extend(root_markers, { '.git' }) + + -- exclude deno + if vim.fs.root(bufnr, { 'deno.json', 'deno.jsonc', 'deno.lock' }) then + return + end + + -- We fallback to the current working directory if no project root is found + local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd() + + on_dir(project_root) + end, +} diff --git a/.config/nvim/lsp/tsp_server.lua b/.config/nvim/lsp/tsp_server.lua new file mode 100644 index 0000000..bfa8470 --- /dev/null +++ b/.config/nvim/lsp/tsp_server.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/microsoft/typespec +--- +--- The language server for TypeSpec, a language for defining cloud service APIs and shapes. +--- +--- `tsp-server` can be installed together with the typespec compiler via `npm`: +--- ```sh +--- npm install -g @typespec/compiler +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'tsp-server', '--stdio' }, + filetypes = { 'typespec' }, + root_markers = { 'tspconfig.yaml', '.git' }, +} diff --git a/.config/nvim/lsp/ttags.lua b/.config/nvim/lsp/ttags.lua new file mode 100644 index 0000000..a329999 --- /dev/null +++ b/.config/nvim/lsp/ttags.lua @@ -0,0 +1,10 @@ +---@brief +--- +--- https://github.com/npezza93/ttags + +---@type vim.lsp.Config +return { + cmd = { 'ttags', 'lsp' }, + filetypes = { 'ruby', 'rust', 'javascript', 'haskell' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/turbo_ls.lua b/.config/nvim/lsp/turbo_ls.lua new file mode 100644 index 0000000..3fdeca9 --- /dev/null +++ b/.config/nvim/lsp/turbo_ls.lua @@ -0,0 +1,22 @@ +---@brief +--- +--- https://www.npmjs.com/package/turbo-language-server +--- +--- `turbo-language-server` can be installed via `npm`: +--- +--- ```sh +--- npm install -g turbo-language-server +--- ``` +--- +--- or via `yarn`: +--- +--- ```sh +--- yarn global add turbo-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'turbo-language-server', '--stdio' }, + filetypes = { 'html', 'ruby', 'eruby', 'blade', 'php' }, + root_markers = { 'Gemfile', '.git' }, +} diff --git a/.config/nvim/lsp/turtle_ls.lua b/.config/nvim/lsp/turtle_ls.lua new file mode 100644 index 0000000..d44b27c --- /dev/null +++ b/.config/nvim/lsp/turtle_ls.lua @@ -0,0 +1,39 @@ +---@brief +--- +--- https://github.com/stardog-union/stardog-language-servers/tree/master/packages/turtle-language-server +--- `turtle-language-server`, An editor-agnostic server providing language intelligence (diagnostics, hover tooltips, etc.) for the W3C standard Turtle RDF syntax via the Language Server Protocol. +--- installable via npm install -g turtle-language-server or yarn global add turtle-language-server. +--- requires node. + +local bin_name = 'turtle-language-server' +local bin_path = os.getenv 'NVM_BIN' +local full_path +if bin_path == nil then + local paths = {} + local sep = ':' + if vim.fn.has 'win32' == 1 then + sep = ';' + end + local path = os.getenv 'PATH' + if path ~= nil then + for str in string.gmatch(path, '([^' .. sep .. ']+)') do + paths[#paths + 1] = str + end + end + for _, p in ipairs(paths) do + local candidate = table.concat({ p, bin_name }, '/') + if (vim.uv.fs_stat(candidate) or {}).type == 'file' then + full_path = candidate + break + end + end +else + full_path = table.concat({ bin_path, bin_name }, '/') +end + +---@type vim.lsp.Config +return { + cmd = { 'node', full_path, '--stdio' }, + filetypes = { 'turtle', 'ttl' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/tvm_ffi_navigator.lua b/.config/nvim/lsp/tvm_ffi_navigator.lua new file mode 100644 index 0000000..992e853 --- /dev/null +++ b/.config/nvim/lsp/tvm_ffi_navigator.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/tqchen/ffi-navigator +--- +--- The Language Server for FFI calls in TVM to be able jump between python and C++ +--- +--- FFI navigator can be installed with `pip install ffi-navigator`, buf for more details, please see +--- https://github.com/tqchen/ffi-navigator?tab=readme-ov-file#installation + +---@type vim.lsp.Config +return { + cmd = { 'python', '-m', 'ffi_navigator.langserver' }, + filetypes = { 'python', 'cpp' }, + root_markers = { 'pyproject.toml', '.git' }, +} diff --git a/.config/nvim/lsp/twiggy_language_server.lua b/.config/nvim/lsp/twiggy_language_server.lua new file mode 100644 index 0000000..7b28249 --- /dev/null +++ b/.config/nvim/lsp/twiggy_language_server.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/moetelo/twiggy +--- +--- `twiggy-language-server` can be installed via `npm`: +--- ```sh +--- npm install -g twiggy-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'twiggy-language-server', '--stdio' }, + filetypes = { 'twig' }, + root_markers = { 'composer.json', '.git' }, +} diff --git a/.config/nvim/lsp/ty.lua b/.config/nvim/lsp/ty.lua new file mode 100644 index 0000000..6309771 --- /dev/null +++ b/.config/nvim/lsp/ty.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/astral-sh/ty +--- +--- A Language Server Protocol implementation for ty, an extremely fast Python type checker and language server, written in Rust. +--- +--- For installation instructions, please refer to the [ty documentation](https://github.com/astral-sh/ty/blob/main/README.md#getting-started). + +---@type vim.lsp.Config +return { + cmd = { 'ty', 'server' }, + filetypes = { 'python' }, + root_markers = { 'ty.toml', 'pyproject.toml', 'setup.py', 'setup.cfg', 'requirements.txt', '.git' }, +} diff --git a/.config/nvim/lsp/typeprof.lua b/.config/nvim/lsp/typeprof.lua new file mode 100644 index 0000000..7fa3441 --- /dev/null +++ b/.config/nvim/lsp/typeprof.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/ruby/typeprof +--- +--- `typeprof` is the built-in analysis and LSP tool for Ruby 3.1+. + +---@type vim.lsp.Config +return { + cmd = { 'typeprof', '--lsp', '--stdio' }, + filetypes = { 'ruby', 'eruby' }, + root_markers = { 'Gemfile', '.git' }, +} diff --git a/.config/nvim/lsp/typos_lsp.lua b/.config/nvim/lsp/typos_lsp.lua new file mode 100644 index 0000000..23b39f2 --- /dev/null +++ b/.config/nvim/lsp/typos_lsp.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://github.com/crate-ci/typos +--- https://github.com/tekumara/typos-lsp +--- +--- A Language Server Protocol implementation for Typos, a low false-positive +--- source code spell checker, written in Rust. Download it from the releases page +--- on GitHub: https://github.com/tekumara/typos-lsp/releases + +---@type vim.lsp.Config +return { + cmd = { 'typos-lsp' }, + root_markers = { 'typos.toml', '_typos.toml', '.typos.toml', 'pyproject.toml', 'Cargo.toml' }, + settings = {}, +} diff --git a/.config/nvim/lsp/typst_lsp.lua b/.config/nvim/lsp/typst_lsp.lua new file mode 100644 index 0000000..966528b --- /dev/null +++ b/.config/nvim/lsp/typst_lsp.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/nvarner/typst-lsp +--- +--- Language server for Typst. + +---@type vim.lsp.Config +return { + cmd = { 'typst-lsp' }, + filetypes = { 'typst' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/uiua.lua b/.config/nvim/lsp/uiua.lua new file mode 100644 index 0000000..eb18893 --- /dev/null +++ b/.config/nvim/lsp/uiua.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/uiua-lang/uiua/ +--- +--- The builtin language server of the Uiua interpreter. +--- +--- The Uiua interpreter can be installed with `cargo install uiua` + +---@type vim.lsp.Config +return { + cmd = { 'uiua', 'lsp' }, + filetypes = { 'uiua' }, + root_markers = { 'main.ua', '.fmt.ua', '.git' }, +} diff --git a/.config/nvim/lsp/ungrammar_languageserver.lua b/.config/nvim/lsp/ungrammar_languageserver.lua new file mode 100644 index 0000000..dc557aa --- /dev/null +++ b/.config/nvim/lsp/ungrammar_languageserver.lua @@ -0,0 +1,26 @@ +---@brief +--- +--- https://github.com/binhtran432k/ungrammar-language-features +--- Language Server for Ungrammar. +--- +--- Ungrammar Language Server can be installed via npm: +--- ```sh +--- npm i ungrammar-languageserver -g +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'ungrammar-languageserver', '--stdio' }, + filetypes = { 'ungrammar' }, + root_markers = { '.git' }, + settings = { + ungrammar = { + validate = { + enable = true, + }, + format = { + enable = true, + }, + }, + }, +} diff --git a/.config/nvim/lsp/unison.lua b/.config/nvim/lsp/unison.lua new file mode 100644 index 0000000..e7434a5 --- /dev/null +++ b/.config/nvim/lsp/unison.lua @@ -0,0 +1,16 @@ +---@brief +--- +--- https://github.com/unisonweb/unison/blob/trunk/docs/language-server.markdown + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +return { + cmd = { 'nc', 'localhost', os.getenv 'UNISON_LSP_PORT' or '5757' }, + filetypes = { 'unison' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir(util.root_pattern('*.u')(fname)) + end, + settings = {}, +} diff --git a/.config/nvim/lsp/unocss.lua b/.config/nvim/lsp/unocss.lua new file mode 100644 index 0000000..95bb105 --- /dev/null +++ b/.config/nvim/lsp/unocss.lua @@ -0,0 +1,41 @@ +---@brief +--- +--- https://github.com/xna00/unocss-language-server +--- +--- UnoCSS Language Server can be installed via npm: +--- ```sh +--- npm i unocss-language-server -g +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'unocss-language-server', '--stdio' }, + -- copied from https://github.com/unocss/unocss/blob/35297359bf61917bda499db86e3728a7ebd05d6c/packages/vscode/src/autocomplete.ts#L12-L35 + filetypes = { + 'erb', + 'haml', + 'hbs', + 'html', + 'css', + 'postcss', + 'javascript', + 'javascriptreact', + 'markdown', + 'ejs', + 'php', + 'svelte', + 'typescript', + 'typescriptreact', + 'vue-html', + 'vue', + 'sass', + 'scss', + 'less', + 'stylus', + 'astro', + 'rescript', + 'rust', + }, + workspace_required = true, + root_markers = { 'unocss.config.js', 'unocss.config.ts', 'uno.config.js', 'uno.config.ts' }, +} diff --git a/.config/nvim/lsp/uvls.lua b/.config/nvim/lsp/uvls.lua new file mode 100644 index 0000000..8987a2f --- /dev/null +++ b/.config/nvim/lsp/uvls.lua @@ -0,0 +1,23 @@ +---@brief +--- +--- https://codeberg.org/caradhras/uvls +--- Language server for UVL, written using tree sitter and rust. +--- You can install the server easily using cargo: +--- ```sh +--- git clone https://codeberg.org/caradhras/uvls +--- cd uvls +--- cargo install --path . +--- ``` +--- +--- Note: To activate properly nvim needs to know the uvl filetype. +--- You can add it via: +--- ```lua +--- vim.cmd([[au BufRead,BufNewFile *.uvl setfiletype uvl]]) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'uvls' }, + filetypes = { 'uvl' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/v_analyzer.lua b/.config/nvim/lsp/v_analyzer.lua new file mode 100644 index 0000000..f46d3fc --- /dev/null +++ b/.config/nvim/lsp/v_analyzer.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/vlang/v-analyzer +--- +--- V language server. +--- +--- `v-analyzer` can be installed by following the instructions [here](https://github.com/vlang/v-analyzer#installation). + +---@type vim.lsp.Config +return { + cmd = { 'v-analyzer' }, + filetypes = { 'v', 'vsh', 'vv' }, + root_markers = { 'v.mod', '.git' }, +} diff --git a/.config/nvim/lsp/vacuum.lua b/.config/nvim/lsp/vacuum.lua new file mode 100644 index 0000000..f5c5bd0 --- /dev/null +++ b/.config/nvim/lsp/vacuum.lua @@ -0,0 +1,23 @@ +---@brief +--- +---Vacuum is the worlds fastest OpenAPI 3, OpenAPI 2 / Swagger linter and quality analysis tool. +--- +--- You can install vacuum using mason or follow the instructions here: https://github.com/daveshanley/vacuum +--- +--- The file types are not detected automatically, you can register them manually (see below) or override the filetypes: +--- +--- ```lua +--- vim.filetype.add { +--- pattern = { +--- ['openapi.*%.ya?ml'] = 'yaml.openapi', +--- ['openapi.*%.json'] = 'json.openapi', +--- }, +--- } +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'vacuum', 'language-server' }, + filetypes = { 'yaml.openapi', 'json.openapi' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/vala_ls.lua b/.config/nvim/lsp/vala_ls.lua new file mode 100644 index 0000000..f67034e --- /dev/null +++ b/.config/nvim/lsp/vala_ls.lua @@ -0,0 +1,35 @@ +---@brief +--- +--- https://github.com/Prince781/vala-language-server + +local meson_matcher = function(path) + local pattern = 'meson.build' + local f = vim.fn.glob(table.concat({ path, pattern }, '/')) + if f == '' then + return nil + end + for line in io.lines(f) do + -- skip meson comments + if not line:match '^%s*#.*' then + local str = line:gsub('%s+', '') + if str ~= '' then + if str:match '^project%(' then + return path + else + break + end + end + end + end +end + +---@type vim.lsp.Config +return { + cmd = { 'vala-language-server' }, + filetypes = { 'vala', 'genie' }, + root_dir = function(bufnr, on_dir) + local fname = vim.api.nvim_buf_get_name(bufnr) + local root = vim.iter(vim.fs.parents(fname)):find(meson_matcher) + on_dir(root or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1])) + end, +} diff --git a/.config/nvim/lsp/vale_ls.lua b/.config/nvim/lsp/vale_ls.lua new file mode 100644 index 0000000..5344440 --- /dev/null +++ b/.config/nvim/lsp/vale_ls.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/errata-ai/vale-ls +--- +--- An implementation of the Language Server Protocol (LSP) for the Vale command-line tool. + +---@type vim.lsp.Config +return { + cmd = { 'vale-ls' }, + filetypes = { 'asciidoc', 'markdown', 'text', 'tex', 'rst', 'html', 'xml' }, + root_markers = { '.vale.ini' }, +} diff --git a/.config/nvim/lsp/vectorcode_server.lua b/.config/nvim/lsp/vectorcode_server.lua new file mode 100644 index 0000000..095c453 --- /dev/null +++ b/.config/nvim/lsp/vectorcode_server.lua @@ -0,0 +1,11 @@ +---@brief +--- https://github.com/Davidyz/VectorCode +--- +--- A Language Server Protocol implementation for VectorCode, a code repository indexing tool. + +---@type vim.lsp.Config +return { + cmd = { 'vectorcode-server' }, + root_dir = vim.fs.root(0, { '.vectorcode', '.git' }), + settings = {}, +} diff --git a/.config/nvim/lsp/verible.lua b/.config/nvim/lsp/verible.lua new file mode 100644 index 0000000..d2629d6 --- /dev/null +++ b/.config/nvim/lsp/verible.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/chipsalliance/verible +--- +--- A linter and formatter for verilog and SystemVerilog files. +--- +--- Release binaries can be downloaded from [here](https://github.com/chipsalliance/verible/releases) +--- and placed in a directory on PATH. +--- +--- See https://github.com/chipsalliance/verible/tree/master/verilog/tools/ls/README.md for options. + +---@type vim.lsp.Config +return { + cmd = { 'verible-verilog-ls' }, + filetypes = { 'systemverilog', 'verilog' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/veridian.lua b/.config/nvim/lsp/veridian.lua new file mode 100644 index 0000000..2e74e50 --- /dev/null +++ b/.config/nvim/lsp/veridian.lua @@ -0,0 +1,24 @@ +---@brief +--- +--- https://github.com/vivekmalneedi/veridian +--- +--- A SystemVerilog LanguageServer. +--- +--- Download the latest release for your OS from the releases page +--- +--- Install with slang feature, if C++17 compiler is available: +--- ``` +--- cargo install --git https://github.com/vivekmalneedi/veridian.git --all-features +--- ``` +--- +--- Install if C++17 compiler is not available: +--- ``` +--- cargo install --git https://github.com/vivekmalneedi/veridian.git +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'veridian' }, + filetypes = { 'systemverilog', 'verilog' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/veryl_ls.lua b/.config/nvim/lsp/veryl_ls.lua new file mode 100644 index 0000000..807dd66 --- /dev/null +++ b/.config/nvim/lsp/veryl_ls.lua @@ -0,0 +1,17 @@ +---@brief +--- +--- https://github.com/veryl-lang/veryl +--- +--- Language server for Veryl +--- +--- `veryl-ls` can be installed via `cargo`: +--- ```sh +--- cargo install veryl-ls +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'veryl-ls' }, + filetypes = { 'veryl' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/vespa_ls.lua b/.config/nvim/lsp/vespa_ls.lua new file mode 100644 index 0000000..ebad300 --- /dev/null +++ b/.config/nvim/lsp/vespa_ls.lua @@ -0,0 +1,38 @@ +---@brief +--- +--- https://github.com/vespa-engine/vespa/tree/master/integration/schema-language-server +--- +--- Vespa Language Server provides LSP features such as completion, diagnostics, +--- and go-to-definition for Vespa schema files (`.sd`), profile files (`.profile`), +--- and YQL query files (`.yql`). +--- +--- This language server requires Java 17 or higher. You can build the jar from source. +--- +--- You can override the default command by manually configuring it like this: +--- +--- ```lua +--- vim.lsp.config('vespa_ls', { +--- cmd = { 'java', '-jar', '/path/to/vespa-language-server.jar' }, +--- }) +--- ``` +--- +--- The project root is determined based on the presence of a `.git` directory. +--- +--- To make Neovim recognize the proper filetypes, add the following setting in `init.lua`: +--- +--- vim.filetype.add { +--- extension = { +--- profile = 'sd', +--- sd = 'sd', +--- yql = 'yql', +--- }, +--- } + +---@type vim.lsp.Config +return { + cmd = { 'java', '-jar', 'vespa-language-server.jar' }, + filetypes = { 'sd', 'profile', 'yql' }, + root_markers = { + '.git', + }, +} diff --git a/.config/nvim/lsp/vhdl_ls.lua b/.config/nvim/lsp/vhdl_ls.lua new file mode 100644 index 0000000..f010e70 --- /dev/null +++ b/.config/nvim/lsp/vhdl_ls.lua @@ -0,0 +1,38 @@ +---@brief +--- +--- Install vhdl_ls from https://github.com/VHDL-LS/rust_hdl and add it to path +--- +--- Configuration +--- +--- The language server needs to know your library mapping to perform full analysis of the code. For this it uses a configuration file in the TOML format named vhdl_ls.toml. +--- +--- vhdl_ls will load configuration files in the following order of priority (first to last): +--- +--- A file named .vhdl_ls.toml in the user home folder. +--- A file name from the VHDL_LS_CONFIG environment variable. +--- A file named vhdl_ls.toml in the workspace root. +--- +--- Settings in a later files overwrites those from previously loaded files. +--- +--- Example vhdl_ls.toml +--- ``` +--- # File names are either absolute or relative to the parent folder of the vhdl_ls.toml file +--- [libraries] +--- lib2.files = [ +--- 'pkg2.vhd', +--- ] +--- lib1.files = [ +--- 'pkg1.vhd', +--- 'tb_ent.vhd' +--- ] +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'vhdl_ls' }, + filetypes = { 'vhd', 'vhdl' }, + root_markers = { + 'vhdl_ls.toml', + '.vhdl_ls.toml', + }, +} diff --git a/.config/nvim/lsp/vimls.lua b/.config/nvim/lsp/vimls.lua new file mode 100644 index 0000000..ba202c1 --- /dev/null +++ b/.config/nvim/lsp/vimls.lua @@ -0,0 +1,29 @@ +---@brief +--- +--- https://github.com/iamcco/vim-language-server +--- +--- You can install vim-language-server via npm: +--- ```sh +--- npm install -g vim-language-server +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'vim-language-server', '--stdio' }, + filetypes = { 'vim' }, + root_markers = { '.git' }, + init_options = { + isNeovim = true, + iskeyword = '@,48-57,_,192-255,-#', + vimruntime = '', + runtimepath = '', + diagnostic = { enable = true }, + indexes = { + runtimepath = true, + gap = 100, + count = 3, + projectRootPatterns = { 'runtime', 'nvim', '.git', 'autoload', 'plugin' }, + }, + suggest = { fromVimruntime = true, fromRuntimepath = true }, + }, +} diff --git a/.config/nvim/lsp/visualforce_ls.lua b/.config/nvim/lsp/visualforce_ls.lua new file mode 100644 index 0000000..5098447 --- /dev/null +++ b/.config/nvim/lsp/visualforce_ls.lua @@ -0,0 +1,31 @@ +---@brief +--- +--- https://github.com/forcedotcom/salesforcedx-vscode +--- +--- Language server for Visualforce. +--- +--- For manual installation, download the .vsix archive file from the +--- [forcedotcom/salesforcedx-vscode](https://github.com/forcedotcom/salesforcedx-vscode) +--- GitHub releases. Then, configure `cmd` to run the Node script at the unpacked location: +--- +--- ```lua +--- vim.lsp.config('visualforce_ls', { +--- cmd = { +--- 'node', +--- '/path/to/unpacked/archive/extension/node_modules/@salesforce/salesforcedx-visualforce-language-server/out/src/visualforceServer.js', +--- '--stdio' +--- } +--- }) +--- ``` + +---@type vim.lsp.Config +return { + filetypes = { 'visualforce' }, + root_markers = { 'sfdx-project.json' }, + init_options = { + embeddedLanguages = { + css = true, + javascript = true, + }, + }, +} diff --git a/.config/nvim/lsp/vls.lua b/.config/nvim/lsp/vls.lua new file mode 100644 index 0000000..f92981a --- /dev/null +++ b/.config/nvim/lsp/vls.lua @@ -0,0 +1,14 @@ +---@brief +--- +--- https://github.com/vlang/vls +--- +--- V language server. +--- +--- `v-language-server` can be installed by following the instructions [here](https://github.com/vlang/vls#installation). + +---@type vim.lsp.Config +return { + cmd = { 'v', 'ls' }, + filetypes = { 'v', 'vlang' }, + root_markers = { 'v.mod', '.git' }, +} diff --git a/.config/nvim/lsp/volar.lua b/.config/nvim/lsp/volar.lua new file mode 100644 index 0000000..040a93e --- /dev/null +++ b/.config/nvim/lsp/volar.lua @@ -0,0 +1,9 @@ +---@brief +--- +--- Renamed to [vue_ls](#vue_ls) +--- +--- +vim.deprecate('volar', 'vue_ls', '3.0.0', 'nvim-lspconfig', false) + +---@type vim.lsp.Config +return vim.lsp.config.vue_ls diff --git a/.config/nvim/lsp/vscoqtop.lua b/.config/nvim/lsp/vscoqtop.lua new file mode 100644 index 0000000..78186c5 --- /dev/null +++ b/.config/nvim/lsp/vscoqtop.lua @@ -0,0 +1,8 @@ +---@brief +--- +--- Renamed to [vsrocq](#vsrocq) + +vim.deprecate('vscoqtop', 'vsrocq', '2.0.0', 'nvim-lspconfig', false) + +---@type vim.lsp.Config +return vim.lsp.config.vsrocq diff --git a/.config/nvim/lsp/vsrocq.lua b/.config/nvim/lsp/vsrocq.lua new file mode 100644 index 0000000..cfd2909 --- /dev/null +++ b/.config/nvim/lsp/vsrocq.lua @@ -0,0 +1,10 @@ +---@brief +--- +--- https://github.com/rocq-prover/vsrocq + +---@type vim.lsp.Config +return { + cmd = { 'vsrocqtop' }, + filetypes = { 'coq' }, + root_markers = { '_RocqProject', '_CoqProject', '.git' }, +} diff --git a/.config/nvim/lsp/vtsls.lua b/.config/nvim/lsp/vtsls.lua new file mode 100644 index 0000000..29466f5 --- /dev/null +++ b/.config/nvim/lsp/vtsls.lua @@ -0,0 +1,102 @@ +---@brief +--- +--- https://github.com/yioneko/vtsls +--- +--- `vtsls` can be installed with npm: +--- ```sh +--- npm install -g @vtsls/language-server +--- ``` +--- +--- To configure a TypeScript project, add a +--- [`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) +--- or [`jsconfig.json`](https://code.visualstudio.com/docs/languages/jsconfig) to +--- the root of your project. +--- +--- ### Vue support +--- +--- Since v3.0.0, the Vue language server requires `vtsls` to support TypeScript. +--- +--- ``` +--- -- If you are using mason.nvim, you can get the ts_plugin_path like this +--- -- For Mason v1, +--- -- local mason_registry = require('mason-registry') +--- -- local vue_language_server_path = mason_registry.get_package('vue-language-server'):get_install_path() .. '/node_modules/@vue/language-server' +--- -- For Mason v2, +--- -- local vue_language_server_path = vim.fn.expand '$MASON/packages' .. '/vue-language-server' .. '/node_modules/@vue/language-server' +--- -- or even +--- -- local vue_language_server_path = vim.fn.stdpath('data') .. "/mason/packages/vue-language-server/node_modules/@vue/language-server" +--- local vue_language_server_path = '/path/to/@vue/language-server' +--- local vue_plugin = { +--- name = '@vue/typescript-plugin', +--- location = vue_language_server_path, +--- languages = { 'vue' }, +--- configNamespace = 'typescript', +--- } +--- vim.lsp.config('vtsls', { +--- settings = { +--- vtsls = { +--- tsserver = { +--- globalPlugins = { +--- vue_plugin, +--- }, +--- }, +--- }, +--- }, +--- filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' }, +--- }) +--- ``` +--- +--- - `location` MUST be defined. If the plugin is installed in `node_modules`, `location` can have any value. +--- - `languages` must include vue even if it is listed in filetypes. +--- - `filetypes` is extended here to include Vue SFC. +--- +--- You must make sure the Vue language server is setup. For example, +--- +--- ``` +--- vim.lsp.enable('vue_ls') +--- ``` +--- +--- See `vue_ls` section and https://github.com/vuejs/language-tools/wiki/Neovim for more information. +--- +--- ### Monorepo support +--- +--- `vtsls` supports monorepos by default. It will automatically find the `tsconfig.json` or `jsconfig.json` corresponding to the package you are working on. +--- This works without the need of spawning multiple instances of `vtsls`, saving memory. +--- +--- It is recommended to use the same version of TypeScript in all packages, and therefore have it available in your workspace root. The location of the TypeScript binary will be determined automatically, but only once. + +---@type vim.lsp.Config +return { + cmd = { 'vtsls', '--stdio' }, + init_options = { + hostInfo = 'neovim', + }, + filetypes = { + 'javascript', + 'javascriptreact', + 'javascript.jsx', + 'typescript', + 'typescriptreact', + 'typescript.tsx', + }, + root_dir = function(bufnr, on_dir) + -- The project root is where the LSP can be started from + -- As stated in the documentation above, this LSP supports monorepos and simple projects. + -- We select then from the project root, which is identified by the presence of a package + -- manager lock file. + local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock' } + -- Give the root markers equal priority by wrapping them in a table + root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } } + or vim.list_extend(root_markers, { '.git' }) + + -- exclude deno + if vim.fs.root(bufnr, { 'deno.json', 'deno.jsonc', 'deno.lock' }) then + return + end + + -- We fallback to the current working directory if no project root is found + local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd() + + on_dir(project_root) + end, +} diff --git a/.config/nvim/lsp/vue_ls.lua b/.config/nvim/lsp/vue_ls.lua new file mode 100644 index 0000000..95e09e2 --- /dev/null +++ b/.config/nvim/lsp/vue_ls.lua @@ -0,0 +1,71 @@ +---@brief +--- +--- https://github.com/vuejs/language-tools/tree/master/packages/language-server +--- +--- The official language server for Vue +--- +--- It can be installed via npm: +--- ```sh +--- npm install -g @vue/language-server +--- ``` +--- +--- The language server only supports Vue 3 projects by default. +--- For Vue 2 projects, [additional configuration](https://github.com/vuejs/language-tools/blob/master/extensions/vscode/README.md?plain=1#L19) are required. +--- +--- The Vue language server works in "hybrid mode" that exclusively manages the CSS/HTML sections. +--- You need the `vtsls` server with the `@vue/typescript-plugin` plugin to support TypeScript in `.vue` files. +--- See `vtsls` section and https://github.com/vuejs/language-tools/wiki/Neovim for more information. +--- +--- NOTE: Since v3.0.0, the Vue Language Server [no longer supports takeover mode](https://github.com/vuejs/language-tools/pull/5248). + +---@type vim.lsp.Config +return { + cmd = { 'vue-language-server', '--stdio' }, + filetypes = { 'vue' }, + root_markers = { 'package.json' }, + on_init = function(client) + local retries = 0 + + ---@param _ lsp.ResponseError + ---@param result any + ---@param context lsp.HandlerContext + local function typescriptHandler(_, result, context) + local ts_client = vim.lsp.get_clients({ bufnr = context.bufnr, name = 'ts_ls' })[1] + or vim.lsp.get_clients({ bufnr = context.bufnr, name = 'vtsls' })[1] + or vim.lsp.get_clients({ bufnr = context.bufnr, name = 'typescript-tools' })[1] + + if not ts_client then + -- there can sometimes be a short delay until `ts_ls`/`vtsls` are attached so we retry for a few times until it is ready + if retries <= 10 then + retries = retries + 1 + vim.defer_fn(function() + typescriptHandler(_, result, context) + end, 100) + else + vim.notify( + 'Could not find `ts_ls`, `vtsls`, or `typescript-tools` lsp client required by `vue_ls`.', + vim.log.levels.ERROR + ) + end + return + end + + local param = unpack(result) + local id, command, payload = unpack(param) + ts_client:exec_cmd({ + title = 'vue_request_forward', -- You can give title anything as it's used to represent a command in the UI, `:h Client:exec_cmd` + command = 'typescript.tsserverRequest', + arguments = { + command, + payload, + }, + }, { bufnr = context.bufnr }, function(_, r) + local response_data = { { id, r and r.body } } + ---@diagnostic disable-next-line: param-type-mismatch + client:notify('tsserver/response', response_data) + end) + end + + client.handlers['tsserver/request'] = typescriptHandler + end, +} diff --git a/.config/nvim/lsp/wasm_language_tools.lua b/.config/nvim/lsp/wasm_language_tools.lua new file mode 100644 index 0000000..d79ae6e --- /dev/null +++ b/.config/nvim/lsp/wasm_language_tools.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/g-plane/wasm-language-tools +--- +--- WebAssembly Language Tools aims to provide and improve the editing experience of WebAssembly Text Format. +--- It also provides an out-of-the-box formatter (a.k.a. pretty printer) for WebAssembly Text Format. + +---@type vim.lsp.Config +return { + cmd = { 'wat_server' }, + filetypes = { 'wat' }, +} diff --git a/.config/nvim/lsp/wc_language_server.lua b/.config/nvim/lsp/wc_language_server.lua new file mode 100644 index 0000000..9005400 --- /dev/null +++ b/.config/nvim/lsp/wc_language_server.lua @@ -0,0 +1,85 @@ +---@brief +--- +--- https://github.com/wc-toolkit/wc-language-server +--- +--- Web Components Language Server provides intelligent editor support for Web Components and custom elements. +--- It offers advanced HTML diagnostics, completion, and validation for custom elements, including support for +--- attribute types, deprecation, and duplicate attribute detection. +--- +--- The language server uses the [Custom Elements Manifest](https://github.com/webcomponents/custom-elements-manifest) +--- to generate component integration and validation information +--- +--- `wc-language-server` can be installed by following the instructions at the [GitHub repository](https://github.com/wc-toolkit/wc-language-server/blob/main/packages/neovim/README.md). +--- +--- The default `cmd` assumes that the `wc-language-server` binary can be found in `$PATH`. +--- +--- Alternatively, you can install it via [mason.nvim](https://github.com/williamboman/mason.nvim): +--- ```vim +--- :MasonInstall wc-language-server +--- ``` +--- +--- ## Configuration +--- +--- The language server reads settings from `wc.config.js` (or `.ts/.mjs/.cjs`) at the project root. +--- Use it to customize manifest sources, file scoping, and diagnostic behavior. +--- +--- Example `wc.config.js`: +--- ```js +--- export default { +--- // Fetch manifest from a custom path or URL +--- manifestSrc: './dist/custom-elements.json', +--- +--- // Narrow which files opt into the language server +--- include: ['src/**/*.ts', 'src/**/*.html'], +--- +--- // Skip specific globs +--- exclude: ['**/*.stories.ts'], +--- +--- // Per-library overrides +--- libraries: { +--- '@your/pkg': { +--- manifestSrc: 'https://cdn.example.com/custom-elements.json', +--- tagFormatter: (tag) => tag.replace(/^x-/, 'my-'), +--- }, +--- }, +--- +--- // Customize diagnostic severity levels +--- diagnosticSeverity: { +--- duplicateAttribute: 'warning', +--- unknownElement: 'info', +--- }, +--- }; +--- ``` +--- +--- See the [configuration documentation](https://github.com/wc-toolkit/wc-language-server#configuration) for more details. +--- + +---@type vim.lsp.Config +return { + init_options = { hostInfo = 'neovim' }, + cmd = { 'wc-language-server', '--stdio' }, + filetypes = { + 'html', + 'javascriptreact', + 'typescriptreact', + 'astro', + 'svelte', + 'vue', + 'markdown', + 'mdx', + 'javascript', + 'typescript', + 'css', + 'scss', + 'less', + }, + root_markers = { + 'wc.config.js', + 'wc.config.ts', + 'wc.config.mjs', + 'wc.config.cjs', + 'custom-elements.json', + 'package.json', + '.git', + }, +} diff --git a/.config/nvim/lsp/wgsl_analyzer.lua b/.config/nvim/lsp/wgsl_analyzer.lua new file mode 100644 index 0000000..ed38772 --- /dev/null +++ b/.config/nvim/lsp/wgsl_analyzer.lua @@ -0,0 +1,16 @@ +---@brief +--- +--- https://github.com/wgsl-analyzer/wgsl-analyzer +--- +--- `wgsl-analyzer` can be installed via `cargo`: +--- ```sh +--- cargo install --git https://github.com/wgsl-analyzer/wgsl-analyzer wgsl-analyzer +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'wgsl-analyzer' }, + filetypes = { 'wgsl' }, + root_markers = { '.git' }, + settings = {}, +} diff --git a/.config/nvim/lsp/yamlls.lua b/.config/nvim/lsp/yamlls.lua new file mode 100644 index 0000000..04e837e --- /dev/null +++ b/.config/nvim/lsp/yamlls.lua @@ -0,0 +1,80 @@ +---@brief +--- +--- https://github.com/redhat-developer/yaml-language-server +--- +--- `yaml-language-server` can be installed via `yarn`: +--- ```sh +--- yarn global add yaml-language-server +--- ``` +--- +--- To use a schema for validation, there are two options: +--- +--- 1. Add a modeline to the file. A modeline is a comment of the form: +--- +--- ``` +--- # yaml-language-server: $schema= +--- ``` +--- +--- where the relative filepath is the path relative to the open yaml file, and the absolute filepath +--- is the filepath relative to the filesystem root ('/' on unix systems) +--- +--- 2. Associated a schema url, relative , or absolute (to root of project, not to filesystem root) path to +--- the a glob pattern relative to the detected project root. Check `:checkhealth vim.lsp` to determine the resolved project +--- root. +--- +--- ```lua +--- vim.lsp.config('yamlls', { +--- ... +--- settings = { +--- yaml = { +--- ... -- other settings. note this overrides the lspconfig defaults. +--- schemas = { +--- ["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*", +--- ["../path/relative/to/file.yml"] = "/.github/workflows/*", +--- ["/path/from/root/of/project"] = "/.github/workflows/*", +--- }, +--- }, +--- } +--- }) +--- ``` +--- +--- Currently, kubernetes is special-cased in yammls, see the following upstream issues: +--- * [#211](https://github.com/redhat-developer/yaml-language-server/issues/211). +--- * [#307](https://github.com/redhat-developer/yaml-language-server/issues/307). +--- +--- To override a schema to use a specific k8s schema version (for example, to use 1.18): +--- +--- ```lua +--- vim.lsp.config('yamlls', { +--- ... +--- settings = { +--- yaml = { +--- ... -- other settings. note this overrides the lspconfig defaults. +--- schemas = { +--- ["https://raw.githubusercontent.com/yannh/kubernetes-json-schema/refs/heads/master/v1.32.1-standalone-strict/all.json"] = "/*.k8s.yaml", +--- ... -- other schemas +--- }, +--- }, +--- } +--- }) +--- ``` + +---@type vim.lsp.Config +return { + cmd = { 'yaml-language-server', '--stdio' }, + filetypes = { 'yaml', 'yaml.docker-compose', 'yaml.gitlab', 'yaml.helm-values' }, + root_markers = { '.git' }, + settings = { + -- https://github.com/redhat-developer/vscode-redhat-telemetry#how-to-disable-telemetry-reporting + redhat = { telemetry = { enabled = false } }, + -- formatting disabled by default in yaml-language-server; enable it + yaml = { format = { enable = true } }, + }, + on_init = function(client) + --- https://github.com/neovim/nvim-lspconfig/pull/4016 + --- Since formatting is disabled by default if you check `client:supports_method('textDocument/formatting')` + --- during `LspAttach` it will return `false`. This hack sets the capability to `true` to facilitate + --- autocmd's which check this capability + client.server_capabilities.documentFormattingProvider = true + end, +} diff --git a/.config/nvim/lsp/yang_lsp.lua b/.config/nvim/lsp/yang_lsp.lua new file mode 100644 index 0000000..1ae15f5 --- /dev/null +++ b/.config/nvim/lsp/yang_lsp.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://github.com/TypeFox/yang-lsp +--- +--- A Language Server for the YANG data modeling language. + +---@type vim.lsp.Config +return { + cmd = { 'yang-language-server' }, + filetypes = { 'yang' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/yls.lua b/.config/nvim/lsp/yls.lua new file mode 100644 index 0000000..cfa35df --- /dev/null +++ b/.config/nvim/lsp/yls.lua @@ -0,0 +1,16 @@ +---@brief +--- +--- https://pypi.org/project/yls-yara/ +--- +--- An YLS plugin adding YARA linting capabilities. +--- +--- This plugin runs yara.compile on every save, parses the errors, and returns list of diagnostic messages. +--- +--- Language Server: https://github.com/avast/yls + +---@type vim.lsp.Config +return { + cmd = { 'yls', '-vv' }, + filetypes = { 'yar', 'yara' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/ziggy.lua b/.config/nvim/lsp/ziggy.lua new file mode 100644 index 0000000..9d01747 --- /dev/null +++ b/.config/nvim/lsp/ziggy.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://ziggy-lang.io/documentation/ziggy-lsp/ +--- +--- Language server for the Ziggy data serialization format + +---@type vim.lsp.Config +return { + cmd = { 'ziggy', 'lsp' }, + filetypes = { 'ziggy' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/ziggy_schema.lua b/.config/nvim/lsp/ziggy_schema.lua new file mode 100644 index 0000000..d12266b --- /dev/null +++ b/.config/nvim/lsp/ziggy_schema.lua @@ -0,0 +1,12 @@ +---@brief +--- +--- https://ziggy-lang.io/documentation/ziggy-lsp/ +--- +--- Language server for schema files of the Ziggy data serialization format + +---@type vim.lsp.Config +return { + cmd = { 'ziggy', 'lsp', '--schema' }, + filetypes = { 'ziggy_schema' }, + root_markers = { '.git' }, +} diff --git a/.config/nvim/lsp/zk.lua b/.config/nvim/lsp/zk.lua new file mode 100644 index 0000000..3faa3ba --- /dev/null +++ b/.config/nvim/lsp/zk.lua @@ -0,0 +1,116 @@ +---@brief +--- +--- https://github.com/zk-org/zk +--- +--- A plain text note-taking assistant + +---List notes +---@param client vim.lsp.Client +---@param bufnr integer +---@param opts table +---@param action fun(path: string, title: string) +local function zk_list(client, bufnr, opts, action) + opts = vim.tbl_extend('keep', { select = { 'path', 'title' } }, opts or {}) + client:exec_cmd({ + title = 'ZkList', + command = 'zk.list', + arguments = { vim.api.nvim_buf_get_name(bufnr), opts }, + }, { bufnr = bufnr }, function(err, result) + if err ~= nil then + vim.api.nvim_echo({ { 'zk.list error\n' }, { vim.inspect(err) } }, true, {}) + return + end + if result == nil then + return + end + + vim.ui.select(result, { + format_item = function(item) + return item.title + end, + }, function(item) + if item ~= nil then + action(vim.fs.joinpath(client.root_dir, item.path), item.title) + end + end) + end) +end + +---@type vim.lsp.Config +return { + cmd = { 'zk', 'lsp' }, + filetypes = { 'markdown' }, + root_markers = { '.zk' }, + workspace_required = true, + on_attach = function(client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspZkIndex', function() + client:exec_cmd({ + title = 'ZkIndex', + command = 'zk.index', + arguments = { vim.api.nvim_buf_get_name(bufnr) }, + }, { bufnr = bufnr }, function(err, result) + if err ~= nil then + vim.api.nvim_echo({ { 'zk.index error\n' }, { vim.inspect(err) } }, true, {}) + return + end + if result ~= nil then + vim.api.nvim_echo({ { vim.inspect(result) } }, false, {}) + end + end) + end, { desc = 'ZkIndex' }) + + vim.api.nvim_buf_create_user_command(bufnr, 'LspZkList', function() + zk_list(client, bufnr, {}, function(path) + vim.cmd('edit ' .. path) + end) + end, { desc = 'ZkList' }) + + vim.api.nvim_buf_create_user_command(bufnr, 'LspZkTagList', function() + client:exec_cmd({ + title = 'ZkTagList', + command = 'zk.tag.list', + arguments = { vim.api.nvim_buf_get_name(bufnr) }, + }, { bufnr = bufnr }, function(err, result) + if err ~= nil then + vim.api.nvim_echo({ { 'zk.tag.list error\n' }, { vim.inspect(err) } }, true, {}) + return + end + if result == nil then + return + end + + vim.ui.select(result, { + format_item = function(item) + return item.name + end, + }, function(item) + if item ~= nil then + zk_list(client, bufnr, { tags = { item.name } }, function(path) + vim.cmd('edit ' .. path) + end) + end + end) + end) + end, { desc = 'ZkTagList' }) + + vim.api.nvim_buf_create_user_command(bufnr, 'LspZkNew', function(args) + local title = #args.fargs >= 1 and args.fargs[1] or '' + local dir = #args.fargs >= 2 and args.fargs[2] or '' + client:exec_cmd({ + title = 'ZkNew', + command = 'zk.new', + arguments = { + vim.api.nvim_buf_get_name(bufnr), + { title = title, dir = dir }, + }, + }, { bufnr = bufnr }, function(err, result) + if err ~= nil then + vim.api.nvim_echo({ { 'zk.new error\n' }, { vim.inspect(err) } }, true, {}) + return + end + + vim.cmd('edit ' .. result.path) + end) + end, { desc = 'ZkNew [title] [dir]', nargs = '*' }) + end, +} diff --git a/.config/nvim/lsp/zls.lua b/.config/nvim/lsp/zls.lua new file mode 100644 index 0000000..6a8dc08 --- /dev/null +++ b/.config/nvim/lsp/zls.lua @@ -0,0 +1,12 @@ +---@brief +--- https://github.com/zigtools/zls +--- +--- Zig LSP implementation + Zig Language Server + +---@type vim.lsp.Config +return { + cmd = { 'zls' }, + filetypes = { 'zig', 'zir' }, + root_markers = { 'zls.json', 'build.zig', '.git' }, + workspace_required = false, +} diff --git a/.config/nvim/lsp/zuban.lua b/.config/nvim/lsp/zuban.lua new file mode 100644 index 0000000..3fea7a2 --- /dev/null +++ b/.config/nvim/lsp/zuban.lua @@ -0,0 +1,19 @@ +---@brief +--- +--- https://zubanls.com/ +--- +--- A high-performance Python Language Server and type checker implemented in Rust, by the author of Jedi. + +---@type vim.lsp.Config +return { + cmd = { 'zuban', 'server' }, + filetypes = { 'python' }, + root_markers = { + 'pyproject.toml', + 'setup.py', + 'setup.cfg', + 'requirements.txt', + 'Pipfile', + '.git', + }, +} diff --git a/.config/nvim/lua/gruvbox.lua b/.config/nvim/lua/gruvbox.lua new file mode 100644 index 0000000..07dedd4 --- /dev/null +++ b/.config/nvim/lua/gruvbox.lua @@ -0,0 +1,1343 @@ +---@class Gruvbox +---@field config GruvboxConfig +---@field palette GruvboxPalette +local Gruvbox = {} + +---@alias Contrast "hard" | "soft" | "" + +---@class ItalicConfig +---@field strings boolean +---@field comments boolean +---@field operators boolean +---@field folds boolean +---@field emphasis boolean + +---@class HighlightDefinition +---@field fg string? +---@field bg string? +---@field sp string? +---@field blend integer? +---@field bold boolean? +---@field standout boolean? +---@field underline boolean? +---@field undercurl boolean? +---@field underdouble boolean? +---@field underdotted boolean? +---@field strikethrough boolean? +---@field italic boolean? +---@field reverse boolean? +---@field nocombine boolean? + +---@class GruvboxConfig +---@field bold boolean? +---@field contrast Contrast? +---@field dim_inactive boolean? +---@field inverse boolean? +---@field invert_selection boolean? +---@field invert_signs boolean? +---@field invert_tabline boolean? +---@field italic ItalicConfig? +---@field overrides table? +---@field palette_overrides table? +---@field strikethrough boolean? +---@field terminal_colors boolean? +---@field transparent_mode boolean? +---@field undercurl boolean? +---@field underline boolean? +local default_config = { + terminal_colors = true, + undercurl = true, + underline = true, + bold = true, + italic = { + strings = true, + emphasis = true, + comments = true, + operators = false, + folds = true, + }, + strikethrough = true, + invert_selection = false, + invert_signs = false, + invert_tabline = false, + inverse = true, + contrast = "", + palette_overrides = {}, + overrides = {}, + dim_inactive = false, + transparent_mode = false, +} + +Gruvbox.config = vim.deepcopy(default_config) + +-- main gruvbox color palette +---@class GruvboxPalette +Gruvbox.palette = { + dark0_hard = "#1d2021", + dark0 = "#282828", + dark0_soft = "#32302f", + dark1 = "#3c3836", + dark2 = "#504945", + dark3 = "#665c54", + dark4 = "#7c6f64", + light0_hard = "#f9f5d7", + light0 = "#fbf1c7", + light0_soft = "#f2e5bc", + light1 = "#ebdbb2", + light2 = "#d5c4a1", + light3 = "#bdae93", + light4 = "#a89984", + bright_red = "#fb4934", + bright_green = "#b8bb26", + bright_yellow = "#fabd2f", + bright_blue = "#83a598", + bright_purple = "#d3869b", + bright_aqua = "#8ec07c", + bright_orange = "#fe8019", + neutral_red = "#cc241d", + neutral_green = "#98971a", + neutral_yellow = "#d79921", + neutral_blue = "#458588", + neutral_purple = "#b16286", + neutral_aqua = "#689d6a", + neutral_orange = "#d65d0e", + faded_red = "#9d0006", + faded_green = "#79740e", + faded_yellow = "#b57614", + faded_blue = "#076678", + faded_purple = "#8f3f71", + faded_aqua = "#427b58", + faded_orange = "#af3a03", + dark_red_hard = "#792329", + dark_red = "#722529", + dark_red_soft = "#7b2c2f", + light_red_hard = "#fc9690", + light_red = "#fc9487", + light_red_soft = "#f78b7f", + dark_green_hard = "#5a633a", + dark_green = "#62693e", + dark_green_soft = "#686d43", + light_green_hard = "#d3d6a5", + light_green = "#d5d39b", + light_green_soft = "#cecb94", + dark_aqua_hard = "#3e4934", + dark_aqua = "#49503b", + dark_aqua_soft = "#525742", + light_aqua_hard = "#e6e9c1", + light_aqua = "#e8e5b5", + light_aqua_soft = "#e1dbac", + gray = "#928374", +} + +-- get a hex list of gruvbox colors based on current bg and constrast config +local function get_colors() + local p = Gruvbox.palette + local config = Gruvbox.config + + for color, hex in pairs(config.palette_overrides) do + p[color] = hex + end + + local bg = vim.o.background + local contrast = config.contrast + + local color_groups = { + dark = { + bg0 = p.dark0, + bg1 = p.dark1, + bg2 = p.dark2, + bg3 = p.dark3, + bg4 = p.dark4, + fg0 = p.light0, + fg1 = p.light1, + fg2 = p.light2, + fg3 = p.light3, + fg4 = p.light4, + red = p.bright_red, + green = p.bright_green, + yellow = p.bright_yellow, + blue = p.bright_blue, + purple = p.bright_purple, + aqua = p.bright_aqua, + orange = p.bright_orange, + neutral_red = p.neutral_red, + neutral_green = p.neutral_green, + neutral_yellow = p.neutral_yellow, + neutral_blue = p.neutral_blue, + neutral_purple = p.neutral_purple, + neutral_aqua = p.neutral_aqua, + dark_red = p.dark_red, + dark_green = p.dark_green, + dark_aqua = p.dark_aqua, + gray = p.gray, + }, + light = { + bg0 = p.light0, + bg1 = p.light1, + bg2 = p.light2, + bg3 = p.light3, + bg4 = p.light4, + fg0 = p.dark0, + fg1 = p.dark1, + fg2 = p.dark2, + fg3 = p.dark3, + fg4 = p.dark4, + red = p.faded_red, + green = p.faded_green, + yellow = p.faded_yellow, + blue = p.faded_blue, + purple = p.faded_purple, + aqua = p.faded_aqua, + orange = p.faded_orange, + neutral_red = p.neutral_red, + neutral_green = p.neutral_green, + neutral_yellow = p.neutral_yellow, + neutral_blue = p.neutral_blue, + neutral_purple = p.neutral_purple, + neutral_aqua = p.neutral_aqua, + dark_red = p.light_red, + dark_green = p.light_green, + dark_aqua = p.light_aqua, + gray = p.gray, + }, + } + + if contrast ~= nil and contrast ~= "" then + color_groups[bg].bg0 = p[bg .. "0_" .. contrast] + color_groups[bg].dark_red = p[bg .. "_red_" .. contrast] + color_groups[bg].dark_green = p[bg .. "_green_" .. contrast] + color_groups[bg].dark_aqua = p[bg .. "_aqua_" .. contrast] + end + + return color_groups[bg] +end + +local function get_groups() + local colors = get_colors() + local config = Gruvbox.config + + if config.terminal_colors then + local term_colors = { + colors.bg0, + colors.neutral_red, + colors.neutral_green, + colors.neutral_yellow, + colors.neutral_blue, + colors.neutral_purple, + colors.neutral_aqua, + colors.fg4, + colors.gray, + colors.red, + colors.green, + colors.yellow, + colors.blue, + colors.purple, + colors.aqua, + colors.fg1, + } + for index, value in ipairs(term_colors) do + vim.g["terminal_color_" .. index - 1] = value + end + end + + local groups = { + GruvboxFg0 = { fg = colors.fg0 }, + GruvboxFg1 = { fg = colors.fg1 }, + GruvboxFg2 = { fg = colors.fg2 }, + GruvboxFg3 = { fg = colors.fg3 }, + GruvboxFg4 = { fg = colors.fg4 }, + GruvboxGray = { fg = colors.gray }, + GruvboxBg0 = { fg = colors.bg0 }, + GruvboxBg1 = { fg = colors.bg1 }, + GruvboxBg2 = { fg = colors.bg2 }, + GruvboxBg3 = { fg = colors.bg3 }, + GruvboxBg4 = { fg = colors.bg4 }, + GruvboxRed = { fg = colors.red }, + GruvboxRedBold = { fg = colors.red, bold = config.bold }, + GruvboxGreen = { fg = colors.green }, + GruvboxGreenBold = { fg = colors.green, bold = config.bold }, + GruvboxYellow = { fg = colors.yellow }, + GruvboxYellowBold = { fg = colors.yellow, bold = config.bold }, + GruvboxBlue = { fg = colors.blue }, + GruvboxBlueBold = { fg = colors.blue, bold = config.bold }, + GruvboxPurple = { fg = colors.purple }, + GruvboxPurpleBold = { fg = colors.purple, bold = config.bold }, + GruvboxAqua = { fg = colors.aqua }, + GruvboxAquaBold = { fg = colors.aqua, bold = config.bold }, + GruvboxOrange = { fg = colors.orange }, + GruvboxOrangeBold = { fg = colors.orange, bold = config.bold }, + GruvboxRedSign = config.transparent_mode and { fg = colors.red, reverse = config.invert_signs } + or { fg = colors.red, bg = colors.bg1, reverse = config.invert_signs }, + GruvboxGreenSign = config.transparent_mode and { fg = colors.green, reverse = config.invert_signs } + or { fg = colors.green, bg = colors.bg1, reverse = config.invert_signs }, + GruvboxYellowSign = config.transparent_mode and { fg = colors.yellow, reverse = config.invert_signs } + or { fg = colors.yellow, bg = colors.bg1, reverse = config.invert_signs }, + GruvboxBlueSign = config.transparent_mode and { fg = colors.blue, reverse = config.invert_signs } + or { fg = colors.blue, bg = colors.bg1, reverse = config.invert_signs }, + GruvboxPurpleSign = config.transparent_mode and { fg = colors.purple, reverse = config.invert_signs } + or { fg = colors.purple, bg = colors.bg1, reverse = config.invert_signs }, + GruvboxAquaSign = config.transparent_mode and { fg = colors.aqua, reverse = config.invert_signs } + or { fg = colors.aqua, bg = colors.bg1, reverse = config.invert_signs }, + GruvboxOrangeSign = config.transparent_mode and { fg = colors.orange, reverse = config.invert_signs } + or { fg = colors.orange, bg = colors.bg1, reverse = config.invert_signs }, + GruvboxRedUnderline = { undercurl = config.undercurl, sp = colors.red }, + GruvboxGreenUnderline = { undercurl = config.undercurl, sp = colors.green }, + GruvboxYellowUnderline = { undercurl = config.undercurl, sp = colors.yellow }, + GruvboxBlueUnderline = { undercurl = config.undercurl, sp = colors.blue }, + GruvboxPurpleUnderline = { undercurl = config.undercurl, sp = colors.purple }, + GruvboxAquaUnderline = { undercurl = config.undercurl, sp = colors.aqua }, + GruvboxOrangeUnderline = { undercurl = config.undercurl, sp = colors.orange }, + Normal = config.transparent_mode and { fg = colors.fg1, bg = nil } or { fg = colors.fg1, bg = colors.bg0 }, + NormalFloat = config.transparent_mode and { fg = colors.fg1, bg = nil } or { fg = colors.fg1, bg = colors.bg1 }, + NormalNC = config.dim_inactive and { fg = colors.fg0, bg = colors.bg1 } or { link = "Normal" }, + CursorLine = { bg = colors.bg1 }, + CursorColumn = { link = "CursorLine" }, + TabLineFill = { fg = colors.bg4, bg = colors.bg1, reverse = config.invert_tabline }, + TabLineSel = { fg = colors.green, bg = colors.bg1, reverse = config.invert_tabline }, + TabLine = { link = "TabLineFill" }, + MatchParen = { bg = colors.bg3, bold = config.bold }, + ColorColumn = { bg = colors.bg1 }, + Conceal = { fg = colors.blue }, + CursorLineNr = { fg = colors.yellow, bg = colors.bg1 }, + NonText = { link = "GruvboxBg2" }, + SpecialKey = { link = "GruvboxFg4" }, + Visual = { bg = colors.bg3, reverse = config.invert_selection }, + VisualNOS = { link = "Visual" }, + Search = { fg = colors.yellow, bg = colors.bg0, reverse = config.inverse }, + IncSearch = { fg = colors.orange, bg = colors.bg0, reverse = config.inverse }, + CurSearch = { link = "IncSearch" }, + QuickFixLine = { link = "GruvboxPurple" }, + Underlined = { fg = colors.blue, underline = config.underline }, + StatusLine = { fg = colors.fg1, bg = colors.bg2 }, + StatusLineNC = { fg = colors.fg4, bg = colors.bg1 }, + WinBar = { fg = colors.fg4, bg = colors.bg0 }, + WinBarNC = { fg = colors.fg3, bg = colors.bg1 }, + WinSeparator = config.transparent_mode and { fg = colors.bg3, bg = nil } or { fg = colors.bg3, bg = colors.bg0 }, + WildMenu = { fg = colors.blue, bg = colors.bg2, bold = config.bold }, + Directory = { link = "GruvboxGreenBold" }, + Title = { link = "GruvboxGreenBold" }, + ErrorMsg = { fg = colors.bg0, bg = colors.red, bold = config.bold }, + MoreMsg = { link = "GruvboxYellowBold" }, + ModeMsg = { link = "GruvboxYellowBold" }, + Question = { link = "GruvboxOrangeBold" }, + WarningMsg = { link = "GruvboxRedBold" }, + LineNr = { fg = colors.bg4 }, + SignColumn = config.transparent_mode and { bg = nil } or { bg = colors.bg1 }, + Folded = { fg = colors.gray, bg = colors.bg1, italic = config.italic.folds }, + FoldColumn = config.transparent_mode and { fg = colors.gray, bg = nil } or { fg = colors.gray, bg = colors.bg1 }, + Cursor = { reverse = config.inverse }, + vCursor = { link = "Cursor" }, + iCursor = { link = "Cursor" }, + lCursor = { link = "Cursor" }, + Special = { link = "GruvboxOrange" }, + Comment = { fg = colors.gray, italic = config.italic.comments }, + Todo = { fg = colors.bg0, bg = colors.yellow, bold = config.bold, italic = config.italic.comments }, + Done = { fg = colors.orange, bold = config.bold, italic = config.italic.comments }, + Error = { fg = colors.red, bold = config.bold, reverse = config.inverse }, + Statement = { link = "GruvboxRed" }, + Conditional = { link = "GruvboxRed" }, + Repeat = { link = "GruvboxRed" }, + Label = { link = "GruvboxRed" }, + Exception = { link = "GruvboxRed" }, + Operator = { fg = colors.orange, italic = config.italic.operators }, + Keyword = { link = "GruvboxRed" }, + Identifier = { link = "GruvboxBlue" }, + Function = { link = "GruvboxGreenBold" }, + PreProc = { link = "GruvboxAqua" }, + Include = { link = "GruvboxAqua" }, + Define = { link = "GruvboxAqua" }, + Macro = { link = "GruvboxAqua" }, + PreCondit = { link = "GruvboxAqua" }, + Constant = { link = "GruvboxPurple" }, + Character = { link = "GruvboxPurple" }, + String = { fg = colors.green, italic = config.italic.strings }, + Boolean = { link = "GruvboxPurple" }, + Number = { link = "GruvboxPurple" }, + Float = { link = "GruvboxPurple" }, + Type = { link = "GruvboxYellow" }, + StorageClass = { link = "GruvboxOrange" }, + Structure = { link = "GruvboxAqua" }, + Typedef = { link = "GruvboxYellow" }, + Pmenu = { fg = colors.fg1, bg = colors.bg2 }, + PmenuSel = { fg = colors.bg2, bg = colors.blue, bold = config.bold }, + PmenuSbar = { bg = colors.bg2 }, + PmenuThumb = { bg = colors.bg4 }, + DiffDelete = { bg = colors.dark_red }, + DiffAdd = { bg = colors.dark_green }, + DiffChange = { bg = colors.dark_aqua }, + DiffText = { bg = colors.yellow, fg = colors.bg0 }, + SpellCap = { link = "GruvboxBlueUnderline" }, + SpellBad = { link = "GruvboxRedUnderline" }, + SpellLocal = { link = "GruvboxAquaUnderline" }, + SpellRare = { link = "GruvboxPurpleUnderline" }, + Whitespace = { fg = colors.bg2 }, + Delimiter = { link = "GruvboxOrange" }, + EndOfBuffer = { link = "NonText" }, + DiagnosticError = { link = "GruvboxRed" }, + DiagnosticWarn = { link = "GruvboxYellow" }, + DiagnosticInfo = { link = "GruvboxBlue" }, + DiagnosticDeprecated = { strikethrough = config.strikethrough }, + DiagnosticHint = { link = "GruvboxAqua" }, + DiagnosticOk = { link = "GruvboxGreen" }, + DiagnosticSignError = { link = "GruvboxRedSign" }, + DiagnosticSignWarn = { link = "GruvboxYellowSign" }, + DiagnosticSignInfo = { link = "GruvboxBlueSign" }, + DiagnosticSignHint = { link = "GruvboxAquaSign" }, + DiagnosticSignOk = { link = "GruvboxGreenSign" }, + DiagnosticUnderlineError = { link = "GruvboxRedUnderline" }, + DiagnosticUnderlineWarn = { link = "GruvboxYellowUnderline" }, + DiagnosticUnderlineInfo = { link = "GruvboxBlueUnderline" }, + DiagnosticUnderlineHint = { link = "GruvboxAquaUnderline" }, + DiagnosticUnderlineOk = { link = "GruvboxGreenUnderline" }, + DiagnosticFloatingError = { link = "GruvboxRed" }, + DiagnosticFloatingWarn = { link = "GruvboxOrange" }, + DiagnosticFloatingInfo = { link = "GruvboxBlue" }, + DiagnosticFloatingHint = { link = "GruvboxAqua" }, + DiagnosticFloatingOk = { link = "GruvboxGreen" }, + DiagnosticVirtualTextError = { link = "GruvboxRed" }, + DiagnosticVirtualTextWarn = { link = "GruvboxYellow" }, + DiagnosticVirtualTextInfo = { link = "GruvboxBlue" }, + DiagnosticVirtualTextHint = { link = "GruvboxAqua" }, + DiagnosticVirtualTextOk = { link = "GruvboxGreen" }, + LspReferenceRead = { link = "GruvboxYellowBold" }, + LspReferenceTarget = { link = "Visual" }, + LspReferenceText = { link = "GruvboxYellowBold" }, + LspReferenceWrite = { link = "GruvboxOrangeBold" }, + LspCodeLens = { link = "GruvboxGray" }, + LspSignatureActiveParameter = { link = "Search" }, + gitcommitSelectedFile = { link = "GruvboxGreen" }, + gitcommitDiscardedFile = { link = "GruvboxRed" }, + GitSignsAdd = { link = "GruvboxGreen" }, + GitSignsChange = { link = "GruvboxOrange" }, + GitSignsDelete = { link = "GruvboxRed" }, + NvimTreeSymlink = { fg = colors.neutral_aqua }, + NvimTreeRootFolder = { fg = colors.neutral_purple, bold = true }, + NvimTreeFolderIcon = { fg = colors.neutral_blue, bold = true }, + NvimTreeFileIcon = { fg = colors.light2 }, + NvimTreeExecFile = { fg = colors.neutral_green, bold = true }, + NvimTreeOpenedFile = { fg = colors.bright_red, bold = true }, + NvimTreeSpecialFile = { fg = colors.neutral_yellow, bold = true, underline = true }, + NvimTreeImageFile = { fg = colors.neutral_purple }, + NvimTreeIndentMarker = { fg = colors.dark3 }, + NvimTreeGitDirty = { fg = colors.neutral_yellow }, + NvimTreeGitStaged = { fg = colors.neutral_yellow }, + NvimTreeGitMerge = { fg = colors.neutral_purple }, + NvimTreeGitRenamed = { fg = colors.neutral_purple }, + NvimTreeGitNew = { fg = colors.neutral_yellow }, + NvimTreeGitDeleted = { fg = colors.neutral_red }, + NvimTreeWindowPicker = { bg = colors.aqua }, + debugPC = { link = "DiffAdd" }, + debugBreakpoint = { link = "GruvboxRedSign" }, + StartifyBracket = { link = "GruvboxFg3" }, + StartifyFile = { link = "GruvboxFg1" }, + StartifyNumber = { link = "GruvboxBlue" }, + StartifyPath = { link = "GruvboxGray" }, + StartifySlash = { link = "GruvboxGray" }, + StartifySection = { link = "GruvboxYellow" }, + StartifySpecial = { link = "GruvboxBg2" }, + StartifyHeader = { link = "GruvboxOrange" }, + StartifyFooter = { link = "GruvboxBg2" }, + StartifyVar = { link = "StartifyPath" }, + StartifySelect = { link = "Title" }, + DirvishPathTail = { link = "GruvboxAqua" }, + DirvishArg = { link = "GruvboxYellow" }, + netrwDir = { link = "GruvboxAqua" }, + netrwClassify = { link = "GruvboxAqua" }, + netrwLink = { link = "GruvboxGray" }, + netrwSymLink = { link = "GruvboxFg1" }, + netrwExe = { link = "GruvboxYellow" }, + netrwComment = { link = "GruvboxGray" }, + netrwList = { link = "GruvboxBlue" }, + netrwHelpCmd = { link = "GruvboxAqua" }, + netrwCmdSep = { link = "GruvboxFg3" }, + netrwVersion = { link = "GruvboxGreen" }, + NERDTreeDir = { link = "GruvboxAqua" }, + NERDTreeDirSlash = { link = "GruvboxAqua" }, + NERDTreeOpenable = { link = "GruvboxOrange" }, + NERDTreeClosable = { link = "GruvboxOrange" }, + NERDTreeFile = { link = "GruvboxFg1" }, + NERDTreeExecFile = { link = "GruvboxYellow" }, + NERDTreeUp = { link = "GruvboxGray" }, + NERDTreeCWD = { link = "GruvboxGreen" }, + NERDTreeHelp = { link = "GruvboxFg1" }, + NERDTreeToggleOn = { link = "GruvboxGreen" }, + NERDTreeToggleOff = { link = "GruvboxRed" }, + CocErrorSign = { link = "GruvboxRedSign" }, + CocWarningSign = { link = "GruvboxOrangeSign" }, + CocInfoSign = { link = "GruvboxBlueSign" }, + CocHintSign = { link = "GruvboxAquaSign" }, + CocErrorFloat = { link = "GruvboxRed" }, + CocWarningFloat = { link = "GruvboxOrange" }, + CocInfoFloat = { link = "GruvboxBlue" }, + CocHintFloat = { link = "GruvboxAqua" }, + CocDiagnosticsError = { link = "GruvboxRed" }, + CocDiagnosticsWarning = { link = "GruvboxOrange" }, + CocDiagnosticsInfo = { link = "GruvboxBlue" }, + CocDiagnosticsHint = { link = "GruvboxAqua" }, + CocSearch = { link = "GruvboxBlue" }, + CocSelectedText = { link = "GruvboxRed" }, + CocMenuSel = { link = "PmenuSel" }, + CocCodeLens = { link = "GruvboxGray" }, + CocErrorHighlight = { link = "GruvboxRedUnderline" }, + CocWarningHighlight = { link = "GruvboxOrangeUnderline" }, + CocInfoHighlight = { link = "GruvboxBlueUnderline" }, + CocHintHighlight = { link = "GruvboxAquaUnderline" }, + SnacksPicker = { link = "GruvboxFg1" }, + SnacksPickerBorder = { link = "SnacksPicker" }, + SnacksPickerListCursorLine = { link = "CursorLine" }, + SnacksPickerMatch = { link = "GruvboxOrange" }, + SnacksPickerPrompt = { link = "GruvboxRed" }, + SnacksPickerTitle = { link = "SnacksPicker" }, + SnacksPickerDir = { link = "GruvboxGray" }, + SnacksPickerPathHidden = { link = "GruvboxGray" }, + SnacksPickerGitStatusUntracked = { link = "GruvboxGray" }, + SnacksPickerPathIgnored = { link = "GruvboxBg3" }, + TelescopeNormal = { link = "GruvboxFg1" }, + TelescopeSelection = { link = "CursorLine" }, + TelescopeSelectionCaret = { link = "GruvboxRed" }, + TelescopeMultiSelection = { link = "GruvboxGray" }, + TelescopeBorder = { link = "TelescopeNormal" }, + TelescopePromptBorder = { link = "TelescopeNormal" }, + TelescopeResultsBorder = { link = "TelescopeNormal" }, + TelescopePreviewBorder = { link = "TelescopeNormal" }, + TelescopeMatching = { link = "GruvboxOrange" }, + TelescopePromptPrefix = { link = "GruvboxRed" }, + TelescopePrompt = { link = "TelescopeNormal" }, + CmpItemAbbr = { link = "GruvboxFg0" }, + CmpItemAbbrDeprecated = { link = "GruvboxFg1" }, + CmpItemAbbrMatch = { link = "GruvboxBlueBold" }, + CmpItemAbbrMatchFuzzy = { link = "GruvboxBlueUnderline" }, + CmpItemMenu = { link = "GruvboxGray" }, + CmpItemKindText = { link = "GruvboxOrange" }, + CmpItemKindVariable = { link = "GruvboxOrange" }, + CmpItemKindMethod = { link = "GruvboxBlue" }, + CmpItemKindFunction = { link = "GruvboxBlue" }, + CmpItemKindConstructor = { link = "GruvboxYellow" }, + CmpItemKindUnit = { link = "GruvboxBlue" }, + CmpItemKindField = { link = "GruvboxBlue" }, + CmpItemKindClass = { link = "GruvboxYellow" }, + CmpItemKindInterface = { link = "GruvboxYellow" }, + CmpItemKindModule = { link = "GruvboxBlue" }, + CmpItemKindProperty = { link = "GruvboxBlue" }, + CmpItemKindValue = { link = "GruvboxOrange" }, + CmpItemKindEnum = { link = "GruvboxYellow" }, + CmpItemKindOperator = { link = "GruvboxYellow" }, + CmpItemKindKeyword = { link = "GruvboxPurple" }, + CmpItemKindEvent = { link = "GruvboxPurple" }, + CmpItemKindReference = { link = "GruvboxPurple" }, + CmpItemKindColor = { link = "GruvboxPurple" }, + CmpItemKindSnippet = { link = "GruvboxGreen" }, + CmpItemKindFile = { link = "GruvboxBlue" }, + CmpItemKindFolder = { link = "GruvboxBlue" }, + CmpItemKindEnumMember = { link = "GruvboxAqua" }, + CmpItemKindConstant = { link = "GruvboxOrange" }, + CmpItemKindStruct = { link = "GruvboxYellow" }, + CmpItemKindTypeParameter = { link = "GruvboxYellow" }, + BlinkCmpLabel = { link = "GruvboxFg0" }, + BlinkCmpLabelDeprecated = { link = "GruvboxFg1" }, + BlinkCmpLabelMatch = { link = "GruvboxBlueBold" }, + BlinkCmpLabelDetail = { link = "GruvboxGray" }, + BlinkCmpLabelDescription = { link = "GruvboxGray" }, + BlinkCmpKindText = { link = "GruvboxOrange" }, + BlinkCmpKindVariable = { link = "GruvboxOrange" }, + BlinkCmpKindMethod = { link = "GruvboxBlue" }, + BlinkCmpKindFunction = { link = "GruvboxBlue" }, + BlinkCmpKindConstructor = { link = "GruvboxYellow" }, + BlinkCmpKindUnit = { link = "GruvboxBlue" }, + BlinkCmpKindField = { link = "GruvboxBlue" }, + BlinkCmpKindClass = { link = "GruvboxYellow" }, + BlinkCmpKindInterface = { link = "GruvboxYellow" }, + BlinkCmpKindModule = { link = "GruvboxBlue" }, + BlinkCmpKindProperty = { link = "GruvboxBlue" }, + BlinkCmpKindValue = { link = "GruvboxOrange" }, + BlinkCmpKindEnum = { link = "GruvboxYellow" }, + BlinkCmpKindOperator = { link = "GruvboxYellow" }, + BlinkCmpKindKeyword = { link = "GruvboxPurple" }, + BlinkCmpKindEvent = { link = "GruvboxPurple" }, + BlinkCmpKindReference = { link = "GruvboxPurple" }, + BlinkCmpKindColor = { link = "GruvboxPurple" }, + BlinkCmpKindSnippet = { link = "GruvboxGreen" }, + BlinkCmpKindFile = { link = "GruvboxBlue" }, + BlinkCmpKindFolder = { link = "GruvboxBlue" }, + BlinkCmpKindEnumMember = { link = "GruvboxAqua" }, + BlinkCmpKindConstant = { link = "GruvboxOrange" }, + BlinkCmpKindStruct = { link = "GruvboxYellow" }, + BlinkCmpKindTypeParameter = { link = "GruvboxYellow" }, + BlinkCmpSource = { link = "GruvboxGray" }, + BlinkCmpGhostText = { link = "GruvboxBg4" }, + diffAdded = { link = "DiffAdd" }, + diffRemoved = { link = "DiffDelete" }, + diffChanged = { link = "DiffChange" }, + diffFile = { link = "GruvboxOrange" }, + diffNewFile = { link = "GruvboxYellow" }, + diffOldFile = { link = "GruvboxOrange" }, + diffLine = { link = "GruvboxBlue" }, + diffIndexLine = { link = "diffChanged" }, + NavicIconsFile = { link = "GruvboxBlue" }, + NavicIconsModule = { link = "GruvboxOrange" }, + NavicIconsNamespace = { link = "GruvboxBlue" }, + NavicIconsPackage = { link = "GruvboxAqua" }, + NavicIconsClass = { link = "GruvboxYellow" }, + NavicIconsMethod = { link = "GruvboxBlue" }, + NavicIconsProperty = { link = "GruvboxAqua" }, + NavicIconsField = { link = "GruvboxPurple" }, + NavicIconsConstructor = { link = "GruvboxBlue" }, + NavicIconsEnum = { link = "GruvboxPurple" }, + NavicIconsInterface = { link = "GruvboxGreen" }, + NavicIconsFunction = { link = "GruvboxBlue" }, + NavicIconsVariable = { link = "GruvboxPurple" }, + NavicIconsConstant = { link = "GruvboxOrange" }, + NavicIconsString = { link = "GruvboxGreen" }, + NavicIconsNumber = { link = "GruvboxOrange" }, + NavicIconsBoolean = { link = "GruvboxOrange" }, + NavicIconsArray = { link = "GruvboxOrange" }, + NavicIconsObject = { link = "GruvboxOrange" }, + NavicIconsKey = { link = "GruvboxAqua" }, + NavicIconsNull = { link = "GruvboxOrange" }, + NavicIconsEnumMember = { link = "GruvboxYellow" }, + NavicIconsStruct = { link = "GruvboxPurple" }, + NavicIconsEvent = { link = "GruvboxYellow" }, + NavicIconsOperator = { link = "GruvboxRed" }, + NavicIconsTypeParameter = { link = "GruvboxRed" }, + NavicText = { link = "GruvboxWhite" }, + NavicSeparator = { link = "GruvboxWhite" }, + htmlTag = { link = "GruvboxAquaBold" }, + htmlEndTag = { link = "GruvboxAquaBold" }, + htmlTagName = { link = "GruvboxBlue" }, + htmlArg = { link = "GruvboxOrange" }, + htmlTagN = { link = "GruvboxFg1" }, + htmlSpecialTagName = { link = "GruvboxBlue" }, + htmlLink = { fg = colors.fg4, underline = config.underline }, + htmlSpecialChar = { link = "GruvboxRed" }, + htmlBold = { fg = colors.fg0, bg = colors.bg0, bold = config.bold }, + htmlBoldUnderline = { fg = colors.fg0, bg = colors.bg0, bold = config.bold, underline = config.underline }, + htmlBoldItalic = { fg = colors.fg0, bg = colors.bg0, bold = config.bold, italic = true }, + htmlBoldUnderlineItalic = { + fg = colors.fg0, + bg = colors.bg0, + bold = config.bold, + italic = true, + underline = config.underline, + }, + htmlUnderline = { fg = colors.fg0, bg = colors.bg0, underline = config.underline }, + htmlUnderlineItalic = { + fg = colors.fg0, + bg = colors.bg0, + italic = true, + underline = config.underline, + }, + htmlItalic = { fg = colors.fg0, bg = colors.bg0, italic = true }, + xmlTag = { link = "GruvboxAquaBold" }, + xmlEndTag = { link = "GruvboxAquaBold" }, + xmlTagName = { link = "GruvboxBlue" }, + xmlEqual = { link = "GruvboxBlue" }, + docbkKeyword = { link = "GruvboxAquaBold" }, + xmlDocTypeDecl = { link = "GruvboxGray" }, + xmlDocTypeKeyword = { link = "GruvboxPurple" }, + xmlCdataStart = { link = "GruvboxGray" }, + xmlCdataCdata = { link = "GruvboxPurple" }, + dtdFunction = { link = "GruvboxGray" }, + dtdTagName = { link = "GruvboxPurple" }, + xmlAttrib = { link = "GruvboxOrange" }, + xmlProcessingDelim = { link = "GruvboxGray" }, + dtdParamEntityPunct = { link = "GruvboxGray" }, + dtdParamEntityDPunct = { link = "GruvboxGray" }, + xmlAttribPunct = { link = "GruvboxGray" }, + xmlEntity = { link = "GruvboxRed" }, + xmlEntityPunct = { link = "GruvboxRed" }, + clojureKeyword = { link = "GruvboxBlue" }, + clojureCond = { link = "GruvboxOrange" }, + clojureSpecial = { link = "GruvboxOrange" }, + clojureDefine = { link = "GruvboxOrange" }, + clojureFunc = { link = "GruvboxYellow" }, + clojureRepeat = { link = "GruvboxYellow" }, + clojureCharacter = { link = "GruvboxAqua" }, + clojureStringEscape = { link = "GruvboxAqua" }, + clojureException = { link = "GruvboxRed" }, + clojureRegexp = { link = "GruvboxAqua" }, + clojureRegexpEscape = { link = "GruvboxAqua" }, + clojureRegexpCharClass = { fg = colors.fg3, bold = config.bold }, + clojureRegexpMod = { link = "clojureRegexpCharClass" }, + clojureRegexpQuantifier = { link = "clojureRegexpCharClass" }, + clojureParen = { link = "GruvboxFg3" }, + clojureAnonArg = { link = "GruvboxYellow" }, + clojureVariable = { link = "GruvboxBlue" }, + clojureMacro = { link = "GruvboxOrange" }, + clojureMeta = { link = "GruvboxYellow" }, + clojureDeref = { link = "GruvboxYellow" }, + clojureQuote = { link = "GruvboxYellow" }, + clojureUnquote = { link = "GruvboxYellow" }, + cOperator = { link = "GruvboxPurple" }, + cppOperator = { link = "GruvboxPurple" }, + cStructure = { link = "GruvboxOrange" }, + pythonBuiltin = { link = "GruvboxOrange" }, + pythonBuiltinObj = { link = "GruvboxOrange" }, + pythonBuiltinFunc = { link = "GruvboxOrange" }, + pythonFunction = { link = "GruvboxAqua" }, + pythonDecorator = { link = "GruvboxRed" }, + pythonInclude = { link = "GruvboxBlue" }, + pythonImport = { link = "GruvboxBlue" }, + pythonRun = { link = "GruvboxBlue" }, + pythonCoding = { link = "GruvboxBlue" }, + pythonOperator = { link = "GruvboxRed" }, + pythonException = { link = "GruvboxRed" }, + pythonExceptions = { link = "GruvboxPurple" }, + pythonBoolean = { link = "GruvboxPurple" }, + pythonDot = { link = "GruvboxFg3" }, + pythonConditional = { link = "GruvboxRed" }, + pythonRepeat = { link = "GruvboxRed" }, + pythonDottedName = { link = "GruvboxGreenBold" }, + cssBraces = { link = "GruvboxBlue" }, + cssFunctionName = { link = "GruvboxYellow" }, + cssIdentifier = { link = "GruvboxOrange" }, + cssClassName = { link = "GruvboxGreen" }, + cssColor = { link = "GruvboxBlue" }, + cssSelectorOp = { link = "GruvboxBlue" }, + cssSelectorOp2 = { link = "GruvboxBlue" }, + cssImportant = { link = "GruvboxGreen" }, + cssVendor = { link = "GruvboxFg1" }, + cssTextProp = { link = "GruvboxAqua" }, + cssAnimationProp = { link = "GruvboxAqua" }, + cssUIProp = { link = "GruvboxYellow" }, + cssTransformProp = { link = "GruvboxAqua" }, + cssTransitionProp = { link = "GruvboxAqua" }, + cssPrintProp = { link = "GruvboxAqua" }, + cssPositioningProp = { link = "GruvboxYellow" }, + cssBoxProp = { link = "GruvboxAqua" }, + cssFontDescriptorProp = { link = "GruvboxAqua" }, + cssFlexibleBoxProp = { link = "GruvboxAqua" }, + cssBorderOutlineProp = { link = "GruvboxAqua" }, + cssBackgroundProp = { link = "GruvboxAqua" }, + cssMarginProp = { link = "GruvboxAqua" }, + cssListProp = { link = "GruvboxAqua" }, + cssTableProp = { link = "GruvboxAqua" }, + cssFontProp = { link = "GruvboxAqua" }, + cssPaddingProp = { link = "GruvboxAqua" }, + cssDimensionProp = { link = "GruvboxAqua" }, + cssRenderProp = { link = "GruvboxAqua" }, + cssColorProp = { link = "GruvboxAqua" }, + cssGeneratedContentProp = { link = "GruvboxAqua" }, + javaScriptBraces = { link = "GruvboxFg1" }, + javaScriptFunction = { link = "GruvboxAqua" }, + javaScriptIdentifier = { link = "GruvboxRed" }, + javaScriptMember = { link = "GruvboxBlue" }, + javaScriptNumber = { link = "GruvboxPurple" }, + javaScriptNull = { link = "GruvboxPurple" }, + javaScriptParens = { link = "GruvboxFg3" }, + typescriptReserved = { link = "GruvboxAqua" }, + typescriptLabel = { link = "GruvboxAqua" }, + typescriptFuncKeyword = { link = "GruvboxAqua" }, + typescriptIdentifier = { link = "GruvboxOrange" }, + typescriptBraces = { link = "GruvboxFg1" }, + typescriptEndColons = { link = "GruvboxFg1" }, + typescriptDOMObjects = { link = "GruvboxFg1" }, + typescriptAjaxMethods = { link = "GruvboxFg1" }, + typescriptLogicSymbols = { link = "GruvboxFg1" }, + typescriptDocSeeTag = { link = "Comment" }, + typescriptDocParam = { link = "Comment" }, + typescriptDocTags = { link = "vimCommentTitle" }, + typescriptGlobalObjects = { link = "GruvboxFg1" }, + typescriptParens = { link = "GruvboxFg3" }, + typescriptOpSymbols = { link = "GruvboxFg3" }, + typescriptHtmlElemProperties = { link = "GruvboxFg1" }, + typescriptNull = { link = "GruvboxPurple" }, + typescriptInterpolationDelimiter = { link = "GruvboxAqua" }, + purescriptModuleKeyword = { link = "GruvboxAqua" }, + purescriptModuleName = { link = "GruvboxFg1" }, + purescriptWhere = { link = "GruvboxAqua" }, + purescriptDelimiter = { link = "GruvboxFg4" }, + purescriptType = { link = "GruvboxFg1" }, + purescriptImportKeyword = { link = "GruvboxAqua" }, + purescriptHidingKeyword = { link = "GruvboxAqua" }, + purescriptAsKeyword = { link = "GruvboxAqua" }, + purescriptStructure = { link = "GruvboxAqua" }, + purescriptOperator = { link = "GruvboxBlue" }, + purescriptTypeVar = { link = "GruvboxFg1" }, + purescriptConstructor = { link = "GruvboxFg1" }, + purescriptFunction = { link = "GruvboxFg1" }, + purescriptConditional = { link = "GruvboxOrange" }, + purescriptBacktick = { link = "GruvboxOrange" }, + coffeeExtendedOp = { link = "GruvboxFg3" }, + coffeeSpecialOp = { link = "GruvboxFg3" }, + coffeeCurly = { link = "GruvboxOrange" }, + coffeeParen = { link = "GruvboxFg3" }, + coffeeBracket = { link = "GruvboxOrange" }, + rubyStringDelimiter = { link = "GruvboxGreen" }, + rubyInterpolationDelimiter = { link = "GruvboxAqua" }, + rubyDefinedOperator = { link = "rubyKeyword" }, + objcTypeModifier = { link = "GruvboxRed" }, + objcDirective = { link = "GruvboxBlue" }, + goDirective = { link = "GruvboxAqua" }, + goConstants = { link = "GruvboxPurple" }, + goDeclaration = { link = "GruvboxRed" }, + goDeclType = { link = "GruvboxBlue" }, + goBuiltins = { link = "GruvboxOrange" }, + luaIn = { link = "GruvboxRed" }, + luaFunction = { link = "GruvboxAqua" }, + luaTable = { link = "GruvboxOrange" }, + moonSpecialOp = { link = "GruvboxFg3" }, + moonExtendedOp = { link = "GruvboxFg3" }, + moonFunction = { link = "GruvboxFg3" }, + moonObject = { link = "GruvboxYellow" }, + javaAnnotation = { link = "GruvboxBlue" }, + javaDocTags = { link = "GruvboxAqua" }, + javaCommentTitle = { link = "vimCommentTitle" }, + javaParen = { link = "GruvboxFg3" }, + javaParen1 = { link = "GruvboxFg3" }, + javaParen2 = { link = "GruvboxFg3" }, + javaParen3 = { link = "GruvboxFg3" }, + javaParen4 = { link = "GruvboxFg3" }, + javaParen5 = { link = "GruvboxFg3" }, + javaOperator = { link = "GruvboxOrange" }, + javaVarArg = { link = "GruvboxGreen" }, + elixirDocString = { link = "Comment" }, + elixirStringDelimiter = { link = "GruvboxGreen" }, + elixirInterpolationDelimiter = { link = "GruvboxAqua" }, + elixirModuleDeclaration = { link = "GruvboxYellow" }, + scalaNameDefinition = { link = "GruvboxFg1" }, + scalaCaseFollowing = { link = "GruvboxFg1" }, + scalaCapitalWord = { link = "GruvboxFg1" }, + scalaTypeExtension = { link = "GruvboxFg1" }, + scalaKeyword = { link = "GruvboxRed" }, + scalaKeywordModifier = { link = "GruvboxRed" }, + scalaSpecial = { link = "GruvboxAqua" }, + scalaOperator = { link = "GruvboxFg1" }, + scalaTypeDeclaration = { link = "GruvboxYellow" }, + scalaTypeTypePostDeclaration = { link = "GruvboxYellow" }, + scalaInstanceDeclaration = { link = "GruvboxFg1" }, + scalaInterpolation = { link = "GruvboxAqua" }, + markdownItalic = { fg = colors.fg3, italic = true }, + markdownBold = { fg = colors.fg3, bold = config.bold }, + markdownBoldItalic = { fg = colors.fg3, bold = config.bold, italic = true }, + markdownH1 = { link = "GruvboxGreenBold" }, + markdownH2 = { link = "GruvboxGreenBold" }, + markdownH3 = { link = "GruvboxYellowBold" }, + markdownH4 = { link = "GruvboxYellowBold" }, + markdownH5 = { link = "GruvboxYellow" }, + markdownH6 = { link = "GruvboxYellow" }, + markdownCode = { link = "GruvboxAqua" }, + markdownCodeBlock = { link = "GruvboxAqua" }, + markdownCodeDelimiter = { link = "GruvboxAqua" }, + markdownBlockquote = { link = "GruvboxGray" }, + markdownListMarker = { link = "GruvboxGray" }, + markdownOrderedListMarker = { link = "GruvboxGray" }, + markdownRule = { link = "GruvboxGray" }, + markdownHeadingRule = { link = "GruvboxGray" }, + markdownUrlDelimiter = { link = "GruvboxFg3" }, + markdownLinkDelimiter = { link = "GruvboxFg3" }, + markdownLinkTextDelimiter = { link = "GruvboxFg3" }, + markdownHeadingDelimiter = { link = "GruvboxOrange" }, + markdownUrl = { link = "GruvboxPurple" }, + markdownUrlTitleDelimiter = { link = "GruvboxGreen" }, + markdownLinkText = { fg = colors.gray, underline = config.underline }, + markdownIdDeclaration = { link = "markdownLinkText" }, + haskellType = { link = "GruvboxBlue" }, + haskellIdentifier = { link = "GruvboxAqua" }, + haskellSeparator = { link = "GruvboxFg4" }, + haskellDelimiter = { link = "GruvboxOrange" }, + haskellOperators = { link = "GruvboxPurple" }, + haskellBacktick = { link = "GruvboxOrange" }, + haskellStatement = { link = "GruvboxPurple" }, + haskellConditional = { link = "GruvboxPurple" }, + haskellLet = { link = "GruvboxRed" }, + haskellDefault = { link = "GruvboxRed" }, + haskellWhere = { link = "GruvboxRed" }, + haskellBottom = { link = "GruvboxRedBold" }, + haskellImportKeywords = { link = "GruvboxPurpleBold" }, + haskellDeclKeyword = { link = "GruvboxOrange" }, + haskellDecl = { link = "GruvboxOrange" }, + haskellDeriving = { link = "GruvboxPurple" }, + haskellAssocType = { link = "GruvboxAqua" }, + haskellNumber = { link = "GruvboxAqua" }, + haskellPragma = { link = "GruvboxRedBold" }, + haskellTH = { link = "GruvboxAquaBold" }, + haskellForeignKeywords = { link = "GruvboxGreen" }, + haskellKeyword = { link = "GruvboxRed" }, + haskellFloat = { link = "GruvboxAqua" }, + haskellInfix = { link = "GruvboxPurple" }, + haskellQuote = { link = "GruvboxGreenBold" }, + haskellShebang = { link = "GruvboxYellowBold" }, + haskellLiquid = { link = "GruvboxPurpleBold" }, + haskellQuasiQuoted = { link = "GruvboxBlueBold" }, + haskellRecursiveDo = { link = "GruvboxPurple" }, + haskellQuotedType = { link = "GruvboxRed" }, + haskellPreProc = { link = "GruvboxFg4" }, + haskellTypeRoles = { link = "GruvboxRedBold" }, + haskellTypeForall = { link = "GruvboxRed" }, + haskellPatternKeyword = { link = "GruvboxBlue" }, + jsonKeyword = { link = "GruvboxGreen" }, + jsonQuote = { link = "GruvboxGreen" }, + jsonBraces = { link = "GruvboxFg1" }, + jsonString = { link = "GruvboxFg1" }, + mailQuoted1 = { link = "GruvboxAqua" }, + mailQuoted2 = { link = "GruvboxPurple" }, + mailQuoted3 = { link = "GruvboxYellow" }, + mailQuoted4 = { link = "GruvboxGreen" }, + mailQuoted5 = { link = "GruvboxRed" }, + mailQuoted6 = { link = "GruvboxOrange" }, + mailSignature = { link = "Comment" }, + csBraces = { link = "GruvboxFg1" }, + csEndColon = { link = "GruvboxFg1" }, + csLogicSymbols = { link = "GruvboxFg1" }, + csParens = { link = "GruvboxFg3" }, + csOpSymbols = { link = "GruvboxFg3" }, + csInterpolationDelimiter = { link = "GruvboxFg3" }, + csInterpolationAlignDel = { link = "GruvboxAquaBold" }, + csInterpolationFormat = { link = "GruvboxAqua" }, + csInterpolationFormatDel = { link = "GruvboxAquaBold" }, + rustSigil = { link = "GruvboxOrange" }, + rustEscape = { link = "GruvboxAqua" }, + rustStringContinuation = { link = "GruvboxAqua" }, + rustEnum = { link = "GruvboxAqua" }, + rustStructure = { link = "GruvboxAqua" }, + rustModPathSep = { link = "GruvboxFg2" }, + rustCommentLineDoc = { link = "Comment" }, + rustDefault = { link = "GruvboxAqua" }, + ocamlOperator = { link = "GruvboxFg1" }, + ocamlKeyChar = { link = "GruvboxOrange" }, + ocamlArrow = { link = "GruvboxOrange" }, + ocamlInfixOpKeyword = { link = "GruvboxRed" }, + ocamlConstructor = { link = "GruvboxOrange" }, + LspSagaCodeActionTitle = { link = "Title" }, + LspSagaCodeActionBorder = { link = "GruvboxFg1" }, + LspSagaCodeActionContent = { fg = colors.green, bold = config.bold }, + LspSagaLspFinderBorder = { link = "GruvboxFg1" }, + LspSagaAutoPreview = { link = "GruvboxOrange" }, + TargetWord = { fg = colors.blue, bold = config.bold }, + FinderSeparator = { link = "GruvboxAqua" }, + LspSagaDefPreviewBorder = { link = "GruvboxBlue" }, + LspSagaHoverBorder = { link = "GruvboxOrange" }, + LspSagaRenameBorder = { link = "GruvboxBlue" }, + LspSagaDiagnosticSource = { link = "GruvboxOrange" }, + LspSagaDiagnosticBorder = { link = "GruvboxPurple" }, + LspSagaDiagnosticHeader = { link = "GruvboxGreen" }, + LspSagaSignatureHelpBorder = { link = "GruvboxGreen" }, + SagaShadow = { link = "GruvboxBg0" }, + DashboardShortCut = { link = "GruvboxOrange" }, + DashboardHeader = { link = "GruvboxAqua" }, + DashboardCenter = { link = "GruvboxYellow" }, + DashboardFooter = { fg = colors.purple, italic = true }, + MasonHighlight = { link = "GruvboxAqua" }, + MasonHighlightBlock = { fg = colors.bg0, bg = colors.blue }, + MasonHighlightBlockBold = { fg = colors.bg0, bg = colors.blue, bold = true }, + MasonHighlightSecondary = { fg = colors.yellow }, + MasonHighlightBlockSecondary = { fg = colors.bg0, bg = colors.yellow }, + MasonHighlightBlockBoldSecondary = { fg = colors.bg0, bg = colors.yellow, bold = true }, + MasonHeader = { link = "MasonHighlightBlockBoldSecondary" }, + MasonHeaderSecondary = { link = "MasonHighlightBlockBold" }, + MasonMuted = { fg = colors.fg4 }, + MasonMutedBlock = { fg = colors.bg0, bg = colors.fg4 }, + MasonMutedBlockBold = { fg = colors.bg0, bg = colors.fg4, bold = true }, + LspInlayHint = { link = "comment" }, + CarbonFile = { link = "GruvboxFg1" }, + CarbonExe = { link = "GruvboxYellow" }, + CarbonSymlink = { link = "GruvboxAqua" }, + CarbonBrokenSymlink = { link = "GruvboxRed" }, + CarbonIndicator = { link = "GruvboxGray" }, + CarbonDanger = { link = "GruvboxRed" }, + CarbonPending = { link = "GruvboxYellow" }, + NoiceCursor = { link = "TermCursor" }, + NoiceCmdlinePopupBorder = { fg = colors.blue, bg = nil }, + NoiceCmdlineIcon = { link = "NoiceCmdlinePopupBorder" }, + NoiceConfirmBorder = { link = "NoiceCmdlinePopupBorder" }, + NoiceCmdlinePopupBorderSearch = { fg = colors.yellow, bg = nil }, + NoiceCmdlineIconSearch = { link = "NoiceCmdlinePopupBorderSearch" }, + NotifyDEBUGBorder = { link = "GruvboxBlue" }, + NotifyDEBUGIcon = { link = "GruvboxBlue" }, + NotifyDEBUGTitle = { link = "GruvboxBlue" }, + NotifyERRORBorder = { link = "GruvboxRed" }, + NotifyERRORIcon = { link = "GruvboxRed" }, + NotifyERRORTitle = { link = "GruvboxRed" }, + NotifyINFOBorder = { link = "GruvboxAqua" }, + NotifyINFOIcon = { link = "GruvboxAqua" }, + NotifyINFOTitle = { link = "GruvboxAqua" }, + NotifyTRACEBorder = { link = "GruvboxGreen" }, + NotifyTRACEIcon = { link = "GruvboxGreen" }, + NotifyTRACETitle = { link = "GruvboxGreen" }, + NotifyWARNBorder = { link = "GruvboxYellow" }, + NotifyWARNIcon = { link = "GruvboxYellow" }, + NotifyWARNTitle = { link = "GruvboxYellow" }, + IlluminatedWordText = { link = "LspReferenceText" }, + IlluminatedWordRead = { link = "LspReferenceRead" }, + IlluminatedWordWrite = { link = "LspReferenceWrite" }, + TSRainbowRed = { fg = colors.red }, + TSRainbowOrange = { fg = colors.orange }, + TSRainbowYellow = { fg = colors.yellow }, + TSRainbowGreen = { fg = colors.green }, + TSRainbowBlue = { fg = colors.blue }, + TSRainbowViolet = { fg = colors.purple }, + TSRainbowCyan = { fg = colors.aqua }, + RainbowDelimiterRed = { fg = colors.red }, + RainbowDelimiterOrange = { fg = colors.orange }, + RainbowDelimiterYellow = { fg = colors.yellow }, + RainbowDelimiterGreen = { fg = colors.green }, + RainbowDelimiterBlue = { fg = colors.blue }, + RainbowDelimiterViolet = { fg = colors.purple }, + RainbowDelimiterCyan = { fg = colors.aqua }, + DapBreakpointSymbol = { fg = colors.red, bg = colors.bg1 }, + DapStoppedSymbol = { fg = colors.green, bg = colors.bg1 }, + DapUIBreakpointsCurrentLine = { link = "GruvboxYellow" }, + DapUIBreakpointsDisabledLine = { link = "GruvboxGray" }, + DapUIBreakpointsInfo = { link = "GruvboxAqua" }, + DapUIBreakpointsLine = { link = "GruvboxYellow" }, + DapUIBreakpointsPath = { link = "GruvboxBlue" }, + DapUICurrentFrameName = { link = "GruvboxPurple" }, + DapUIDecoration = { link = "GruvboxPurple" }, + DapUIEndofBuffer = { link = "EndOfBuffer" }, + DapUIFloatBorder = { link = "GruvboxAqua" }, + DapUILineNumber = { link = "GruvboxYellow" }, + DapUIModifiedValue = { link = "GruvboxRed" }, + DapUIPlayPause = { fg = colors.green, bg = colors.bg1 }, + DapUIRestart = { fg = colors.green, bg = colors.bg1 }, + DapUIScope = { link = "GruvboxBlue" }, + DapUISource = { link = "GruvboxFg1" }, + DapUIStepBack = { fg = colors.blue, bg = colors.bg1 }, + DapUIStepInto = { fg = colors.blue, bg = colors.bg1 }, + DapUIStepOut = { fg = colors.blue, bg = colors.bg1 }, + DapUIStepOver = { fg = colors.blue, bg = colors.bg1 }, + DapUIStop = { fg = colors.red, bg = colors.bg1 }, + DapUIStoppedThread = { link = "GruvboxBlue" }, + DapUIThread = { link = "GruvboxBlue" }, + DapUIType = { link = "GruvboxOrange" }, + DapUIUnavailable = { link = "GruvboxGray" }, + DapUIWatchesEmpty = { link = "GruvboxGray" }, + DapUIWatchesError = { link = "GruvboxRed" }, + DapUIWatchesValue = { link = "GruvboxYellow" }, + DapUIWinSelect = { link = "GruvboxYellow" }, + NeogitDiffDelete = { link = "DiffDelete" }, + NeogitDiffAdd = { link = "DiffAdd" }, + NeogitHunkHeader = { link = "WinBar" }, + NeogitHunkHeaderHighlight = { link = "WinBarNC" }, + DiffviewStatusModified = { link = "GruvboxGreenBold" }, + DiffviewFilePanelInsertions = { link = "GruvboxGreenBold" }, + DiffviewFilePanelDeletions = { link = "GruvboxRedBold" }, + MiniAnimateCursor = { reverse = true, nocombine = true }, + MiniAnimateNormalFloat = { fg = colors.fg1, bg = colors.bg1 }, + MiniClueBorder = { link = "FloatBorder" }, + MiniClueDescGroup = { link = "DiagnosticFloatingWarn" }, + MiniClueDescSingle = { link = "NormalFloat" }, + MiniClueNextKey = { link = "DiagnosticFloatingHint" }, + MiniClueNextKeyWithPostkeys = { link = "DiagnosticFloatingError" }, + MiniClueSeparator = { link = "DiagnosticFloatingInfo" }, + MiniClueTitle = { link = "FloatTitle" }, + MiniCompletionActiveParameter = { underline = true }, + MiniCursorword = { underline = true }, + MiniCursorwordCurrent = { underline = true }, + MiniDepsChangeAdded = { link = "GruvboxGreen" }, + MiniDepsChangeRemoved = { link = "GruvboxRed" }, + MiniDepsHint = { link = "DiagnosticHint" }, + MiniDepsInfo = { link = "DiagnosticInfo" }, + MiniDepsMsgBreaking = { link = "DiagnosticWarn" }, + MiniDepsPlaceholder = { link = "Comment" }, + MiniDepsTitle = { link = "Title" }, + MiniDepsTitleError = { link = "DiffDelete" }, + MiniDepsTitleSame = { link = "DiffChange" }, + MiniDepsTitleUpdate = { link = "DiffAdd" }, + MiniDiffOverAdd = { link = "DiffAdd" }, + MiniDiffOverChange = { link = "DiffText" }, + MiniDiffOverContext = { link = "DiffChange" }, + MiniDiffOverDelete = { link = "DiffDelete" }, + MiniDiffSignAdd = { link = "GruvboxGreen" }, + MiniDiffSignChange = { link = "GruvboxAqua" }, + MiniDiffSignDelete = { link = "GruvboxRed" }, + MiniFilesBorder = { link = "FloatBorder" }, + MiniFilesBorderModified = { link = "DiagnosticFloatingWarn" }, + MiniFilesCursorLine = { bg = colors.bg2 }, + MiniFilesDirectory = { link = "Directory" }, + MiniFilesFile = { link = "GruvboxFg1" }, + MiniFilesNormal = { link = "NormalFloat" }, + MiniFilesTitle = { link = "FloatTitle" }, + MiniFilesTitleFocused = { link = "GruvboxOrangeBold" }, + MiniHipatternsFixme = { fg = colors.bg0, bg = colors.red, bold = config.bold }, + MiniHipatternsHack = { fg = colors.bg0, bg = colors.yellow, bold = config.bold }, + MiniHipatternsNote = { fg = colors.bg0, bg = colors.blue, bold = config.bold }, + MiniHipatternsTodo = { fg = colors.bg0, bg = colors.aqua, bold = config.bold }, + MiniIconsAzure = { link = "GruvboxBlue" }, + MiniIconsBlue = { link = "GruvboxBlue" }, + MiniIconsCyan = { link = "GruvboxAqua" }, + MiniIconsGreen = { link = "GruvboxGreen" }, + MiniIconsGrey = { link = "GruvboxFg0" }, + MiniIconsOrange = { link = "GruvboxOrange" }, + MiniIconsPurple = { link = "GruvboxPurple" }, + MiniIconsRed = { link = "GruvboxRed" }, + MiniIconsYellow = { link = "GruvboxYellow" }, + MiniIndentscopeSymbol = { link = "GruvboxGray" }, + MiniIndentscopeSymbolOff = { link = "GruvboxYellow" }, + MiniJump = { link = "GruvboxOrangeUnderline" }, + MiniJump2dDim = { link = "GruvboxGray" }, + MiniJump2dSpot = { fg = colors.orange, bold = config.bold, nocombine = true }, + MiniJump2dSpotAhead = { fg = colors.aqua, bg = colors.bg0, nocombine = true }, + MiniJump2dSpotUnique = { fg = colors.yellow, bold = config.bold, nocombine = true }, + MiniMapNormal = { link = "NormalFloat" }, + MiniMapSymbolCount = { link = "Special" }, + MiniMapSymbolLine = { link = "Title" }, + MiniMapSymbolView = { link = "Delimiter" }, + MiniNotifyBorder = { link = "FloatBorder" }, + MiniNotifyNormal = { link = "NormalFloat" }, + MiniNotifyTitle = { link = "FloatTitle" }, + MiniOperatorsExchangeFrom = { link = "IncSearch" }, + MiniPickBorder = { link = "FloatBorder" }, + MiniPickBorderBusy = { link = "DiagnosticFloatingWarn" }, + MiniPickBorderText = { link = "FloatTitle" }, + MiniPickIconDirectory = { link = "Directory" }, + MiniPickIconFile = { link = "MiniPickNormal" }, + MiniPickHeader = { link = "DiagnosticFloatingHint" }, + MiniPickMatchCurrent = { bg = colors.bg2 }, + MiniPickMatchMarked = { link = "Visual" }, + MiniPickMatchRanges = { link = "DiagnosticFloatingHint" }, + MiniPickNormal = { link = "NormalFloat" }, + MiniPickPreviewLine = { link = "CursorLine" }, + MiniPickPreviewRegion = { link = "IncSearch" }, + MiniPickPrompt = { link = "DiagnosticFloatingInfo" }, + MiniStarterCurrent = { nocombine = true }, + MiniStarterFooter = { link = "GruvboxGray" }, + MiniStarterHeader = { link = "Title" }, + MiniStarterInactive = { link = "Comment" }, + MiniStarterItem = { link = "Normal" }, + MiniStarterItemBullet = { link = "Delimiter" }, + MiniStarterItemPrefix = { link = "WarningMsg" }, + MiniStarterSection = { link = "Delimiter" }, + MiniStarterQuery = { link = "MoreMsg" }, + MiniStatuslineDevinfo = { link = "StatusLine" }, + MiniStatuslineFileinfo = { link = "StatusLine" }, + MiniStatuslineFilename = { link = "StatusLineNC" }, + MiniStatuslineInactive = { link = "StatusLineNC" }, + MiniStatuslineModeCommand = { fg = colors.bg0, bg = colors.yellow, bold = config.bold, nocombine = true }, + MiniStatuslineModeInsert = { fg = colors.bg0, bg = colors.blue, bold = config.bold, nocombine = true }, + MiniStatuslineModeNormal = { fg = colors.bg0, bg = colors.fg1, bold = config.bold, nocombine = true }, + MiniStatuslineModeOther = { fg = colors.bg0, bg = colors.aqua, bold = config.bold, nocombine = true }, + MiniStatuslineModeReplace = { fg = colors.bg0, bg = colors.red, bold = config.bold, nocombine = true }, + MiniStatuslineModeVisual = { fg = colors.bg0, bg = colors.green, bold = config.bold, nocombine = true }, + MiniSurround = { link = "IncSearch" }, + MiniTablineCurrent = { fg = colors.green, bg = colors.bg1, bold = config.bold, reverse = config.invert_tabline }, + MiniTablineFill = { link = "TabLineFill" }, + MiniTablineHidden = { fg = colors.bg4, bg = colors.bg1, reverse = config.invert_tabline }, + MiniTablineModifiedCurrent = { + fg = colors.bg1, + bg = colors.green, + bold = config.bold, + reverse = config.invert_tabline, + }, + MiniTablineModifiedHidden = { fg = colors.bg1, bg = colors.bg4, reverse = config.invert_tabline }, + MiniTablineModifiedVisible = { fg = colors.bg1, bg = colors.fg1, reverse = config.invert_tabline }, + MiniTablineTabpagesection = { link = "Search" }, + MiniTablineVisible = { fg = colors.fg1, bg = colors.bg1, reverse = config.invert_tabline }, + MiniTestEmphasis = { bold = config.bold }, + MiniTestFail = { link = "GruvboxRedBold" }, + MiniTestPass = { link = "GruvboxGreenBold" }, + MiniTrailspace = { bg = colors.red }, + WhichKeyTitle = { link = "NormalFloat" }, + NeoTreeFloatBorder = { link = "GruvboxGray" }, + NeoTreeTitleBar = { fg = colors.fg1, bg = colors.bg2 }, + NeoTreeDirectoryIcon = { link = "GruvboxGreen" }, + NeoTreeDirectoryName = { link = "GruvboxGreenBold" }, + ["@comment"] = { link = "Comment" }, + ["@none"] = { bg = "NONE", fg = "NONE" }, + ["@preproc"] = { link = "PreProc" }, + ["@define"] = { link = "Define" }, + ["@operator"] = { link = "Operator" }, + ["@punctuation.delimiter"] = { link = "Delimiter" }, + ["@punctuation.bracket"] = { link = "Delimiter" }, + ["@punctuation.special"] = { link = "Delimiter" }, + ["@string"] = { link = "String" }, + ["@string.regex"] = { link = "String" }, + ["@string.regexp"] = { link = "String" }, + ["@string.escape"] = { link = "SpecialChar" }, + ["@string.special"] = { link = "SpecialChar" }, + ["@string.special.path"] = { link = "Underlined" }, + ["@string.special.symbol"] = { link = "Identifier" }, + ["@string.special.url"] = { link = "Underlined" }, + ["@character"] = { link = "Character" }, + ["@character.special"] = { link = "SpecialChar" }, + ["@boolean"] = { link = "Boolean" }, + ["@number"] = { link = "Number" }, + ["@number.float"] = { link = "Float" }, + ["@float"] = { link = "Float" }, + ["@function"] = { link = "Function" }, + ["@function.builtin"] = { link = "Special" }, + ["@function.call"] = { link = "Function" }, + ["@function.macro"] = { link = "Macro" }, + ["@function.method"] = { link = "Function" }, + ["@method"] = { link = "Function" }, + ["@method.call"] = { link = "Function" }, + ["@constructor"] = { link = "Special" }, + ["@parameter"] = { link = "Identifier" }, + ["@keyword"] = { link = "Keyword" }, + ["@keyword.conditional"] = { link = "Conditional" }, + ["@keyword.debug"] = { link = "Debug" }, + ["@keyword.directive"] = { link = "PreProc" }, + ["@keyword.directive.define"] = { link = "Define" }, + ["@keyword.exception"] = { link = "Exception" }, + ["@keyword.function"] = { link = "Keyword" }, + ["@keyword.import"] = { link = "Include" }, + ["@keyword.operator"] = { link = "GruvboxRed" }, + ["@keyword.repeat"] = { link = "Repeat" }, + ["@keyword.return"] = { link = "Keyword" }, + ["@keyword.storage"] = { link = "StorageClass" }, + ["@conditional"] = { link = "Conditional" }, + ["@repeat"] = { link = "Repeat" }, + ["@debug"] = { link = "Debug" }, + ["@label"] = { link = "Label" }, + ["@include"] = { link = "Include" }, + ["@exception"] = { link = "Exception" }, + ["@type"] = { link = "Type" }, + ["@type.builtin"] = { link = "Type" }, + ["@type.definition"] = { link = "Typedef" }, + ["@type.qualifier"] = { link = "Type" }, + ["@storageclass"] = { link = "StorageClass" }, + ["@attribute"] = { link = "PreProc" }, + ["@field"] = { link = "Identifier" }, + ["@property"] = { link = "Identifier" }, + ["@variable"] = { link = "GruvboxFg1" }, + ["@variable.builtin"] = { link = "Special" }, + ["@variable.member"] = { link = "Identifier" }, + ["@variable.parameter"] = { link = "Identifier" }, + ["@constant"] = { link = "Constant" }, + ["@constant.builtin"] = { link = "Special" }, + ["@constant.macro"] = { link = "Define" }, + ["@markup"] = { link = "GruvboxFg1" }, + ["@markup.strong"] = { bold = config.bold }, + ["@markup.italic"] = { link = "@text.emphasis" }, + ["@markup.underline"] = { underline = config.underline }, + ["@markup.strikethrough"] = { strikethrough = config.strikethrough }, + ["@markup.heading"] = { link = "Title" }, + ["@markup.raw"] = { link = "String" }, + ["@markup.math"] = { link = "Special" }, + ["@markup.environment"] = { link = "Macro" }, + ["@markup.environment.name"] = { link = "Type" }, + ["@markup.link"] = { link = "Underlined" }, + ["@markup.link.label"] = { link = "SpecialChar" }, + ["@markup.list"] = { link = "Delimiter" }, + ["@markup.list.checked"] = { link = "GruvboxGreen" }, + ["@markup.list.unchecked"] = { link = "GruvboxGray" }, + ["@comment.todo"] = { link = "Todo" }, + ["@comment.note"] = { link = "SpecialComment" }, + ["@comment.warning"] = { link = "WarningMsg" }, + ["@comment.error"] = { link = "ErrorMsg" }, + ["@diff.plus"] = { link = "diffAdded" }, + ["@diff.minus"] = { link = "diffRemoved" }, + ["@diff.delta"] = { link = "diffChanged" }, + ["@module"] = { link = "GruvboxFg1" }, + ["@namespace"] = { link = "GruvboxFg1" }, + ["@symbol"] = { link = "Identifier" }, + ["@text"] = { link = "GruvboxFg1" }, + ["@text.strong"] = { bold = config.bold }, + ["@text.emphasis"] = { italic = config.italic.emphasis }, + ["@text.underline"] = { underline = config.underline }, + ["@text.strike"] = { strikethrough = config.strikethrough }, + ["@text.title"] = { link = "Title" }, + ["@text.literal"] = { link = "String" }, + ["@text.uri"] = { link = "Underlined" }, + ["@text.math"] = { link = "Special" }, + ["@text.environment"] = { link = "Macro" }, + ["@text.environment.name"] = { link = "Type" }, + ["@text.reference"] = { link = "Constant" }, + ["@text.todo"] = { link = "Todo" }, + ["@text.todo.checked"] = { link = "GruvboxGreen" }, + ["@text.todo.unchecked"] = { link = "GruvboxGray" }, + ["@text.note"] = { link = "SpecialComment" }, + ["@text.note.comment"] = { fg = colors.purple, bold = config.bold }, + ["@text.warning"] = { link = "WarningMsg" }, + ["@text.danger"] = { link = "ErrorMsg" }, + ["@text.danger.comment"] = { fg = colors.fg0, bg = colors.red, bold = config.bold }, + ["@text.diff.add"] = { link = "diffAdded" }, + ["@text.diff.delete"] = { link = "diffRemoved" }, + ["@tag"] = { link = "Tag" }, + ["@tag.attribute"] = { link = "Identifier" }, + ["@tag.delimiter"] = { link = "Delimiter" }, + ["@punctuation"] = { link = "Delimiter" }, + ["@macro"] = { link = "Macro" }, + ["@structure"] = { link = "Structure" }, + ["@lsp.type.class"] = { link = "@type" }, + ["@lsp.type.comment"] = { link = "@comment" }, + ["@lsp.type.decorator"] = { link = "@macro" }, + ["@lsp.type.enum"] = { link = "@type" }, + ["@lsp.type.enumMember"] = { link = "@constant" }, + ["@lsp.type.function"] = { link = "@function" }, + ["@lsp.type.interface"] = { link = "@constructor" }, + ["@lsp.type.macro"] = { link = "@macro" }, + ["@lsp.type.method"] = { link = "@method" }, + ["@lsp.type.modifier.java"] = { link = "@keyword.type.java" }, + ["@lsp.type.namespace"] = { link = "@namespace" }, + ["@lsp.type.parameter"] = { link = "@parameter" }, + ["@lsp.type.property"] = { link = "@property" }, + ["@lsp.type.struct"] = { link = "@type" }, + ["@lsp.type.type"] = { link = "@type" }, + ["@lsp.type.typeParameter"] = { link = "@type.definition" }, + ["@lsp.type.variable"] = { link = "@variable" }, + + -- NeoTreeDirectoryName = { link = "Directory" }, + -- NeoTreeDotfile = { fg = colors.fg4 }, + -- NeoTreeFadeText1 = { fg = colors.fg3 }, + -- NeoTreeFadeText2 = { fg = colors.fg4 }, + -- NeoTreeFileIcon = { fg = colors.blue }, + -- NeoTreeFileName = { fg = colors.fg1 }, + -- NeoTreeFileNameOpened = { fg = colors.fg1, bold = true }, + -- NeoTreeFileStats = { fg = colors.fg3 }, + -- NeoTreeFileStatsHeader = { fg = colors.fg2, italic = true }, + -- NeoTreeFilterTerm = { link = "SpecialChar" }, + -- NeoTreeHiddenByName = { link = "NeoTreeDotfile" }, + -- NeoTreeIndentMarker = { fg = colors.fg4 }, + -- NeoTreeMessage = { fg = colors.fg3, italic = true }, + -- NeoTreeModified = { fg = colors.yellow }, + -- NeoTreeRootName = { fg = colors.fg1, bold = true, italic = true }, + -- NeoTreeSymbolicLinkTarget = { link = "NeoTreeFileName" }, + -- NeoTreeExpander = { fg = colors.fg4 }, + -- NeoTreeWindowsHidden = { link = "NeoTreeDotfile" }, + -- NeoTreePreview = { link = "Search" }, + -- NeoTreeGitAdded = { link = "GitGutterAdd" }, + -- NeoTreeGitConflict = { fg = colors.orange, bold = true, italic = true }, + -- NeoTreeGitDeleted = { link = "GitGutterDelete" }, + -- NeoTreeGitIgnored = { link = "NeoTreeDotfile" }, + -- NeoTreeGitModified = { link = "GitGutterChange" }, + -- NeoTreeGitRenamed = { link = "NeoTreeGitModified" }, + -- NeoTreeGitStaged = { link = "NeoTreeGitAdded" }, + -- NeoTreeGitUntracked = { fg = colors.orange, italic = true }, + -- NeoTreeGitUnstaged = { link = "NeoTreeGitConflict" }, + -- NeoTreeTabActive = { fg = colors.fg1, bold = true }, + -- NeoTreeTabInactive = { fg = colors.fg4, bg = colors.bg1 }, + -- NeoTreeTabSeparatorActive = { fg = colors.bg1 }, + -- NeoTreeTabSeparatorInactive = { fg = colors.bg2, bg = colors.bg1 }, + } + + for group, hl in pairs(config.overrides) do + if groups[group] then + -- "link" should not mix with other configs (:h hi-link) + groups[group].link = nil + end + + groups[group] = vim.tbl_extend("force", groups[group] or {}, hl) + end + + return groups +end + +---@param config GruvboxConfig? +Gruvbox.setup = function(config) + Gruvbox.config = vim.deepcopy(default_config) + Gruvbox.config = vim.tbl_deep_extend("force", Gruvbox.config, config or {}) +end + +--- main load function +Gruvbox.load = function() + if vim.version().minor < 8 then + vim.notify_once("gruvbox.nvim: you must use neovim 0.8 or higher") + return + end + + -- reset colors + if vim.g.colors_name then + vim.cmd.hi("clear") + end + vim.g.colors_name = "gruvbox" + vim.o.termguicolors = true + + local groups = get_groups() + + -- add highlights + for group, settings in pairs(groups) do + vim.api.nvim_set_hl(0, group, settings) + end +end + +return Gruvbox diff --git a/.config/nvim/nvim-pack-lock.json b/.config/nvim/nvim-pack-lock.json new file mode 100644 index 0000000..c7a5b14 --- /dev/null +++ b/.config/nvim/nvim-pack-lock.json @@ -0,0 +1,92 @@ +{ + "plugins": { + "mason-lspconfig.nvim": { + "rev": "80c0130c5f16b551865a69e832f1feadeedb5fbe", + "src": "https://github.com/mason-org/mason-lspconfig.nvim" + }, + "mason-tool-installer.nvim": { + "rev": "517ef5994ef9d6b738322664d5fdd948f0fdeb46", + "src": "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim" + }, + "mason.nvim": { + "rev": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65", + "src": "https://github.com/mason-org/mason.nvim" + }, + "mini-git": { + "rev": "df3881fec1d2fd7f8b9334821861de511e71f69e", + "src": "https://github.com/nvim-mini/mini-git" + }, + "mini.animate": { + "rev": "0365de8b69331c25d0d0d7573407a7dc7719e578", + "src": "https://github.com/nvim-mini/mini.animate" + }, + "mini.clue": { + "rev": "e2f0c1eb3ce652e34b1e9a9c504a780acf3bd4e3", + "src": "https://github.com/nvim-mini/mini.clue" + }, + "mini.completion": { + "rev": "4d451f82f193f6751719935a63d16ccb79a76e0b", + "src": "https://github.com/nvim-mini/mini.completion" + }, + "mini.diff": { + "rev": "6010e588e9ed14724880f244d7fa3df8f0be3f46", + "src": "https://github.com/nvim-mini/mini.diff" + }, + "mini.files": { + "rev": "fafacfecdd6c5a66bb10d173a749f3c098e84498", + "src": "https://github.com/nvim-mini/mini.files" + }, + "mini.hipatterns": { + "rev": "add8d8abad602787377ec5d81f6b248605828e0f", + "src": "https://github.com/nvim-mini/mini.hipatterns" + }, + "mini.icons": { + "rev": "efc85e42262cd0c9e1fdbf806c25cb0be6de115c", + "src": "https://github.com/nvim-mini/mini.icons" + }, + "mini.notify": { + "rev": "29ec27f60bf4b63e447c851d9061c434d80795a6", + "src": "https://github.com/nvim-mini/mini.notify" + }, + "mini.nvim": { + "rev": "8c40d95931cbe6138391af9180e59439ed2e69df", + "src": "https://github.com/nvim-mini/mini.nvim" + }, + "mini.snippets": { + "rev": "b4065ca6b33e4df2897672d3bb760cfc93f4390a", + "src": "https://github.com/nvim-mini/mini.snippets" + }, + "mini.statusline": { + "rev": "3e96596ebe51b899874d8174409cdc4f3c749d9a", + "src": "https://github.com/nvim-mini/mini.statusline" + }, + "mini.tabline": { + "rev": "caf23615b9b99bacc79ecd60f61c4e6a8ec18c84", + "src": "https://github.com/nvim-mini/mini.tabline" + }, + "nvim-dap": { + "rev": "cdfd55a133f63228c55f91378f12908cb2a78ded", + "src": "https://github.com/mfussenegger/nvim-dap" + }, + "nvim-dap-ui": { + "rev": "cf91d5e2d07c72903d052f5207511bf7ecdb7122", + "src": "https://github.com/rcarriga/nvim-dap-ui" + }, + "nvim-dap-virtual-text": { + "rev": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6", + "src": "https://github.com/theHamsta/nvim-dap-virtual-text" + }, + "nvim-lspconfig": { + "rev": "92ee7d42320edfbb81f3cad851314ab197fa324a", + "src": "https://github.com/neovim/nvim-lspconfig" + }, + "nvim-treesitter": { + "rev": "5a7e5638e7d220575b1c22c8a2e099b52231886e", + "src": "https://github.com/nvim-treesitter/nvim-treesitter" + }, + "tree-sitter-latex": { + "rev": "7e0ecdc02926c7b9b2e0c76003d4fe7b0944f957", + "src": "https://github.com/latex-lsp/tree-sitter-latex" + } + } +} \ No newline at end of file diff --git a/.config/procps/toprc b/.config/procps/toprc new file mode 100644 index 0000000..b701cee --- /dev/null +++ b/.config/procps/toprc @@ -0,0 +1,31 @@ +top's Config File (Linux processes with windows) +Id:k, Mode_altscr=0, Mode_irixps=1, Delay_time=3.0, Curwin=0 +Def fieldscur= 75 81 103 105 119 123 129 120 137 111 117 115 139 76 78 82 84 86 88 90 + 92 94 96 98 100 106 108 112 124 126 130 132 134 140 142 144 146 148 150 152 + 154 156 158 160 162 164 166 168 170 172 174 176 178 180 182 184 186 188 190 192 + 194 196 198 200 202 204 206 208 210 212 214 216 218 220 222 224 226 228 230 232 + 234 236 238 240 242 244 246 248 250 252 254 256 258 260 262 264 266 268 270 272 + winflags=457524, sortindx=21, maxtasks=0, graph_cpus=1, graph_mems=1, double_up=0, combine_cpus=0, core_types=0 + summclr=2, msgsclr=11, headclr=15, taskclr=7 +Job fieldscur= 75 77 115 111 117 80 103 105 137 119 123 128 120 79 139 82 84 86 88 90 + 92 94 96 98 100 106 108 112 124 126 130 132 134 140 142 144 146 148 150 152 + 154 156 158 160 162 164 166 168 170 172 174 176 178 180 182 184 186 188 190 192 + 194 196 198 200 202 204 206 208 210 212 214 216 218 220 222 224 226 228 230 232 + 234 236 238 240 242 244 246 248 250 252 254 256 258 260 262 264 266 268 270 272 + winflags=193844, sortindx=0, maxtasks=0, graph_cpus=0, graph_mems=0, double_up=0, combine_cpus=0, core_types=0 + summclr=6, msgsclr=6, headclr=7, taskclr=6 +Mem fieldscur= 75 117 119 120 123 125 127 129 131 154 132 156 135 136 102 104 111 139 76 78 + 80 82 84 86 88 90 92 94 96 98 100 106 108 112 114 140 142 144 146 148 + 150 152 158 160 162 164 166 168 170 172 174 176 178 180 182 184 186 188 190 192 + 194 196 198 200 202 204 206 208 210 212 214 216 218 220 222 224 226 228 230 232 + 234 236 238 240 242 244 246 248 250 252 254 256 258 260 262 264 266 268 270 272 + winflags=193844, sortindx=21, maxtasks=0, graph_cpus=0, graph_mems=0, double_up=0, combine_cpus=0, core_types=0 + summclr=5, msgsclr=5, headclr=4, taskclr=5 +Usr fieldscur= 75 77 79 81 85 97 115 111 117 137 139 82 86 88 90 92 94 98 100 102 + 104 106 108 112 118 120 122 124 126 128 130 132 134 140 142 144 146 148 150 152 + 154 156 158 160 162 164 166 168 170 172 174 176 178 180 182 184 186 188 190 192 + 194 196 198 200 202 204 206 208 210 212 214 216 218 220 222 224 226 228 230 232 + 234 236 238 240 242 244 246 248 250 252 254 256 258 260 262 264 266 268 270 272 + winflags=193844, sortindx=3, maxtasks=0, graph_cpus=0, graph_mems=0, double_up=0, combine_cpus=0, core_types=0 + summclr=3, msgsclr=3, headclr=2, taskclr=3 +Fixed_widest=0, Summ_mscale=1, Task_mscale=1, Zero_suppress=1, Tics_scaled=0 diff --git a/.config/qt6ct/colors/CosmicDark.conf b/.config/qt6ct/colors/CosmicDark.conf new file mode 100644 index 0000000..dca3c14 --- /dev/null +++ b/.config/qt6ct/colors/CosmicDark.conf @@ -0,0 +1,6 @@ +# GENERATED BY COSMIC + +[ColorScheme] +active_colors=#ffe7e7e7, #ff4a4a4a, #ff555555, #ff4f4f4f, #ff4e4e4e, #ff4c4c4c, #ffc0c0c0, #ffe7e7e7, #ffc0c0c0, #ff2e2e2e, #ff1b1b1b, #ff1b1b1b, #ff63d0df, #ff434343, #ff63d0df, #ff5bb2be, #ff1f2425, #ff2e2e2e, #ff2e2e2e, #ffc0c0c0, #ff777777 +disabled_colors=#e6d2d2d2, #90474747, #a9696969, #a5626262, #a95f5f5f, #a55d5d5d, #d3a1a1a1, #ffe7e7e7, #d3a1a1a1, #c02e2e2e, #ff1b1b1b, #ff1b1b1b, #ff63d0df, #c03c3c3c, #c031555a, #c0324f53, #ff1f2425, #c02e2e2e, #c02e2e2e, #d3a1a1a1, #c08f8f8f +inactive_colors=#ffc2c2c2, #ff4a4a4a, #ff555555, #ff4f4f4f, #ff4e4e4e, #ff4c4c4c, #ffa3a3a3, #ffe7e7e7, #ffc0c0c0, #ff2e2e2e, #ff1b1b1b, #ff1b1b1b, #ff63d0df, #ff3f3f3f, #ff63d0df, #ff5bb2be, #ff1f2425, #ff2e2e2e, #ff2e2e2e, #ffa3a3a3, #ff777777 diff --git a/.config/qt6ct/colors/CosmicLight.conf b/.config/qt6ct/colors/CosmicLight.conf new file mode 100644 index 0000000..6723a8c --- /dev/null +++ b/.config/qt6ct/colors/CosmicLight.conf @@ -0,0 +1,6 @@ +# GENERATED BY COSMIC + +[ColorScheme] +active_colors=#ff121212, #ffc3c3c3, #ffbababa, #ffbebebe, #ffb3b3b3, #ffbbbbbb, #ff272727, #ffd7d7d7, #ff272727, #fff5f5f5, #ffd7d7d7, #ff121212, #ff00525a, #fff6f6f6, #ff00525a, #ff317379, #ffccd0d1, #fff5f5f5, #fff5f5f5, #ff272727, #ff8e8e8e +disabled_colors=#e62b2b2b, #90c9c9c9, #a99c9c9c, #a5a0a0a0, #a9929292, #a59b9b9b, #d3535353, #ffd7d7d7, #d3535353, #c0f5f5f5, #ffd7d7d7, #ff121212, #ff00525a, #c0f6f6f6, #c0516d6f, #c072888a, #ffccd0d1, #c0f5f5f5, #c0f5f5f5, #d3535353, #c06c6c6c +inactive_colors=#ff3f3f3f, #ffc3c3c3, #ffbababa, #ffbebebe, #ffb3b3b3, #ffbbbbbb, #ff505050, #ffd7d7d7, #ff272727, #fff5f5f5, #ffd7d7d7, #ff121212, #ff00525a, #fff6f6f6, #ff00525a, #ff317379, #ffccd0d1, #fff5f5f5, #fff5f5f5, #ff505050, #ff8e8e8e diff --git a/.config/qt6ct/qt6ct.conf b/.config/qt6ct/qt6ct.conf new file mode 100644 index 0000000..098f59a --- /dev/null +++ b/.config/qt6ct/qt6ct.conf @@ -0,0 +1,33 @@ +[Interface] +underline_shortcut=1 +activate_item_on_single_click=1 +keyboard_scheme=4 +menus_have_icons=true +stylesheets=@Invalid() +show_shortcuts_in_context_menus=true +gui_effects=@Invalid() +buttonbox_layout=3 +wheel_scroll_lines=3 +toolbutton_style=4 +dialog_buttons_have_icons=1 +double_click_interval=400 +cursor_flash_time=1000 + +[Appearance] +custom_palette=true +style=Fusion +standard_dialogs=xdgdesktopportal + +[Fonts] +general="Adwaita Sans,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1,,0,0" +fixed="Adwaita Mono,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1,,0,0" + +[Troubleshooting] +ignored_applications=@Invalid() +force_raster_widgets=1 + +[SettingsWindow] +geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x1@\0\0\x5\xa1\0\0\x4\x99\0\0\t\xb9\0\0\x1@\0\0\x5\xa1\0\0\x4\x99\0\0\t\xb9\0\0\0\0\0\0\0\0\x6\xc9\0\0\x1@\0\0\x5\xa1\0\0\x4\x99\0\0\t\xb9) + +[QSSEditor] +geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x1@\0\0\x5\xa1\0\0\x3\xc2\0\0\a\x93\0\0\x1@\0\0\x5\xa1\0\0\x3\xc2\0\0\a\x93\0\0\0\0\0\0\0\0\a\x80\0\0\x1@\0\0\x5\xa1\0\0\x3\xc2\0\0\a\x93) diff --git a/.config/qt6ct/style-colors.conf b/.config/qt6ct/style-colors.conf new file mode 100644 index 0000000..2d9dc34 --- /dev/null +++ b/.config/qt6ct/style-colors.conf @@ -0,0 +1,4 @@ +[ColorScheme] +active_colors=#ff000000, #ffefefef, #ffffffff, #ffcacaca, #ff9f9f9f, #ffb8b8b8, #ff000000, #ffffffff, #ff000000, #ffffffff, #ffefefef, #ff767676, #ff308cc6, #ffffffff, #ff0000ff, #ffff00ff, #fff7f7f7, #ff000000, #ffffffdc, #ff000000, #80000000, #ff308cc6 +disabled_colors=#ff808080, #ff424245, #ff979797, #ff5e5c5b, #ff302f2e, #ff4a4947, #ff808080, #ffffffff, #ff808080, #ff3d3d3d, #ff222020, #ffe7e4e0, #ff12608a, #ff808080, #ff0986d3, #ffa70b06, #ff5c5b5a, #ffffffff, #ff3f3f36, #ffffffff, #80ffffff, #ff12608a +inactive_colors=#ff000000, #ffefefef, #ffffffff, #ffcacaca, #ff9f9f9f, #ffb8b8b8, #ff000000, #ffffffff, #ff000000, #ffffffff, #ffefefef, #ff767676, #ff308cc6, #ffffffff, #ff0000ff, #ffff00ff, #fff7f7f7, #ff000000, #ffffffdc, #ff000000, #80000000, #ff308cc6 diff --git a/.config/quickshell/noctalia-shell b/.config/quickshell/noctalia-shell deleted file mode 160000 index 0f3a4fe..0000000 --- a/.config/quickshell/noctalia-shell +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0f3a4fe91ee8785211e37a019540b6aad7be0845 diff --git a/.config/qutebrowser/autoconfig.yml b/.config/qutebrowser/autoconfig.yml index e9c5ff8..79f8206 100644 --- a/.config/qutebrowser/autoconfig.yml +++ b/.config/qutebrowser/autoconfig.yml @@ -6,44 +6,5 @@ config_version: 2 settings: - colors.tabs.selected.odd.bg: - global: '#282828' - colors.webpage.bg: - global: white colors.webpage.preferred_color_scheme: global: dark - content.blocking.method: - global: both - editor.command: - global: - - alacritty - - -e - - nvim - - -f - - '{file}' - - -c - - normal {line}G{column0}l - fileselect.folder.command: - global: - - alacritty - - -e - - ranger - - --choosedir={} - fileselect.multiple_files.command: - global: - - alacritty - - -e - - ranger - - --choosefiles={} - fileselect.single_file.command: - global: - - alacritty - - -e - - ranger - - --choosefile={} - fonts.contextmenu: - global: Adwaita Sans - fonts.default_family: - global: Adwaita Mono - tabs.position: - global: left diff --git a/.config/qutebrowser/config.py b/.config/qutebrowser/config.py index a6d9a9b..88a3ffe 100644 --- a/.config/qutebrowser/config.py +++ b/.config/qutebrowser/config.py @@ -1,4 +1,21 @@ -config.load_autoconfig() -# config.bind('', 'hint links spawn --detach mpv {hint-url}') config.source("gruvbox.py") -#c.colors.webpage.bg = "#ffffff" + +c.fonts.default_size = '14px' +c.fonts.default_family = 'Adwaita Mono' + +c.tabs.padding = {'top': 0, 'bottom': 0, 'left': 8, 'right': 8} +c.tabs.indicator.width = 0 # no tab indicators + +c.editor.command = ['alacritty', '-e', 'nvim', '-f', '{file}', '-c', 'normal {line}G{column0}l'] + +c.fileselect.handler = 'default' +c.fileselect.folder.command = ['alacritty', '-e', 'ranger', '--choosedir={}'] +c.fileselect.multiple_files.command = ['alacritty', '-e', 'ranger', '--choosefiles={}'] +c.fileselect.single_file.command = ['alacritty', '-e', 'ranger', '--choosefile={}'] + +c.colors.webpage.preferred_color_scheme = 'dark' + +config.bind('', 'spawn mpv {url}') + +c.content.blocking.enabled = True +config.load_autoconfig(False) diff --git a/.config/qutebrowser/gruvbox.py b/.config/qutebrowser/gruvbox.py index 7c96968..e44efb2 100644 --- a/.config/qutebrowser/gruvbox.py +++ b/.config/qutebrowser/gruvbox.py @@ -204,7 +204,7 @@ c.colors.statusbar.normal.bg = bg0 c.colors.statusbar.insert.fg = bg0 # Background color of the statusbar in insert mode. -c.colors.statusbar.insert.bg = dark_aqua +c.colors.statusbar.insert.bg = bright_blue # Foreground color of the statusbar in passthrough mode. c.colors.statusbar.passthrough.fg = bg0 @@ -280,7 +280,7 @@ c.colors.tabs.indicator.stop = bright_aqua c.colors.tabs.indicator.error = bright_red # Foreground color of unselected odd tabs. -c.colors.tabs.odd.fg = fg2 +c.colors.tabs.odd.fg = fg3 # Background color of unselected odd tabs. c.colors.tabs.odd.bg = bg2 @@ -289,44 +289,44 @@ c.colors.tabs.odd.bg = bg2 c.colors.tabs.even.fg = c.colors.tabs.odd.fg # Background color of unselected even tabs. -c.colors.tabs.even.bg = bg3 +c.colors.tabs.even.bg = c.colors.tabs.odd.bg # Foreground color of selected odd tabs. -c.colors.tabs.selected.odd.fg = fg2 +c.colors.tabs.selected.odd.fg = bright_green # Background color of selected odd tabs. -c.colors.tabs.selected.odd.bg = bg0 +c.colors.tabs.selected.odd.bg = c.colors.tabs.odd.bg # Foreground color of selected even tabs. c.colors.tabs.selected.even.fg = c.colors.tabs.selected.odd.fg # Background color of selected even tabs. -c.colors.tabs.selected.even.bg = bg0 - -# Background color of pinned unselected even tabs. -c.colors.tabs.pinned.even.bg = bright_green - -# Foreground color of pinned unselected even tabs. -c.colors.tabs.pinned.even.fg = bg2 +c.colors.tabs.selected.even.bg = c.colors.tabs.selected.odd.bg # Background color of pinned unselected odd tabs. c.colors.tabs.pinned.odd.bg = bright_green # Foreground color of pinned unselected odd tabs. -c.colors.tabs.pinned.odd.fg = c.colors.tabs.pinned.even.fg +c.colors.tabs.pinned.odd.fg = bg2 -# Background color of pinned selected even tabs. -c.colors.tabs.pinned.selected.even.bg = bg0 +# Background color of pinned unselected even tabs. +c.colors.tabs.pinned.even.bg = c.colors.tabs.pinned.odd.bg -# Foreground color of pinned selected even tabs. -c.colors.tabs.pinned.selected.even.fg = c.colors.tabs.selected.odd.fg +# Foreground color of pinned unselected even tabs. +c.colors.tabs.pinned.even.fg = c.colors.tabs.pinned.odd.fg # Background color of pinned selected odd tabs. -c.colors.tabs.pinned.selected.odd.bg = c.colors.tabs.pinned.selected.even.bg +c.colors.tabs.pinned.selected.odd.bg = c.colors.tabs.selected.odd.fg # Foreground color of pinned selected odd tabs. -c.colors.tabs.pinned.selected.odd.fg = c.colors.tabs.selected.odd.fg +c.colors.tabs.pinned.selected.odd.fg = bg2 + +# Background color of pinned selected even tabs. +c.colors.tabs.pinned.selected.even.bg = c.colors.tabs.pinned.selected.odd.bg + +# Foreground color of pinned selected even tabs. +c.colors.tabs.pinned.selected.even.fg = c.colors.tabs.pinned.selected.odd.fg # Background color for webpages if unset (or empty to use the theme's # color). -# c.colors.webpage.bg = bg4 +c.colors.webpage.bg = fg0 diff --git a/.config/qutebrowser/qsettings/QtProject.conf b/.config/qutebrowser/qsettings/QtProject.conf new file mode 100644 index 0000000..1dc191d --- /dev/null +++ b/.config/qutebrowser/qsettings/QtProject.conf @@ -0,0 +1,8 @@ +[FileDialog] +history=file:///home/never/Downloads +lastVisited=file:///home/never/Downloads +qtVersion=6.10.1 +shortcuts=file:, file:///home/never +sidebarWidth=113 +treeViewHeader=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x2T\0\0\0\x4\x1\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x4\0\0\x1?\0\0\0\x1\0\0\0\0\0\0\0H\0\0\0\x1\0\0\0\0\0\0\0L\0\0\0\x1\0\0\0\0\0\0\0\x81\0\0\0\x1\0\0\0\0\0\0\x3\xe8\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x1) +viewMode=Detail diff --git a/.config/qutebrowser/template.py b/.config/qutebrowser/template.py new file mode 100644 index 0000000..44e3950 --- /dev/null +++ b/.config/qutebrowser/template.py @@ -0,0 +1,2522 @@ +## Autogenerated config.py +## +## NOTE: config.py is intended for advanced users who are comfortable +## with manually migrating the config file on qutebrowser upgrades. If +## you prefer, you can also configure qutebrowser using the +## :set/:bind/:config-* commands without having to write a config.py +## file. +## +## Documentation: +## qute://help/configuring.html +## qute://help/settings.html + +## This is here so configs done via the GUI are still loaded. +## Remove it to not load settings done via the GUI. +# config.load_autoconfig(True) + +## Aliases for commands. The keys of the given dictionary are the +## aliases, while the values are the commands they map to. +## Type: Dict +# c.aliases = {'w': 'session-save', 'q': 'close', 'qa': 'quit', 'wq': 'quit --save', 'wqa': 'quit --save'} + +## Time interval (in milliseconds) between auto-saves of +## config/cookies/etc. +## Type: Int +# c.auto_save.interval = 15000 + +## Always restore open sites when qutebrowser is reopened. Without this +## option set, `:wq` (`:quit --save`) needs to be used to save open tabs +## (and restore them), while quitting qutebrowser in any other way will +## not save/restore the session. By default, this will save to the +## session which was last loaded. This behavior can be customized via the +## `session.default_name` setting. +## Type: Bool +# c.auto_save.session = False + +## Backend to use to display websites. qutebrowser supports two different +## web rendering engines / backends, QtWebEngine and QtWebKit (not +## recommended). QtWebEngine is Qt's official successor to QtWebKit, and +## both the default/recommended backend. It's based on a stripped-down +## Chromium and regularly updated with security fixes and new features by +## the Qt project: https://wiki.qt.io/QtWebEngine QtWebKit was +## qutebrowser's original backend when the project was started. However, +## support for QtWebKit was discontinued by the Qt project with Qt 5.6 in +## 2016. The development of QtWebKit was picked up in an official fork: +## https://github.com/qtwebkit/qtwebkit - however, the project seems to +## have stalled again. The latest release (5.212.0 Alpha 4) from March +## 2020 is based on a WebKit version from 2016, with many known security +## vulnerabilities. Additionally, there is no process isolation and +## sandboxing. Due to all those issues, while support for QtWebKit is +## still available in qutebrowser for now, using it is strongly +## discouraged. +## Type: String +## Valid values: +## - webengine: Use QtWebEngine (based on Chromium - recommended). +## - webkit: Use QtWebKit (based on WebKit, similar to Safari - many known security issues!). +# c.backend = 'webengine' + +## Map keys to other keys, so that they are equivalent in all modes. When +## the key used as dictionary-key is pressed, the binding for the key +## used as dictionary-value is invoked instead. This is useful for global +## remappings of keys, for example to map to . NOTE: +## This should only be used if two keys should always be equivalent, i.e. +## for things like (keypad) and (non-keypad). For normal +## command bindings, qutebrowser works differently to vim: You always +## bind keys to commands, usually via `:bind` or `config.bind()`. Instead +## of using this setting, consider finding the command a key is bound to +## (e.g. via `:bind gg`) and then binding the same command to the desired +## key. Note that when a key is bound (via `bindings.default` or +## `bindings.commands`), the mapping is ignored. +## Type: Dict +# c.bindings.key_mappings = {'': '', '': '', '': '', '': '', '': '', '': '', '': '', '': '', '': ''} + +## When to show a changelog after qutebrowser was upgraded. +## Type: String +## Valid values: +## - major: Show changelog for major upgrades (e.g. v2.0.0 -> v3.0.0). +## - minor: Show changelog for major and minor upgrades (e.g. v2.0.0 -> v2.1.0). +## - patch: Show changelog for major, minor and patch upgrades (e.g. v2.0.0 -> v2.0.1). +## - never: Never show changelog after upgrades. +# c.changelog_after_upgrade = 'minor' + +## Background color of the completion widget category headers. +## Type: QssColor +# c.colors.completion.category.bg = 'qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #888888, stop:1 #505050)' + +## Bottom border color of the completion widget category headers. +## Type: QssColor +# c.colors.completion.category.border.bottom = 'black' + +## Top border color of the completion widget category headers. +## Type: QssColor +# c.colors.completion.category.border.top = 'black' + +## Foreground color of completion widget category headers. +## Type: QtColor +# c.colors.completion.category.fg = 'white' + +## Background color of the completion widget for even rows. +## Type: QssColor +# c.colors.completion.even.bg = '#333333' + +## Text color of the completion widget. May be a single color to use for +## all columns or a list of three colors, one for each column. +## Type: List of QtColor, or QtColor +# c.colors.completion.fg = ['white', 'white', 'white'] + +## Background color of the selected completion item. +## Type: QssColor +# c.colors.completion.item.selected.bg = '#e8c000' + +## Bottom border color of the selected completion item. +## Type: QssColor +# c.colors.completion.item.selected.border.bottom = '#bbbb00' + +## Top border color of the selected completion item. +## Type: QssColor +# c.colors.completion.item.selected.border.top = '#bbbb00' + +## Foreground color of the selected completion item. +## Type: QtColor +# c.colors.completion.item.selected.fg = 'black' + +## Foreground color of the matched text in the selected completion item. +## Type: QtColor +# c.colors.completion.item.selected.match.fg = '#ff4444' + +## Foreground color of the matched text in the completion. +## Type: QtColor +# c.colors.completion.match.fg = '#ff4444' + +## Background color of the completion widget for odd rows. +## Type: QssColor +# c.colors.completion.odd.bg = '#444444' + +## Color of the scrollbar in the completion view. +## Type: QssColor +# c.colors.completion.scrollbar.bg = '#333333' + +## Color of the scrollbar handle in the completion view. +## Type: QssColor +# c.colors.completion.scrollbar.fg = 'white' + +## Background color of disabled items in the context menu. If set to +## null, the Qt default is used. +## Type: QssColor +# c.colors.contextmenu.disabled.bg = None + +## Foreground color of disabled items in the context menu. If set to +## null, the Qt default is used. +## Type: QssColor +# c.colors.contextmenu.disabled.fg = None + +## Background color of the context menu. If set to null, the Qt default +## is used. +## Type: QssColor +# c.colors.contextmenu.menu.bg = None + +## Foreground color of the context menu. If set to null, the Qt default +## is used. +## Type: QssColor +# c.colors.contextmenu.menu.fg = None + +## Background color of the context menu's selected item. If set to null, +## the Qt default is used. +## Type: QssColor +# c.colors.contextmenu.selected.bg = None + +## Foreground color of the context menu's selected item. If set to null, +## the Qt default is used. +## Type: QssColor +# c.colors.contextmenu.selected.fg = None + +## Background color for the download bar. +## Type: QssColor +# c.colors.downloads.bar.bg = 'black' + +## Background color for downloads with errors. +## Type: QtColor +# c.colors.downloads.error.bg = 'red' + +## Foreground color for downloads with errors. +## Type: QtColor +# c.colors.downloads.error.fg = 'white' + +## Color gradient start for download backgrounds. +## Type: QtColor +# c.colors.downloads.start.bg = '#0000aa' + +## Color gradient start for download text. +## Type: QtColor +# c.colors.downloads.start.fg = 'white' + +## Color gradient stop for download backgrounds. +## Type: QtColor +# c.colors.downloads.stop.bg = '#00aa00' + +## Color gradient end for download text. +## Type: QtColor +# c.colors.downloads.stop.fg = 'white' + +## Color gradient interpolation system for download backgrounds. +## Type: ColorSystem +## Valid values: +## - rgb: Interpolate in the RGB color system. +## - hsv: Interpolate in the HSV color system. +## - hsl: Interpolate in the HSL color system. +## - none: Don't show a gradient. +# c.colors.downloads.system.bg = 'rgb' + +## Color gradient interpolation system for download text. +## Type: ColorSystem +## Valid values: +## - rgb: Interpolate in the RGB color system. +## - hsv: Interpolate in the HSV color system. +## - hsl: Interpolate in the HSL color system. +## - none: Don't show a gradient. +# c.colors.downloads.system.fg = 'rgb' + +## Background color for hints. Note that you can use a `rgba(...)` value +## for transparency. +## Type: QssColor +# c.colors.hints.bg = 'qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 247, 133, 0.8), stop:1 rgba(255, 197, 66, 0.8))' + +## Font color for hints. +## Type: QssColor +# c.colors.hints.fg = 'black' + +## Font color for the matched part of hints. +## Type: QtColor +# c.colors.hints.match.fg = 'green' + +## Background color of the keyhint widget. +## Type: QssColor +# c.colors.keyhint.bg = 'rgba(0, 0, 0, 80%)' + +## Text color for the keyhint widget. +## Type: QssColor +# c.colors.keyhint.fg = '#FFFFFF' + +## Highlight color for keys to complete the current keychain. +## Type: QssColor +# c.colors.keyhint.suffix.fg = '#FFFF00' + +## Background color of an error message. +## Type: QssColor +# c.colors.messages.error.bg = 'red' + +## Border color of an error message. +## Type: QssColor +# c.colors.messages.error.border = '#bb0000' + +## Foreground color of an error message. +## Type: QssColor +# c.colors.messages.error.fg = 'white' + +## Background color of an info message. +## Type: QssColor +# c.colors.messages.info.bg = 'black' + +## Border color of an info message. +## Type: QssColor +# c.colors.messages.info.border = '#333333' + +## Foreground color of an info message. +## Type: QssColor +# c.colors.messages.info.fg = 'white' + +## Background color of a warning message. +## Type: QssColor +# c.colors.messages.warning.bg = 'darkorange' + +## Border color of a warning message. +## Type: QssColor +# c.colors.messages.warning.border = '#d47300' + +## Foreground color of a warning message. +## Type: QssColor +# c.colors.messages.warning.fg = 'black' + +## Background color for prompts. +## Type: QssColor +# c.colors.prompts.bg = '#444444' + +## Border used around UI elements in prompts. +## Type: String +# c.colors.prompts.border = '1px solid gray' + +## Foreground color for prompts. +## Type: QssColor +# c.colors.prompts.fg = 'white' + +## Background color for the selected item in filename prompts. +## Type: QssColor +# c.colors.prompts.selected.bg = 'grey' + +## Foreground color for the selected item in filename prompts. +## Type: QssColor +# c.colors.prompts.selected.fg = 'white' + +## Background color of the statusbar in caret mode. +## Type: QssColor +# c.colors.statusbar.caret.bg = 'purple' + +## Foreground color of the statusbar in caret mode. +## Type: QssColor +# c.colors.statusbar.caret.fg = 'white' + +## Background color of the statusbar in caret mode with a selection. +## Type: QssColor +# c.colors.statusbar.caret.selection.bg = '#a12dff' + +## Foreground color of the statusbar in caret mode with a selection. +## Type: QssColor +# c.colors.statusbar.caret.selection.fg = 'white' + +## Background color of the statusbar in command mode. +## Type: QssColor +# c.colors.statusbar.command.bg = 'black' + +## Foreground color of the statusbar in command mode. +## Type: QssColor +# c.colors.statusbar.command.fg = 'white' + +## Background color of the statusbar in private browsing + command mode. +## Type: QssColor +# c.colors.statusbar.command.private.bg = 'darkslategray' + +## Foreground color of the statusbar in private browsing + command mode. +## Type: QssColor +# c.colors.statusbar.command.private.fg = 'white' + +## Background color of the statusbar in insert mode. +## Type: QssColor +# c.colors.statusbar.insert.bg = 'darkgreen' + +## Foreground color of the statusbar in insert mode. +## Type: QssColor +# c.colors.statusbar.insert.fg = 'white' + +## Background color of the statusbar. +## Type: QssColor +# c.colors.statusbar.normal.bg = 'black' + +## Foreground color of the statusbar. +## Type: QssColor +# c.colors.statusbar.normal.fg = 'white' + +## Background color of the statusbar in passthrough mode. +## Type: QssColor +# c.colors.statusbar.passthrough.bg = 'darkblue' + +## Foreground color of the statusbar in passthrough mode. +## Type: QssColor +# c.colors.statusbar.passthrough.fg = 'white' + +## Background color of the statusbar in private browsing mode. +## Type: QssColor +# c.colors.statusbar.private.bg = '#666666' + +## Foreground color of the statusbar in private browsing mode. +## Type: QssColor +# c.colors.statusbar.private.fg = 'white' + +## Background color of the progress bar. +## Type: QssColor +# c.colors.statusbar.progress.bg = 'white' + +## Foreground color of the URL in the statusbar on error. +## Type: QssColor +# c.colors.statusbar.url.error.fg = 'orange' + +## Default foreground color of the URL in the statusbar. +## Type: QssColor +# c.colors.statusbar.url.fg = 'white' + +## Foreground color of the URL in the statusbar for hovered links. +## Type: QssColor +# c.colors.statusbar.url.hover.fg = 'aqua' + +## Foreground color of the URL in the statusbar on successful load +## (http). +## Type: QssColor +# c.colors.statusbar.url.success.http.fg = 'white' + +## Foreground color of the URL in the statusbar on successful load +## (https). +## Type: QssColor +# c.colors.statusbar.url.success.https.fg = 'lime' + +## Foreground color of the URL in the statusbar when there's a warning. +## Type: QssColor +# c.colors.statusbar.url.warn.fg = 'yellow' + +## Background color of the tab bar. +## Type: QssColor +# c.colors.tabs.bar.bg = '#555555' + +## Background color of unselected even tabs. +## Type: QtColor +# c.colors.tabs.even.bg = 'darkgrey' + +## Foreground color of unselected even tabs. +## Type: QtColor +# c.colors.tabs.even.fg = 'white' + +## Color for the tab indicator on errors. +## Type: QtColor +# c.colors.tabs.indicator.error = '#ff0000' + +## Color gradient start for the tab indicator. +## Type: QtColor +# c.colors.tabs.indicator.start = '#0000aa' + +## Color gradient end for the tab indicator. +## Type: QtColor +# c.colors.tabs.indicator.stop = '#00aa00' + +## Color gradient interpolation system for the tab indicator. +## Type: ColorSystem +## Valid values: +## - rgb: Interpolate in the RGB color system. +## - hsv: Interpolate in the HSV color system. +## - hsl: Interpolate in the HSL color system. +## - none: Don't show a gradient. +# c.colors.tabs.indicator.system = 'rgb' + +## Background color of unselected odd tabs. +## Type: QtColor +# c.colors.tabs.odd.bg = 'grey' + +## Foreground color of unselected odd tabs. +## Type: QtColor +# c.colors.tabs.odd.fg = 'white' + +## Background color of pinned unselected even tabs. +## Type: QtColor +# c.colors.tabs.pinned.even.bg = 'darkseagreen' + +## Foreground color of pinned unselected even tabs. +## Type: QtColor +# c.colors.tabs.pinned.even.fg = 'white' + +## Background color of pinned unselected odd tabs. +## Type: QtColor +# c.colors.tabs.pinned.odd.bg = 'seagreen' + +## Foreground color of pinned unselected odd tabs. +## Type: QtColor +# c.colors.tabs.pinned.odd.fg = 'white' + +## Background color of pinned selected even tabs. +## Type: QtColor +# c.colors.tabs.pinned.selected.even.bg = 'black' + +## Foreground color of pinned selected even tabs. +## Type: QtColor +# c.colors.tabs.pinned.selected.even.fg = 'white' + +## Background color of pinned selected odd tabs. +## Type: QtColor +# c.colors.tabs.pinned.selected.odd.bg = 'black' + +## Foreground color of pinned selected odd tabs. +## Type: QtColor +# c.colors.tabs.pinned.selected.odd.fg = 'white' + +## Background color of selected even tabs. +## Type: QtColor +# c.colors.tabs.selected.even.bg = 'black' + +## Foreground color of selected even tabs. +## Type: QtColor +# c.colors.tabs.selected.even.fg = 'white' + +## Background color of selected odd tabs. +## Type: QtColor +# c.colors.tabs.selected.odd.bg = 'black' + +## Foreground color of selected odd tabs. +## Type: QtColor +# c.colors.tabs.selected.odd.fg = 'white' + +## Background color of tooltips. If set to null, the Qt default is used. +## Type: QssColor +# c.colors.tooltip.bg = None + +## Foreground color of tooltips. If set to null, the Qt default is used. +## Type: QssColor +# c.colors.tooltip.fg = None + +## Background color for webpages if unset (or empty to use the theme's +## color). +## Type: QtColor +# c.colors.webpage.bg = 'white' + +## Which algorithm to use for modifying how colors are rendered with dark +## mode. The `lightness-cielab` value was added with QtWebEngine 5.14 and +## is treated like `lightness-hsl` with older QtWebEngine versions. +## Type: String +## Valid values: +## - lightness-cielab: Modify colors by converting them to CIELAB color space and inverting the L value. Not available with Qt < 5.14. +## - lightness-hsl: Modify colors by converting them to the HSL color space and inverting the lightness (i.e. the "L" in HSL). +## - brightness-rgb: Modify colors by subtracting each of r, g, and b from their maximum value. +# c.colors.webpage.darkmode.algorithm = 'lightness-cielab' + +## Contrast for dark mode. This only has an effect when +## `colors.webpage.darkmode.algorithm` is set to `lightness-hsl` or +## `brightness-rgb`. +## Type: Float +# c.colors.webpage.darkmode.contrast = 0.0 + +## Render all web contents using a dark theme. On QtWebEngine < 6.7, this +## setting requires a restart and does not support URL patterns, only the +## global setting is applied. Example configurations from Chromium's +## `chrome://flags`: - "With simple HSL/CIELAB/RGB-based inversion": Set +## `colors.webpage.darkmode.algorithm` accordingly, and set +## `colors.webpage.darkmode.policy.images` to `never`. - "With selective +## image inversion": qutebrowser default settings. +## Type: Bool +# c.colors.webpage.darkmode.enabled = False + +## Which images to apply dark mode to. +## Type: String +## Valid values: +## - always: Apply dark mode filter to all images. +## - never: Never apply dark mode filter to any images. +## - smart: Apply dark mode based on image content. Not available with Qt 5.15.0. +## - smart-simple: On QtWebEngine 6.6, use a simpler algorithm for smart mode (based on numbers of colors and transparency), rather than an ML-based model. Same as 'smart' on older QtWebEnigne versions. +# c.colors.webpage.darkmode.policy.images = 'smart' + +## Which pages to apply dark mode to. The underlying Chromium setting has +## been removed in QtWebEngine 5.15.3, thus this setting is ignored +## there. Instead, every element is now classified individually. +## Type: String +## Valid values: +## - always: Apply dark mode filter to all frames, regardless of content. +## - smart: Apply dark mode filter to frames based on background color. +# c.colors.webpage.darkmode.policy.page = 'smart' + +## Threshold for inverting background elements with dark mode. Background +## elements with brightness above this threshold will be inverted, and +## below it will be left as in the original, non-dark-mode page. Set to +## 256 to never invert the color or to 0 to always invert it. Note: This +## behavior is the opposite of +## `colors.webpage.darkmode.threshold.foreground`! +## Type: Int +# c.colors.webpage.darkmode.threshold.background = 0 + +## Threshold for inverting text with dark mode. Text colors with +## brightness below this threshold will be inverted, and above it will be +## left as in the original, non-dark-mode page. Set to 256 to always +## invert text color or to 0 to never invert text color. +## Type: Int +# c.colors.webpage.darkmode.threshold.foreground = 256 + +## Value to use for `prefers-color-scheme:` for websites. The "light" +## value is only available with QtWebEngine 5.15.2+. On older versions, +## it is the same as "auto". The "auto" value is broken on QtWebEngine +## 5.15.2 due to a Qt bug. There, it will fall back to "light" +## unconditionally. +## Type: String +## Valid values: +## - auto: Use the system-wide color scheme setting. +## - light: Force a light theme. +## - dark: Force a dark theme. +# c.colors.webpage.preferred_color_scheme = 'auto' + +## Number of commands to save in the command history. 0: no history / -1: +## unlimited +## Type: Int +# c.completion.cmd_history_max_items = 100 + +## Delay (in milliseconds) before updating completions after typing a +## character. +## Type: Int +# c.completion.delay = 0 + +## Default filesystem autocomplete suggestions for :open. The elements of +## this list show up in the completion window under the Filesystem +## category when the command line contains `:open` but no argument. +## Type: List of String +# c.completion.favorite_paths = [] + +## Height (in pixels or as percentage of the window) of the completion. +## Type: PercOrInt +# c.completion.height = '50%' + +## Minimum amount of characters needed to update completions. +## Type: Int +# c.completion.min_chars = 1 + +## Which categories to show (in which order) in the :open completion. +## Type: FlagList +## Valid values: +## - searchengines +## - quickmarks +## - bookmarks +## - history +## - filesystem +# c.completion.open_categories = ['searchengines', 'quickmarks', 'bookmarks', 'history', 'filesystem'] + +## Move on to the next part when there's only one possible completion +## left. +## Type: Bool +# c.completion.quick = True + +## Padding (in pixels) of the scrollbar handle in the completion window. +## Type: Int +# c.completion.scrollbar.padding = 2 + +## Width (in pixels) of the scrollbar in the completion window. +## Type: Int +# c.completion.scrollbar.width = 12 + +## When to show the autocompletion window. +## Type: String +## Valid values: +## - always: Whenever a completion is available. +## - auto: Whenever a completion is requested. +## - never: Never. +# c.completion.show = 'always' + +## Shrink the completion to be smaller than the configured size if there +## are no scrollbars. +## Type: Bool +# c.completion.shrink = False + +## Format of timestamps (e.g. for the history completion). See +## https://sqlite.org/lang_datefunc.html and +## https://docs.python.org/3/library/datetime.html#strftime-strptime- +## behavior for allowed substitutions, qutebrowser uses both sqlite and +## Python to format its timestamps. +## Type: String +# c.completion.timestamp_format = '%Y-%m-%d %H:%M' + +## Execute the best-matching command on a partial match. +## Type: Bool +# c.completion.use_best_match = False + +## A list of patterns which should not be shown in the history. This only +## affects the completion. Matching URLs are still saved in the history +## (and visible on the `:history` page), but hidden in the completion. +## Changing this setting will cause the completion history to be +## regenerated on the next start, which will take a short while. +## Type: List of UrlPattern +# c.completion.web_history.exclude = [] + +## Number of URLs to show in the web history. 0: no history / -1: +## unlimited +## Type: Int +# c.completion.web_history.max_items = -1 + +## Require a confirmation before quitting the application. +## Type: ConfirmQuit +## Valid values: +## - always: Always show a confirmation. +## - multiple-tabs: Show a confirmation if multiple tabs are opened. +## - downloads: Show a confirmation if downloads are running +## - never: Never show a confirmation. +# c.confirm_quit = ['never'] + +## Automatically start playing `