diff --git a/bootstrap/packages_stable.tsv b/bootstrap/packages_stable.tsv index 665ae96..a35d4e3 100644 --- a/bootstrap/packages_stable.tsv +++ b/bootstrap/packages_stable.tsv @@ -16,6 +16,7 @@ asix-ax88179-dkms A kernel module for ASIX AX88178A AX88179 USB 3.0 network adap aspell-de German dictionary for aspell R aspell-en English dictionary for aspell R atool A script for managing file archives of various types R +atuin Magical shell history R aubio A tool for extracting annotations from audio signals R autofs A kernel-based automounter for Linux A barrier Open-source KVM software based on Synergy (GUI) R @@ -179,6 +180,7 @@ needrestart Restart daemons after library updates. A neomutt A version of mutt with added features R neovim Fork of Vim aiming to improve user experience, plugins, and GUIs R net-tools Configuration tools for Linux networking R +netbird-bin WireGuard-based mesh network A netctl Profile based systemd network management R nethogs A net top tool which displays traffic used per process instead of per IP or interface R network-manager-applet Applet for managing network connections R @@ -253,7 +255,7 @@ qt6-svg Classes for displaying the contents of SVG files R qt6-wayland Provides APIs for Wayland R qtcurve-gtk2 A configurable set of widget styles for KDE and Gtk R quarto-cli-bin An open-source scientific and technical publishing system built on Pandoc (binary from official repo) A -qutebrowser A keyboard-driven, vim-like browser based on PyQt5 R +qutebrowser A keyboard-driven, vim-like browser based on Python and Qt R refind An EFI boot manager R refind-btrfs Generate rEFInd manual boot stanzas from Btrfs snapshots A reflector A Python 3 module and script to retrieve and filter the latest Pacman mirror list. R @@ -277,6 +279,7 @@ smartmontools Control and monitor S.M.A.R.T. enabled ATA and SCSI Hard Drives R snap-pac Pacman hooks that use snapper to create pre/post btrfs snapshots like openSUSE's YaST R speedtest-cli Command line interface for testing internet bandwidth using speedtest.net R sshfs FUSE client based on the SSH File Transfer Protocol R +starship The cross-shell prompt for astronauts R steam Valve's digital software delivery system R sudo Give certain users the ability to run some commands as root R surfraw Shell Users' Revolutionary Front Rage Against the Web R @@ -357,4 +360,3 @@ zoxide A smarter cd command for your terminal R zq Tooling for super-structured data A zsh-autosuggestions Fish-like autosuggestions for zsh R zsh-fast-syntax-highlighting Optimized and extended zsh-syntax-highlighting A -zsh-pure-prompt Pretty, minimal and fast ZSH prompt A diff --git a/nvim/.config/nvim/after/ftplugin/quarto.lua b/nvim/.config/nvim/after/ftplugin/quarto.lua index b5c90ca..fff645a 100644 --- a/nvim/.config/nvim/after/ftplugin/quarto.lua +++ b/nvim/.config/nvim/after/ftplugin/quarto.lua @@ -67,12 +67,7 @@ local function molten_mappings_set() map("n", "cN", ":MoltenInit ") map("n", "cD", ":MoltenDeinit") map("n", "cR", ":MoltenRestart") - map( - "n", - "cA", - require("quarto.runner").run_all, - { silent = true, desc = "Evaluate all code cells" } - ) + map("n", "cA", require("quarto.runner").run_all, { silent = true, desc = "Evaluate all code cells" }) map( "n", "ca", diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 2110ae4..4354f69 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -23,7 +23,6 @@ "cmp-tmux": { "branch": "main", "commit": "97ec06b8030b8bf6d1fd83d49bdd16c98e04c845" }, "cmp-treesitter": { "branch": "master", "commit": "13e4ef8f4dd5639fca2eb9150e68f47639a9b37d" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "codeium.nvim": { "branch": "main", "commit": "a0d43300f9a17a6ac775947ae4fb6b99ac5a92d0" }, "completion-vcard": { "branch": "master", "commit": "2220fd517a985ececed1adcf0e5be8f2815564c7" }, "conform.nvim": { "branch": "master", "commit": "ce95e6b2a072d81fd312ff213f241cacab1eccef" }, "dial.nvim": { "branch": "master", "commit": "54b503f906bc9e5ab85288414840a1b86d40769f" }, @@ -34,40 +33,38 @@ "git-conflict.nvim": { "branch": "main", "commit": "4e0191c9a0ae05d7fbdcdc7f15cd358f56d23bfb" }, "gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" }, "headlines.nvim": { "branch": "master", "commit": "e3d7bfdf40e41a020d966d35f8b48d75b90367d2" }, - "image.nvim": { "branch": "master", "commit": "c40215d7d7d1d8c823ee9a77be1a894d5c8df41b" }, + "image.nvim": { "branch": "master", "commit": "9b6248bd8b58b505559e31eb581b7c4638369ec3" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, "lightspeed.nvim": { "branch": "main", "commit": "fcc72d8a4d5f4ebba62d8a3a0660f88f1b5c3b05" }, - "lsp-setup.nvim": { "branch": "main", "commit": "7276e54faf4af909b6ea171975fd4179ebe65cec" }, - "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, + "lsp-setup.nvim": { "branch": "main", "commit": "22ba14fb5c4208fd93f616d7b99bb47656e6e144" }, + "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, "markdown-preview.nvim": { "branch": "master", "commit": "9becceee5740b7db6914da87358a183ad11b2049" }, "markmap.nvim": { "branch": "main", "commit": "3befc2a54c2448a16c30c1c7762aab263f22946a" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "4eb8e15e3c0757303d4c6dea64d2981fc679e990" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "8b70e7f1e0a4119c1234c3bde4a01c241cabcc74" }, "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, - "mdeval.nvim": { "branch": "master", "commit": "2654caf8ecaad702b50199d18e39cff23d81e0ba" }, "mini.nvim": { "branch": "main", "commit": "b5645ac6eefce8e7af9d7dd4e5e296a81cba8a10" }, - "molten-nvim": { "branch": "main", "commit": "883ecb358e3b4dca9a83daa05b51f22b81f878e9" }, - "neotest": { "branch": "master", "commit": "009328955066ae6c170d24bb0de5f168d8760ff8" }, + "molten-nvim": { "branch": "main", "commit": "1752f9d0027bf8ccb3440416e1112cae8f8f412c" }, + "neotest": { "branch": "master", "commit": "6aa6e4529a4a125b49c48541b97ba146ceee2441" }, "neotest-python": { "branch": "master", "commit": "81d2265efac717bb567bc15cc652ae10801286b3" }, - "nvim-FeMaco.lua": { "branch": "main", "commit": "6af458f0196215f397db31a6e1fb2df795811693" }, - "nvim-base16": { "branch": "master", "commit": "010bedf0b7c01ab4d4e4e896a8527d97c222351d" }, - "nvim-cmp": { "branch": "main", "commit": "41d7633e4146dce1072de32cea31ee31b056a131" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" }, + "nvim-base16": { "branch": "master", "commit": "96e308958625a84940d5e443475465abf99c7bd9" }, + "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, "nvim-coverage": { "branch": "main", "commit": "cf4b5c61dfac977026a51a2bcad9173c272986ce" }, - "nvim-lint": { "branch": "master", "commit": "849ccb610de3f6ce1a239ea1e68568ef1a53d5df" }, - "nvim-lspconfig": { "branch": "master", "commit": "f451052bd6804e9e5ccd0ac874d7df8d3d4c55b9" }, + "nvim-lint": { "branch": "master", "commit": "32f98300881f38f4e022391f240188fec42f74db" }, + "nvim-lspconfig": { "branch": "master", "commit": "9099871a7c7e1c16122e00d70208a2cd02078d80" }, "nvim-surround": { "branch": "main", "commit": "703ec63aa798e5e07d309b35e42def34bebe0174" }, "nvim-toggleterm.lua": { "branch": "main", "commit": "cbd041d91b90cd3c02df03fe6133208888f8e008" }, - "nvim-tree.lua": { "branch": "master", "commit": "141c0f97c35f274031294267808ada59bb5fb08e" }, + "nvim-tree.lua": { "branch": "master", "commit": "50f30bcd8c62ac4a83d133d738f268279f2c2ce2" }, "nvim-treesitter": { "branch": "master", "commit": "63260da18bf273c76b8e2ea0db84eb901cab49ce" }, - "nvim-treesitter-context": { "branch": "master", "commit": "cfa8ee19ac9bae9b7fb2958eabe2b45b70c56ccb" }, + "nvim-treesitter-context": { "branch": "master", "commit": "652ec514d6ba8bc4a3c2de76c855fe668e2c7196" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "4c344ffc8d54d7e1ba2cefaaa2c10ea93aa1cc2d" }, "nvim-treesitter-textsubjects": { "branch": "master", "commit": "011c09784f1a95cf469a48c1993b664190440391" }, "nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1277b4a1f451b0f18c0790e1a7f12e1e5fdebfee" }, "nvim-ts-rainbow2": { "branch": "master", "commit": "b3120cd5ae9ca524af9cb602f41e12e301fa985f" }, - "nvim-web-devicons": { "branch": "master", "commit": "8b2e5ef9eb8a717221bd96cb8422686d65a09ed5" }, - "otter.nvim": { "branch": "main", "commit": "9a3db06bf3abadafb93279648317984ca789b888" }, + "nvim-web-devicons": { "branch": "master", "commit": "43aa2ddf476012a2155f5f969ee55ab17174da7a" }, + "otter.nvim": { "branch": "main", "commit": "e4cfb3444e65750023d9db1947d1d12463d06eb5" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "quarto-nvim": { "branch": "main", "commit": "0a35b3890e9d723b730506d7d8b3ba3d0d6aae2e" }, diff --git a/nvim/.config/nvim/lua/core/init.lua b/nvim/.config/nvim/lua/core/init.lua index 035fe11..f13b09e 100644 --- a/nvim/.config/nvim/lua/core/init.lua +++ b/nvim/.config/nvim/lua/core/init.lua @@ -3,7 +3,6 @@ for _, source in ipairs({ "core.lazy", "core.autocmds", "core.mappings", - "core.look", }) do local status_ok, fault = pcall(require, source) if not status_ok then diff --git a/nvim/.config/nvim/lua/core/lazy.lua b/nvim/.config/nvim/lua/core/lazy.lua index 840f4e2..6c2c0d3 100644 --- a/nvim/.config/nvim/lua/core/lazy.lua +++ b/nvim/.config/nvim/lua/core/lazy.lua @@ -34,5 +34,9 @@ vim.opt.rtp:prepend(lazypath) require("lazy").setup({ spec = { { import = "plugins" } }, defaults = { lazy = true, version = "*" }, - performance = { rtp = { disabled_plugins = { "netrw", "netrwPlugin" } } }, + performance = { + rtp = { disabled_plugins = { "netrw", "netrwPlugin" } }, + cache = { enable = false }, + }, }) +vim.keymap.set("n", "vl", ":Lazy", { desc = "Lazy" }) diff --git a/nvim/.config/nvim/lua/core/look.lua b/nvim/.config/nvim/lua/core/look.lua deleted file mode 100644 index 8622ada..0000000 --- a/nvim/.config/nvim/lua/core/look.lua +++ /dev/null @@ -1,17 +0,0 @@ -local colorsfile = vim.fn.stdpath("state") .. "/colorscheme.lua" -local function source_colors() - if vim.fn.filereadable(colorsfile) == 1 then - vim.cmd("source " .. colorsfile) - end -end - --- set on startup -source_colors() - --- continuously watch colors file for changes -local fwatch = require("fwatch") -fwatch.watch(colorsfile, { - on_event = vim.schedule_wrap(function() - source_colors() - end), -}) diff --git a/nvim/.config/nvim/lua/core/mappings.lua b/nvim/.config/nvim/lua/core/mappings.lua index 3b3d39b..d6e2442 100644 --- a/nvim/.config/nvim/lua/core/mappings.lua +++ b/nvim/.config/nvim/lua/core/mappings.lua @@ -1,7 +1,14 @@ local map = vim.keymap.set -local prefix = require("which-key").register local is_available = require("util").is_available +if is_available("which-key") then + local prefix = require("which-key").register + prefix({ ["v"] = { name = "+vim" } }) + prefix({ ["s"] = { name = "+show" } }) + prefix({ ["s"] = { name = "+set" } }) + prefix({ ["Z"] = { name = "+spelling" } }) +end + -- The general ideas behind these mappings: -- -- * Leader prefix is the generally preferred way to map new things, however @@ -112,66 +119,6 @@ map("n", "T", ":tabedit | Vifm", { desc = "open tab" }) -- select the whole buffer with -a map("n", "a", "ggVG", { desc = "select all" }) --- PLUGIN: Navigator.nvim -map("n", "h", 'lua require("Navigator").left()', { silent = true }) -map("n", "k", 'lua require("Navigator").up()', { silent = true }) -map("n", "l", 'lua require("Navigator").right()', { silent = true }) -map("n", "j", 'lua require("Navigator").down()', { silent = true }) -map("n", "p", 'lua require("Navigator").previous()', { silent = true }) - --- PLUGIN: Vifm.vim --- open/close file tree with leader-e -map("n", "e", ":Vifm", { desc = "browse files" }) --- open current file tree with current file directory -map("n", "E", ":Vifm getcwd()", { desc = "browse project" }) - --- set 'v'im-related options -prefix({ ["v"] = { name = "+vim" } }) -map("n", "vc", ":Vifm " .. vim.fn.stdpath("config") .. "/lua", { desc = "open config" }) -map("n", "vh", ":lua require 'telescope.builtin'.help_tags()", { desc = "help tags" }) -map("n", "vH", ":lua require 'telescope.builtin'.man_pages()", { desc = "man pages" }) -map( - "n", - "vC", - ":lua require 'telescope.builtin'.colorscheme(require 'telescope.themes'.get_ivy())", - { desc = "colorschemes" } -) -map("n", "vl", ":Lazy", { desc = "Lazy" }) - --- PLUGIN: Telescope GLOBAL FUZZY FINDING --- buffers and files in current workdir -prefix({ ["f"] = { name = "+find" } }) -map( - "n", - "fb", - ":lua require 'telescope.builtin'.buffers(require 'telescope.themes'.get_ivy())", - { desc = "list buffers" } -) --- most recently used / MRU, bound to S since it is essentially a larger --- go-back intention than just buffers -map( - "n", - "fo", - ":lua require 'telescope.builtin'.oldfiles(require 'telescope.themes'.get_ivy())", - { desc = "list old files" } -) --- fuzzy find files in cwd -map("n", "ff", ":lua require 'telescope.builtin'.find_files()", { desc = "find files" }) --- fuzzy find hidden files in cwd -map("n", "fh", ":lua require 'telescope.builtin'.find_files({hidden=true})", { desc = "find hidden files" }) --- general full-text search in cwd with rg -map("n", "fw", ":lua require 'telescope.builtin'.live_grep()", { desc = "grep search" }) - --- git status -map("n", "fg", ":lua require 'telescope.builtin'.git_status()", { desc = "git status" }) --- git buffercommits -map("n", "fc", ":lua require 'telescope.builtin'.git_bcommits()", { desc = "git buffer commits" }) --- git commitlog -map("n", "fl", ":lua require 'telescope.builtin'.git_commits()", { desc = "git commit log" }) - --- spell suggestions -map("n", "z=", ":lua require 'telescope.builtin'.spell_suggest(require 'telescope.themes'.get_ivy())") - -- Format current Paragraph (esp useful in prose writing) map("n", "q", "gqap", { silent = true, desc = "Format current paragraph" }) map("x", "q", "gq", { silent = true, desc = "Format {motion}" }) @@ -180,7 +127,6 @@ map("n", "Q", "vapJgqap", { silent = true, desc = "Unformat then fo -- SPELL CHECKING -- Move to the prev/next spelling error with [S ]S -- Move to the prev/next spelling error or suggestion with [s ]s -prefix({ ["Z"] = { name = "+Spelling" } }) map("n", "ZZ", ":setlocal spell! spelllang=en_us,en_gb,de_de", { desc = "Toggle spellcheck" }) map("n", "ZE", ":setlocal spell! spelllang=en_us", { desc = "Toggle EN_US spellcheck" }) map("n", "ZB", ":setlocal spell! spelllang=en_gb", { desc = "Toggle EN_GB spellcheck" }) @@ -188,81 +134,3 @@ map("n", "ZD", ":setlocal spell! spelllang=de_de", { desc = "To -- undo last spelling mistake from insert and normal mode map("i", "", "u[s1z=`]au") map("n", "z", "ms[s1z=`s", { desc = "Fix last spell error" }) - -prefix({ ["s"] = { name = "+show" } }) --- Set vim to distraction free prose mode -map("n", "sz", ":ZenMode", { silent = true }) --- PLUGIN: mini.nvim -map("n", "sm", ":lua MiniMap.toggle()", { silent = true, desc = "minimap" }) -map("n", "ss", ":lua MiniStarter.open()", { desc = "startpage" }) - --- PLUGIN: symbols-outline.nvim -map("n", "so", "AerialNavToggle", { silent = true, desc = "symbol navigator" }) -map("n", "sO", "AerialToggle", { silent = true, desc = "symbol outline" }) - --- PLUGIN: nvim-tree -map("n", "se", "NvimTreeToggle", { silent = true, desc = "filetree" }) - --- PLUGIN: nvim-tree -map("n", "sd", "Trouble workspace_diagnostics", { silent = true, desc = "diagnostics workspace" }) -map("n", "sD", "Trouble document_diagnostics", { silent = true, desc = "diagnostics document" }) - --- PLUGIN: easy-align --- Start interactive EasyAlign in visual mode (e.g. vipga) -map("x", "ga", "(EasyAlign)") --- Start interactive EasyAlign for a motion/text object (e.g. gaip) -map("n", "ga", "(EasyAlign)") - --- trim trailing whitespaces with mini.nvim trailspace -map("n", "w", function() - require("mini.trailspace").trim() -end, { noremap = true }) - --- PLUGIN: dial-increment -map("n", "", "(dial-increment)") -map("n", "", "(dial-decrement)") -map("v", "", "(dial-increment)") -map("v", "", "(dial-increment)") -map("v", "g", "g(dial-increment)") -map("v", "g", "g(dial-increment)") - --- PLUGIN: zettelkasten.nvim -map("n", "", [[:silent lua require 'zettelkasten'.link_follow()]]) -map("v", "", [[:lua require 'zettelkasten'.link_follow(true)]]) -prefix({ ["n"] = { name = "+notes" } }) -map("n", "ni", [[:lua require 'zettelkasten'.index_open() ]], { desc = "index page" }) --- PLUGIN: zk -map("n", "nn", "ZkNotes { sort = { 'modified' } }", { desc = "note list" }) -map( - "n", - "nf", - "ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }", - { desc = "note search" } -) -map("n", "nt", "ZkTags", { desc = "note tags" }) -map("n", "nc", "ZkCd", { desc = "notes directory" }) -prefix({ ["n"] = { name = "+note" } }) -map("n", "nl", "ZkLinks", { desc = "note links" }) -map("n", "nb", "ZkLinks", { desc = "note backlinks" }) -map("n", "nn", "ZkNew { title = vim.fn.input('Title: ') }", { desc = "new note" }) -prefix({ ["n"] = { name = "+note", mode = "v" } }) -map("v", "nn", ":ZkNewFromTitleSelection", { desc = "title from selection" }) -map("v", "nN", ":ZkNewFromContentSelection", { desc = "content from selection" }) -map("v", "nf", ":ZkMatch", { desc = "find note from selection" }) - --- PLUGIN: toggleterm.nvim --- create a lazygit or python window, set up in toggleterm settings --- TODO create ability to go into python environment when in poetry venv and/or euporie/jupyter notebook -map("n", "sg", ":Lazygit") -map("n", "sG", ":Lazygit!") -map("n", "sp", ":Pythonterm") -map("n", "sP", ":Pythonterm!") - -prefix({ ["s"] = { name = "+set" } }) --- PLUGIN: wrapping.nvim -map( - "n", - "sw", - [[:lua require('wrapping').toggle_wrap_mode() ]], - { silent = true, desc = "toggle wrap mode" } -) diff --git a/nvim/.config/nvim/lua/core/settings.lua b/nvim/.config/nvim/lua/core/settings.lua index 3686e89..7ad8774 100644 --- a/nvim/.config/nvim/lua/core/settings.lua +++ b/nvim/.config/nvim/lua/core/settings.lua @@ -85,6 +85,7 @@ local globals = { tex_flavor = "latex", disable_autoformat = true, -- only format files manually + disable_autolint = false, -- but lint automatically } for o, v in pairs(globals) do diff --git a/nvim/.config/nvim/lua/plugins/core.lua b/nvim/.config/nvim/lua/plugins/core.lua index 7162fd1..f317b39 100644 --- a/nvim/.config/nvim/lua/plugins/core.lua +++ b/nvim/.config/nvim/lua/plugins/core.lua @@ -5,6 +5,43 @@ return { branch = "master", config = true, event = "VeryLazy", + keys = { + { + "h", + function() + require("Navigator").left() + end, + { silent = true }, + }, + { + "k", + function() + require("Navigator").up() + end, + { silent = true }, + }, + { + "l", + function() + require("Navigator").right() + end, + { silent = true }, + }, + { + "j", + function() + require("Navigator").down() + end, + { silent = true }, + }, + { + "p", + function() + require("Navigator").previous() + end, + { silent = true }, + }, + }, }, -- jump between letters with improved fFtT quicksearch, mimics sneak { "ggandor/lightspeed.nvim", event = "BufEnter" }, @@ -24,6 +61,16 @@ return { require("plugins.config.mini") end, event = "VimEnter", -- need to load pretty soon for Starter screen + keys = { + { "sm", ":lua MiniMap.toggle()", { silent = true, desc = "minimap" } }, + { "ss", ":lua MiniStarter.open()", { desc = "startpage" } }, + { + "w", + function() + require("mini.trailspace").trim() + end, + }, + }, }, -- simpler, programmable and multiple terminal toggling for nvim { @@ -32,22 +79,41 @@ return { require("plugins.config.toggleterm") end, cmd = { "ToggleTerm", "TermExec", "Lazygit", "Pythonterm" }, + keys = { + { "sg", ":Lazygit" }, + { "sG", ":Lazygit!" }, + { "sp", ":Pythonterm" }, + { "sP", ":Pythonterm!" }, + }, }, -- colorschemes { "RRethy/nvim-base16", lazy = false, + commit = "96e3089", priority = 1000, dependencies = { "rktjmp/fwatch.nvim" }, + config = function() + local colorsfile = vim.fn.stdpath("state") .. "/colorscheme.lua" + local function source_colors() + if vim.fn.filereadable(colorsfile) == 1 then + vim.cmd("source " .. colorsfile) + end + end + -- set on startup + source_colors() + + -- continuously watch colors file for changes + local fwatch = require("fwatch") + fwatch.watch(colorsfile, { + on_event = vim.schedule_wrap(function() + source_colors() + end), + }) + end, }, -- try to avoid putting files in util buffers, e.g. filetree, aerial, undotree, .. - { - "stevearc/stickybuf.nvim", - config = true, - }, + { "stevearc/stickybuf.nvim", config = true }, -- make it a little less painful to open really big (>2mb) files by disabling features - { - "LunarVim/bigfile.nvim", - lazy = false, - }, + { "LunarVim/bigfile.nvim", lazy = false }, } diff --git a/nvim/.config/nvim/lua/plugins/data_analysis.lua b/nvim/.config/nvim/lua/plugins/data_analysis.lua index 5a75268..8845b52 100644 --- a/nvim/.config/nvim/lua/plugins/data_analysis.lua +++ b/nvim/.config/nvim/lua/plugins/data_analysis.lua @@ -13,7 +13,7 @@ return { lspFeatures = { enabled = true, languages = { "r", "python", "julia", "bash" }, - diagnostics = { enabled = true, triggers = { "BufWritePost" } }, + diagnostics = { enabled = false, triggers = { "BufWritePost" } }, completion = { enabled = true }, }, codeRunner = { diff --git a/nvim/.config/nvim/lua/plugins/editing.lua b/nvim/.config/nvim/lua/plugins/editing.lua index 4730382..70d59dc 100644 --- a/nvim/.config/nvim/lua/plugins/editing.lua +++ b/nvim/.config/nvim/lua/plugins/editing.lua @@ -7,7 +7,11 @@ return { -- Align tables and other alignable things { "junegunn/vim-easy-align", - event = "VeryLazy", + event = "InsertEnter", + keys = { + { "ga", "(EasyAlign)", mode = "n" }, + { "ga", "(EasyAlign)", mode = "x" }, + }, }, -- surround things with other things using ys/cs/ds { "kylechui/nvim-surround", version = "*", config = true, event = "VeryLazy" }, @@ -48,5 +52,13 @@ return { }) end, event = "InsertEnter", + keys = { + { "", "(dial-increment)", mode = "n" }, + { "", "(dial-decrement)", mode = "n" }, + { "", "(dial-increment)", mode = "v" }, + { "", "(dial-increment)", mode = "v" }, + { "g", "g(dial-increment)", mode = "v" }, + { "g", "g(dial-increment)", mode = "v" }, + }, }, } diff --git a/nvim/.config/nvim/lua/plugins/filebrowsers.lua b/nvim/.config/nvim/lua/plugins/filebrowsers.lua index 476f17d..411f81b 100644 --- a/nvim/.config/nvim/lua/plugins/filebrowsers.lua +++ b/nvim/.config/nvim/lua/plugins/filebrowsers.lua @@ -8,11 +8,20 @@ return { vim.g.vifm_exec_args = '-c "set vifminfo=" -c "set statusline=" -c "only"' end, cmd = "Vifm", + keys = { + { "e", "Vifm", desc = "browse files" }, + { "E", ":Vifm getcwd()", desc = "browse project" }, + { "vc", ":Vifm " .. vim.fn.stdpath("config") .. "/lua", desc = "open config" }, + }, + event = { "BufEnter" }, }, -- integrate file manager { "nvim-tree/nvim-tree.lua", -- integrate file tree config = true, dependencies = { "nvim-tree/nvim-web-devicons", config = true }, cmd = "NvimTreeToggle", + keys = { + { "se", "NvimTreeToggle", desc = "filetree", silent = true }, + }, }, } diff --git a/nvim/.config/nvim/lua/plugins/ide.lua b/nvim/.config/nvim/lua/plugins/ide.lua index 7c3730c..1f34547 100644 --- a/nvim/.config/nvim/lua/plugins/ide.lua +++ b/nvim/.config/nvim/lua/plugins/ide.lua @@ -25,6 +25,10 @@ return { opts = { backends = { "treesitter", "lsp", "markdown", "man" }, }, + keys = { + { "so", "AerialNavToggle", silent = true, desc = "symbol navigator" }, + { "sO", "AerialToggle", silent = true, desc = "symbol outline" }, + }, }, -- lsp setup @@ -55,9 +59,7 @@ return { "williamboman/mason-lspconfig.nvim", cmd = { "LspInstall", "LspUninstall" }, }, - { - "WhoIsSethDaniel/mason-tool-installer.nvim", - }, + { "WhoIsSethDaniel/mason-tool-installer.nvim" }, }, event = { "BufRead", "BufNewFile", "InsertEnter" }, after = { "nvim-cmp" }, @@ -76,40 +78,24 @@ return { "mfussenegger/nvim-lint", config = function() local linters = { - astro = {}, - bash = {}, - javascript = {}, - javascriptreact = {}, - markdown = {}, - quarto = {}, - sh = {}, - svelte = {}, - text = {}, - typescript = {}, - typescriptreact = {}, + astro = { "eslint_d" }, + bash = { "shellcheck" }, + javascript = { "eslint_d" }, + javascriptreact = { "eslint_d" }, + markdown = { "markdownlint", "vale" }, + quarto = { "markdownlint", "vale" }, + sh = { "shellcheck" }, + svelte = { "eslint_d" }, + text = { "vale" }, + typescript = { "eslint_d" }, + typescriptreact = { "eslint_d" }, } - local per_cmd = function(cmd, ft_table) - if vim.fn.executable(cmd) == 1 then - for _, v in pairs(ft_table) do - table.insert(v, cmd) - end - end - end - per_cmd("markdownlint", { linters.markdown, linters.quarto }) - per_cmd("vale", { linters.markdown, linters.text, linters.quarto }) - per_cmd("shellcheck", { linters.sh, linters.bash }) - per_cmd("eslint_d", { - linters.astro, - linters.javascript, - linters.javascriptreact, - linters.svelte, - linters.typescript, - linters.typescriptreact, - }) require("lint").linters_by_ft = linters vim.api.nvim_create_autocmd({ "BufWritePost", "InsertLeave" }, { callback = function() - require("lint").try_lint() + if not vim.g.disable_autoformat then + require("lint").try_lint() + end end, }) end, @@ -247,6 +233,10 @@ return { "TroubleToggle", "TroubleClose", }, + keys = { + { "sd", "Trouble workspace_diagnostics", silent = true, desc = "diagnostics workspace" }, + { "sD", "Trouble document_diagnostics", silent = true, desc = "diagnostics document" }, + }, }, -- testing setup @@ -268,9 +258,8 @@ return { }), }, }) - local status, wk = pcall(require, "which-key") - if status then - wk.register({ ["t"] = { name = "+test" } }) + if require("util").is_available("which-key") then + require("which-key").register({ ["t"] = { name = "+test" } }) end end, ft = { "python" }, diff --git a/nvim/.config/nvim/lua/plugins/prose.lua b/nvim/.config/nvim/lua/plugins/prose.lua index 5dbb327..4f3e4fb 100644 --- a/nvim/.config/nvim/lua/plugins/prose.lua +++ b/nvim/.config/nvim/lua/plugins/prose.lua @@ -3,17 +3,42 @@ local writing_ft = { "quarto", "pandoc", "markdown", "text", "tex" } local prose_plugs = { -- UI improvements -- provide distraction free writing - { "folke/zen-mode.nvim", config = true, cmd = { "ZenMode" }, dependencies = { "folke/twilight.nvim" } }, + { + "folke/zen-mode.nvim", + config = true, + cmd = { "ZenMode" }, + dependencies = { "folke/twilight.nvim" }, + keys = { { "sz", ":ZenMode", { silent = true } } }, + }, { "andrewferrier/wrapping.nvim", - config = function() - require("wrapping").setup({ - create_keymappings = false, - notify_on_switch = false, - softener = { markdown = true, text = true, asciidoc = true }, - }) - end, - lazy = false, + opts = { + create_keymappings = false, + notify_on_switch = false, + softener = { quarto = true, markdown = true, text = true, asciidoc = true }, + auto_set_mode_filetype_allowlist = { + "asciidoc", + "gitcommit", + "latex", + "mail", + "markdown", + "rst", + "tex", + "text", + "quarto", + }, + }, + event = { "BufReadPre", "BufNewFile" }, + keys = { + { + "sw", + function() + require("wrapping").toggle_wrap_mode() + end, + silent = true, + desc = "toggle wrap mode", + }, + }, }, -- displays prettier headlines mimicking the ones in emacs orgmode { @@ -35,6 +60,12 @@ local prose_plugs = { { "mickael-menu/zk-nvim", config = function() + if require("util").is_available("which-key") then + local prefix = require("which-key").register + prefix({ ["n"] = { name = "+notes" } }) + prefix({ ["n"] = { name = "+note" } }) + prefix({ ["n"] = { name = "+note", mode = "v" } }) + end require("zk").setup({ picker = "telescope" }) end, ft = writing_ft, @@ -52,9 +83,51 @@ local prose_plugs = { "ZkNotes", "ZkTags", }, + keys = { + { "nn", "ZkNotes { sort = { 'modified' } }", desc = "note list" }, + { + "nf", + "ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }", + desc = "note search", + }, + { "nt", "ZkTags", desc = "note tags" }, + { "nc", "ZkCd", desc = "notes directory" }, + { "nl", "ZkLinks", desc = "note links" }, + { "nb", "ZkLinks", desc = "note backlinks" }, + { "nn", "ZkNew { title = vim.fn.input('Title: ') }", desc = "new note" }, + { "nn", ":ZkNewFromTitleSelection", desc = "title from selection", mode = "v" }, + { "nN", ":ZkNewFromContentSelection", desc = "content from selection", mode = "v" }, + { "nf", ":ZkMatch", desc = "find note from selection", mode = "v" }, + }, }, -- simple static markdown linking and link following using zettel IDs - { "marty-oehme/zettelkasten.nvim", ft = writing_ft, event = "VeryLazy" }, + { + "marty-oehme/zettelkasten.nvim", + ft = writing_ft, + keys = { + { + "", + function() + require("zettelkasten").link_follow() + end, + silent = true, + }, + { + "", + function() + require("zettelkasten").link_follow(true) + end, + mode = "v", + }, + { + "ni", + function() + require("zettelkasten").index_open() + end, + desc = "index page", + }, + }, + }, -- syntax highlighting for markdown criticmarkup (comments, additions, ...) { "vim-pandoc/vim-criticmarkup", ft = writing_ft }, diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua index 408f89e..91e3e97 100644 --- a/nvim/.config/nvim/lua/plugins/telescope.lua +++ b/nvim/.config/nvim/lua/plugins/telescope.lua @@ -7,9 +7,11 @@ return { "nvim-lua/plenary.nvim", { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, }, - event = "VeryLazy", cmd = "Telescope", config = function() + if require("util").is_available("which-key") then + require("which-key").register({ ["f"] = { name = "+find" } }) + end -- Setup up telescope fuzzy finding settings -- -- Makes use of optionally installed external programs to work fully: @@ -44,26 +46,8 @@ return { borderchars = { { "─", "│", "─", "│", "┌", "┐", "┘", "└" }, prompt = { "─", "│", " ", "│", "┌", "┐", "│", "│" }, - results = { - "─", - "│", - "─", - "│", - "├", - "┤", - "┘", - "└", - }, - preview = { - "─", - "│", - "─", - "│", - "┌", - "┐", - "┘", - "└", - }, + results = { "─", "│", "─", "│", "├", "┤", "┘", "└" }, + preview = { "─", "│", "─", "│", "┌", "┐", "┘", "└" }, }, width = 0.8, previewer = false, @@ -73,5 +57,92 @@ return { }) require("telescope").load_extension("fzf") end, + keys = { + { + "vh", + function() + require("telescope.builtin").help_tags() + end, + desc = "help tags", + }, + { + "vH", + function() + require("telescope.builtin").man_pages() + end, + desc = "man pages", + }, + { + "vC", + function() + require("telescope.builtin").colorscheme(require("telescope.themes").get_ivy()) + end, + desc = "colorschemes" , + }, + + { + "fb", + function() + require("telescope.builtin").buffers(require("telescope.themes").get_ivy()) + end, + desc = "list buffers", + }, + { + "fo", + function() + require("telescope.builtin").oldfiles(require("telescope.themes").get_ivy()) + end, + desc = "list old files", + }, + { + "ff", + function() + require("telescope.builtin").find_files() + end, + desc = "find files", + }, + { + "fh", + function() + require("telescope.builtin").find_files({ hidden = true }) + end, + desc = "find hidden files", + }, + { + "fw", + function() + require("telescope.builtin").live_grep() + end, + desc = "grep search", + }, + { + "fg", + function() + require("telescope.builtin").git_status() + end, + desc = "git status", + }, + { + "fc", + function() + require("telescope.builtin").git_bcommits() + end, + desc = "git buffer commits", + }, + { + "fl", + function() + require("telescope.builtin").git_commits() + end, + desc = "git commit log", + }, + { + "z=", + function() + require("telescope.builtin").spell_suggest(require("telescope.themes").get_ivy()) + end, + desc = "spell suggest", + }, + }, }, } diff --git a/nvim/.config/nvim/lua/util/pyenv.lua b/nvim/.config/nvim/lua/util/pyenv.lua index b36e474..c3e89b6 100644 --- a/nvim/.config/nvim/lua/util/pyenv.lua +++ b/nvim/.config/nvim/lua/util/pyenv.lua @@ -1,27 +1,29 @@ -local util = require("lspconfig.util") -local path = util.path local T = {} local exepath = vim.fn.exepath +local function path_join(...) +return table.concat(vim.tbl_flatten { ... }, '/') +end + -- from https://github.com/ray-x/navigator.lua/issues/247#issue-1465308677 T.get_path = function(workspace) -- Use activated virtualenv. if vim.env.VIRTUAL_ENV then - return path.join(vim.env.VIRTUAL_ENV, "bin", "python") + return path_join(vim.env.VIRTUAL_ENV, "bin", "python") end -- Find and use virtualenv in workspace directory. for _, pattern in ipairs({ "*", ".*" }) do - local match = vim.fn.glob(path.join(workspace, pattern, "pyvenv.cfg")) + local match = vim.fn.glob(path_join(workspace, pattern, "pyvenv.cfg")) if match ~= "" then - local py = path.join("bin", "python") + local py = path_join("bin", "python") match = string.gsub(match, "pyvenv.cfg", py) return match end - match = vim.fn.glob(path.join(workspace, pattern, "poetry.lock")) + match = vim.fn.glob(path_join(workspace, pattern, "poetry.lock")) if match ~= "" then local venv_base_folder = vim.fn.trim(vim.fn.system("poetry env info -p")) - return path.join(venv_base_folder, "bin", "python") + return path_join(venv_base_folder, "bin", "python") end end diff --git a/nvim/.config/nvim/spell/en.utf-8.add b/nvim/.config/nvim/spell/en.utf-8.add index ef2712f..f19a7b4 100644 --- a/nvim/.config/nvim/spell/en.utf-8.add +++ b/nvim/.config/nvim/spell/en.utf-8.add @@ -206,3 +206,6 @@ ppt Programo Urbano redistributional +HIC +LMIC +hukou diff --git a/office/.config/sh/alias.d/taskwarrior.sh b/office/.config/sh/alias.d/taskwarrior.sh index 4f28098..9df34f4 100644 --- a/office/.config/sh/alias.d/taskwarrior.sh +++ b/office/.config/sh/alias.d/taskwarrior.sh @@ -16,9 +16,6 @@ t() { # works for now. from here: https://unix.stackexchange.com/a/72564/414758 if exist task && [ "$(ps -p $$ -o comm --no-headers)" = "zsh" ]; then compdef t=task; fi -# Make taskopen XDG conforming. If changing here, also change in taskrc alias. -alias taskopen='taskopen --config=${XDG_CONFIG_HOME:-~/.config}/task/taskopenrc' - alias ta="task add" alias tal="task log" alias tan="task annotate" diff --git a/office/.config/task/taskopenrc b/office/.config/task/taskopenrc index 9fea550..a446a24 100644 --- a/office/.config/task/taskopenrc +++ b/office/.config/task/taskopenrc @@ -7,7 +7,7 @@ path_ext = /usr/share/taskopen/scripts note_custom_ext.regex = "^Note\\.?(.*)?" note_custom_ext.command = "$EDITOR ${XDG_DATA_HOME:-$HOME/.local/share}/task/notes/$UUID.$LAST_MATCH" -notes.regex = "^Note" +notes.regex = "^Note$" notes.command = "$EDITOR ${XDG_DATA_HOME:-$HOME/.local/share}/task/notes/$UUID.md" links.regex = "^https?://" diff --git a/office/.config/task/taskrc b/office/.config/task/taskrc index 1ce9ced..b9718dc 100644 --- a/office/.config/task/taskrc +++ b/office/.config/task/taskrc @@ -23,7 +23,7 @@ weekstart=monday # Make daily burndown default alias alias.burndown=burndown.daily -alias.open=exec taskopen "--config=${XDG_CONFIG_HOME:-$HOME/.config}/task/taskopenrc" +alias.open=exec taskopen # Sort the columns a little differently active.indicator=> diff --git a/terminal/.bashrc b/terminal/.bashrc index 0d9ecd5..eac6a0c 100644 --- a/terminal/.bashrc +++ b/terminal/.bashrc @@ -12,18 +12,25 @@ CONFDIR="${XDG_CONFIG_HOME:-$HOME/.config}" [ -f "$CONFDIR/sh/alias" ] && source "$CONFDIR/sh/alias" # load additional aliases if [ -d "$CONFDIR/sh/alias.d" ]; then - for _alias in "$CONFDIR/sh/alias.d"/*.sh; do - . "$_alias" - done - unset _alias + for _alias in "$CONFDIR/sh/alias.d"/*.sh; do + . "$_alias" + done + unset _alias fi if [ -d "$CONFDIR/bash/alias.d" ]; then - for _alias in "$CONFDIR/bash/alias.d"/*.sh; do - . "$_alias" - done - unset _alias + for _alias in "$CONFDIR/bash/alias.d"/*.sh; do + . "$_alias" + done + unset _alias fi -eval "$(zoxide init bash)" alias ls='ls --color=auto' -PS1='[\u@\h \W]\$ ' + +eval "$(starship init bash)" +eval "$(zoxide init bash)" + +set -o vi +stty time 0 +bind 'set keyseq-timeout 1' + +eval "$(atuin init bash)" diff --git a/terminal/.config/nushell/config.nu b/terminal/.config/nushell/config.nu new file mode 100644 index 0000000..4ea3a50 --- /dev/null +++ b/terminal/.config/nushell/config.nu @@ -0,0 +1,769 @@ +# Nushell Config File +# +# version = "0.87.1" + +# For more information on defining custom themes, see +# https://www.nushell.sh/book/coloring_and_theming.html +# And here is the theme collection +# https://github.com/nushell/nu_scripts/tree/main/themes +let dark_theme = { + # color for nushell primitives + separator: white + leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off + header: green_bold + empty: blue + # Closures can be used to choose colors for specific values. + # The value (in this case, a bool) is piped into the closure. + # eg) {|| if $in { 'light_cyan' } else { 'light_gray' } } + bool: light_cyan + int: white + filesize: cyan + duration: white + date: purple + range: white + float: white + string: white + nothing: white + binary: white + cell-path: white + row_index: green_bold + record: white + list: white + block: white + hints: dark_gray + search_result: {bg: red fg: white} + shape_and: purple_bold + shape_binary: purple_bold + shape_block: blue_bold + shape_bool: light_cyan + shape_closure: green_bold + shape_custom: green + shape_datetime: cyan_bold + shape_directory: cyan + shape_external: cyan + shape_externalarg: green_bold + shape_filepath: cyan + shape_flag: blue_bold + shape_float: purple_bold + # shapes are used to change the cli syntax highlighting + shape_garbage: { fg: white bg: red attr: b} + shape_globpattern: cyan_bold + shape_int: purple_bold + shape_internalcall: cyan_bold + shape_keyword: cyan_bold + shape_list: cyan_bold + shape_literal: blue + shape_match_pattern: green + shape_matching_brackets: { attr: u } + shape_nothing: light_cyan + shape_operator: yellow + shape_or: purple_bold + shape_pipe: purple_bold + shape_range: yellow_bold + shape_record: cyan_bold + shape_redirection: purple_bold + shape_signature: green_bold + shape_string: green + shape_string_interpolation: cyan_bold + shape_table: blue_bold + shape_variable: purple + shape_vardecl: purple +} + +let light_theme = { + # color for nushell primitives + separator: dark_gray + leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off + header: green_bold + empty: blue + # Closures can be used to choose colors for specific values. + # The value (in this case, a bool) is piped into the closure. + # eg) {|| if $in { 'dark_cyan' } else { 'dark_gray' } } + bool: dark_cyan + int: dark_gray + filesize: cyan_bold + duration: dark_gray + date: purple + range: dark_gray + float: dark_gray + string: dark_gray + nothing: dark_gray + binary: dark_gray + cell-path: dark_gray + row_index: green_bold + record: dark_gray + list: dark_gray + block: dark_gray + hints: dark_gray + search_result: {fg: white bg: red} + shape_and: purple_bold + shape_binary: purple_bold + shape_block: blue_bold + shape_bool: light_cyan + shape_closure: green_bold + shape_custom: green + shape_datetime: cyan_bold + shape_directory: cyan + shape_external: cyan + shape_externalarg: green_bold + shape_filepath: cyan + shape_flag: blue_bold + shape_float: purple_bold + # shapes are used to change the cli syntax highlighting + shape_garbage: { fg: white bg: red attr: b} + shape_globpattern: cyan_bold + shape_int: purple_bold + shape_internalcall: cyan_bold + shape_keyword: cyan_bold + shape_list: cyan_bold + shape_literal: blue + shape_match_pattern: green + shape_matching_brackets: { attr: u } + shape_nothing: light_cyan + shape_operator: yellow + shape_or: purple_bold + shape_pipe: purple_bold + shape_range: yellow_bold + shape_record: cyan_bold + shape_redirection: purple_bold + shape_signature: green_bold + shape_string: green + shape_string_interpolation: cyan_bold + shape_table: blue_bold + shape_variable: purple + shape_vardecl: purple +} + +# External completer example +# let carapace_completer = {|spans| +# carapace $spans.0 nushell $spans | from json +# } + +# The default config record. This is where much of your global configuration is setup. +$env.config = { + show_banner: false # true or false to enable or disable the welcome banner at startup + + ls: { + use_ls_colors: true # use the LS_COLORS environment variable to colorize output + clickable_links: true # enable or disable clickable links. Your terminal has to support links. + } + + rm: { + always_trash: false # always act as if -t was given. Can be overridden with -p + } + + table: { + mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other + index_mode: always # "always" show indexes, "never" show indexes, "auto" = show indexes when a table has "index" column + show_empty: true # show 'empty list' and 'empty record' placeholders for command output + padding: { left: 1, right: 1 } # a left right padding of each column in a table + trim: { + methodology: wrapping # wrapping or truncating + wrapping_try_keep_words: true # A strategy used by the 'wrapping' methodology + truncating_suffix: "..." # A suffix used by the 'truncating' methodology + } + header_on_separator: false # show header text on separator/border line + # abbreviated_row_count: 10 # limit data rows from top and bottom after reaching a set point + } + + error_style: "fancy" # "fancy" or "plain" for screen reader-friendly error messages + + # datetime_format determines what a datetime rendered in the shell would look like. + # Behavior without this configuration point will be to "humanize" the datetime display, + # showing something like "a day ago." + datetime_format: { + # normal: '%a, %d %b %Y %H:%M:%S %z' # shows up in displays of variables or other datetime's outside of tables + # table: '%m/%d/%y %I:%M:%S%p' # generally shows up in tabular outputs such as ls. commenting this out will change it to the default human readable datetime format + } + + explore: { + status_bar_background: {fg: "#1D1F21", bg: "#C4C9C6"}, + command_bar_text: {fg: "#C4C9C6"}, + highlight: {fg: "black", bg: "yellow"}, + status: { + error: {fg: "white", bg: "red"}, + warn: {} + info: {} + }, + table: { + split_line: {fg: "#404040"}, + selected_cell: {bg: light_blue}, + selected_row: {}, + selected_column: {}, + }, + } + + history: { + max_size: 100_000 # Session has to be reloaded for this to take effect + sync_on_enter: true # Enable to share history between multiple sessions, else you have to close the session to write history to file + file_format: "plaintext" # "sqlite" or "plaintext" + isolation: false # only available with sqlite file_format. true enables history isolation, false disables it. true will allow the history to be isolated to the current session using up/down arrows. false will allow the history to be shared across all sessions. + } + + completions: { + case_sensitive: false # set to true to enable case-sensitive completions + quick: true # set this to false to prevent auto-selecting completions when only one remains + partial: true # set this to false to prevent partial filling of the prompt + algorithm: "fuzzy" # prefix or fuzzy + external: { + enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up may be very slow + max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options + completer: null # check 'carapace_completer' above as an example + } + } + + filesize: { + metric: true # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard) + format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, auto + } + + cursor_shape: { + emacs: line # block, underscore, line, blink_block, blink_underscore, blink_line, inherit to skip setting cursor shape (line is the default) + vi_insert: line # block, underscore, line, blink_block, blink_underscore, blink_line, inherit to skip setting cursor shape (block is the default) + vi_normal: block # block, underscore, line, blink_block, blink_underscore, blink_line, inherit to skip setting cursor shape (underscore is the default) + } + + color_config: $dark_theme # if you want a more interesting theme, you can replace the empty record with `$dark_theme`, `$light_theme` or another custom record + use_grid_icons: true + footer_mode: "25" # always, never, number_of_rows, auto + float_precision: 2 # the precision for displaying floats in tables + buffer_editor: "" # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL + use_ansi_coloring: true + bracketed_paste: true # enable bracketed paste, currently useless on windows + edit_mode: vi # emacs, vi + shell_integration: true # enables terminal shell integration. Off by default, as some terminals have issues with this. + render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt. + use_kitty_protocol: false # enables keyboard enhancement protocol implemented by kitty console, only if your terminal support this + + hooks: { + pre_prompt: [{ null }] # run before the prompt is shown + pre_execution: [{ null }] # run before the repl input is run + env_change: { + PWD: [{|before, after| null }] # run if the PWD environment is different since the last repl input + } + display_output: "if (term size).columns >= 100 { table -e } else { table }" # run to display the output of a pipeline + command_not_found: { null } # return an error message when a command is not found + } + + menus: [ + # Configuration for default nushell menus + # Note the lack of source parameter + { + name: completion_menu + only_buffer_difference: false + marker: "| " + type: { + layout: columnar + columns: 4 + col_width: 20 # Optional value. If missing all the screen width is used to calculate column width + col_padding: 2 + } + style: { + text: green + selected_text: green_reverse + description_text: yellow + } + } + { + name: history_menu + only_buffer_difference: true + marker: "? " + type: { + layout: list + page_size: 10 + } + style: { + text: green + selected_text: green_reverse + description_text: yellow + } + } + { + name: help_menu + only_buffer_difference: true + marker: "? " + type: { + layout: description + columns: 4 + col_width: 20 # Optional value. If missing all the screen width is used to calculate column width + col_padding: 2 + selection_rows: 4 + description_rows: 10 + } + style: { + text: green + selected_text: green_reverse + description_text: yellow + } + } + ] + + keybindings: [ + { + name: completion_menu + modifier: none + keycode: tab + mode: [emacs vi_normal vi_insert] + event: { + until: [ + { send: menu name: completion_menu } + { send: menunext } + { edit: complete } + ] + } + } + { + name: history_menu + modifier: control + keycode: char_r + mode: [emacs, vi_insert, vi_normal] + event: { send: menu name: history_menu } + } + { + name: help_menu + modifier: none + keycode: f1 + mode: [emacs, vi_insert, vi_normal] + event: { send: menu name: help_menu } + } + { + name: completion_previous_menu + modifier: shift + keycode: backtab + mode: [emacs, vi_normal, vi_insert] + event: { send: menuprevious } + } + { + name: next_page_menu + modifier: control + keycode: char_x + mode: emacs + event: { send: menupagenext } + } + { + name: undo_or_previous_page_menu + modifier: control + keycode: char_z + mode: emacs + event: { + until: [ + { send: menupageprevious } + { edit: undo } + ] + } + } + { + name: escape + modifier: none + keycode: escape + mode: [emacs, vi_normal, vi_insert] + event: { send: esc } # NOTE: does not appear to work + } + { + name: cancel_command + modifier: control + keycode: char_c + mode: [emacs, vi_normal, vi_insert] + event: { send: ctrlc } + } + { + name: quit_shell + modifier: control + keycode: char_d + mode: [emacs, vi_normal, vi_insert] + event: { send: ctrld } + } + { + name: clear_screen + modifier: control + keycode: char_l + mode: [emacs, vi_normal, vi_insert] + event: { send: clearscreen } + } + { + name: search_history + modifier: control + keycode: char_q + mode: [emacs, vi_normal, vi_insert] + event: { send: searchhistory } + } + { + name: open_command_editor + modifier: control + keycode: char_o + mode: [emacs, vi_normal, vi_insert] + event: { send: openeditor } + } + { + name: move_up + modifier: none + keycode: up + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: menuup} + {send: up} + ] + } + } + { + name: move_down + modifier: none + keycode: down + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: menudown} + {send: down} + ] + } + } + { + name: move_left + modifier: none + keycode: left + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: menuleft} + {send: left} + ] + } + } + { + name: move_right_or_take_history_hint + modifier: none + keycode: right + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: historyhintcomplete} + {send: menuright} + {send: right} + ] + } + } + { + name: move_one_word_left + modifier: control + keycode: left + mode: [emacs, vi_normal, vi_insert] + event: {edit: movewordleft} + } + { + name: move_one_word_right_or_take_history_hint + modifier: control + keycode: right + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: historyhintwordcomplete} + {edit: movewordright} + ] + } + } + { + name: move_to_line_start + modifier: none + keycode: home + mode: [emacs, vi_normal, vi_insert] + event: {edit: movetolinestart} + } + { + name: move_to_line_start + modifier: control + keycode: char_a + mode: [emacs, vi_normal, vi_insert] + event: {edit: movetolinestart} + } + { + name: move_to_line_end_or_take_history_hint + modifier: none + keycode: end + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: historyhintcomplete} + {edit: movetolineend} + ] + } + } + { + name: move_to_line_end_or_take_history_hint + modifier: control + keycode: char_e + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: historyhintcomplete} + {edit: movetolineend} + ] + } + } + { + name: move_to_line_start + modifier: control + keycode: home + mode: [emacs, vi_normal, vi_insert] + event: {edit: movetolinestart} + } + { + name: move_to_line_end + modifier: control + keycode: end + mode: [emacs, vi_normal, vi_insert] + event: {edit: movetolineend} + } + { + name: move_up + modifier: control + keycode: char_p + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: menuup} + {send: up} + ] + } + } + { + name: move_down + modifier: control + keycode: char_t + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: menudown} + {send: down} + ] + } + } + { + name: delete_one_character_backward + modifier: none + keycode: backspace + mode: [emacs, vi_insert] + event: {edit: backspace} + } + { + name: delete_one_word_backward + modifier: control + keycode: backspace + mode: [emacs, vi_insert] + event: {edit: backspaceword} + } + { + name: delete_one_character_forward + modifier: none + keycode: delete + mode: [emacs, vi_insert] + event: {edit: delete} + } + { + name: delete_one_character_forward + modifier: control + keycode: delete + mode: [emacs, vi_insert] + event: {edit: delete} + } + { + name: delete_one_character_forward + modifier: control + keycode: char_h + mode: [emacs, vi_insert] + event: {edit: backspace} + } + { + name: delete_one_word_backward + modifier: control + keycode: char_w + mode: [emacs, vi_insert] + event: {edit: backspaceword} + } + { + name: move_left + modifier: none + keycode: backspace + mode: vi_normal + event: {edit: moveleft} + } + { + name: newline_or_run_command + modifier: none + keycode: enter + mode: emacs + event: {send: enter} + } + { + name: move_left + modifier: control + keycode: char_b + mode: emacs + event: { + until: [ + {send: menuleft} + {send: left} + ] + } + } + { + name: move_right_or_take_history_hint + modifier: control + keycode: char_f + mode: emacs + event: { + until: [ + {send: historyhintcomplete} + {send: menuright} + {send: right} + ] + } + } + { + name: redo_change + modifier: control + keycode: char_g + mode: emacs + event: {edit: redo} + } + { + name: undo_change + modifier: control + keycode: char_z + mode: emacs + event: {edit: undo} + } + { + name: paste_before + modifier: control + keycode: char_y + mode: emacs + event: {edit: pastecutbufferbefore} + } + { + name: cut_word_left + modifier: control + keycode: char_w + mode: emacs + event: {edit: cutwordleft} + } + { + name: cut_line_to_end + modifier: control + keycode: char_k + mode: emacs + event: {edit: cuttoend} + } + { + name: cut_line_from_start + modifier: control + keycode: char_u + mode: emacs + event: {edit: cutfromstart} + } + { + name: swap_graphemes + modifier: control + keycode: char_t + mode: emacs + event: {edit: swapgraphemes} + } + { + name: move_one_word_left + modifier: alt + keycode: left + mode: emacs + event: {edit: movewordleft} + } + { + name: move_one_word_right_or_take_history_hint + modifier: alt + keycode: right + mode: emacs + event: { + until: [ + {send: historyhintwordcomplete} + {edit: movewordright} + ] + } + } + { + name: move_one_word_left + modifier: alt + keycode: char_b + mode: emacs + event: {edit: movewordleft} + } + { + name: move_one_word_right_or_take_history_hint + modifier: alt + keycode: char_f + mode: emacs + event: { + until: [ + {send: historyhintwordcomplete} + {edit: movewordright} + ] + } + } + { + name: delete_one_word_forward + modifier: alt + keycode: delete + mode: emacs + event: {edit: deleteword} + } + { + name: delete_one_word_backward + modifier: alt + keycode: backspace + mode: emacs + event: {edit: backspaceword} + } + { + name: delete_one_word_backward + modifier: alt + keycode: char_m + mode: emacs + event: {edit: backspaceword} + } + { + name: cut_word_to_right + modifier: alt + keycode: char_d + mode: emacs + event: {edit: cutwordright} + } + { + name: upper_case_word + modifier: alt + keycode: char_u + mode: emacs + event: {edit: uppercaseword} + } + { + name: lower_case_word + modifier: alt + keycode: char_l + mode: emacs + event: {edit: lowercaseword} + } + { + name: capitalize_char + modifier: alt + keycode: char_c + mode: emacs + event: {edit: capitalizechar} + } + ] +} + +# The prompt indicators are environmental variables that represent +# the state of the prompt +$env.PROMPT_INDICATOR = ": " +$env.PROMPT_INDICATOR_VI_INSERT = "⟩ " +$env.PROMPT_INDICATOR_VI_NORMAL = "⟨ " +$env.PROMPT_MULTILINE_INDICATOR = "::: " + +use ~/.cache/starship/init.nu +source ~/.local/share/atuin/init.nu diff --git a/terminal/.config/nushell/env.nu b/terminal/.config/nushell/env.nu new file mode 100644 index 0000000..1907ea0 --- /dev/null +++ b/terminal/.config/nushell/env.nu @@ -0,0 +1,103 @@ +# Nushell Environment Config File +# +# version = "0.87.1" + +# def create_left_prompt [] { +# let home = $nu.home-path +# +# # Perform tilde substitution on dir +# # To determine if the prefix of the path matches the home dir, we split the current path into +# # segments, and compare those with the segments of the home dir. In cases where the current dir +# # is a parent of the home dir (e.g. `/home`, homedir is `/home/user`), this comparison will +# # also evaluate to true. Inside the condition, we attempt to str replace `$home` with `~`. +# # Inside the condition, either: +# # 1. The home prefix will be replaced +# # 2. The current dir is a parent of the home dir, so it will be uneffected by the str replace +# let dir = ( +# if ($env.PWD | path split | zip ($home | path split) | all { $in.0 == $in.1 }) { +# ($env.PWD | str replace $home "~") +# } else { +# $env.PWD +# } +# ) +# +# let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold }) +# let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold }) +# let path_segment = $"($path_color)($dir)" +# +# $path_segment | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)" +# } +# +# def create_right_prompt [] { +# # create a right prompt in magenta with green separators and am/pm underlined +# let time_segment = ([ +# (ansi reset) +# (ansi magenta) +# (date now | format date '%x %X %p') # try to respect user's locale +# ] | str join | str replace --regex --all "([/:])" $"(ansi green)${1}(ansi magenta)" | +# str replace --regex --all "([AP]M)" $"(ansi magenta_underline)${1}") +# +# let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([ +# (ansi rb) +# ($env.LAST_EXIT_CODE) +# ] | str join) +# } else { "" } +# +# ([$last_exit_code, (char space), $time_segment] | str join) +# } +# +# # Use nushell functions to define your right and left prompt +# $env.PROMPT_COMMAND = {|| create_left_prompt } +# # FIXME: This default is not implemented in rust code as of 2023-09-08. +# $env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt } + +# The prompt indicators are environmental variables that represent +# the state of the prompt +$env.PROMPT_INDICATOR = {|| "> " } +$env.PROMPT_INDICATOR_VI_INSERT = {|| ": " } +$env.PROMPT_INDICATOR_VI_NORMAL = {|| "> " } +$env.PROMPT_MULTILINE_INDICATOR = {|| "::: " } + +# If you want previously entered commands to have a different prompt from the usual one, +# you can uncomment one or more of the following lines. +# This can be useful if you have a 2-line prompt and it's taking up a lot of space +# because every command entered takes up 2 lines instead of 1. You can then uncomment +# the line below so that previously entered commands show with a single `🚀`. +# $env.TRANSIENT_PROMPT_COMMAND = {|| "🚀 " } +# $env.TRANSIENT_PROMPT_INDICATOR = {|| "" } +# $env.TRANSIENT_PROMPT_INDICATOR_VI_INSERT = {|| "" } +# $env.TRANSIENT_PROMPT_INDICATOR_VI_NORMAL = {|| "" } +# $env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = {|| "" } +# $env.TRANSIENT_PROMPT_COMMAND_RIGHT = {|| "" } + +# Specifies how environment variables are: +# - converted from a string to a value on Nushell startup (from_string) +# - converted from a value back to a string when running external commands (to_string) +# Note: The conversions happen *after* config.nu is loaded +$env.ENV_CONVERSIONS = { + "PATH": { + from_string: { |s| $s | split row (char esep) | path expand --no-symlink } + to_string: { |v| $v | path expand --no-symlink | str join (char esep) } + } + "Path": { + from_string: { |s| $s | split row (char esep) | path expand --no-symlink } + to_string: { |v| $v | path expand --no-symlink | str join (char esep) } + } +} + +# Directories to search for scripts when calling source or use +$env.NU_LIB_DIRS = [ + # FIXME: This default is not implemented in rust code as of 2023-09-06. + ($nu.default-config-dir | path join 'scripts') # add /scripts +] + +# Directories to search for plugin binaries when calling register +$env.NU_PLUGIN_DIRS = [ + # FIXME: This default is not implemented in rust code as of 2023-09-06. + ($nu.default-config-dir | path join 'plugins') # add /plugins +] + +# To add entries to PATH (on Windows you might use Path), you can use the following pattern: +# $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path') +mkdir ~/.cache/starship +starship init nu | save -f ~/.cache/starship/init.nu diff --git a/terminal/.config/vifm/vifmrc b/terminal/.config/vifm/vifmrc index 55362ad..ee96e43 100644 --- a/terminal/.config/vifm/vifmrc +++ b/terminal/.config/vifm/vifmrc @@ -372,7 +372,7 @@ filextype ,*.pdf \ sioyek %c %i, zathura %c %i &, apvlv %c, xpdf %c, \ { edit text content } \ pdftotext -nopgbrk %c - | nvim -filextype ,*.pdf +fileviewer ,*.pdf \ pdftotext -nopgbrk %c - " PostScript diff --git a/terminal/.config/zsh/.zshrc b/terminal/.config/zsh/.zshrc index 35d5659..898652b 100644 --- a/terminal/.config/zsh/.zshrc +++ b/terminal/.config/zsh/.zshrc @@ -5,7 +5,7 @@ CONFDIR="${XDG_CONFIG_HOME:-$HOME/.config}" ZSHCONFDIR="$CONFDIR/zsh" # load completion, extended zsh moving syntax, zle edit in vim (or other $EDITOR) possibility -autoload -Uz compinit zmv edit-command-line promptinit +autoload -Uz compinit zmv edit-command-line # Set completion style # The following lines were added by compinstall @@ -60,17 +60,10 @@ zstyle ':fzf-tab:complete:kill:argument-rest' extra-opts --preview=$extract'ps - # give a preview of directory by exa when completing cd zstyle ':fzf-tab:complete:cd:*' extra-opts --preview=$extract'exa -1 --color=always $realpath' -# pure prompt init -promptinit -# make it single line -prompt_newline='%666v' -# show git stash status as a ≡ -zstyle :prompt:pure:git:stash show yes # show hostname if we are in a distrobox environment if [ -n "$DISTROBOX_ENTER_PATH" ] && [ -f /run/.containerenv ]; then local container=lxc fi -prompt pure # shellcheck source=alias [ -f "$CONFDIR/sh/alias" ] && source "$CONFDIR/sh/alias" @@ -99,7 +92,9 @@ ENABLE_CORRECTION="true" # allow moving through directories without prepending cd setopt autocd +eval "$(starship init zsh)" eval "$(zoxide init zsh)" +eval "$(atuin init zsh)" # Speed up autocomplete, force prefix mapping zstyle ':completion:*' accept-exact '*(N)' @@ -157,6 +152,26 @@ bindkey "^[." insert-last-word bindkey -v # remove the delay for switching modes export KEYTIMEOUT=1 +# Change cursor shape for different vi modes. +function zle-keymap-select { + if [[ ${KEYMAP} == vicmd ]] || + [[ $1 = 'block' ]]; then + echo -ne '\e[2 q' + + elif [[ ${KEYMAP} == main ]] || + [[ ${KEYMAP} == viins ]] || + [[ ${KEYMAP} = '' ]] || + [[ $1 = 'beam' ]]; then + echo -ne '\e[6 q' + fi +} +zle -N zle-keymap-select +# Use beam shape cursor on startup. +_fix_cursor() { + echo -ne '\e[6 q' +} +precmd_functions+=(_fix_cursor) + # space puts a space, even in cmd mode bindkey -a ' ' magic-space # always allow backspace/delete to remove letters diff --git a/terminal/.local/share/atuin/init.nu b/terminal/.local/share/atuin/init.nu new file mode 100644 index 0000000..93ebb7f --- /dev/null +++ b/terminal/.local/share/atuin/init.nu @@ -0,0 +1,81 @@ +# Source this in your ~/.config/nushell/config.nu +$env.ATUIN_SESSION = (atuin uuid) + +# Magic token to make sure we don't record commands run by keybindings +let ATUIN_KEYBINDING_TOKEN = $"# (random uuid)" + +let _atuin_pre_execution = {|| + let cmd = (commandline) + if ($cmd | is-empty) { + return + } + if not ($cmd | str starts-with $ATUIN_KEYBINDING_TOKEN) { + $env.ATUIN_HISTORY_ID = (atuin history start -- $cmd) + } +} + +let _atuin_pre_prompt = {|| + let last_exit = $env.LAST_EXIT_CODE + if 'ATUIN_HISTORY_ID' not-in $env { + return + } + with-env { ATUIN_LOG: error } { + do { atuin history end $'--exit=($last_exit)' -- $env.ATUIN_HISTORY_ID | null } | null + + } + hide-env ATUIN_HISTORY_ID +} + +def _atuin_search_cmd [...flags: string] { + [ + $ATUIN_KEYBINDING_TOKEN, + ([ + `commandline (ATUIN_LOG=error run-external --redirect-stderr atuin search`, + ($flags | append [--interactive, --] | each {|e| $'"($e)"'}), + `(commandline) | complete | $in.stderr | str substring ..-1)`, + ] | flatten | str join ' '), + ] | str join "\n" +} + +$env.config = ($env | default {} config).config +$env.config = ($env.config | default {} hooks) +$env.config = ( + $env.config | upsert hooks ( + $env.config.hooks + | upsert pre_execution ( + $env.config.hooks | get -i pre_execution | default [] | append $_atuin_pre_execution) + | upsert pre_prompt ( + $env.config.hooks | get -i pre_prompt | default [] | append $_atuin_pre_prompt) + ) +) + +$env.config = ($env.config | default [] keybindings) + +$env.config = ( + $env.config | upsert keybindings ( + $env.config.keybindings + | append { + name: atuin + modifier: control + keycode: char_r + mode: [emacs, vi_normal, vi_insert] + event: { send: executehostcommand cmd: (_atuin_search_cmd) } + } + ) +) + +# The up arrow keybinding has surprising behavior in Nu, and is disabled by default. +# See https://github.com/atuinsh/atuin/issues/1025 for details +# $env.config = ( +# $env.config | upsert keybindings ( +# $env.config.keybindings +# | append { +# name: atuin +# modifier: none +# keycode: up +# mode: [emacs, vi_normal, vi_insert] +# event: { send: executehostcommand cmd: (_atuin_search_cmd '--shell-up-key-binding') } +# } +# ) +# ) +