diff --git a/README.md b/README.md index becabea..28513bf 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ Save this service config to `$XDG_CONFIG_HOME/systemd/user/dotfiles.service`: [Unit] Description=Stow dotfiles linker Documentation=man:stow(1) -Before=basic.target +Before=wayland-session.target +Conflicts=wayland-session.target [Service] Type=oneshot @@ -19,7 +20,7 @@ ExecStop=/usr/bin/stow --target=%h --delete dotfiles/ WantedBy=default.target ``` -Update `WorkingDirectory=%h/dev/dotfiles` and enable the service: +(and enable it:) ```sh systemctl --user enable --now dotfiles.service diff --git a/dotfiles/.bashrc b/dotfiles/.bashrc index 52dc78b..6f086b2 100644 --- a/dotfiles/.bashrc +++ b/dotfiles/.bashrc @@ -15,20 +15,23 @@ 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='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"; pwd > $HOME/.cwd' +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-$ " # Use fzf if installed. 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 diff --git a/dotfiles/.config/alacritty/alacritty.toml b/dotfiles/.config/alacritty/alacritty.toml index acf2d4c..2f95351 100644 --- a/dotfiles/.config/alacritty/alacritty.toml +++ b/dotfiles/.config/alacritty/alacritty.toml @@ -1,9 +1,9 @@ -[general] +live_config_reload = true +working_directory = "None" + 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" -[terminal.shell] +[shell] program = "/bin/bash" [window] diff --git a/dotfiles/.config/mako/config b/dotfiles/.config/mako/config index a19fc01..a70e683 100644 --- a/dotfiles/.config/mako/config +++ b/dotfiles/.config/mako/config @@ -1,6 +1,6 @@ sort=-time -default-timeout=5000 -ignore-timeout=1 +default-timeout=0 +ignore-timeout=0 height=200 width=400 @@ -17,14 +17,15 @@ border-radius=10 background-color=#eff1f5E0 text-color=#4c4f69 +border-color=#fe640b progress-color=over #ccd0da -[urgency=low] -border-color=#c1ca8c - -[urgency=normal] -border-color=#a1bacc +[urgency=high] +border-color=#fe040b +background-color=#ffe1e5 +border-size=5 [urgency=critical] border-color=#fe040b -default-timeout=0 +background-color=#ffe1e5 +border-size=5 diff --git a/dotfiles/.config/nvim/lua/lsp.lua b/dotfiles/.config/nvim/lua/lsp.lua index 2dde945..85f9e8f 100644 --- a/dotfiles/.config/nvim/lua/lsp.lua +++ b/dotfiles/.config/nvim/lua/lsp.lua @@ -1,5 +1,3 @@ -local autoformat_files = '*.py,*.rs,*.tf' - local common_on_attach = function(client, bufnr) -- Mappings. vim.keymap.set("n", "K", "lua vim.lsp.buf.hover()") @@ -9,16 +7,18 @@ 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 vim.api.nvim_create_autocmd("BufWritePre", { - pattern = autoformat_files, + pattern = '*.py,*.rs', callback = function() vim.lsp.buf.format() end, }) end + -- Use vim's default coloring. client.server_capabilities.semanticTokensProvider = nil for _, group in ipairs(vim.fn.getcompletion("@lsp", "highlight")) do @@ -26,61 +26,14 @@ 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", + "dartls", + "gleam", "lua_ls", "ocamllsp", "pyright", @@ -92,6 +45,32 @@ 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) @@ -105,3 +84,12 @@ 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 deleted file mode 100644 index cf4f022..0000000 --- a/dotfiles/.config/nvim/lua/plugins/dap.lua +++ /dev/null @@ -1,120 +0,0 @@ -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) - -vim.fn.sign_define('DapBreakpoint', {text='󰬪', texthl='', linehl='', numhl=''}) - --- 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" - } -} - --- 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; - }, -} diff --git a/dotfiles/.config/nvim/lua/plugins/init.lua b/dotfiles/.config/nvim/lua/plugins/init.lua index cb6ca9d..61e0a61 100644 --- a/dotfiles/.config/nvim/lua/plugins/init.lua +++ b/dotfiles/.config/nvim/lua/plugins/init.lua @@ -3,7 +3,6 @@ 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 { @@ -39,29 +38,14 @@ require('packer').startup(function() -- LSP and related use { 'neovim/nvim-lspconfig' } use { 'aznhe21/actions-preview.nvim' } - use { 'folke/trouble.nvim' } -- diagnostics + use { 'folke/trouble.nvim' } -- lsp diagnostics - -- Plugins to extend builtin lsp + -- Plugins to extend builtin language support 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 { @@ -86,7 +70,6 @@ end) require('plugins.catppuccin') require('plugins.cmp') -require('plugins.dap') require('plugins.gitsigns') require('plugins.luasnip_config') require('plugins.neogit') diff --git a/dotfiles/.config/nvim/lua/plugins/telescope.lua b/dotfiles/.config/nvim/lua/plugins/telescope.lua index 08388d6..3accc4a 100644 --- a/dotfiles/.config/nvim/lua/plugins/telescope.lua +++ b/dotfiles/.config/nvim/lua/plugins/telescope.lua @@ -43,8 +43,7 @@ telescope.setup { treesitter = false }, file_ignore_patterns = { - '.git/', - '.venv/', + '.git', }, }, pickers = { @@ -73,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', 'rg', builtin.live_grep) +vim.keymap.set('n', 'gg', builtin.live_grep) -- LSP navigation. vim.keymap.set('n', 'gd', builtin.lsp_definitions) diff --git a/dotfiles/.config/nvim/lua/settings.lua b/dotfiles/.config/nvim/lua/settings.lua index 684ff54..7447ed9 100644 --- a/dotfiles/.config/nvim/lua/settings.lua +++ b/dotfiles/.config/nvim/lua/settings.lua @@ -42,7 +42,6 @@ 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} diff --git a/dotfiles/.config/sway/config.d/50-style.conf b/dotfiles/.config/sway/config.d/50-style.conf index e28733b..a2c938c 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 2 +default_border pixel 1 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 #8a8a8a +set $fi #646464 # Border active -set $bra #449a64 +set $bra #9a9a9a # Border inactive set $bri #000000 # class border backgr. text indicator child_border -client.focused $bra $bra $fa $bg $bra +client.focused $bra $bra $bg $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 diff --git a/dotfiles/.config/sway/config.d/90-bindings.conf b/dotfiles/.config/sway/config.d/90-bindings.conf index a38c706..395d805 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 /tmp/screen.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)" /tmp/screen.png # # Resizing containers: diff --git a/dotfiles/.config/waybar/config b/dotfiles/.config/waybar/config index 207aefd..4312297 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", "clock", "sway/language", "tray"], + "modules-right": ["temperature", "network", "battery", "pulseaudio", "backlight", "cpu", "memory", "custom/layout", "clock", "tray"], // Module config "sway/mode": { "tooltip": true, @@ -73,8 +73,10 @@ "memory": { "format": " {}%" }, - "sway/language": { - "format": "| {short} {variant}", + "custom/layout": { + "exec": "~/.config/waybar/keyboard-layout.py", + "return-type": "json", + "format": "| {}" }, "clock": { "tooltip": false, diff --git a/dotfiles/.environ b/dotfiles/.environ index 24ba281..ebe8a3a 100644 --- a/dotfiles/.environ +++ b/dotfiles/.environ @@ -11,12 +11,9 @@ 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 diff --git a/dotfiles/.profile b/dotfiles/.profile index 52e7f30..c7cffbd 100644 --- a/dotfiles/.profile +++ b/dotfiles/.profile @@ -1,7 +1,7 @@ # vim: set ft=sh: [ -f $HOME/.environ ] && source $HOME/.environ -[ -n "$BASH_VERSION" ] && source $HOME/.bashrc +[ $BASH == "/usr/bin/bash" ] && source $HOME/.bashrc MOZ_ENABLE_WAYLAND=1 XDG_CURRENT_DESKTOP=sway diff --git a/dotfiles/.ripgreprc b/dotfiles/.ripgreprc deleted file mode 100644 index 6516a24..0000000 --- a/dotfiles/.ripgreprc +++ /dev/null @@ -1,21 +0,0 @@ -# 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