From 9bb7d5133144471c14fb93086d0d662ca13d9c74 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Sun, 6 Oct 2024 04:51:33 +0200 Subject: [PATCH 01/24] mako: change style --- dotfiles/.config/mako/config | 38 +++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/dotfiles/.config/mako/config b/dotfiles/.config/mako/config index 8f0e625..a70e683 100644 --- a/dotfiles/.config/mako/config +++ b/dotfiles/.config/mako/config @@ -1,21 +1,31 @@ sort=-time -layer=overlay -background-color=#2e3440C4 -border-size=2 -border-color=#88c0d0 -border-radius=15 -icons=1 -max-icon-size=164 -default-timeout=5000 +default-timeout=0 ignore-timeout=0 + +height=200 +width=400 padding=10 -[urgency=low] -border-color=#cccccc +icons=1 +max-icon-size=128 -[urgency=normal] -border-color=#d08770 +border-size=3 +layer=overlay +border-radius=10 + +# colors + +background-color=#eff1f5E0 +text-color=#4c4f69 +border-color=#fe640b +progress-color=over #ccd0da [urgency=high] -border-color=#bf616a -default-timeout=0 +border-color=#fe040b +background-color=#ffe1e5 +border-size=5 + +[urgency=critical] +border-color=#fe040b +background-color=#ffe1e5 +border-size=5 From 8195f975be4b7dfb08d02eedeea8f6085044060e Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Sun, 6 Oct 2024 04:58:36 +0200 Subject: [PATCH 02/24] bash: load completions --- dotfiles/.bashrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dotfiles/.bashrc b/dotfiles/.bashrc index 24e6235..6f086b2 100644 --- a/dotfiles/.bashrc +++ b/dotfiles/.bashrc @@ -15,6 +15,15 @@ shopt -s histappend [[ -f $HOME/.bash_colors ]] && source "$HOME/.bash_colors" [[ -f $HOME/.bash_functions ]] && source "$HOME/.bash_functions" +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi +while read -r completion ; do source "$completion" ; done < <(find $HOME/.bash_completion/ -maxdepth 1 -not -type d) + # Save working dir on every prompt. export PROMPT_COMMAND='pwd > $HOME/.cwd' export PS1="${Yellow}\d \A ${Off}${Green}\u@\h: ${Off}\w ${Red}\$(parse_branch git)${BRed}\$(parse_branch fossil)${Off}\n-$ " From c571328361c0c776017c97ce06d95e36409dfbf6 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Sun, 6 Oct 2024 04:51:33 +0200 Subject: [PATCH 03/24] mako: change style --- dotfiles/.config/mako/config | 39 +++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/dotfiles/.config/mako/config b/dotfiles/.config/mako/config index 8f0e625..a32fc19 100644 --- a/dotfiles/.config/mako/config +++ b/dotfiles/.config/mako/config @@ -1,21 +1,32 @@ sort=-time -layer=overlay -background-color=#2e3440C4 -border-size=2 -border-color=#88c0d0 -border-radius=15 -icons=1 -max-icon-size=164 -default-timeout=5000 +default-timeout=0 ignore-timeout=0 + +height=200 +width=400 padding=10 -[urgency=low] -border-color=#cccccc +icons=1 +max-icon-size=128 -[urgency=normal] -border-color=#d08770 +border-size=3 +layer=overlay +border-radius=10 + +# colors + +background-color=#eff1f5E0 +text-color=#4c4f69 +border-color=#40a02b +progress-color=over #ccd0da + +[urgency=low] +border-color=#c1ca8c [urgency=high] -border-color=#bf616a -default-timeout=0 +border-color=#fe040b +background-color=#ffe1e5 + +[urgency=critical] +border-color=#fe040b +background-color=#ffe1e5 From 8b3b22432a0d2d6e13522aa6f8d9780840d2d0a6 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Sun, 6 Oct 2024 22:29:00 +0200 Subject: [PATCH 04/24] nvim: rg everywhere! :) --- dotfiles/.config/nvim/lua/plugins/telescope.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotfiles/.config/nvim/lua/plugins/telescope.lua b/dotfiles/.config/nvim/lua/plugins/telescope.lua index 3accc4a..3b5abf5 100644 --- a/dotfiles/.config/nvim/lua/plugins/telescope.lua +++ b/dotfiles/.config/nvim/lua/plugins/telescope.lua @@ -72,7 +72,7 @@ vim.keymap.set('n', 'fh', builtin.help_tags) vim.keymap.set('n', 'fs', builtin.lsp_dynamic_workspace_symbols) -- Grep (the only one). -vim.keymap.set('n', 'gg', builtin.live_grep) +vim.keymap.set('n', 'rg', builtin.live_grep) -- LSP navigation. vim.keymap.set('n', 'gd', builtin.lsp_definitions) From f1a244178f8739bce36c4d404d50cd62bb4732f4 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Sun, 6 Oct 2024 22:35:42 +0200 Subject: [PATCH 05/24] Update readme - Before=basic.service --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 28513bf..becabea 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,7 @@ Save this service config to `$XDG_CONFIG_HOME/systemd/user/dotfiles.service`: [Unit] Description=Stow dotfiles linker Documentation=man:stow(1) -Before=wayland-session.target -Conflicts=wayland-session.target +Before=basic.target [Service] Type=oneshot @@ -20,7 +19,7 @@ ExecStop=/usr/bin/stow --target=%h --delete dotfiles/ WantedBy=default.target ``` -(and enable it:) +Update `WorkingDirectory=%h/dev/dotfiles` and enable the service: ```sh systemctl --user enable --now dotfiles.service From c0245c9d1c8f5dc318fd8be3c9c85d962b104648 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 7 Oct 2024 01:16:41 +0200 Subject: [PATCH 06/24] sway: fix keyboard language display --- dotfiles/.config/waybar/config | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dotfiles/.config/waybar/config b/dotfiles/.config/waybar/config index 4312297..207aefd 100644 --- a/dotfiles/.config/waybar/config +++ b/dotfiles/.config/waybar/config @@ -4,7 +4,7 @@ "height": 30, "modules-left": ["sway/workspaces", "sway/mode", "sway/window"], "modules-center": [], - "modules-right": ["temperature", "network", "battery", "pulseaudio", "backlight", "cpu", "memory", "custom/layout", "clock", "tray"], + "modules-right": ["temperature", "network", "battery", "pulseaudio", "backlight", "cpu", "memory", "clock", "sway/language", "tray"], // Module config "sway/mode": { "tooltip": true, @@ -73,10 +73,8 @@ "memory": { "format": " {}%" }, - "custom/layout": { - "exec": "~/.config/waybar/keyboard-layout.py", - "return-type": "json", - "format": "| {}" + "sway/language": { + "format": "| {short} {variant}", }, "clock": { "tooltip": false, From 750cd50c3dc6265132384c5c77ab9c03897059d5 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 7 Oct 2024 08:43:18 +0200 Subject: [PATCH 07/24] nvim: ignore .git/ in telescope --- dotfiles/.config/nvim/lua/plugins/telescope.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotfiles/.config/nvim/lua/plugins/telescope.lua b/dotfiles/.config/nvim/lua/plugins/telescope.lua index 3b5abf5..ed66d57 100644 --- a/dotfiles/.config/nvim/lua/plugins/telescope.lua +++ b/dotfiles/.config/nvim/lua/plugins/telescope.lua @@ -43,7 +43,7 @@ telescope.setup { treesitter = false }, file_ignore_patterns = { - '.git', + '.git/', }, }, pickers = { From 12f9dcceb9151c4883e4966a56c23bc81f8b2c4a Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 7 Oct 2024 11:45:56 +0200 Subject: [PATCH 08/24] bash: set terminal window title --- dotfiles/.bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotfiles/.bashrc b/dotfiles/.bashrc index 24e6235..8cf27ec 100644 --- a/dotfiles/.bashrc +++ b/dotfiles/.bashrc @@ -16,7 +16,7 @@ shopt -s histappend [[ -f $HOME/.bash_functions ]] && source "$HOME/.bash_functions" # Save working dir on every prompt. -export PROMPT_COMMAND='pwd > $HOME/.cwd' +export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"; pwd > $HOME/.cwd' export PS1="${Yellow}\d \A ${Off}${Green}\u@\h: ${Off}\w ${Red}\$(parse_branch git)${BRed}\$(parse_branch fossil)${Off}\n-$ " # Use fzf if installed. From 62fd64ddb80826858d5aedd5ee4cf8b37d9e05de Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 7 Oct 2024 11:46:59 +0200 Subject: [PATCH 09/24] bash: lesspipe + checkwinsize --- dotfiles/.bashrc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dotfiles/.bashrc b/dotfiles/.bashrc index 8cf27ec..52dc78b 100644 --- a/dotfiles/.bashrc +++ b/dotfiles/.bashrc @@ -23,6 +23,12 @@ export PS1="${Yellow}\d \A ${Off}${Green}\u@\h: ${Off}\w ${Red}\$(parse_branch g hash fzf 2>/dev/null && eval "$(fzf --bash)" export FZF_DEFAULT_OPTS='--border=horizontal --info=inline --no-reverse --height=50%' +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + # Use gpg-agent as ssh agent (and get a nice graphical prompt). unset SSH_AGENT_PID if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then From bf0e8daf49c3d47d095a1997dd8f2ec07a7c4539 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 7 Oct 2024 11:47:16 +0200 Subject: [PATCH 10/24] nvim: set title --- dotfiles/.config/nvim/lua/settings.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/dotfiles/.config/nvim/lua/settings.lua b/dotfiles/.config/nvim/lua/settings.lua index 7447ed9..684ff54 100644 --- a/dotfiles/.config/nvim/lua/settings.lua +++ b/dotfiles/.config/nvim/lua/settings.lua @@ -42,6 +42,7 @@ vim.api.nvim_create_autocmd({'InsertLeave', 'BufEnter'}, { }) vim.cmd([[ + set title set noautoread autocmd CursorHold * checktime autocmd TextYankPost * lua vim.highlight.on_yank {on_visual = false} From ae7733a7767998cfce5dee6aa3c5eaba08cc93c8 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 7 Oct 2024 11:47:43 +0200 Subject: [PATCH 11/24] sway: green color on active window title --- dotfiles/.config/sway/config.d/50-style.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dotfiles/.config/sway/config.d/50-style.conf b/dotfiles/.config/sway/config.d/50-style.conf index a2c938c..e28733b 100644 --- a/dotfiles/.config/sway/config.d/50-style.conf +++ b/dotfiles/.config/sway/config.d/50-style.conf @@ -1,6 +1,6 @@ # Remove title from windows -default_border pixel 1 +default_border pixel 2 default_floating_border normal bindsym $mod+t border toggle @@ -15,14 +15,14 @@ set $bi #3f3f3f # Foreground active set $fa #eff1f5 # Foreground inactive -set $fi #646464 +set $fi #8a8a8a # Border active -set $bra #9a9a9a +set $bra #449a64 # Border inactive set $bri #000000 # class border backgr. text indicator child_border -client.focused $bra $bra $bg $bg $bra +client.focused $bra $bra $fa $bg $bra client.focused_inactive $bra $ba $fa $bg $bri client.unfocused $bri $bi $fi $bg $bri #client.urgent $br $br $fg $bg $br #currently not implemented From fa4426d193c8cdec7192519007a2aeb9fd6a1a6c Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 7 Oct 2024 11:48:31 +0200 Subject: [PATCH 12/24] bash: restore pythonuserbase --- dotfiles/.environ | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dotfiles/.environ b/dotfiles/.environ index ebe8a3a..24ba281 100644 --- a/dotfiles/.environ +++ b/dotfiles/.environ @@ -11,9 +11,12 @@ export RIPGREP_CONFIG_PATH=$HOME/.ripgreprc export SYSTEMD_EDITOR=$EDITOR export TERM=alacritty export PYTHONDONTWRITEBYTECODE=1 +export PYTHONUSERBASE=$HOME/.env/python export TZ="Europe/Belgrade" +export FZF_DEFAULT_OPTS='--border=horizontal --info=inline --no-reverse --height=50%' # Local user bins add_path() case :$PATH: in *:$1:*) ;; *) PATH=$1:$PATH;; esac add_path $HOME/.local/bin +add_path $PYTHONUSERBASE/bin add_path $HOME/.cargo/bin From 1a207b0c7a6a38d7de925920a298ec6759867f65 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 7 Oct 2024 11:49:10 +0200 Subject: [PATCH 13/24] rg: add config file --- dotfiles/.ripgreprc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 dotfiles/.ripgreprc diff --git a/dotfiles/.ripgreprc b/dotfiles/.ripgreprc new file mode 100644 index 0000000..6516a24 --- /dev/null +++ b/dotfiles/.ripgreprc @@ -0,0 +1,21 @@ +# Don't let ripgrep vomit really long lines to my terminal, and show a preview. +--max-columns=150 +--max-columns-preview + +# Add my 'web' type. +--type-add +web:*.{html,css,js}* + +# Search hidden files / directories (e.g. dotfiles) by default +--hidden + +# Using glob patterns to include/exclude files or folders +--glob +!.git/* + +# Set the colors. +--colors=line:none +--colors=line:style:bold + +# Because who cares about case!? +--smart-case From 51495f158df590cc30d0606073f52daaf237daa2 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 7 Oct 2024 11:59:07 +0200 Subject: [PATCH 14/24] bash: do a better 'bash is running' check --- dotfiles/.profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotfiles/.profile b/dotfiles/.profile index c7cffbd..52e7f30 100644 --- a/dotfiles/.profile +++ b/dotfiles/.profile @@ -1,7 +1,7 @@ # vim: set ft=sh: [ -f $HOME/.environ ] && source $HOME/.environ -[ $BASH == "/usr/bin/bash" ] && source $HOME/.bashrc +[ -n "$BASH_VERSION" ] && source $HOME/.bashrc MOZ_ENABLE_WAYLAND=1 XDG_CURRENT_DESKTOP=sway From 563995032ca9b8ddfdfe4f0f301dbbd93093b786 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 7 Oct 2024 12:10:05 +0200 Subject: [PATCH 15/24] nvim: ignore .venv/ in telescope --- dotfiles/.config/nvim/lua/plugins/telescope.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/dotfiles/.config/nvim/lua/plugins/telescope.lua b/dotfiles/.config/nvim/lua/plugins/telescope.lua index ed66d57..08388d6 100644 --- a/dotfiles/.config/nvim/lua/plugins/telescope.lua +++ b/dotfiles/.config/nvim/lua/plugins/telescope.lua @@ -44,6 +44,7 @@ telescope.setup { }, file_ignore_patterns = { '.git/', + '.venv/', }, }, pickers = { From a3b0b8754ba9631dd65e5c82a18f09849c9c6ea3 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 14 Oct 2024 09:59:14 +0200 Subject: [PATCH 16/24] nvim: remove dart, move autoformat extensions to var --- dotfiles/.config/nvim/lua/lsp.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dotfiles/.config/nvim/lua/lsp.lua b/dotfiles/.config/nvim/lua/lsp.lua index 85f9e8f..a340218 100644 --- a/dotfiles/.config/nvim/lua/lsp.lua +++ b/dotfiles/.config/nvim/lua/lsp.lua @@ -1,3 +1,5 @@ +local autoformat_files = '*.py,*.rs,*.tf' + local common_on_attach = function(client, bufnr) -- Mappings. vim.keymap.set("n", "K", "lua vim.lsp.buf.hover()") @@ -12,7 +14,7 @@ local common_on_attach = function(client, bufnr) -- Autoformat on save. if client.supports_method("textDocument/formatting") then vim.api.nvim_create_autocmd("BufWritePre", { - pattern = '*.py,*.rs', + pattern = autoformat_files, callback = function() vim.lsp.buf.format() end, @@ -32,7 +34,6 @@ local capabilities = vim.lsp.protocol.make_client_capabilities() -- LSPs local servers = { "clangd", - "dartls", "gleam", "lua_ls", "ocamllsp", From db4a1cf19885b5a5ab4d03570df9d24afb79375e Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 14 Oct 2024 09:59:52 +0200 Subject: [PATCH 17/24] sway: date formatted screenshots in home --- dotfiles/.config/sway/config.d/90-bindings.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotfiles/.config/sway/config.d/90-bindings.conf b/dotfiles/.config/sway/config.d/90-bindings.conf index 395d805..2f16926 100644 --- a/dotfiles/.config/sway/config.d/90-bindings.conf +++ b/dotfiles/.config/sway/config.d/90-bindings.conf @@ -122,9 +122,9 @@ bindsym $mod+z exec swaylock -c 000000 # Take full screen screenshot with PrtScr -bindsym Print exec grim -t png /tmp/screen.png +bindsym Print exec grim -t png "~/screenshot-$(date +%Y-%m-%d-%H%M%S).png" # Take area screenshot with Shift+PrtScr -bindsym Shift+Print exec grim -g "$(slurp)" /tmp/screen.png +bindsym Shift+Print exec grim -g "$(slurp)" "~/screenshot-$(date +%Y-%m-%d-%H%M%S).png" # # Resizing containers: From db05b6ba8e53570c0e9fa4fd7954fff28b5936e1 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 14 Oct 2024 10:02:09 +0200 Subject: [PATCH 18/24] nvim: remove rename shortcut --- dotfiles/.config/nvim/lua/lsp.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/dotfiles/.config/nvim/lua/lsp.lua b/dotfiles/.config/nvim/lua/lsp.lua index a340218..5f337ea 100644 --- a/dotfiles/.config/nvim/lua/lsp.lua +++ b/dotfiles/.config/nvim/lua/lsp.lua @@ -9,7 +9,6 @@ local common_on_attach = function(client, bufnr) vim.keymap.set("n", "wl", "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))") vim.keymap.set("n", "wa", "lua vim.lsp.buf.add_workspace_folder()") vim.keymap.set("n", "wr", "lua vim.lsp.buf.remove_workspace_folder()") - vim.keymap.set("n", "r", "lua vim.lsp.buf.rename()") -- Autoformat on save. if client.supports_method("textDocument/formatting") then From 2844c29a9c645b59d199b6a0f55f34edcb0f05cf Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Tue, 22 Oct 2024 20:37:15 +0200 Subject: [PATCH 19/24] sway: fix screenshot capture --- dotfiles/.config/sway/config.d/90-bindings.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotfiles/.config/sway/config.d/90-bindings.conf b/dotfiles/.config/sway/config.d/90-bindings.conf index 2f16926..a38c706 100644 --- a/dotfiles/.config/sway/config.d/90-bindings.conf +++ b/dotfiles/.config/sway/config.d/90-bindings.conf @@ -122,9 +122,9 @@ bindsym $mod+z exec swaylock -c 000000 # Take full screen screenshot with PrtScr -bindsym Print exec grim -t png "~/screenshot-$(date +%Y-%m-%d-%H%M%S).png" +bindsym Print exec grim -t png ~/screenshot-$(date +%Y-%m-%d-%H%M%S).png # Take area screenshot with Shift+PrtScr -bindsym Shift+Print exec grim -g "$(slurp)" "~/screenshot-$(date +%Y-%m-%d-%H%M%S).png" +bindsym Shift+Print exec grim -g "$(slurp)" ~/screenshot-$(date +%Y-%m-%d-%H%M%S).png # # Resizing containers: From 9259e7b2ba2425e22aa0882b97a32696d07eedc9 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Sat, 2 Nov 2024 12:37:30 +0100 Subject: [PATCH 20/24] Update alacritty - config format --- dotfiles/.config/alacritty/alacritty.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dotfiles/.config/alacritty/alacritty.toml b/dotfiles/.config/alacritty/alacritty.toml index 2f95351..acf2d4c 100644 --- a/dotfiles/.config/alacritty/alacritty.toml +++ b/dotfiles/.config/alacritty/alacritty.toml @@ -1,9 +1,9 @@ -live_config_reload = true -working_directory = "None" - +[general] import = [ "~/.config/alacritty/light.toml" ] +live_config_reload = true +working_directory = "None" [cursor] thickness = 0.2 @@ -414,7 +414,7 @@ history = 100000 save_to_clipboard = true semantic_escape_chars = ",│`|:\"' ()[]{}<>\t" -[shell] +[terminal.shell] program = "/bin/bash" [window] From b48b531d3d535ba1b2ef564d12df350f0e2cc0ef Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Sun, 3 Nov 2024 16:00:31 +0100 Subject: [PATCH 21/24] Swith to rustaceanvim and set up Rust debugging --- dotfiles/.config/nvim/lua/lsp.lua | 86 ++++++++++++--------- dotfiles/.config/nvim/lua/plugins/dap.lua | 87 ++++++++++++++++++++++ dotfiles/.config/nvim/lua/plugins/init.lua | 22 +++++- 3 files changed, 155 insertions(+), 40 deletions(-) create mode 100644 dotfiles/.config/nvim/lua/plugins/dap.lua diff --git a/dotfiles/.config/nvim/lua/lsp.lua b/dotfiles/.config/nvim/lua/lsp.lua index 5f337ea..2dde945 100644 --- a/dotfiles/.config/nvim/lua/lsp.lua +++ b/dotfiles/.config/nvim/lua/lsp.lua @@ -19,7 +19,6 @@ local common_on_attach = function(client, bufnr) end, }) end - -- Use vim's default coloring. client.server_capabilities.semanticTokensProvider = nil for _, group in ipairs(vim.fn.getcompletion("@lsp", "highlight")) do @@ -27,13 +26,61 @@ local common_on_attach = function(client, bufnr) end end +-- LSP diagnostics. +vim.lsp.handlers["textDocument/publishDiagnostics"] = + vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = false, + underline = true, + signs = true, + update_in_insert = false + }) + +-- Setup rust outside of lspconfig. +vim.g.rustaceanvim = function() + return { + -- Plugin configuration. + tools = { + }, + -- LSP configuration. + server = { + on_attach = function(client, bufnr) + common_on_attach(client, bufnr) + end, + default_settings = { + -- rust-analyzer language server configuration + ['rust-analyzer'] = { + imports = { + granularity = { + group = "module", + }, + prefix = "self", + }, + cargo = { + buildScripts = { + enable = true, + }, + }, + procMacro = { + enable = true + }, + checkOnSave = { + command = "clippy", + }, + }, + }, + -- DAP configuration. + dap = { + }, + } + } +end + local nvim_lsp = require('lspconfig') local capabilities = vim.lsp.protocol.make_client_capabilities() -- LSPs local servers = { "clangd", - "gleam", "lua_ls", "ocamllsp", "pyright", @@ -45,32 +92,6 @@ for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { capabilities = capabilities, on_attach = common_on_attach } end -nvim_lsp.rust_analyzer.setup({ - on_attach = common_on_attach, - capabilities = capabilities, - settings = { - ["rust-analyzer"] = { - imports = { - granularity = { - group = "module", - }, - prefix = "self", - }, - cargo = { - buildScripts = { - enable = true, - }, - }, - procMacro = { - enable = true - }, - checkOnSave = { - command = "clippy", - }, - } - } -}) - nvim_lsp.ruff.setup({ on_attach = function (client) common_on_attach(client) @@ -84,12 +105,3 @@ nvim_lsp.ruff.setup({ } }, }) - --- LSP diagnostics. -vim.lsp.handlers["textDocument/publishDiagnostics"] = - vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { - virtual_text = false, - underline = true, - signs = true, - update_in_insert = false - }) diff --git a/dotfiles/.config/nvim/lua/plugins/dap.lua b/dotfiles/.config/nvim/lua/plugins/dap.lua new file mode 100644 index 0000000..de6ae2f --- /dev/null +++ b/dotfiles/.config/nvim/lua/plugins/dap.lua @@ -0,0 +1,87 @@ +local dap, dapui = require('dap'), require('dapui') + +-- Open dapui once dap starts. +dapui.setup() +dap.listeners.before.attach.dapui_config = function() + dapui.open() +end +dap.listeners.before.launch.dapui_config = function() + dapui.open() +end +dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() +end +dap.listeners.before.event_exited.dapui_config = function() + dapui.close() +end + +-- Keybindings used in probably all editors/IDEs. +vim.keymap.set('n', '', dap.continue) +vim.keymap.set('n', '', dap.step_over) +vim.keymap.set('n', '', dap.step_into) +vim.keymap.set('n', '', dap.step_out) +-- Breakpoints. +vim.keymap.set('n', 'b', dap.toggle_breakpoint) +vim.keymap.set('n', 'B', dap.set_breakpoint) +vim.keymap.set('n', 'lp', function() dap.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) end) +-- Repl, run and dap-ui bindings. +vim.keymap.set('n', 'dr', dap.repl.open) +vim.keymap.set('n', 'dl', dap.run_last) +vim.keymap.set({'n', 'v'}, 'dh', function() require('dap.ui.widgets').hover() end) +vim.keymap.set({'n', 'v'}, 'dp', function() require('dap.ui.widgets').preview() end) +vim.keymap.set('n', 'df', function() local widgets = require('dap.ui.widgets') widgets.centered_float(widgets.frames) end) +vim.keymap.set('n', 'ds', function() local widgets = require('dap.ui.widgets') widgets.centered_float(widgets.scopes) end) + +-- Set up lldb (LLVM debugger) +-- Install archlinux: sudo pacman -S lldb +-- Install ubuntu: sudo apt +dap.adapters.lldb = { + type = 'server', + port = "${port}", + executable = { + command = '/usr/bin/lldb-dap', + args = { "--port", "${port}" }, + }, +} + +-- Custom debuggable build runs (on top of rust-analyzer debuggables). +local ExecTypes = { + TEST = "cargo build --tests -q --message-format=json", + BIN = "cargo build -q --message-format=json" +} +local function runBuild(type) + local lines = vim.fn.systemlist(type) + local output = table.concat(lines, "\n") + local filename = output:match('^.*"executable":"(.*)",.*\n.*,"success":true}$') + + if filename == nil then + return error("failed to build cargo project") + end + + return filename +end +-- Custom debuggable configurations. +dap.configurations.rust = { + { + name = "Debug Test", + type = "lldb", + request = "launch", + program = function () + return runBuild(ExecTypes.TEST) + end, + cwd = "${workspaceFolder}", + stopOnEntry = false, + showDisassembly = "never" + }, + { + name = "Debug Bin", + type = "lldb", + request = "launch", + program = function () + return runBuild(ExecTypes.BIN) + end, + cwd = "${workspaceFolder}", + stopOnEntry = false, + showDisassembly = "never" + } +} diff --git a/dotfiles/.config/nvim/lua/plugins/init.lua b/dotfiles/.config/nvim/lua/plugins/init.lua index 61e0a61..94e4584 100644 --- a/dotfiles/.config/nvim/lua/plugins/init.lua +++ b/dotfiles/.config/nvim/lua/plugins/init.lua @@ -38,14 +38,29 @@ require('packer').startup(function() -- LSP and related use { 'neovim/nvim-lspconfig' } use { 'aznhe21/actions-preview.nvim' } - use { 'folke/trouble.nvim' } -- lsp diagnostics + use { 'folke/trouble.nvim' } -- diagnostics - -- Plugins to extend builtin language support + -- Plugins to extend builtin lsp use { 'cespare/vim-toml' } use { 'gleam-lang/gleam.vim' } - use { 'rust-lang/rust.vim' } use { 'folke/neodev.nvim' } use { 'hashivim/vim-terraform' } + use { + 'mrcjkb/rustaceanvim', + requires = { + 'mfussenegger/nvim-dap' + } + } + + -- Debugging + use { 'mfussenegger/nvim-dap' } + use { + "rcarriga/nvim-dap-ui", + requires = { + "mfussenegger/nvim-dap", + "nvim-neotest/nvim-nio", + } + } -- Git use { @@ -70,6 +85,7 @@ end) require('plugins.catppuccin') require('plugins.cmp') +require('plugins.dap') require('plugins.gitsigns') require('plugins.luasnip_config') require('plugins.neogit') From 7dfe2ca68b7f055ea7fba839fda779b8e81b4a15 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Sun, 3 Nov 2024 19:53:47 +0100 Subject: [PATCH 22/24] change breakpoint icon --- dotfiles/.config/nvim/lua/plugins/dap.lua | 2 ++ dotfiles/.config/nvim/lua/plugins/init.lua | 1 + 2 files changed, 3 insertions(+) diff --git a/dotfiles/.config/nvim/lua/plugins/dap.lua b/dotfiles/.config/nvim/lua/plugins/dap.lua index de6ae2f..4414638 100644 --- a/dotfiles/.config/nvim/lua/plugins/dap.lua +++ b/dotfiles/.config/nvim/lua/plugins/dap.lua @@ -32,6 +32,8 @@ vim.keymap.set({'n', 'v'}, 'dp', function() require('dap.ui.widgets').pr vim.keymap.set('n', 'df', function() local widgets = require('dap.ui.widgets') widgets.centered_float(widgets.frames) end) vim.keymap.set('n', 'ds', function() local widgets = require('dap.ui.widgets') widgets.centered_float(widgets.scopes) end) +vim.fn.sign_define('DapBreakpoint', {text='󰬪', texthl='', linehl='', numhl=''}) + -- Set up lldb (LLVM debugger) -- Install archlinux: sudo pacman -S lldb -- Install ubuntu: sudo apt diff --git a/dotfiles/.config/nvim/lua/plugins/init.lua b/dotfiles/.config/nvim/lua/plugins/init.lua index 94e4584..cb6ca9d 100644 --- a/dotfiles/.config/nvim/lua/plugins/init.lua +++ b/dotfiles/.config/nvim/lua/plugins/init.lua @@ -3,6 +3,7 @@ require('plugins.packer_setup') require('packer').startup(function() -- Packer can manage itself as an optional plugin use { 'wbthomason/packer.nvim', opt = true } + use { 'glepnir/nerdicons.nvim', cmd = 'NerdIcons', config = function() require('nerdicons').setup({}) end } -- Fuzzy finder use { From a06e856332587a34c27e7a0d5198ba91c856ab5a Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Sun, 17 Nov 2024 00:07:23 +0100 Subject: [PATCH 23/24] nvim: python dap wip --- dotfiles/.config/nvim/lua/plugins/dap.lua | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dotfiles/.config/nvim/lua/plugins/dap.lua b/dotfiles/.config/nvim/lua/plugins/dap.lua index 4414638..cf4f022 100644 --- a/dotfiles/.config/nvim/lua/plugins/dap.lua +++ b/dotfiles/.config/nvim/lua/plugins/dap.lua @@ -87,3 +87,34 @@ dap.configurations.rust = { showDisassembly = "never" } } + +-- Set up debugpy via uv +dap.adapters.python = { + type = 'server', + port = "${port}", + host = "127.0.0.1", + executable = { + command = "uvx", + args = { + "debugpy", + "--listen", + "127.0.0.1:${port}", + "--wait-for-client", + }, + }, + options = { + source_filetype = 'python', + }, +} + +dap.configurations.python = { + { + type = 'python'; + request = 'launch'; + name = "Launch file"; + program = "${file}"; + pythonPath = function() + return "${workspaceFolder}/.venv/bin/python" + end; + }, +} From 92781385aebb005871409dfa89ca2d6fb686216b Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Tue, 3 Dec 2024 01:47:00 +0100 Subject: [PATCH 24/24] Reconfigure mako, colors and timeouts --- dotfiles/.config/mako/config | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/dotfiles/.config/mako/config b/dotfiles/.config/mako/config index a32fc19..a19fc01 100644 --- a/dotfiles/.config/mako/config +++ b/dotfiles/.config/mako/config @@ -1,6 +1,6 @@ sort=-time -default-timeout=0 -ignore-timeout=0 +default-timeout=5000 +ignore-timeout=1 height=200 width=400 @@ -17,16 +17,14 @@ border-radius=10 background-color=#eff1f5E0 text-color=#4c4f69 -border-color=#40a02b progress-color=over #ccd0da [urgency=low] border-color=#c1ca8c -[urgency=high] -border-color=#fe040b -background-color=#ffe1e5 +[urgency=normal] +border-color=#a1bacc [urgency=critical] border-color=#fe040b -background-color=#ffe1e5 +default-timeout=0