diff --git a/Makefile b/Makefile index 99cdbde..f9341c5 100644 --- a/Makefile +++ b/Makefile @@ -1,40 +1,40 @@ -# can be either macos or ubuntu -OS = macos - -.PHONY: default bootstrap-stow dotfiles test setup-macos setup-ubuntu - default: - echo "hello ^^" + @echo "hello ^^" -.PHONY: setup-macos setup-ubuntu boostrap-stow +.PHONY: setup-macos setup-ubuntu setup-wsl setup-common setup-stow -setup-macos: brew-pkgs nix-pkgs dotfiles +setup-common: bash ./tmux/setup.sh - bash ./scripts/setup-zpretzo.sh + bash ./zsh/setup.sh bash ./fzf/setup.sh + +setup-macos: export OS=macos +setup-macos: brew-pkgs nix-pkgs dotfiles setup-common bash ./macos/setup.sh -setup-ubuntu: dotfiles nix-pkgs dotfiles - bash ./tmux/setup.sh - bash ./scripts/setup-zpretzo.sh - bash ./fzf/setup.sh +setup-ubuntu: export OS=ubuntu +setup-ubuntu: dotfiles nix-pkgs dotfiles setup-common bash ./ubuntu/setup.sh -bootstrap-stow: - bash ./scripts/bootstrap-stow.sh +setup-wsl: export OS=wsl +setup-wsl: dotfiles nix-pkgs dotfiles setup-common + +setup-stow: + bash ./stow/setup.sh .PHONY: dotfiles test STOW_ARGS=-vv -dotfiles: bootstrap-stow +dotfiles: setup-stow stow $(STOW_ARGS) -d dotfiles -t $(HOME) $(OS) stow $(STOW_ARGS) dotfiles stow $(STOW_ARGS) yabai + ln -sf ~/dotfiles/fish ~/.config/fish\ test: setup-nix bash ./nix/load-$(OS).sh && bash ./tests/*.sh -.PHONY: setup-pyenv python js +.PHONY: setup-uv python js setup-uv: bash ./python/setup-uv.sh @@ -44,10 +44,7 @@ python: setup-uv ~/.local/bin/uv pip install -r ./python/pyproject.toml js: - npm install -g @tailwindcss/language-server markserv - npm install -g remark-cli remark-lint remark-preset-lint-consistent remark-preset-lint-markdown-style-guide remark-preset-lint-recommended remark-stringify - npm install -g jsonlint jshint - npm install -g sql-language-server + npm install -g remark-cli remark-lint remark-preset-lint-consistent remark-preset-lint-markdown-style-guide remark-preset-lint-recommended remark-stringify jsonlint jshint sql-language-server @tailwindcss/language-server markserv .PHONY: clean-nvim setup-vim diff --git a/README.md b/README.md index feeed86..35b245f 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,11 @@ Setup and configuration for my terminal based developer workflow: -- Zsh for a shell, -- Nix for package management of shell programs, -- uv for Python, -- Neovim for text editing. +- Zsh for a shell +- Nix for package management of shell programs +- uv for Python +- Neovim for text editing +- Stow for dotfiles management This repo should be cloned into `$HOME` and set as `$XDG_CONFIG_HOME`. @@ -16,7 +17,7 @@ This repo should be cloned into `$HOME` and set as `$XDG_CONFIG_HOME`. Setup an Ubuntu machine: ```shell-session -$ make setup-ubuntu OS=ubuntu +$ make setup-ubuntu ``` This will also setup dependencies with Nix. @@ -26,14 +27,14 @@ This will also setup dependencies with Nix. Setup an macOS machine: ```shell-session -$ make setup-macos OS=macos +$ make setup-macos ``` This will also setup dependencies with Nix. ### Python -Ian stall `uv` and setup a global Python installation in a virtual environment: +Install `uv` and setup a global Python installation in a virtual environment: ```bash $ make python @@ -44,17 +45,23 @@ $ make python Use GNU Stow to symlink dotfiles for Bash, Zsh, Tmux and Git: ```shell-session -$ make dotfiles OS=macos +$ make dotfiles +``` + +Note: The `OS` variable is automatically set by the `setup-macos` and `setup-ubuntu` targets. For manual dotfiles setup, you can export the OS variable first: + +```shell-session +$ export OS=macos && make dotfiles ``` Valid values for `OS` are `macos`, `wsl` or `windows`. -A script `./scripts/bootstrap-stow.sh` will attempt to bootstrap Stow if it's not already available. Stow bootstrapping is not setup for Windows because Windows is awful. +A script `./stow/setup.sh` will attempt to bootstrap Stow if it's not already available. Stow bootstrapping is not setup for Windows because Windows is awful. You can run the setup without bootstrapping Stow with: ```shell-session -$ make dotfiles OS=macos -o bootstrap-stow +$ make dotfiles OS=macos -o setup-stow ``` ### Nix @@ -105,3 +112,5 @@ Had weird issue with the first execution of Kitty not loading the `kitty.conf` c $ launchctl load ~/Library/LaunchAgents/setenv.XDG_CONFIG_HOME.plist ``` + + diff --git a/dotfiles/.envrc b/dotfiles/.envrc index 97aa155..74c0550 100644 --- a/dotfiles/.envrc +++ b/dotfiles/.envrc @@ -1,5 +1,2 @@ -source_env_if_exists ~/.envrc.secret +source_env_if_exists ~/.env.secret export TRACE=0 -export VIRTUAL_ENV="~/.venv/bin/activate" -source ~/.venv/bin/activate -layout python diff --git a/dotfiles/.gitconfig b/dotfiles/.gitconfig index 5a42591..67be266 100644 --- a/dotfiles/.gitconfig +++ b/dotfiles/.gitconfig @@ -3,6 +3,7 @@ diffs = diff --staged logg = log --pretty=fuller --abbrev-commit --stat -n 5 loggg = log --pretty=fuller --abbrev-commit --stat --patch -n 5 + logggg = log --oneline --decorate rmf = rm -f [column] @@ -39,7 +40,7 @@ tool = nvimdiff [mergetool "nvimdiff"] - cmd = nvim -d $LOCAL $REMOTE + cmd = nvim -d $LOCAL $REMOTE $MERGED [pull] rebase = false diff --git a/dotfiles/.tmux.conf b/dotfiles/.tmux.conf index 5a85c2d..5cc09a4 100644 --- a/dotfiles/.tmux.conf +++ b/dotfiles/.tmux.conf @@ -17,6 +17,7 @@ set -g base-index 1 set -g default-shell $SHELL set -g default-terminal screen-256color set -g status-keys vi +set -g mode-keys vi set -g history-limit 100000 # KEYS diff --git a/dotfiles/common/.zshenv b/dotfiles/common/.zshenv index 68cead0..449d153 100644 --- a/dotfiles/common/.zshenv +++ b/dotfiles/common/.zshenv @@ -1,15 +1,11 @@ bash $HOME/dotfiles/scripts/trace.sh "$0" - -export XDG_CONFIG_HOME=~/dotfiles - if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' fi export EDITOR=$(which nvim) - +export XDG_CONFIG_HOME=$HOME/dotfiles if command -v launchctl >/dev/null 2>&1; then launchctl setenv XDG_CONFIG_HOME $XDG_CONFIG_HOME fi - source $HOME/dotfiles/scripts/funcs.sh source $HOME/dotfiles/scripts/aliases.sh diff --git a/dotfiles/common/env.sh b/dotfiles/common/env.sh index ca90e77..d7b84e4 100644 --- a/dotfiles/common/env.sh +++ b/dotfiles/common/env.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash - +export XDG_CONFIG_HOME=~/dotfiles export PERSONAL_PATH="$HOME/personal" -export TODO="$PERSONAL_PATH/todo.md" +export DIRENV_LOG_FORMAT="" +# export TODO="$PERSONAL_PATH/todo.md" diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000..9c2a829 --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,27 @@ +# Enable Nix daemon +if test -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish' + source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish' +end + +# Source common environment variables +set -gx XDG_CONFIG_HOME ~/dotfiles +set -gx PERSONAL_PATH "$HOME/personal" +set -gx TODO "$PERSONAL_PATH/todo.md" +set -gx EDITOR nvim + +bass source ~/dotfiles/scripts/aliases.sh +alias 'claude'='npx claude' +alias 't'='tmux new' +alias 's'='search' + +# Add homebrew to PATH +set -gx PATH /opt/homebrew/bin $PATH + +# Disable fish greeting message +set -g fish_greeting + +if status is-interactive + bass source ~/dotfiles/scripts/aliases.sh + starship init fish | source + set -gx PATH ~/.fzf/bin $PATH +end diff --git a/fish/setup.sh b/fish/setup.sh new file mode 100644 index 0000000..9fc9266 --- /dev/null +++ b/fish/setup.sh @@ -0,0 +1,3 @@ +curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher +fisher install edc/bass +fisher install jethrokuan/z diff --git a/nix/flake.lock b/nix/flake.lock index 90c9144..0de4ed5 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1744463964, - "narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=", + "lastModified": 1753429684, + "narHash": "sha256-9h7+4/53cSfQ/uA3pSvCaBepmZaz/dLlLVJnbQ+SJjk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650", + "rev": "7fd36ee82c0275fb545775cc5e4d30542899511d", "type": "github" }, "original": { diff --git a/nix/flake.nix b/nix/flake.nix index 1716f0a..f0fe5bd 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -27,11 +27,11 @@ cmakeMinimal codespell direnv - dpkg + # dpkg efm-langserver entr findutils - fish + # fish flyctl gh git diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index da29cf9..d5b2f63 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,70 +1,58 @@ { - "CopilotChat.nvim": { "branch": "main", "commit": "a89f5f1162b04a0962e5f4c3cdf248a81e7e53cb" }, - "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, + "CopilotChat.nvim": { "branch": "main", "commit": "1d8aa27e2317950b0b7ddc023487c6f2b7b074ca" }, + "LuaSnip": { "branch": "master", "commit": "de10d8414235b0a8cabfeba60d07c24304e71f5c" }, "Vim-Jinja2-Syntax": { "branch": "master", "commit": "2c17843b074b06a835f88587e1023ceff7e2c7d1" }, - "barbar.nvim": { "branch": "master", "commit": "807bede7ef1d8e2ac5f108e9ac8123b1e2d321e3" }, + "barbar.nvim": { "branch": "master", "commit": "549ee11d97057eae207bafa2c23c315942cca097" }, "blink-cmp-copilot": { "branch": "main", "commit": "439cff78780c033aa23cf061d7315314b347e3c1" }, - "blink-cmp-dictionary": { "branch": "master", "commit": "5f1a703416e5090b9633c43873dba8ba03b0fb23" }, - "blink-emoji.nvim": { "branch": "master", "commit": "a77aebc092ebece1eed108f301452ae774d6b67a" }, - "blink-ripgrep.nvim": { "branch": "main", "commit": "56084d1f45c8621d23d4bac724c2dc50b1eb75db" }, - "blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" }, + "blink-cmp-dictionary": { "branch": "master", "commit": "43b701fe9728a704bc63e4667c5d8b398bf129b2" }, + "blink-emoji.nvim": { "branch": "master", "commit": "f22ce8cac02a6ece05368220f1e38bd34fe376f9" }, + "blink-ripgrep.nvim": { "branch": "main", "commit": "b71592e916d748492c54b8bc9bc17dc2a0dcdfb5" }, + "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, "blink.compat": { "branch": "main", "commit": "2ed6d9a28b07fa6f3bface818470605f8896408c" }, - "bullets.vim": { "branch": "master", "commit": "8f3259e807c40b91d247f612823295ab99777a65" }, - "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "eebc724d12c5579d733d1f801386e0ceb909d001" }, + "bullets.vim": { "branch": "master", "commit": "1c13e510e11d08b0259e8e627f128359c5521962" }, + "conform.nvim": { "branch": "master", "commit": "b4aab989db276993ea5dcb78872be494ce546521" }, "copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" }, - "copilot.lua": { "branch": "master", "commit": "0a7502946845fb14b860a6384c709a791bbab96a" }, - "dbtpal": { "branch": "main", "commit": "706134b879eb2f48b2abf56f29e95a30a52cf398" }, + "copilot.lua": { "branch": "master", "commit": "407fbd5cd3397e1e46b7dedbd928eefcaf621e76" }, + "dbtpal": { "branch": "main", "commit": "981eab51609362712c64e3cf3fb773fe11f859b9" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "emmet-vim": { "branch": "master", "commit": "6c511a8d7d2863066f32e25543e2bb99d505172c" }, - "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "gitsigns.nvim": { "branch": "main", "commit": "17ab794b6fce6fce768430ebc925347e349e1d60" }, + "emmet-vim": { "branch": "master", "commit": "e98397144982d1e75b20d94d55a82de3ec8f648d" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "git-conflict.nvim": { "branch": "main", "commit": "4bbfdd92d547d2862a75b4e80afaf30e73f7bbb4" }, + "gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lualine.nvim": { "branch": "master", "commit": "0ea56f91b7f51a37b749c050a5e5dfdd56b302b3" }, - "mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" }, - "mini.indentscope": { "branch": "main", "commit": "8af2569a7d7fd37300dfa760e44e71efbbf322fd" }, - "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, - "nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" }, - "nvim-autopairs": { "branch": "master", "commit": "2a406cdd8c373ae7fe378a9e062a5424472bd8d8" }, - "nvim-bqf": { "branch": "main", "commit": "e20417d5e589e03eaaaadc4687904528500608be" }, + "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, + "mini.icons": { "branch": "main", "commit": "f9a177c11daa7829389b7b6eaaec8b8a5c47052d" }, + "mini.nvim": { "branch": "main", "commit": "e7538b549361c9ac8416a07b0223ce03c508bfe7" }, + "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, + "nvim-bqf": { "branch": "main", "commit": "17680cda3538913e88dd4c6456c837db9ace40ae" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, - "nvim-lint": { "branch": "master", "commit": "5b1bdf306bd3e565908145279e8bbfc594dac3b3" }, - "nvim-lspconfig": { "branch": "master", "commit": "4ea9083b6d3dff4ddc6da17c51334c3255b7eba5" }, - "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, - "nvim-treesitter": { "branch": "master", "commit": "0e21ee8df6235511c02bab4a5b391d18e165a58d" }, - "nvim-treesitter-context": { "branch": "master", "commit": "439789a9a8df9639ecd749bb3286b77117024a6f" }, + "nvim-lint": { "branch": "master", "commit": "f126af5345c7472e9a0cdbe1d1a29209be72c4c4" }, + "nvim-lspconfig": { "branch": "master", "commit": "c8b90ae5cbe21d547b342b05c9266dcb8ca0de8f" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter-context": { "branch": "master", "commit": "dca8726fea2c14e1ce6adbaa76a04816fbfaff61" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, - "nvim-web-devicons": { "branch": "master", "commit": "c90dee4e930ab9f49fa6d77f289bff335b49e972" }, - "obsidian.nvim": { "branch": "main", "commit": "e0eb92c5afcacf5bf11e4735079a538fd1486ea9" }, - "oil.nvim": { "branch": "master", "commit": "302bbaceeafc690e6419e0c8296e804d60cb9446" }, + "nvim-web-devicons": { "branch": "master", "commit": "f66cdfef5e84112045b9ebc3119fee9bddb3c687" }, + "obsidian.nvim": { "branch": "main", "commit": "705cc9b4f66eca1e54040ac819102e80a32896d3" }, + "oil.nvim": { "branch": "master", "commit": "07f80ad645895af849a597d1cac897059d89b686" }, "peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" }, - "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, - "telescope-git-file-history.nvim": { "branch": "master", "commit": "c27d99ba88ec5f0b6d2b9f9bc67dd3d14c610b25" }, + "telescope-git-file-history.nvim": { "branch": "master", "commit": "e7d495319f2a04df96402057a6992ea970f8914d" }, "telescope-makefile": { "branch": "master", "commit": "6e5b5767751dbf73ad4f126840dcf1abfc38e891" }, - "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }, - "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, - "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, + "undotree": { "branch": "master", "commit": "fe9a9d0645f0f5532360b5e5f5c550d7bb4f1869" }, "vim": { "branch": "master", "commit": "d4b0823100c702af127cba8dd5595a8f599041ec" }, "vim-argwrap": { "branch": "master", "commit": "f3e26a5ad249d09467804b92e760d08b1cc457a1" }, "vim-bufkill": { "branch": "master", "commit": "3113181d0c1bfb8719f3ddcd2e2f35a8d763d1e5" }, "vim-closetag": { "branch": "master", "commit": "d0a562f8bdb107a50595aefe53b1a690460c3822" }, - "vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" }, - "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" }, + "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, "vim-grepper": { "branch": "master", "commit": "acaaf32edaa11d82fb972d2af36b949ec3042928" }, - "vim-lastplace": { "branch": "master", "commit": "e58cb0df716d3c88605ae49db5c4741db8b48aa9" }, "vim-markdown-toc": { "branch": "master", "commit": "aa9cc3b07791db5cbe5f29d661763bc0eb4fb7c1" }, "vim-one": { "branch": "master", "commit": "187f5c85b682c1933f8780d4d419c55d26a82e24" }, "vim-python-pep8-indent": { "branch": "master", "commit": "60ba5e11a61618c0344e2db190210145083c91f8" }, - "vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" }, - "vim-strip-trailing-whitespace": { "branch": "master", "commit": "59385775cbe416b2797ec5e2c7eb445a3398dd46" }, - "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, - "vim-table-mode": { "branch": "master", "commit": "e4365bde024f73e205eefa2fb78e3029ddb92ea9" }, - "vim-textobj-markdown": { "branch": "master", "commit": "9cba182b2c30afc982ace0deb1200cc394799799" }, - "vim-textobj-python": { "branch": "master", "commit": "06de233e805b6bcfd0fde7591c64cf927637feb7" }, - "vim-textobj-user": { "branch": "master", "commit": "41a675ddbeefd6a93664a4dc52f302fe3086a933" }, + "vim-table-mode": { "branch": "master", "commit": "e156dbbedce0bbf61c0919db7678fa246fabd616" }, "winresizer": { "branch": "master", "commit": "9bd559a03ccec98a458e60c705547119eb5350f3" }, "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } } diff --git a/nvim/lua/config/augroup.lua b/nvim/lua/config/augroup.lua index e50bd7d..e7647f2 100644 --- a/nvim/lua/config/augroup.lua +++ b/nvim/lua/config/augroup.lua @@ -29,22 +29,24 @@ augroup END ]]) -- .md -vim.api.nvim_exec( - [[ - augroup markdown - autocmd FileType markdown setlocal syntax=markdown - autocmd FileType markdown setlocal spell spelllang=en_nz spellfile=~/dotfiles/nvim/spell/en.utf-8.add - autocmd FileType markdown setlocal noautoindent - autocmd FileType markdown setlocal nosmartindent - autocmd FileType markdown setlocal expandtab - autocmd FileType markdown let g:indentLine_enabled=0 - autocmd FileType markdown syntax keyword Todo TODO DONE - set complete+=k - autocmd FileType markdown setlocal conceallevel=0 - augroup end - ]], - false -) +vim.opt.spell = false +local markdown_group = vim.api.nvim_create_augroup("markdown", { clear = true }) +vim.api.nvim_create_autocmd("FileType", { + pattern = "markdown", + group = markdown_group, + callback = function() + vim.opt_local.syntax = "markdown" + vim.opt_local.spell = true + vim.opt_local.spelllang = { "en_nz" } + vim.opt_local.spellfile = vim.fn.expand("~/dotfiles/nvim/spell/en.utf-8.add") + vim.opt_local.autoindent = false + vim.opt_local.smartindent = false + vim.opt_local.expandtab = true + vim.g.indentLine_enabled = 0 + vim.opt.complete:append("k") + vim.opt_local.conceallevel = 0 + end, +}) -- .py vim.api.nvim_create_autocmd("FileType", { diff --git a/nvim/lua/config/option.lua b/nvim/lua/config/option.lua index 0ce4ebe..81c7992 100644 --- a/nvim/lua/config/option.lua +++ b/nvim/lua/config/option.lua @@ -56,9 +56,10 @@ vim.opt.ignorecase = true vim.opt.list = true vim.opt.listchars = "tab:>-" --- Enable spell checking and set language -vim.opt.spell = true +-- Spell checking and language +vim.opt.spell = false vim.opt.spelllang = "en_nz" +vim.opt.spellsuggest = { "best", 9 } -- Automatically open quickfix list after running :make vim.cmd("autocmd QuickFixCmdPost [^l]* copen") @@ -153,3 +154,4 @@ vim.opt.wildignore = "+=*.egg-info/**" -- Enable wildmenu for command-line completion vim.opt.wildmenu = true +vim.opt.wildmode = "longest:full,full" diff --git a/nvim/lua/plugins/autopairs.lua b/nvim/lua/plugins/autopairs.lua index 8663fc3..fba60b3 100644 --- a/nvim/lua/plugins/autopairs.lua +++ b/nvim/lua/plugins/autopairs.lua @@ -37,12 +37,7 @@ return { Rule("/*", "*/", "sql"), }) - local cmp_autopairs = require("nvim-autopairs.completion.cmp") - local cmp_status_ok, cmp = pcall(require, "cmp") - if not cmp_status_ok then - return - end - cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } })) + -- Integration with blink.cmp is handled automatically end, }, } diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 6d62aae..b2285dd 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -14,7 +14,6 @@ return { "mikavilpas/blink-ripgrep.nvim", "moyiz/blink-emoji.nvim", "nvim-lua/plenary.nvim", - "rafamadriz/friendly-snippets", "L3MON4D3/LuaSnip", }, version = "*", @@ -24,25 +23,42 @@ return { opts = { snippets = { preset = "luasnip" }, + fuzzy = { implementation = "prefer_rust_with_warning" }, + keymap = { - preset = "enter", + [""] = { + "select_next", + -- "fallback" + }, + [""] = { + "select_prev", + -- "fallback" + }, + [""] = { + -- "accept", + "fallback", + }, }, cmdline = { enabled = true, completion = { + -- keyword = { range = "full" }, menu = { auto_show = true }, ghost_text = { enabled = true }, }, keymap = { - preset = "none", - [""] = { "select_and_accept" }, - [""] = { "select_next" }, - [""] = { "select_prev" }, + [""] = { + "select_next", + -- "fallback" + }, + [""] = { + "select_prev", + -- "fallback" + }, [""] = { + -- "select_accept_and_enter", "fallback", - "select_accept_and_enter", - "accept_and_enter", }, }, }, @@ -82,15 +98,13 @@ return { }, list = { - selection = { auto_insert = true, preselect = false }, + selection = { + auto_insert = true, + preselect = false, + }, }, menu = { - cmdline_position = function() - local Api = require("noice.api") - local pos = Api.get_cmdline_position() - return { pos.screenpos.row, pos.screenpos.col } - end, - border = "single", + border = nil, auto_show = function() return vim.bo.buftype ~= "prompt" and vim.b.completion ~= false @@ -98,20 +112,60 @@ return { end, draw = { columns = { - { "label", "label_description", gap = 3 }, - { "kind_icon", gap = 1, "source_name", gap = 1, "kind" }, + { + "label", + -- "label_description", + -- gap = 3 + }, + { + "kind_icon", + gap = 1, + "source_name", + }, }, components = { kind_icon = { ellipsis = false, text = function(ctx) - local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind) - return kind_icon - end, - -- Optionally, you may also use the highlights from mini.icons - highlight = function(ctx) - local _, hl, _ = require("mini.icons").get("lsp", ctx.kind) - return hl + local icons = { + Array = "󰅪", + Boolean = "⊨", + Class = "󰠱", + Color = "󰏘", + Constant = "󰏿", + Constructor = "", + Copilot = "󱚣", + Enum = "", + EnumMember = "", + Event = "", + Field = "󰜢", + File = "󰈙", + Folder = "󰉋", + Function = "󰊕", + Interface = "", + Key = "󰌋", + Keyword = "󰌋", + Method = "󰆧", + Module = "", + Namespace = "󰌗", + Null = "󰟢", + Number = "󰎠", + Object = "󰅩", + Operator = "󰆕", + Package = "", + Property = "󰜢", + Reference = "󰈇", + Ripgrep = "", + Snippet = "", + String = "󰉿", + Struct = "󰙅", + Text = "󰉿", + TypeParameter = "", + Unit = "󰑭", + Value = "󰎠", + Variable = "󰀫", + } + return icons[ctx.kind] or "●" end, }, }, @@ -131,7 +185,7 @@ return { min_width = 1, max_width = 400, max_height = 10, - border = nil, -- Defaults to `vim.o.winborder` on nvim 0.11+ or 'padded' when not defined/<=0.10 + -- border = nil, -- Defaults to `vim.o.winborder` on nvim 0.11+ or 'padded' when not defined/<=0.10 winblend = 0, winhighlight = "Normal:BlinkCmpSignatureHelp,FloatBorder:BlinkCmpSignatureHelpBorder", scrollbar = false, -- Note that the gutter will be disabled when border ~= 'none' @@ -154,9 +208,10 @@ return { -- Default list of enabled providers defined so that you can extend it -- elsewhere in your config, without redefining it, due to `opts_extend` sources = { + min_keyword_length = 2, default = { - "snippets", "copilot", + "snippets", "path", "lsp", "buffer", @@ -166,8 +221,8 @@ return { }, per_filetype = { markdown = { - "snippets", "copilot", + "snippets", "path", "lsp", "buffer", @@ -176,17 +231,17 @@ return { "dictionary", }, go = { + "snippets", "path", "lsp", - "snippets", "buffer", "ripgrep", }, python = { "copilot", + "snippets", "path", "lsp", - "snippets", "buffer", "ripgrep", }, diff --git a/nvim/lua/plugins/formatting.lua b/nvim/lua/plugins/formatting.lua index 6342083..599658f 100644 --- a/nvim/lua/plugins/formatting.lua +++ b/nvim/lua/plugins/formatting.lua @@ -19,16 +19,16 @@ return { lua = { "stylua" }, go = { "gofmt" }, python = { "isort", "ruff_format" }, - -- markdown = { "injected" }, + markdown = { "injected" }, javascript = { "prettier" }, css = { "stylelint" }, yaml = { "yamlfix" }, sql = { "sqlfluff" }, ["*"] = { - -- "codespell", - -- "trim_newlines", - -- "injected", - -- "trim_whitespace", + "codespell", + "trim_newlines", + "injected", + "trim_whitespace", }, }, }) diff --git a/nvim/lua/plugins/linting.lua b/nvim/lua/plugins/linting.lua index 78dcdcf..e40d793 100644 --- a/nvim/lua/plugins/linting.lua +++ b/nvim/lua/plugins/linting.lua @@ -1,17 +1,29 @@ return { { - "mfussenegger/nvim-lint", event = "BufEnter", config = function() + -- override diagnostic signs using the new API + vim.diagnostic.config({ + signs = { + text = { + [vim.diagnostic.severity.ERROR] = "", + [vim.diagnostic.severity.WARN] = "", + [vim.diagnostic.severity.HINT] = "", + [vim.diagnostic.severity.INFO] = "", + }, + }, + }) + + -- custom linter definition for staticcheck require("lint").linters.staticcheck = { - cmd = "staticcheck", -- Command to run staticcheck - stdin = false, -- staticcheck does not support stdin; it requires a file path - append_fname = true, -- Append the filename to the args + cmd = "staticcheck", + stdin = false, + append_fname = true, args = { "--checks", "all" }, - stream = "stdout", -- staticcheck writes its output to stdout - ignore_exitcode = true, -- staticcheck may exit with non-zero on lint warnings/errors - parser = function(output, bufnr) -- Define a parser function for the linter output + stream = "stdout", + ignore_exitcode = true, + parser = function(output, bufnr) local diagnostics = {} local s_pattern = "^(.+):(%d+):(%d+):%s+(.*)$" for _, line in ipairs(vim.split(output, "\n")) do @@ -30,6 +42,7 @@ return { end, } + -- filetype to linter mapping require("lint").linters_by_ft = { dockerfile = { "hadolint" }, go = { "golangcilint" }, @@ -39,17 +52,12 @@ return { jinja2 = { "markdownlint", "codespell" }, json = { "jsonlint" }, markdown = { "markdownlint", "codespell" }, - python = { - "ruff", - -- "mypy", - -- "flake8", - "pydocstyle", - -- "pylint", - }, + python = { "ruff", "pydocstyle" }, sql = { "sqlfluff" }, yaml = { "actionlint", "yamllint" }, } + -- auto-run linting on buffer events vim.api.nvim_create_autocmd({ "BufWritePost", "BufReadPost", diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index 2288360..e832e22 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -3,19 +3,13 @@ return { "neovim/nvim-lspconfig", event = { "BufReadPre", "BufNewFile" }, config = function() - local lspconfig = require("lspconfig") - - -- Diagnostic Appearance - local signs = { - { name = "DiagnosticSignError", text = "" }, - { name = "DiagnosticSignWarn", text = "" }, - { name = "DiagnosticSignHint", text = "" }, - { name = "DiagnosticSignInfo", text = "" }, - } - - for _, sign in ipairs(signs) do - vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) - end + -- global diagnostic keymaps + -- TODO - should these be elsewhere? + local opts = { noremap = true, silent = true } + vim.keymap.set("n", "gl", vim.diagnostic.open_float, opts) + vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) + vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) + vim.keymap.set("n", "q", vim.diagnostic.setloclist, opts) vim.diagnostic.config({ virtual_text = false, @@ -40,95 +34,92 @@ return { }, }) - -- Key Mappings - local opts = { noremap = true, silent = true } - vim.keymap.set("n", "gl", vim.diagnostic.open_float, opts) - vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) - vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) - vim.keymap.set("n", "q", vim.diagnostic.setloclist, opts) - - -- Language Server Configs + -- basedpyright + vim.lsp.config["basedpyright"] = { + cmd = { "basedpyright-langserver", "--stdio" }, + filetypes = { "python" }, + root_markers = { ".git", "pyproject.toml", "setup.py", "setup.cfg", "requirements.txt" }, + settings = { + basedpyright = { + analysis = { + autoSearchPaths = true, + diagnosticMode = "openFilesOnly", + useLibraryCodeForTypes = true, + }, + }, + }, + } + vim.lsp.enable("basedpyright") - -- On Attach - local on_attach = function(client, bufnr) - local bufopts = { noremap = true, silent = true, buffer = bufnr } - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts) - vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts) - vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts) - vim.keymap.set("n", "k", vim.lsp.buf.signature_help, bufopts) - vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts) - vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, bufopts) - vim.keymap.set("n", "wl", function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, bufopts) - vim.keymap.set("n", "D", vim.lsp.buf.type_definition, bufopts) - vim.keymap.set("n", "ca", vim.lsp.buf.code_action, bufopts) - vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts) - vim.keymap.set("n", "grr", vim.lsp.buf.rename, bufopts) - end + -- lua + vim.lsp.config["luals"] = { + cmd = { "lua-language-server" }, + filetypes = { "lua" }, + root_markers = { ".luarc.json", ".luarc.jsonc", ".git" }, + settings = { + Lua = { + runtime = { + version = "LuaJIT", + }, + diagnostics = { globals = { "vim" } }, + }, + }, + } + vim.lsp.enable("luals") - -- Capabilities - local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) - capabilities.textDocument.completion.completionItem.snippetSupport = true + -- ruff + vim.lsp.config["ruff"] = { + cmd = { "ruff", "server" }, + filetypes = { "python" }, + single_file_support = true, + root_markers = { + "pyproject.toml", + "ruff.toml", + ".ruff.toml", + ".git", + }, + } + vim.lsp.enable("ruff") - -- Flags - local lsp_flags = { - debounce_text_changes = 150, + -- gopls + vim.lsp.config["gopls"] = { + cmd = { "gopls" }, + filetypes = { "go", "gomod", "gowork", "gotmpl" }, + root_markers = { "go.work", "go.mod", ".git" }, } + vim.lsp.enable("gopls") - -- Servers - local servers = { - -- bashls = {}, - -- dockerls = {}, - -- emmet_language_server = {}, - -- gopls = {}, - html = {}, - -- jsonls = {}, - ltex = { - -- filetypes = { "markdown" }, - -- settings = { ltex = { enabled = { "markdown" }, language = { "en-NZ" } } }, - }, - -- lua_ls = { - -- cmd = { "lua-language-server", "--force-accept-workspace" }, - -- settings = { - -- Lua = { - -- runtime = { version = "LuaJIT" }, - -- diagnostics = { globals = { "vim" } }, - -- workspace = { library = ".", checkThirdParty = false }, - -- telemetry = { enable = false }, - -- }, - -- }, - -- }, - marksman = {}, - prosemd_lsp = { - cmd = { os.getenv("HOME") .. "/.cargo/bin/prosemd-lsp", "--stdio" }, - }, - basedpyright = {}, - -- pyright = { cmd = { "pyright-langserver", "--stdio" } }, - ruff = { - cmd = { "/Users/adamgreen/.venv/bin/ruff", "server" }, - filetypes = { "python" }, - -- root_dir = require("lspconfig").util.root_pattern( - -- ".git", - -- "pyproject.toml", - -- "setup.py", - -- "setup.cfg", - -- "requirements.txt" - -- ), - single_file_support = true, - }, - -- rust_analyzer = { settings = { ["rust-analyzer"] = {} } }, - -- tailwindcss = { cmd = { "tailwindcss-language-server", "--stdio" } }, - -- ts_ls = {}, + -- html + vim.lsp.config["html"] = { + cmd = { "vscode-html-language-server", "--stdio" }, + filetypes = { "html" }, + root_markers = { "package.json", ".git" }, + single_file_support = true, } - for server, config in pairs(servers) do - require("lspconfig")[server].setup(vim.tbl_deep_extend("force", { - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, - }, config)) - end + vim.lsp.enable("html") + + -- LSP keymaps and features on attach + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local bufnr = args.buf + local bufopts = { noremap = true, silent = true, buffer = bufnr } + + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts) + vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts) + vim.keymap.set("n", "k", vim.lsp.buf.signature_help, bufopts) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts) + vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, bufopts) + vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, bufopts) + vim.keymap.set("n", "wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, bufopts) + vim.keymap.set("n", "D", vim.lsp.buf.type_definition, bufopts) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, bufopts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts) + vim.keymap.set("n", "grr", vim.lsp.buf.rename, bufopts) + end, + }) end, }, } diff --git a/nvim/lua/plugins/mini.lua b/nvim/lua/plugins/mini.lua new file mode 100644 index 0000000..1bcc796 --- /dev/null +++ b/nvim/lua/plugins/mini.lua @@ -0,0 +1,53 @@ +return { + { + "echasnovski/mini.nvim", + version = false, + config = function() + -- text editing + require("mini.comment").setup() + require("mini.surround").setup() + require("mini.pairs").setup() + require("mini.trailspace").setup() + + -- utilities + require("mini.misc").setup() + require("mini.misc").setup_restore_cursor() + require("mini.operators").setup() + + -- keymap for zoom + vim.keymap.set('n', 'z', require('mini.misc').zoom, { desc = 'Zoom current buffer' }) + + -- enhanced text objects + require("mini.ai").setup({ + custom_textobjects = { + -- Python text objects + f = require('mini.ai').gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' }), + c = require('mini.ai').gen_spec.treesitter({ a = '@class.outer', i = '@class.inner' }), + -- Markdown text objects + h = require('mini.ai').gen_spec.treesitter({ a = '@markup.heading', i = '@markup.heading' }), + -- Code blocks in markdown + C = function(ai_type) + local pattern = '```.-```' + return require('mini.ai').gen_spec.pair(pattern, pattern, { + type = 'non-balanced' + })(ai_type) + end, + }, + }) + + -- visual + require("mini.hipatterns").setup({ + highlighters = { + todo = { pattern = "TODO", group = "DiagnosticInfo" }, + hack = { pattern = "HACK", group = "DiagnosticInfo" }, + warn = { pattern = "WARN", group = "DiagnosticInfo" }, + perf = { pattern = "PERF", group = "DiagnosticInfo" }, + note = { pattern = "NOTE", group = "DiagnosticInfo" }, + test = { pattern = "TEST", group = "DiagnosticInfo" }, + fix = { pattern = "FIX", group = "DiagnosticInfo" }, + fixme = { pattern = "FIXME", group = "DiagnosticInfo" }, + }, + }) + end, + }, +} diff --git a/nvim/lua/plugins/noice.lua b/nvim/lua/plugins/noice.lua deleted file mode 100644 index 4d75151..0000000 --- a/nvim/lua/plugins/noice.lua +++ /dev/null @@ -1,46 +0,0 @@ -return { - "folke/noice.nvim", - event = "VeryLazy", - dependencies = { - "MunifTanjim/nui.nvim", - "rcarriga/nvim-notify", - }, - config = function() - require("noice").setup({ - cmdline = { - enabled = true, - }, - messages = { - enabled = false, - }, - popup = { - enabled = false, - }, - popupmenu = { - enabled = true, - }, - -- this is the messages that appear in top right - notify = { - enabled = false, - }, - lsp = { - signature = { - enabled = false, - }, - progress = { - enabled = false, - }, - message = { - enabled = false, - }, - }, - presets = { - bottom_search = false, - command_palette = false, - long_message_to_split = true, - inc_rename = false, - lsp_doc_border = false, - }, - }) - end, -} diff --git a/nvim/lua/plugins/obsidian.lua b/nvim/lua/plugins/obsidian.lua index 960d361..1aea41f 100644 --- a/nvim/lua/plugins/obsidian.lua +++ b/nvim/lua/plugins/obsidian.lua @@ -1,16 +1,8 @@ return { "obsidian-nvim/obsidian.nvim", - version = "*", -- recommended, use latest release instead of latest commit + version = "*", lazy = true, ft = "markdown", - -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: - -- event = { - -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. - -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md" - -- -- refer to `:h file-pattern` for more examples - -- "BufReadPre path/to/my-vault/*.md", - -- "BufNewFile path/to/my-vault/*.md", - -- }, dependencies = { -- Required. "nvim-lua/plenary.nvim", @@ -27,6 +19,36 @@ return { nvim_cmp = false, blink = true, min_chars = 2, + create_new = false, }, + legacy_commands = false, + hl_groups = { + -- The options are passed directly to `vim.api.nvim_set_hl()`. See `:help nvim_set_hl`. + ObsidianTodo = { fg = "NONE", bg = "NONE" }, + }, + note_frontmatter_func = function(note) + local out = { + id = note.id, + created = os.date("%Y-%m-%d %H:%M:%S"), + link = "", + parent = "", + tags = { "note" }, -- Add your default tags here + } + + -- Add title as alias if it exists + if note.title then + note:add_alias(note.title) + out.aliases = note.aliases + end + + -- Preserve any existing metadata + if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then + for k, v in pairs(note.metadata) do + out[k] = v + end + end + + return out + end, }, } diff --git a/nvim/lua/plugins/snippets.lua b/nvim/lua/plugins/snippets.lua index da33475..3e45e91 100644 --- a/nvim/lua/plugins/snippets.lua +++ b/nvim/lua/plugins/snippets.lua @@ -2,7 +2,6 @@ return { { "L3MON4D3/LuaSnip", dependencies = { - "saadparwaiz1/cmp_luasnip", "rafamadriz/friendly-snippets", }, config = function() diff --git a/nvim/lua/plugins/text-editing.lua b/nvim/lua/plugins/text-editing.lua index 0af71eb..774361c 100644 --- a/nvim/lua/plugins/text-editing.lua +++ b/nvim/lua/plugins/text-editing.lua @@ -1,4 +1,5 @@ return { + { "akinsho/git-conflict.nvim", version = "*", config = true }, { "toppair/peek.nvim", event = { "VeryLazy" }, @@ -12,17 +13,10 @@ return { vim.api.nvim_create_user_command("PeekClose", require("peek").close, {}) end, }, - { "sindrets/diffview.nvim" }, { "mhinz/vim-grepper" }, { "FooSoft/vim-argwrap" }, - { "nvim-tree/nvim-web-devicons" }, - { "tpope/vim-commentary" }, { "mattn/emmet-vim" }, - { "tpope/vim-surround" }, - { "tpope/vim-repeat" }, - { "farmergreg/vim-lastplace" }, - { "axelf4/vim-strip-trailing-whitespace" }, { "folke/zen-mode.nvim", opts = { @@ -38,11 +32,6 @@ return { }, }, }, - { - "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = {}, - }, { "mbbill/undotree", config = function() @@ -55,8 +44,6 @@ return { end, }, { "norcalli/nvim-colorizer.lua" }, - { "windwp/nvim-ts-autotag" }, - { "kana/vim-textobj-user" }, { "lukas-reineke/indent-blankline.nvim", opts = { @@ -83,60 +70,15 @@ return { }, main = "ibl", }, - { - "echasnovski/mini.indentscope", - opts = { - -- symbol = "▏", - symbol = "│", - options = { try_as_border = true }, - }, - init = function() - vim.api.nvim_create_autocmd("FileType", { - pattern = { - "help", - "alpha", - "dashboard", - "neo-tree", - "Trouble", - "trouble", - "lazy", - "mason", - "notify", - "toggleterm", - "lazyterm", - }, - callback = function() - vim.b.miniindentscope_disable = true - end, - }) - end, - }, - -- Text editing - Python { "Vimjas/vim-python-pep8-indent" }, - { "bps/vim-textobj-python" }, --- Text editing - Markdown - { "coachshea/vim-textobj-markdown" }, { "dhruvasagar/vim-table-mode" }, { "dkarter/bullets.vim" }, { "mzlogin/vim-markdown-toc" }, --- Text editing - HTML { "alvan/vim-closetag" }, { "Glench/Vim-Jinja2-Syntax" }, - { - "folke/todo-comments.nvim", - cmd = { "TodoTrouble", "TodoTelescope" }, - config = true, - -- stylua: ignore - keys = { - { "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" }, - { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" }, - { "xt", "TodoTrouble", desc = "Todo (Trouble)" }, - { "xT", "TodoTrouble keywords=TODO,FIX,FIXME", desc = "Todo/Fix/Fixme (Trouble)" }, - { "st", "TodoTelescope", desc = "Todo" }, - { "sT", "TodoTelescope keywords=TODO,FIX,FIXME", desc = "Todo/Fix/Fixme" }, - }, - }, { "PedramNavid/dbtpal", dependencies = { diff --git a/nvim/snippets/html.snippets b/nvim/snippets/html.snippets index 0ec6cd8..b43f96e 100644 --- a/nvim/snippets/html.snippets +++ b/nvim/snippets/html.snippets @@ -421,7 +421,7 @@ snippet hgroup ${0} snippet hgroup. -
${0}
snippet hr @@ -579,7 +579,7 @@ snippet map. ${0} snippet map# - ${0} snippet map+ @@ -739,7 +739,7 @@ snippet select ${0} snippet select. - snippet select+ @@ -829,7 +829,7 @@ snippet tr+ td+${0} snippet track - ${5} snippet ul
    ${0} diff --git a/nvim/snippets/markdown.snippets b/nvim/snippets/markdown.snippets index 1dd40f7..e41c6bb 100644 --- a/nvim/snippets/markdown.snippets +++ b/nvim/snippets/markdown.snippets @@ -25,4 +25,4 @@ snippet shell-session snippet ` \`\`\`$1 - \`\` + \`\`\` diff --git a/nvim/snippets/python.snippets b/nvim/snippets/python.snippets index 6be2e49..a40482f 100644 --- a/nvim/snippets/python.snippets +++ b/nvim/snippets/python.snippets @@ -1,4 +1,4 @@ -snippet " +snippet docstring """ $0 """ @@ -56,8 +56,8 @@ snippet @pytest-param snippet with-pytest-raises with pytest.raises(Exception) as err: -snippet: dataclasses +snippet dataclasses import dataclasses @dataclasses.dataclass - class $0 + class $0: diff --git a/scripts/aliases.sh b/scripts/aliases.sh index edaa308..b442a8c 100755 --- a/scripts/aliases.sh +++ b/scripts/aliases.sh @@ -51,7 +51,7 @@ alias pipr='pip install -r requirements.txt' alias cheat='$EDITOR $PERSONAL_PATH/resource/cheat_sheet.md' alias ideas='$EDITOR $HOME/dss/notes/content/ideas/README.md' alias inb='inbox' -alias inbox='$EDITOR $PERSONAL_PATH/area/inbox.md' +alias inbox='$EDITOR $PERSONAL_PATH/inbox/inbox.md' alias quotes='$EDITOR $PERSONAL_PATH/lists/quotes.md' alias someday='$EDITOR $PERSONAL_PATH/someday.md' @@ -111,7 +111,7 @@ alias gmv='git mv ' alias gcb='git checkout ' alias gnb='git checkout -b' alias gp='git push origin ' -alias gs='git status --short --branch --show-stash --verbose -uno' +alias gs='git status --short --branch --show-stash --verbose' alias nbg='git checkout -b' alias gss='git stash' alias gst='git stash' @@ -153,3 +153,5 @@ alias lg='lazygit' alias air='ssh adamgreen@air.local' alias macbook='ssh adam@macbook.local' + +alias f='fish' diff --git a/scripts/funcs.sh b/scripts/funcs.sh index f79e919..ed7ebd7 100644 --- a/scripts/funcs.sh +++ b/scripts/funcs.sh @@ -68,8 +68,9 @@ v() { which python } alias vinit=v +alias vact=v vneu() { - uv venv --python 3.11.10 + uv venv --python 3.11.10 && source .venv/bin/activate && which python } vdel() { rm .venv diff --git a/scripts/setup-fish.sh b/scripts/setup-fish.sh new file mode 100644 index 0000000..7544d70 --- /dev/null +++ b/scripts/setup-fish.sh @@ -0,0 +1,5 @@ +mkdir -p "$XDG_CONFIG_HOME"/fish/functions +git clone https://github.com/edc/bass "$XDG_CONFIG_HOME"/fish/functions/bass +cd "$XDG_CONFIG_HOME"/fish/functions/bass && make install +cp ~/.config/fish/functions/* "$XDG_CONFIG_HOME"/fish/functions/ +rm -rf ~/.config/fish/functions/bass diff --git a/scripts/setup-lsps.sh b/scripts/setup-lsps.sh index 21b9aa8..0d71909 100644 --- a/scripts/setup-lsps.sh +++ b/scripts/setup-lsps.sh @@ -2,5 +2,4 @@ brew install lua-language-server marksman ltex-ls yamllint uv tool install pyright uv tool install ruff uv tool install basedpyright -npm i -g vscode-langservers-extracted prosemd-lsp ltex cargo install prosemd-lsp diff --git a/scripts/todo/go.mod b/scripts/todo/go.mod new file mode 100644 index 0000000..792b726 --- /dev/null +++ b/scripts/todo/go.mod @@ -0,0 +1,3 @@ +module todo + +go 1.22.3 diff --git a/scripts/todo/todo.go b/scripts/todo/todo.go new file mode 100644 index 0000000..3dce155 --- /dev/null +++ b/scripts/todo/todo.go @@ -0,0 +1,53 @@ +package main + +import "fmt" +import "os" + +func fileExists(fi string) bool { + _, err := os.Stat(fi) + return err == nil +} + +func main() { + args := os.Args + + // if we pass a CLI arg, then this is the project + var project string + + if len(args) == 2 { + project = args[1] + } + Resolve(project) +} + +func Resolve(project string) string { + // this is one way to have default args + // works, but I don't like it! + return ResolveToHome(project, "~/personal/project/") +} + +func ResolveToHome(project string, home string) string { + + fmt.Println("TODO for", project) + + // look for a todofile + if fileExists(".todofile") { + fmt.Println(".todofile found!") + // TODO - read from the .todofile + } + + // look for folder locally (ie local todo.md) + if fileExists("todo.md") { + fmt.Println("local todo.md found!") + } + + // check if a file exists in ~/personal/project/{project}/todo.md + + // fallback to project/{project}.md + filename := home + "/" + project + if !fileExists(filename) { + fmt.Println(filename, "does not exist") + } + + return filename +} diff --git a/scripts/todo/todo_test.go b/scripts/todo/todo_test.go new file mode 100644 index 0000000..5482230 --- /dev/null +++ b/scripts/todo/todo_test.go @@ -0,0 +1,21 @@ +package main + +import "testing" + +func TestTodo(t *testing.T) { + t.Run("no files exist, default to project directory", func(t *testing.T) { + got := ResolveToHome("fake.md", "tmp-dir") + want := "tmp-dir/fake.md" + if got != want { + t.Errorf("got %q want %q", got, want) + } + }) + + t.Run("local file exists", func(t *testing.T) { + got := ResolveToHome("fake", "tmp-dir") + want := "tmp-dir/fake" + if got != want { + t.Errorf("got %q want %q", got, want) + } + }) +} diff --git a/starship/starship.toml b/starship/starship.toml index e5d9d46..66e77dc 100644 --- a/starship/starship.toml +++ b/starship/starship.toml @@ -1,43 +1,49 @@ add_newline = true command_timeout = 2000 -format = """$hostname$directory$line_break$character""" +format = """$shell$hostname$directory$line_break$character""" right_format = """$cmd_duration$git_branch$python$nix_shell""" +[shell] +fish_indicator = "[  ](bold purple)" +zsh_indicator = " 󰬇" +bash_indicator = " $" +disabled = false + +[localip] +ssh_only = false +format = " [$localipv4](blue) " +disabled = false + [character] # success_symbol = "[ \\$](green)" success_symbol = "[ >∶](green)" error_symbol = "[ 󰙦 ](red)" vimcmd_symbol = "[  ](green)" +[hostname] +ssh_only = false +format = "on [$hostname](fg:green) " + [directory] truncate_to_repo = false format = "in [$path]($style)[$read_only]($read_only_style) " style='bold purple' +[cmd_duration] +min_time = 0 +format = "[took]() [$duration](bold purple) " +show_milliseconds = true +disabled = false + [git_branch] symbol = "" -format = " [on]() [$symbol $branch(:$remote_branch)](bold green)" - -[hostname] -ssh_only = false -format = " on [$hostname](fg:green) " +format = "[on]() [$symbol $branch(:$remote_branch)](bold green) " [python] -format=' [with]() [${symbol} ${version}](bold blue)' +format='[with]() [${symbol} ${version}](bold blue) ' symbol="" -[localip] -ssh_only = false -format = " [$localipv4](blue) " -disabled = false - -[cmd_duration] -min_time = 0 -format = "[took]() [$duration](bold purple)" -show_milliseconds = true -disabled = false - [nix_shell] disabled = false impure_msg = '' diff --git a/scripts/bootstrap-stow.sh b/stow/setup.sh similarity index 100% rename from scripts/bootstrap-stow.sh rename to stow/setup.sh diff --git a/yabai/.yabairc b/yabai/.yabairc index 4beec7d..5de178a 100755 --- a/yabai/.yabairc +++ b/yabai/.yabairc @@ -12,7 +12,7 @@ for space in 2 3 4; do echo "Configuring space $space" yabai -m config --space "$space" \ layout bsp \ - auto_balance off \ + auto_balance on \ split_ratio 0.5 \ split_type vertical \ mouse_follows_focus off \ diff --git a/scripts/setup-zpretzo.sh b/zsh/setup.sh similarity index 100% rename from scripts/setup-zpretzo.sh rename to zsh/setup.sh