diff --git a/Makefile b/Makefile index 0a8e486..25d73f0 100644 --- a/Makefile +++ b/Makefile @@ -14,20 +14,24 @@ setup-brew: brew-pkgs: setup-brew brew install hadolint vale actionlint fzf mactex pandoc -setup-macos: brew-pkgs nix-setup +setup-macos: brew-pkgs setup-nix bash ./macos/setup.sh -setup-linux: +setup-linux: setup-nix bash ./linux/setup.sh .PHONY: dotfiles dotfiles: bash ./dotfiles/setup.sh -.PHONY: python js -python: - zsh ./python/setup-general-venv.sh general 3.10.6 - zsh ./python/setup-general-venv-pkgs.sh +.PHONY: python js setup-pyenv + +setup-pyenv: + bash ./python/setup-pyenv.sh + +python: setup-pyenv + bash ./python/setup-general-venv.sh general 3.10.6 + bash ./python/setup-general-venv-pkgs.sh js: npm install -g @tailwindcss/language-server markserv diff --git a/README.md b/README.md index 8101a26..9af1a25 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Dotfiles +# dotfiles Setup and configuration for a terminal based developer workflow. @@ -10,9 +10,14 @@ Setup `.bashrc`, `.zshrc` & `.gitconfig` in `$HOME`: $ make dotfiles ``` -This appends to your `rc` files in `$HOME` -- beware running this multiple times, as you will end up sourcing the `rc` files multiple times. +This runs a script `./dotfiles/setup.sh` which either: -This is destructive to your Git config - your `$HOME/.{gitconfig,gitignore}` will be overwritten. +- appends to your `rc` files in `$HOME`, +- copies over files in `$HOME` for `.gitignore`, `.gitconfig` and `.npmrc`. + +Beware running this multiple times, as you will end up sourcing the `rc` files multiple times. + +Beware overwriting your `.gitignore`, `.gitconfig` and `.npmrc` files in `$HOME`. ## Linux @@ -22,6 +27,8 @@ Setup an Linux machine: $ make setup-linux OS=linux ``` +This will also setup dependencies with Nix from `./nix/default.nix`. + ## MacOS Setup an MacOS machine: @@ -30,27 +37,25 @@ Setup an MacOS machine: $ make setup-macos OS=macoS ``` +This will also setup dependencies with Nix from `./nix/default.nix`. + ## Global Python Virtual Env Install pyenv and pyenv-virtualenv: ```bash -$ bash ./python/setup-pyenv.sh -``` - -Setup a global Python installation in a pyenv virtual environment - requires `pyenv`: - -```shell-session $ make python ``` +This will setup a global Python installation in a pyenv virtual environment. + ## Neovim -Neovim setup is in [nvim](https://github.com/ADGEfficiency/dotfiles/tree/master/nvim) -- it's a Lua based setup. +Neovim setup is in [./nvim](https://github.com/ADGEfficiency/dotfiles/tree/master/nvim) -- it's a Lua based setup. To use my Neovim setup, you would put this folder into `$XDG_CONFIG_HOME`. -### Formatting and Linting, +### Formatting and Linting I used to use NullLS, then tried efm - I now use [conform](https://github.com/stevearc/conform.nvim) to manage formatters and `nvim-lint` to manage linting. @@ -74,13 +79,13 @@ I don't use this package -- I used to use Null LS -- their list of tools is stil ### Conform -https://github.com/stevearc/conform.nvim#formatters +[Conform formatters](https://github.com/stevearc/conform.nvim#formatters). ### Nvim Lint -https://github.com/mfussenegger/nvim-lint#available-linters +[nvim-lint linters](https://github.com/mfussenegger/nvim-lint#available-linters). -## Getting Kitty to Play Nice +## Getting Kitty to Play Nice on MacOS Had weird issue with the first execution of Kitty not loading the config correctly - fixed with: diff --git a/dotfiles/.zshrc b/dotfiles/.zshrc index acb38e8..1a6e667 100644 --- a/dotfiles/.zshrc +++ b/dotfiles/.zshrc @@ -82,7 +82,7 @@ alias brew='arch -x86_64 brew' export PATH="$HOME/.poetry/bin:$PATH" export PATH="$HOME/checkmake:$PATH" export PATH="$HOME/dotfiles/scripts:$PATH" -export PATH="$HOME/personal/scripts:$PATH" +export PATH="$HOME/personal/para/area/script:$PATH" source ~/dotfiles/macos/pyenv-flags source $HOME/dotfiles/scripts/funcs.sh diff --git a/git/.gitconfig b/git/.gitconfig index 585b3fa..145512b 100644 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -18,6 +18,9 @@ [pull] rebase = false +[diff] + algorithm = histogram + [alias] diffs = diff --staged logg = log --pretty=fuller --abbrev-commit --stat -n 5 diff --git a/marksman/config.toml b/marksman/config.toml new file mode 100644 index 0000000..a6eb09f --- /dev/null +++ b/marksman/config.toml @@ -0,0 +1,2 @@ +[completion] +wiki.style = "file-path-stem" diff --git a/nix/default.nix b/nix/default.nix index 74c4a89..170a24f 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -24,13 +24,14 @@ with pkgs; [ zsh inetutils ] -++ lib.optionals isLinux [ python310 ] +++ lib.optionals isLinux [ python311 ] ++ lib.optionals isDarwin [ cargo locale llvm cmakeMinimal gtk4 + python311 ] ++ lib.optionals devShell [ bat @@ -52,7 +53,7 @@ with pkgs; [ pandoc texlive.combined.scheme-tetex beautysh - # hadolint + #hadolint htop tig ov @@ -65,7 +66,7 @@ with pkgs; [ nodePackages_latest.prettier nodePackages_latest.sql-formatter nodePackages_latest.stylelint - yamlfix + #yamlfix shellcheck starship stylua diff --git a/nvim/init.lua b/nvim/init.lua index da4ebff..b444886 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,22 +1,25 @@ -- Entrypoint -- The order of the `require` below is important. +-- require("adam.plugins") +-- require("adam.color") +-- require("adam.alpha") +-- require("adam.cmp") +-- require("adam.gitsigns") +-- require("adam.lsp") +-- require("adam.format") +-- require("adam.lint") +-- require("adam.lualine") +-- require("adam.luasnip") +-- require("adam.pairs") +-- require("adam.telescope") +-- require("adam.treesitter") +-- require("adam.whichkey") +-- require("adam.barbar") +-- require("adam.copilot") +-- require("adam.signature") +-- require("adam.keys") + vim.lsp.set_log_level("debug") -require("adam.options") -require("adam.plugins") -require("adam.color") -require("adam.alpha") -require("adam.cmp") -require("adam.gitsigns") -require("adam.lsp") -require("adam.format") -require("adam.lint") -require("adam.lualine") -require("adam.luasnip") -require("adam.pairs") -require("adam.telescope") -require("adam.treesitter") -require("adam.whichkey") -require("adam.barbar") -require("adam.copilot") -require("adam.signature") -require("adam.keys") +require("config.options") +require("config.lazy") +require("config.keymaps") diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json new file mode 100644 index 0000000..5fb12f3 --- /dev/null +++ b/nvim/lazy-lock.json @@ -0,0 +1,71 @@ +{ + "LuaSnip": { "branch": "master", "commit": "f3b3d3446bcbfa62d638b1903ff00a78b2b730a1" }, + "Vim-Jinja2-Syntax": { "branch": "master", "commit": "2c17843b074b06a835f88587e1023ceff7e2c7d1" }, + "barbar.nvim": { "branch": "master", "commit": "71ac376acd000743146b1e08e62151b4d887bbac" }, + "bullets.vim": { "branch": "master", "commit": "d9a47f114031d3030b1e4de3c0b6a664b1201524" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, + "cmp-cmdline-history": { "branch": "master", "commit": "003573b72d4635ce636234a826fa8c4ba2895ffe" }, + "cmp-conventionalcommits": { "branch": "master", "commit": "a4dfacf0601130b7f8afa7c948d735c27802fb7f" }, + "cmp-dictionary": { "branch": "main", "commit": "afa18f35a818af7bcb65b05c183a6777ede6c0ad" }, + "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp-pypi": { "branch": "main", "commit": "69a3c7eca2d430dabb8d8df5b17f4ce11b256f25" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "conform.nvim": { "branch": "master", "commit": "61cff430c9f15770d0c5e68c1b08067223bd94ab" }, + "copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" }, + "copilot.lua": { "branch": "master", "commit": "03f825956ec49e550d07875d867ea6e7c4dc8c00" }, + "emmet-vim": { "branch": "master", "commit": "def5d57a1ae5afb1b96ebe83c4652d1c03640f4d" }, + "friendly-snippets": { "branch": "main", "commit": "dbd45e9ba76d535e4cba88afa1b7aa43bb765336" }, + "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, + "indent-blankline.nvim": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" }, + "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, + "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, + "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "fe4cce44dec93c69be17dad79b21de867dde118a" }, + "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, + "mini.indentscope": { "branch": "main", "commit": "cf07f19e718ebb0bcc5b00999083ce11c37b8d40" }, + "noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" }, + "nui.nvim": { "branch": "main", "commit": "c3c7fd618dcb5a89e443a2e1033e7d11fdb0596b" }, + "nvim-autopairs": { "branch": "master", "commit": "2e8a10c5fc0dcaf8296a5f1a7077efcd37065cc8" }, + "nvim-bqf": { "branch": "main", "commit": "bdc2a4e5bb670b3c0e33ada9c0eec636d93a0748" }, + "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" }, + "nvim-lint": { "branch": "master", "commit": "31be66c27214174a28fc092ffcf4bb3e8f6cfd43" }, + "nvim-lspconfig": { "branch": "master", "commit": "d1bab4cf4b69e49d6058028fd933d8ef5e74e680" }, + "nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" }, + "nvim-treesitter": { "branch": "master", "commit": "eb1914bb10dc9b114a61197de0ec58a308c40071" }, + "nvim-treesitter-context": { "branch": "master", "commit": "23b699ac40091d8c729f024b3f1400bc7e26e0c5" }, + "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" }, + "nvim-web-devicons": { "branch": "master", "commit": "7f30f2da3c3641841ceb0e2c150281f624445e8f" }, + "obsidian.nvim": { "branch": "main", "commit": "0a6739d2229c8eb30396db550f3818e092088c27" }, + "oil.nvim": { "branch": "master", "commit": "6953c2c17d8ae7454b28c44c8767eebede312e6f" }, + "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope-makefile": { "branch": "master", "commit": "6e5b5767751dbf73ad4f126840dcf1abfc38e891" }, + "telescope.nvim": { "branch": "master", "commit": "b744cf59752aaa01561afb4223006de26f3836fd" }, + "todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" }, + "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, + "undotree": { "branch": "master", "commit": "9dbbf3b7d19dda0d22ceca461818e4739ad8154d" }, + "vim": { "branch": "master", "commit": "6495b4ff40479ec7705addb4ea800ec308026648" }, + "vim-argwrap": { "branch": "master", "commit": "f3e26a5ad249d09467804b92e760d08b1cc457a1" }, + "vim-bufkill": { "branch": "master", "commit": "3113181d0c1bfb8719f3ddcd2e2f35a8d763d1e5" }, + "vim-closetag": { "branch": "master", "commit": "d0a562f8bdb107a50595aefe53b1a690460c3822" }, + "vim-commentary": { "branch": "master", "commit": "f67e3e67ea516755005e6cccb178bc8439c6d402" }, + "vim-grepper": { "branch": "master", "commit": "485d349125d46f2788833ecb43df7a14c46706f6" }, + "vim-illuminate": { "branch": "master", "commit": "305bf07b919ac526deb5193280379e2f8b599926" }, + "vim-lastplace": { "branch": "master", "commit": "a715d602745cdb1c35cfe73c50d3dd266eb5a349" }, + "vim-markdown-toc": { "branch": "master", "commit": "0e2c7cdc3ac1d067eb309a10220d001bb7be39cd" }, + "vim-pandoc-syntax": { "branch": "master", "commit": "16939cda184ff555938cc895cc62477c172997f9" }, + "vim-python-pep8-indent": { "branch": "master", "commit": "60ba5e11a61618c0344e2db190210145083c91f8" }, + "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, + "vim-strip-trailing-whitespace": { "branch": "master", "commit": "59385775cbe416b2797ec5e2c7eb445a3398dd46" }, + "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, + "vim-table-mode": { "branch": "master", "commit": "4ff8de2ac93431ee6d85a9e04177012752e6abdc" }, + "vim-textobj-markdown": { "branch": "master", "commit": "9cba182b2c30afc982ace0deb1200cc394799799" }, + "vim-textobj-python": { "branch": "master", "commit": "06de233e805b6bcfd0fde7591c64cf927637feb7" }, + "vim-textobj-user": { "branch": "master", "commit": "41a675ddbeefd6a93664a4dc52f302fe3086a933" }, + "winresizer": { "branch": "master", "commit": "9bd559a03ccec98a458e60c705547119eb5350f3" } +} \ No newline at end of file diff --git a/nvim/lazyvim.json b/nvim/lazyvim.json new file mode 100644 index 0000000..ff6a139 --- /dev/null +++ b/nvim/lazyvim.json @@ -0,0 +1,9 @@ +{ + "extras": [ + + ], + "news": { + "NEWS.md": "2123" + }, + "version": 2 +} \ No newline at end of file diff --git a/nvim/lua/adam/alpha.lua b/nvim/lua/adam/alpha.lua deleted file mode 100644 index edb867f..0000000 --- a/nvim/lua/adam/alpha.lua +++ /dev/null @@ -1,39 +0,0 @@ -local alpha = require("alpha") -local dashboard = require("alpha.themes.dashboard") - -dashboard.section.header.val = { - " ` --._ `-._ `-. `. : / .' .-' _.-' _.--' ", - " `--.__ `--._ `-._ `-. `. `. : .' .' .-' _.-' _.--' __.--' ", - " __ `--.__ `--._ `-._ `-. `. :/ .' .-' _.-' _.--' __.--' __ ", - " `--..__ `--.__ `--._ `-._`-.`_=_'.-'_.-' _.--' __.--' __..--' ", - " --..__ `--..__ `--.__ `--._`-q(-_-)p-'_.--' __.--' __..--' __..-- ", - " ``--..__ `--..__ `--.__ `-'_) (_`-' __.--' __..--' __..--'' ", - " ...___ ``--..__ `--..__`--/__/ --'__..--' __..--'' ___... ", - " ```---...___ ``--..__`_(<_ _/)_'__..--'' ___...---''' ", - " ```-----....._____```---...___(____|_/__)___...---'''_____.....-----''' ", - " ", - "Virtue is what you do when nobody is looking. The rest is marketing. - Nassim Nicholas Taleb", -} - -dashboard.section.buttons.val = { - dashboard.button("r", " recent", ":Telescope oldfiles"), - dashboard.button("e", " neu", ":ene startinsert "), - dashboard.button("f", " find local", ":Telescope find_files cwd=."), - dashboard.button("g", " find global", ":Telescope find_files cwd=~"), - dashboard.button( - "p", - " find personal", - ":Telescope find_files search_dirs=['~/personal','~/programming-resources']" - ), - dashboard.button("q", " quit", ":qa"), -} - -dashboard.section.footer.val = { - "The true test of a man’s character is what he does when no one is watching. - John Wooden", -} - -alpha.setup(dashboard.opts) - -vim.cmd([[ - autocmd FileType alpha setlocal nofoldenable -]]) diff --git a/nvim/lua/adam/barbar.lua b/nvim/lua/adam/barbar.lua deleted file mode 100644 index 4e0be51..0000000 --- a/nvim/lua/adam/barbar.lua +++ /dev/null @@ -1,78 +0,0 @@ -local km = vim.api.nvim_set_keymap --- --- automatic sort of buffers -local opts = { noremap = true, silent = true } -km("n", "1", "BufferOrderByBufferNumber", opts) -km("n", "2", "BufferOrderByDirectory", opts) - -require("barbar").setup({ - -- Enable/disable auto-hiding the tab bar when there is a single buffer - auto_hide = false, - clickable = false, - icons = { - -- Configure the base icons on the bufferline. - -- Valid options to display the buffer index and -number are `true`, 'superscript' and 'subscript' - buffer_index = true, - buffer_number = false, - button = "", - filetype = { - -- Sets the icon's highlight group. - -- If false, will use nvim-web-devicons colors - custom_colors = false, - -- Requires `nvim-web-devicons` if `true` - enabled = false, - }, - separator = { left = "", right = "" }, - -- If true, add an additional separator at the end of the buffer list - modified = { button = "" }, - separator_at_end = false, - -- Use a preconfigured buffer appearance— can be 'default', 'powerline', or 'slanted' - preset = "default", - -- Configure the icons on the bufferline based on the visibility of a buffer. - -- Supports all the base icon options, plus `modified` and `pinned`. - alternate = { filetype = { enabled = false } }, - current = { buffer_index = true }, - visible = { modified = { buffer_number = false } }, - }, -}) - -vim.cmd([[ - - - hi BufferCurrent gui=bold guibg='#282A36' - hi BufferVisible guibg='#282A36' - hi BufferInactive guibg='#282A36' - - hi BufferCurrentIndex guifg='#FF79C6' gui=bold - hi BufferVisibleIndex guifg='#FF79C6' guibg='#282A36' - hi BufferInactiveIndex guifg='#FF79C6' guibg='#282A36' - - hi BufferCurrentMod guifg='#51FA7B' gui=bold - hi BufferVisibleMod guifg='#51FA7B' guibg='#282A36' - hi BufferInactiveMod guifg='#51FA7B' guibg='#282A36' - - hi BufferCurrentSign guifg='#282A36' guibg='#282A36' - hi BufferVisibleSign guifg='#282A36' guibg='#282A36' - hi BufferInactiveSign guifg='#282A36' guibg='#282A36' - - hi BufferCurrentSignRight guifg='#282A36' guibg='#282A36' - hi BufferVisibleSignRight guifg='#282A36' guibg='#282A36' - hi BufferInactiveSignRight guifg='#282A36' guibg='#282A36' - - hi BufferTabpageFill guifg='#282A36' -]]) - -vim.cmd([[ - cnoreabbrev b1 BufferGoto 1 - cnoreabbrev b2 BufferGoto 2 - cnoreabbrev b3 BufferGoto 3 - cnoreabbrev b4 BufferGoto 4 - cnoreabbrev b5 BufferGoto 5 - cnoreabbrev b6 BufferGoto 6 - cnoreabbrev b7 BufferGoto 7 - cnoreabbrev b8 BufferGoto 8 - cnoreabbrev b9 BufferGoto 9 - cnoreabbrev b10 BufferGoto 10 - cnoreabbrev b11 BufferGoto 11 - cnoreabbrev b12 BufferGoto 12 -]]) diff --git a/nvim/lua/adam/cmp.lua b/nvim/lua/adam/cmp.lua deleted file mode 100644 index 2a05ede..0000000 --- a/nvim/lua/adam/cmp.lua +++ /dev/null @@ -1,257 +0,0 @@ --- Autocompletion - --- Check if 'cmp' (completion-nvim) and 'luasnip' (LuaSnip) are available -local cmp_status_ok, cmp = pcall(require, "cmp") -local snip_status_ok, luasnip = pcall(require, "luasnip") -if not cmp_status_ok or not snip_status_ok then - return -end --- --- Load snippets from the 'snippets' directory for LuaSnip -require("luasnip/loaders/from_snipmate").load({ paths = "./snippets" }) - ---   פּ ﯟ   some other good icons - more here: https://www.nerdfonts.com/cheat-sheet -local kind_icons = { - Text = "", - Method = "m", - Function = "󰊕", - Constructor = "", - Field = "", - Variable = "󰫧", - Class = "", - Interface = "", - Module = "", - Property = "", - Unit = "", - Value = "", - Enum = "", - Keyword = "", - Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = "", - Operator = "", - TypeParameter = "", - Copilot = "󰚩", -} - --- Set up 'cmp' for different command-line types --- Includes setting up sources -for _, cmd_type in ipairs({ ":", "/", "?", "@" }) do - cmp.setup.cmdline(cmd_type, { - sources = cmp.config.sources({ - { name = "cmdline" }, - { name = "cmdline_history" }, - { name = "path" }, - { name = "buffer" }, - { name = "copilot" }, - { name = "dictionary" }, - }), - }) -end - -require("cmp_dictionary").setup({ - dic = { - ["*"] = { "/usr/share/dict/words" }, - ["python"] = { "~/dotfiles/dict/python.dic" }, - }, - exact_length = -1, - first_case_insensitive = true, - document = { - enabled = false, - command = { "wn", "${label}", "-over" }, - }, - async = true, - max_number_items = 3, -}) - --- Set up 'cmp' --- Includes setting up sources -cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = { - [""] = cmp.mapping(function() - if cmp.visible() then - cmp.select_prev_item() - else - cmp.complete() - end - end, { "i", "c" }), - [""] = cmp.mapping(function() - if cmp.visible() then - cmp.select_next_item() - else - cmp.complete() - end - end, { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), - [""] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. - [""] = cmp.mapping({ - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }), - -- Accept currently selected item. If none selected, `select` first item. - -- Set `select` to `false` to only confirm explicitly selected items. - [""] = cmp.mapping.confirm({ select = false }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() - -- that way you will only jump inside the snippet region - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { - "i", - "s", - }), - }, - formatting = { - fields = { "kind", "abbr", "menu" }, - format = function(entry, vim_item) - -- Kind icons - vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) - vim_item.menu = ({ - nvim_lsp = "[LSP]", - luasnip = "[Snippet]", - path = "[Path]", - buffer = "[Buffer]", - dictionary = "[Dict]", - copilot = "[AI]", - })[entry.source.name] - return vim_item - end, - }, - sources = { - { name = "copilot" }, - { name = "luasnip" }, - { name = "nvim_lsp" }, - { - name = "path", - option = { - get_cwd = function(params) - return vim.fn.getcwd() - end, - }, - }, - { - name = "buffer", - option = { - get_bufnrs = function() - return vim.api.nvim_list_bufs() - end, - }, - }, - { name = "emoji" }, - { name = "latex_symbols" }, - { name = "npm", keyword_length = 4 }, - { - name = "dictionary", - keyword_length = 3, - max_item_count = 3, - }, - }, - confirm_opts = { - behavior = cmp.ConfirmBehavior.Replace, - select = false, - }, - experimental = { - ghost_text = true, - native_menu = false, - }, - window = { - documentation = { - border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, - }, - }, -}) - -cmp.setup.filetype("python", { - sources = { - { name = "copilot" }, - { name = "luasnip" }, - { - name = "buffer", - option = { - get_bufnrs = function() - return vim.api.nvim_list_bufs() - end, - }, - }, - { - name = "path", - option = { - get_cwd = function(params) - return vim.fn.getcwd() - end, - }, - }, - { name = "nvim_lsp" }, - { - name = "dictionary", - keyword_length = 4, - max_item_count = 3, - }, - }, -}) - -cmp.setup.filetype("markdown", { - sources = { - { name = "copilot" }, - { - name = "buffer", - option = { - get_bufnrs = function() - return vim.api.nvim_list_bufs() - end, - }, - }, - { - name = "path", - option = { - get_cwd = function(params) - return vim.fn.getcwd() - end, - }, - }, - { name = "buffer-lines", option = { words = true, comments = true } }, - { - name = "dictionary", - keyword_length = 4, - max_item_count = 3, - }, - { name = "luasnip" }, - }, -}) - -cmp.event:on("menu_opened", function() - vim.b.copilot_suggestion_hidden = true -end) - -cmp.event:on("menu_closed", function() - vim.b.copilot_suggestion_hidden = false -end) diff --git a/nvim/lua/adam/color.lua b/nvim/lua/adam/color.lua deleted file mode 100644 index 1968966..0000000 --- a/nvim/lua/adam/color.lua +++ /dev/null @@ -1,24 +0,0 @@ --- Colors and themes - --- Color highlighter - -require("colorizer").setup({ - "css", - "javascript", - html = { - mode = "foreground", - }, -}) - --- Dracula -vim.cmd([[ - try - colorscheme dracula - catch /^Vim\%((\a\+)\)\=:E185/ - colorscheme default - set background=dark - endtry -]]) - --- Highlight spelling mistakes by linking SpellBad to ErrorMsg -vim.cmd([[hi! link SpellBad ErrorMsg]]) diff --git a/nvim/lua/adam/copilot.lua b/nvim/lua/adam/copilot.lua deleted file mode 100644 index a5981f9..0000000 --- a/nvim/lua/adam/copilot.lua +++ /dev/null @@ -1,44 +0,0 @@ -require("copilot").setup({ - panel = { - enabled = false, - auto_refresh = true, - keymap = { - jump_prev = "[[", - jump_next = "]]", - accept = "", - refresh = "gr", - open = "", - }, - layout = { - position = "bottom", -- | top | left | right - ratio = 0.4, - }, - }, - suggestion = { - enabled = false, - auto_trigger = false, - debounce = 75, - keymap = { - accept = "", - accept_word = false, - accept_line = false, - next = "", - prev = "", - dismiss = "", - }, - }, - filetypes = { - python = true, - markdown = true, - yaml = true, - help = false, - gitcommit = false, - gitrebase = false, - hgcommit = false, - svn = false, - cvs = false, - ["*"] = true, - }, - copilot_node_command = "/Users/adam/.nix-profile/bin/node", - server_opts_overrides = {}, -}) diff --git a/nvim/lua/adam/format.lua b/nvim/lua/adam/format.lua deleted file mode 100644 index aa1054e..0000000 --- a/nvim/lua/adam/format.lua +++ /dev/null @@ -1,55 +0,0 @@ -require("conform").setup({ - notify_on_error = true, - formatters_by_ft = { - bash = { "beautysh", "shellharden" }, - sh = { "beautysh", "shellharden" }, - html = { "djlintJinja", "prettier" }, - jinja = { "djlintJinja" }, - json = { "jq" }, - lua = { "stylua" }, - go = { "gofmt" }, - -- markdown = { "mdformat" }, - python = { "isort", "ruff_format", "ruff_lint" }, - javascript = { "prettier" }, - css = { "stylelint" }, - yaml = { "yamlfix" }, - sql = { "sql_formatter" }, - ["*"] = { - "codespell", - "trim_newlines", - -- "trim_whitespace" - }, - }, -}) - --- setup format on save -vim.api.nvim_create_autocmd("BufWritePre", { - pattern = "*", - callback = function(args) - require("conform").format({ - bufnr = args.buf, - quiet = false, - lsp_fallback = false, - timeout_ms = 2000, - }) - end, -}) - -require("conform").formatters.djlintJinja = { - command = "djlint", - args = { - "--reformat", - "--profile", - "jinja", - "-", - }, -} - -require("conform").formatters.beautysh = { - command = "beautysh", - args = { - "--indent-size", - "2", - "-", - }, -} diff --git a/nvim/lua/adam/fzf.lua b/nvim/lua/adam/fzf.lua deleted file mode 100644 index 15934cb..0000000 --- a/nvim/lua/adam/fzf.lua +++ /dev/null @@ -1,534 +0,0 @@ -local actions = require("fzf-lua.actions") -local fzf = require("fzf-lua") -fzf.setup { - -- fzf_bin = 'sk', -- use skim instead of fzf? - -- https://github.com/lotabout/skim - global_resume = true, -- enable global `resume`? - -- can also be sent individually: - -- `.({ gl ... })` - global_resume_query = true, -- include typed query in `resume`? - winopts = { - -- split = "belowright new",-- open in a split instead? - -- "belowright new" : split below - -- "aboveleft new" : split above - -- "belowright vnew" : split right - -- "aboveleft vnew : split left - -- Only valid when using a float window - -- (i.e. when 'split' is not defined, default) - height = 0.30, -- window height - width = 1.00, -- window width - row = 1.00, -- window row position (0=top, 1=bottom) - col = 0.50, -- window col position (0=left, 1=right) - -- border argument passthrough to nvim_open_win(), also used - -- to manually draw the border characters around the preview - -- window, can be set to 'false' to remove all borders or to - -- 'none', 'single', 'double', 'thicc' or 'rounded' (default) - border = 'none', - fullscreen = false, -- start fullscreen? - hl = { - normal = 'Normal', -- window normal color (fg+bg) - border = 'Normal', -- border color (try 'FloatBorder') - -- Only valid with the builtin previewer: - cursor = 'Cursor', -- cursor highlight (grep/LSP matches) - cursorline = 'CursorLine', -- cursor line - cursorlinenr = 'CursorLineNr', -- cursor line number - search = 'IncSearch', -- search matches (ctags|help) - -- title = 'Normal', -- preview border title (file/buffer) - -- scrollbar_f = 'PmenuThumb', -- scrollbar "full" section highlight - -- scrollbar_e = 'PmenuSbar', -- scrollbar "empty" section highlight - }, - preview = { - -- default = 'bat', -- override the default previewer? - -- default uses the 'builtin' previewer - border = 'border', -- border|noborder, applies only to - -- native fzf previewers (bat/cat/git/etc) - wrap = 'nowrap', -- wrap|nowrap - hidden = 'hidden', -- hidden|nohidden - vertical = 'down:45%', -- up|down:size - horizontal = 'right:70%', -- right|left:size - layout = 'flex', -- horizontal|vertical|flex - flip_columns = 120, -- #cols to switch to horizontal on flex - -- Only valid with the builtin previewer: - title = true, -- preview border title (file/buf)? - scrollbar = 'float', -- `false` or string:'float|border' - -- float: in-window floating border - -- border: in-border chars (see below) - scrolloff = '-2', -- float scrollbar offset from right - -- applies only when scrollbar = 'float' - scrollchars = {'█', '' }, -- scrollbar chars ({ , } - -- applies only when scrollbar = 'border' - delay = 100, -- delay(ms) displaying the preview - -- prevents lag on fast scrolling - winopts = { -- builtin previewer window options - number = true, - relativenumber = false, - cursorline = true, - cursorlineopt = 'both', - cursorcolumn = false, - signcolumn = 'no', - list = false, - foldenable = false, - foldmethod = 'manual', - }, - }, - on_create = function() - -- called once upon creation of the fzf main window - -- can be used to add custom fzf-lua mappings, e.g: - -- vim.api.nvim_buf_set_keymap(0, "t", "", "", - -- { silent = true, noremap = true }) - end, - }, - keymap = { - -- These override the default tables completely - -- no need to set to `false` to disable a bind - -- delete or modify is sufficient - builtin = { - -- neovim `:tmap` mappings for the fzf win - [""] = "toggle-help", - [""] = "toggle-fullscreen", - -- Only valid with the 'builtin' previewer - [""] = "toggle-preview-wrap", - [""] = "toggle-preview", - -- Rotate preview clockwise/counter-clockwise - [""] = "toggle-preview-ccw", - [""] = "toggle-preview-cw", - [""] = "preview-page-down", - [""] = "preview-page-up", - [""] = "preview-page-reset", - }, - fzf = { - -- fzf '--bind=' options - ["ctrl-z"] = "abort", - ["ctrl-u"] = "unix-line-discard", - ["ctrl-f"] = "half-page-down", - ["ctrl-b"] = "half-page-up", - ["ctrl-a"] = "beginning-of-line", - ["ctrl-e"] = "end-of-line", - ["alt-a"] = "toggle-all", - -- Only valid with fzf previewers (bat/cat/git/etc) - ["f3"] = "toggle-preview-wrap", - ["f4"] = "toggle-preview", - ["shift-down"] = "preview-page-down", - ["shift-up"] = "preview-page-up", - }, - }, - actions = { - -- These override the default tables completely - -- no need to set to `false` to disable an action - -- delete or modify is sufficient - files = { - -- providers that inherit these actions: - -- files, git_files, git_status, grep, lsp - -- oldfiles, quickfix, loclist, tags, btags - -- args - -- default action opens a single selection - -- or sends multiple selection to quickfix - -- replace the default action with the below - -- to open all files whether single or multiple - -- ["default"] = actions.file_edit, - ["default"] = actions.file_edit_or_qf, - ["ctrl-s"] = actions.file_split, - ["ctrl-v"] = actions.file_vsplit, - ["ctrl-t"] = actions.file_tabedit, - ["alt-q"] = actions.file_sel_to_qf, - }, - buffers = { - -- providers that inherit these actions: - -- buffers, tabs, lines, blines - ["default"] = actions.buf_edit, - ["ctrl-s"] = actions.buf_split, - ["ctrl-v"] = actions.buf_vsplit, - ["ctrl-t"] = actions.buf_tabedit, - } - }, - fzf_opts = { - -- options are sent as `=` - -- set to `false` to remove a flag - -- set to '' for a non-value flag - -- for raw args use `fzf_args` instead - ['--ansi'] = '', - ['--info'] = 'inline', - ['--height'] = '100%', - ['--layout'] = 'reverse', - ['--border'] = 'none', - }, - -- fzf '--color=' options (optional) - --[[ fzf_colors = { - ["fg"] = { "fg", "CursorLine" }, - ["bg"] = { "bg", "Normal" }, - ["hl"] = { "fg", "Comment" }, - ["fg+"] = { "fg", "Normal" }, - ["bg+"] = { "bg", "CursorLine" }, - ["hl+"] = { "fg", "Statement" }, - ["info"] = { "fg", "PreProc" }, - ["prompt"] = { "fg", "Conditional" }, - ["pointer"] = { "fg", "Exception" }, - ["marker"] = { "fg", "Keyword" }, - ["spinner"] = { "fg", "Label" }, - ["header"] = { "fg", "Comment" }, - ["gutter"] = { "bg", "Normal" }, - }, ]] - previewers = { - cat = { - cmd = "cat", - args = "--number", - }, - bat = { - cmd = "bat", - args = "--style=numbers,changes --color always", - theme = 'Coldark-Dark', -- bat preview theme (bat --list-themes) - config = nil, -- nil uses $BAT_CONFIG_PATH - }, - head = { - cmd = "head", - args = nil, - }, - git_diff = { - cmd_deleted = "git diff --color HEAD --", - cmd_modified = "git diff --color HEAD", - cmd_untracked = "git diff --color --no-index /dev/null", - -- pager = "delta", -- if you have `delta` installed - }, - man = { - -- NOTE: remove the `-c` flag when using man-db - cmd = "man -c %s | col -bx", - }, - builtin = { - syntax = true, -- preview syntax highlight? - syntax_limit_l = 0, -- syntax limit (lines), 0=nolimit - syntax_limit_b = 1024*1024, -- syntax limit (bytes), 0=nolimit - limit_b = 1024*1024*10, -- preview limit (bytes), 0=nolimit - -- preview extensions using a custom shell command: - -- for example, use `viu` for image previews - -- will do nothing if `viu` isn't executable - extensions = { - -- neovim terminal only supports `viu` block output - ["png"] = { "viu", "-b" }, - ["jpg"] = { "ueberzug" }, - }, - -- if using `ueberzug` in the above extensions map - -- set the default image scaler, possible scalers: - -- false (none), "crop", "distort", "fit_contain", - -- "contain", "forced_cover", "cover" - -- https://github.com/seebye/ueberzug - ueberzug_scaler = "cover", - }, - }, - -- provider setup - files = { - -- previewer = "bat", -- uncomment to override previewer - -- (name from 'previewers' table) - -- set to 'false' to disable - prompt = 'Files❯ ', - multiprocess = true, -- run command in a separate process - git_icons = true, -- show git icons? - file_icons = true, -- show file icons? - color_icons = true, -- colorize file|git icons - -- path_shorten = 1, -- 'true' or number, shorten path? - -- executed command priority is 'cmd' (if exists) - -- otherwise auto-detect prioritizes `fd`:`rg`:`find` - -- default options are controlled by 'fd|rg|find|_opts' - -- NOTE: 'find -printf' requires GNU find - -- cmd = "find . -type f -printf '%P\n'", - find_opts = [[-type f -not -path '*/\.git/*' -printf '%P\n']], - rg_opts = "--color=never --files --hidden --follow -g '!.git'", - fd_opts = "--color=never --type f --hidden --follow --exclude .git", - actions = { - -- inherits from 'actions.files', here we can override - -- or set bind to 'false' to disable a default action - ["default"] = actions.file_edit, - -- custom actions are available too - ["ctrl-y"] = function(selected) print(selected[1]) end, - } - }, - git = { - files = { - prompt = 'GitFiles❯ ', - cmd = 'git ls-files --exclude-standard', - multiprocess = true, -- run command in a separate process - git_icons = true, -- show git icons? - file_icons = true, -- show file icons? - color_icons = true, -- colorize file|git icons - -- force display the cwd header line regardles of your current working - -- directory can also be used to hide the header when not wanted - -- show_cwd_header = true - }, - status = { - prompt = 'GitStatus❯ ', - cmd = "git status -s", - previewer = "git_diff", - file_icons = true, - git_icons = true, - color_icons = true, - actions = { - -- actions inherit from 'actions.files' and merge - ["right"] = { actions.git_unstage, actions.resume }, - ["left"] = { actions.git_stage, actions.resume }, - }, - }, - commits = { - prompt = 'Commits❯ ', - cmd = "git log --pretty=oneline --abbrev-commit --color", - preview = "git show --pretty='%Cred%H%n%Cblue%an%n%Cgreen%s' --color {1}", - actions = { - ["default"] = actions.git_checkout, - }, - }, - bcommits = { - prompt = 'BCommits❯ ', - cmd = "git log --pretty=oneline --abbrev-commit --color", - preview = "git show --pretty='%Cred%H%n%Cblue%an%n%Cgreen%s' --color {1}", - actions = { - ["default"] = actions.git_buf_edit, - ["ctrl-s"] = actions.git_buf_split, - ["ctrl-v"] = actions.git_buf_vsplit, - ["ctrl-t"] = actions.git_buf_tabedit, - }, - }, - branches = { - prompt = 'Branches❯ ', - cmd = "git branch --all --color", - preview = "git log --graph --pretty=oneline --abbrev-commit --color {1}", - actions = { - ["default"] = actions.git_switch, - }, - }, - stash = { - prompt = 'Stash> ', - cmd = "git --no-pager stash list", - preview = "git --no-pager stash show --patch --color {1}", - actions = { - ["default"] = actions.git_stash_apply, - ["ctrl-x"] = { actions.git_stash_drop, actions.resume }, - }, - fzf_opts = { - ["--no-multi"] = '', - ['--delimiter'] = "'[:]'", - }, - }, - icons = { - ["M"] = { icon = "M", color = "yellow" }, - ["D"] = { icon = "D", color = "red" }, - ["A"] = { icon = "A", color = "green" }, - ["R"] = { icon = "R", color = "yellow" }, - ["C"] = { icon = "C", color = "yellow" }, - ["T"] = { icon = "T", color = "magenta" }, - ["?"] = { icon = "?", color = "magenta" }, - -- override git icons? - -- ["M"] = { icon = "★", color = "red" }, - -- ["D"] = { icon = "✗", color = "red" }, - -- ["A"] = { icon = "+", color = "green" }, - }, - }, - grep = { - prompt = 'Rg❯ ', - input_prompt = 'Grep For❯ ', - multiprocess = true, -- run command in a separate process - git_icons = true, -- show git icons? - file_icons = true, -- show file icons? - color_icons = true, -- colorize file|git icons - -- executed command priority is 'cmd' (if exists) - -- otherwise auto-detect prioritizes `rg` over `grep` - -- default options are controlled by 'rg|grep_opts' - -- cmd = "rg --vimgrep", - grep_opts = "--binary-files=without-match --line-number --recursive --color=auto --perl-regexp", - rg_opts = "--column --line-number --no-heading --color=always --smart-case --max-columns=512", - -- set to 'true' to always parse globs in both 'grep' and 'live_grep' - -- search strings will be split using the 'glob_separator' and translated - -- to '--iglob=' arguments, requires 'rg' - -- can still be used when 'false' by calling 'live_grep_glob' directly - rg_glob = false, -- default to glob parsing? - glob_flag = "--iglob", -- for case sensitive globs use '--glob' - glob_separator = "%s%-%-", -- query separator pattern (lua): ' --' - -- advanced usage: for custom argument parsing define - -- 'rg_glob_fn' to return a pair: - -- first returned argument is the new search query - -- second returned argument are addtional rg flags - -- rg_glob_fn = function(query, opts) - -- ... - -- return new_query, flags - -- end, - actions = { - -- actions inherit from 'actions.files' and merge - -- this action toggles between 'grep' and 'live_grep' - ["ctrl-g"] = { actions.grep_lgrep } - }, - no_header = false, -- hide grep|cwd header? - no_header_i = false, -- hide interactive header? - }, - args = { - prompt = 'Args❯ ', - files_only = true, - -- actions inherit from 'actions.files' and merge - actions = { ["ctrl-x"] = { actions.arg_del, actions.resume } } - }, - oldfiles = { - prompt = 'History❯ ', - cwd_only = false, - stat_file = true, -- verify files exist on disk - include_current_session = false, -- include bufs from current session - }, - buffers = { - prompt = 'Buffers❯ ', - file_icons = true, -- show file icons? - color_icons = true, -- colorize file|git icons - sort_lastused = true, -- sort buffers() by last used - actions = { - -- actions inherit from 'actions.buffers' and merge - -- by supplying a table of functions we're telling - -- fzf-lua to not close the fzf window, this way we - -- can resume the buffers picker on the same window - -- eliminating an otherwise unaesthetic win "flash" - ["ctrl-x"] = { actions.buf_del, actions.resume }, - } - }, - tabs = { - prompt = 'Tabs❯ ', - tab_title = "Tab", - tab_marker = "<<", - file_icons = true, -- show file icons? - color_icons = true, -- colorize file|git icons - actions = { - -- actions inherit from 'actions.buffers' and merge - ["default"] = actions.buf_switch, - ["ctrl-x"] = { actions.buf_del, actions.resume }, - }, - fzf_opts = { - -- hide tabnr - ['--delimiter'] = "'[\\):]'", - ["--with-nth"] = '2..', - }, - }, - lines = { - previewer = "builtin", -- set to 'false' to disable - prompt = 'Lines❯ ', - show_unlisted = false, -- exclude 'help' buffers - no_term_buffers = true, -- exclude 'term' buffers - fzf_opts = { - -- do not include bufnr in fuzzy matching - -- tiebreak by line no. - ['--delimiter'] = "'[\\]:]'", - ["--nth"] = '2..', - ["--tiebreak"] = 'index', - }, - -- actions inherit from 'actions.buffers' and merge - actions = { - ["default"] = { actions.buf_edit_or_qf }, - ["alt-q"] = { actions.buf_sel_to_qf } - }, - }, - blines = { - previewer = "builtin", -- set to 'false' to disable - prompt = 'BLines❯ ', - show_unlisted = true, -- include 'help' buffers - no_term_buffers = false, -- include 'term' buffers - fzf_opts = { - -- hide filename, tiebreak by line no. - ['--delimiter'] = "'[\\]:]'", - ["--with-nth"] = '2..', - ["--tiebreak"] = 'index', - }, - -- actions inherit from 'actions.buffers' and merge - actions = { - ["default"] = { actions.buf_edit_or_qf }, - ["alt-q"] = { actions.buf_sel_to_qf } - }, - }, - tags = { - prompt = 'Tags❯ ', - ctags_file = "tags", - multiprocess = true, - file_icons = true, - git_icons = true, - color_icons = true, - -- 'tags_live_grep' options, `rg` prioritizes over `grep` - rg_opts = "--no-heading --color=always --smart-case", - grep_opts = "--color=auto --perl-regexp", - actions = { - -- actions inherit from 'actions.files' and merge - -- this action toggles between 'grep' and 'live_grep' - ["ctrl-g"] = { actions.grep_lgrep } - }, - no_header = false, -- hide grep|cwd header? - no_header_i = false, -- hide interactive header? - }, - btags = { - prompt = 'BTags❯ ', - ctags_file = "tags", - multiprocess = true, - file_icons = true, - git_icons = true, - color_icons = true, - rg_opts = "--no-heading --color=always", - grep_opts = "--color=auto --perl-regexp", - fzf_opts = { - ['--delimiter'] = "'[\\]:]'", - ["--with-nth"] = '2..', - ["--tiebreak"] = 'index', - }, - -- actions inherit from 'actions.files' - }, - colorschemes = { - prompt = 'Colorschemes❯ ', - live_preview = true, -- apply the colorscheme on preview? - actions = { ["default"] = actions.colorscheme, }, - winopts = { height = 0.55, width = 0.30, }, - post_reset_cb = function() - -- reset statusline highlights after - -- a live_preview of the colorscheme - -- require('feline').reset_highlights() - end, - }, - quickfix = { - file_icons = true, - git_icons = true, - }, - lsp = { - prompt_postfix = '❯ ', -- will be appended to the LSP label - -- to override use 'prompt' instead - cwd_only = false, -- LSP/diagnostics for cwd only? - async_or_timeout = 5000, -- timeout(ms) or 'true' for async calls - file_icons = true, - git_icons = false, - lsp_icons = true, - ui_select = true, -- use 'vim.ui.select' for code actions - symbol_style = 1, -- style for document/workspace symbols - -- false: disable, 1: icon+kind - -- 2: icon only, 3: kind only - -- NOTE: icons are extracted from - -- vim.lsp.protocol.CompletionItemKind - -- colorize using nvim-cmp's CmpItemKindXXX highlights - -- can also be set to 'TS' for treesitter highlights ('TSProperty', etc) - -- or 'false' to disable highlighting - symbol_hl_prefix = "CmpItemKind", - -- additional symbol formatting, works with or without style - symbol_fmt = function(s) return "["..s.."]" end, - severity = "hint", - icons = { - ["Error"] = { icon = "", color = "red" }, -- error - ["Warning"] = { icon = "", color = "yellow" }, -- warning - ["Information"] = { icon = "", color = "blue" }, -- info - ["Hint"] = { icon = "", color = "magenta" }, -- hint - }, - }, - -- uncomment to use the old help previewer which used a - -- minimized help window to generate the help tag preview - -- helptags = { previewer = "help_tags" }, - -- uncomment to use `man` command as native fzf previewer - -- (instead of using a neovim floating window) - -- manpages = { previewer = "man_native" }, - -- - -- optional override of file extension icon colors - -- available colors (terminal): - -- clear, bold, black, red, green, yellow - -- blue, magenta, cyan, grey, dark_grey, white - file_icon_colors = { - ["sh"] = "green", - }, - -- padding can help kitty term users with - -- double-width icon rendering - file_icon_padding = '', - -- uncomment if your terminal/font does not support unicode character - -- 'EN SPACE' (U+2002), the below sets it to 'NBSP' (U+00A0) instead - -- nbsp = '\xc2\xa0', -} diff --git a/nvim/lua/adam/gitsigns.lua b/nvim/lua/adam/gitsigns.lua deleted file mode 100644 index cb1e393..0000000 --- a/nvim/lua/adam/gitsigns.lua +++ /dev/null @@ -1,48 +0,0 @@ -local status_ok, gitsigns = pcall(require, "gitsigns") -if not status_ok then - return -end - -gitsigns.setup { - signs = { - add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, - change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, - delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, - topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, - changedelete = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = false, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - watch_gitdir = { - interval = 1000, - follow_files = true, - }, - attach_to_untracked = true, - current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' - delay = 1000, - ignore_whitespace = false, - }, - current_line_blame_formatter_opts = { - relative_time = false, - }, - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, - preview_config = { - -- Options passed to nvim_open_win - border = "single", - style = "minimal", - relative = "cursor", - row = 0, - col = 1, - }, - yadm = { - enable = false, - }, -} diff --git a/nvim/lua/adam/lint.lua b/nvim/lua/adam/lint.lua deleted file mode 100644 index d9ac2aa..0000000 --- a/nvim/lua/adam/lint.lua +++ /dev/null @@ -1,17 +0,0 @@ -require("lint").linters_by_ft = { - json = { "jsonlint" }, - html = { "djlint" }, - docker = { "hadolint" }, - markdown = { "markdownlint", "codespell" }, - jinja = { "markdownlint", "codespell" }, - jinja2 = { "markdownlint", "codespell" }, - yaml = { "actionlint", "yamllint" }, - python = { "ruff", "mypy", "flake8", "pydocstyle", "pylint" }, - javascript = { "jshint" }, -} - -vim.api.nvim_create_autocmd({ "BufWritePost" }, { - callback = function() - require("lint").try_lint() - end, -}) diff --git a/nvim/lua/adam/lsp.lua b/nvim/lua/adam/lsp.lua deleted file mode 100644 index f457c30..0000000 --- a/nvim/lua/adam/lsp.lua +++ /dev/null @@ -1,230 +0,0 @@ --- Language Server Protocol (LSP) Settings --- --- Turn off logging by default for LSP -vim.lsp.set_log_level("off") --- You can turn logging on with 'vim.lsp.set_log_level("debug")' --- mason setup -local lspconfig = require("lspconfig") - -require("mason").setup() -require("mason-lspconfig").setup({ - ensure_installed = { - "pyright", - "tailwindcss", - "ruff_lsp", - "bashls", - "prosemd_lsp", - "marksman", - "lua_ls", - "html", - "docker_compose_language_service", - "ruff_lsp", - "bashls", - "dockerls", - "jsonls", - "prosemd_lsp", - "rnix", - "tsserver", - "emmet_language_server", - "pyright", - "rust_analyzer", - "jedi_language_server", - "sqlls", - }, - automatic_installation = true, -}) - -require("mason-lspconfig").setup_handlers({ - function(server) - lspconfig[server].setup({}) - end, -}) --- 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) - --- map the following keys after the language server attaches to the current buffer -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", "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", "rn", vim.lsp.buf.rename, bufopts) - vim.keymap.set("n", "ca", vim.lsp.buf.code_action, bufopts) - vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts) -end - -local capabilities = require("cmp_nvim_lsp").default_capabilities() - --- 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 - -vim.diagnostic.config({ - virtual_text = false, - signs = { - active = signs, - }, - update_in_insert = true, - underline = true, - severity_sort = true, - float = { - focusable = true, - style = "minimal", - border = "rounded", - source = "always", - header = "", - prefix = "", - height = 16, - width = 80, - max_height = 32, - }, -}) - -vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = "single", - height = 32, - width = 80, - focusable = true, -}) - --- Language Server Configs - -local lsp_flags = { - debounce_text_changes = 150, -} - -require("lspconfig")["bashls"].setup({ - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, -}) - -require("lspconfig")["sqlls"].setup({ - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, - root_dir = function(fname) - return vim.loop.cwd() - end, -}) - -require("lspconfig")["dockerls"].setup({ - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, -}) - -require("lspconfig")["jsonls"].setup({ - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, -}) - -require("lspconfig")["prosemd_lsp"].setup({ - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, -}) - -require("lspconfig")["rnix"].setup({ - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, -}) - -require("lspconfig")["tsserver"].setup({ - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, -}) - -require("lspconfig")["html"].setup({ - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, -}) - -require("lspconfig")["emmet_language_server"].setup({ - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, -}) - -require("lspconfig").pyright.setup({ - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, - cmd = { "pyright-langserver", "--stdio" }, -}) - -require("lspconfig")["jedi_language_server"].setup({ - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, -}) - -require("lspconfig")["tailwindcss"].setup({ - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, - cmd = { "tailwindcss-language-server", "--stdio" }, -}) - -require("lspconfig")["marksman"].setup({ - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, - filetypes = { "markdown" }, -}) - -require("lspconfig")["rust_analyzer"].setup({ - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, - settings = { - ["rust-analyzer"] = {}, - }, -}) - -require("lspconfig")["lua_ls"].setup({ - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, - settings = { - Lua = { - runtime = { - version = "LuaJIT", - }, - diagnostics = { - globals = { "vim" }, - }, - workspace = { - library = vim.api.nvim_get_runtime_file("", true), - }, - telemetry = { - enable = false, - }, - }, - }, -}) diff --git a/nvim/lua/adam/lualine.lua b/nvim/lua/adam/lualine.lua deleted file mode 100644 index e4f0305..0000000 --- a/nvim/lua/adam/lualine.lua +++ /dev/null @@ -1,47 +0,0 @@ -require('lualine').setup { - options = { - theme = 'nightfly', - icons_enabled = true, - section_separators = { left = ' ', right = ' '}, - component_separators = { left = ' ', right = ' '}, - disabled_filetypes = {}, - always_divide_middle = true, - globalstatus = false, - }, - sections = { - lualine_a = {{'mode', fmt = function(str) return str:sub(1,1) end }}, - lualine_b = { - { - 'diagnostics', - colored = true, - symbols = {error = ' ', warn = ' ', info = '', hint = ''}, - always_visible = true, - sections = { 'error', 'warn'}, - update_in_insert = true, - }, - { - 'diff', - colored = true, - symbols = {added = ' ', modified = ' ', removed = ' '}, - }, - }, - lualine_c = { - { - 'branch', - colored = true, - icon = '' - }, - { - 'filename', - colored = true, - path = 3, - symbols = {modified = ' ', readonly = ' ', shorting_target = 4} - } - }, - lualine_x = {}, - lualine_y = {}, - lualine_z = {'progress', 'location'} - }, - tabline = {}, - extensions = {'fzf'} -} diff --git a/nvim/lua/adam/luasnip.lua b/nvim/lua/adam/luasnip.lua deleted file mode 100644 index e835677..0000000 --- a/nvim/lua/adam/luasnip.lua +++ /dev/null @@ -1 +0,0 @@ -require("luasnip.loaders.from_snipmate").lazy_load() diff --git a/nvim/lua/adam/pairs.lua b/nvim/lua/adam/pairs.lua deleted file mode 100644 index 577e571..0000000 --- a/nvim/lua/adam/pairs.lua +++ /dev/null @@ -1,33 +0,0 @@ --- Setup nvim-cmp. -local status_ok, npairs = pcall(require, "nvim-autopairs") -if not status_ok then - return -end - -npairs.setup { - check_ts = true, - ts_config = { - lua = { "string", "source" }, - javascript = { "string", "template_string" }, - java = false, - }, - disable_filetype = { "TelescopePrompt", "spectre_panel" }, - fast_wrap = { - map = "", - chars = { "{", "[", "(", '"', "'" }, - pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), - offset = 0, -- Offset from pattern match - end_key = "$", - keys = "qwertyuiopzxcvbnmasdfghjkl", - check_comma = true, - highlight = "PmenuSel", - highlight_grey = "LineNr", - }, -} - -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 = "" } }) diff --git a/nvim/lua/adam/plugins.lua b/nvim/lua/adam/plugins.lua deleted file mode 100644 index 93d251b..0000000 --- a/nvim/lua/adam/plugins.lua +++ /dev/null @@ -1,203 +0,0 @@ --- Plugin Management - -local fn = vim.fn - --- Automatically install packer -local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" -if fn.empty(fn.glob(install_path)) > 0 then - PACKER_BOOTSTRAP = fn.system({ - "git", - "clone", - "--depth", - "1", - "https://github.com/wbthomason/packer.nvim", - install_path, - }) - print("Installing packer close and reopen Neovim...") - vim.cmd([[packadd packer.nvim]]) -end - --- Autocommand that reloads neovim whenever you save the plugins.lua file -vim.cmd([[ - augroup packer_user_config - autocmd! - autocmd BufWritePost plugins.lua source | PackerSync - augroup end -]]) - --- Use a protected call so we don't error out on first use -local status_ok, packer = pcall(require, "packer") -if not status_ok then - return -end - --- Initialize Packer.nvim with a floating window display -packer.init({ - display = { - open_fn = function() - return require("packer.util").float({ border = "rounded" }) - end, - }, -}) - --- Plugin list -return packer.startup(function(use) - -- Packer manages itself - use({ - "wbthomason/packer.nvim", - "nvim-lua/popup.nvim", - "nvim-lua/plenary.nvim", - }) - use({ "nvim-tree/nvim-web-devicons" }) - - -- LSP configures the servers - -- Mason sets up the servers - use({ - "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", - "neovim/nvim-lspconfig", - run = ":MasonUpdate", - }) - - -- Trouble - use({ - "folke/trouble.nvim", - requires = "kyazdani42/nvim-web-devicons", - config = function() - require("trouble").setup({ - height = 5, -- height of the trouble list when position is top or bottom - width = 50, -- width of the list when position is left or right - icons = false, -- use devicons for filenames - indent_lines = false, -- add an indent guide below the fold icons - auto_open = false, -- automatically open the list when you have diagnostics - auto_close = false, -- automatically close the list when you have no diagnostics - }) - end, - }) - - -- Formatting - use({ - "stevearc/conform.nvim", - config = function() - require("conform").setup() - end, - }) - - -- Linting - use({ "mfussenegger/nvim-lint" }) - - -- Buffers in top bar - use({ - "romgrk/barbar.nvim", - requires = "nvim-web-devicons", - }) - - -- Status line in bottom bar - use({ "nvim-lualine/lualine.nvim" }) - - -- Greeter - use({ "goolord/alpha-nvim" }) - - -- Treesitter for syntax highlighting - use("nvim-treesitter/nvim-treesitter", { run = ":TSUpdate" }) - - -- Colormaps - use("sainnhe/everforest") - use("dracula/vim") - use("catppuccin/nvim") - use("sam4llis/nvim-tundra") - use("rebelot/kanagawa.nvim") - use("folke/tokyonight.nvim") - - -- Copilot - use({ "zbirenbaum/copilot.lua" }) - - -- Completion with CMP - use("hrsh7th/nvim-cmp") - use("hrsh7th/cmp-buffer") - use("hrsh7th/cmp-path") - use("hrsh7th/cmp-cmdline") - use("dmitmel/cmp-cmdline-history") - use("hrsh7th/cmp-emoji") - use("hrsh7th/cmp-latex-symbols") - use("uga-rosa/cmp-dictionary") - use("David-Kunz/cmp-npm") - use("hrsh7th/cmp-nvim-lsp") - use("amarakon/nvim-cmp-buffer-lines") - use({ - "zbirenbaum/copilot-cmp", - after = { "copilot.lua" }, - config = function() - require("copilot_cmp").setup() - end, - }) - - -- Snippets - use("saadparwaiz1/cmp_luasnip") - use("L3MON4D3/LuaSnip") - use("rafamadriz/friendly-snippets") - - -- Searching with Telescope - use("nvim-telescope/telescope.nvim") - use({ - "nvim-telescope/telescope-fzf-native.nvim", - run = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build", - }) - use({ "ptethng/telescope-makefile" }) - - -- Searching with Grepper - use({ "mhinz/vim-grepper" }) - - -- Buffer and window management - use({ "kevinhwang91/nvim-bqf", ft = "qf" }) - use({ "simeji/winresizer" }) - use({ "qpkorr/vim-bufkill" }) - - -- Text Editing - use("tpope/vim-commentary") - use("windwp/nvim-autopairs") - use("FooSoft/vim-argwrap") - use("mattn/emmet-vim") - use("tpope/vim-surround") - use("tpope/vim-repeat") - use("lewis6991/gitsigns.nvim") - use("farmergreg/vim-lastplace") - use("axelf4/vim-strip-trailing-whitespace") - use({ "mbbill/undotree" }) - use({ - "lukas-reineke/indent-blankline.nvim", - config = function() - -- Define a custom highlight group for indent lines - vim.api.nvim_set_hl(0, "CustomIndent", { fg = "#6272A4" }) - -- Setup indent-blankline with the custom highlight group - require("ibl").setup({ - indent = { - char = "┆", - highlight = { "CustomIndent" }, -- Using the custom highlight group - }, - }) - end, - }) - use({ "norcalli/nvim-colorizer.lua" }) - use({ "windwp/nvim-ts-autotag" }) - use({ "kana/vim-textobj-user" }) - - -- Text editing - Python - use("Vimjas/vim-python-pep8-indent") - use({ "bps/vim-textobj-python" }) - - --- Text editing - Markdown - use({ "coachshea/vim-textobj-markdown" }) - use("dhruvasagar/vim-table-mode") - use("dkarter/bullets.vim") - - --- Text editing - HTML - use({ "alvan/vim-closetag" }) - use({ "Glench/Vim-Jinja2-Syntax" }) - - use({ "mzlogin/vim-markdown-toc" }) - - if PACKER_BOOTSTRAP then - require("packer").sync() - end -end) diff --git a/nvim/lua/adam/signature.lua b/nvim/lua/adam/signature.lua deleted file mode 100644 index 5f55f1e..0000000 --- a/nvim/lua/adam/signature.lua +++ /dev/null @@ -1,53 +0,0 @@ -local cmp_status_ok, signature = pcall(require, "lsp_signature") -if not cmp_status_ok then - return -end - -signature.setup( - { - debug = false, -- set to true to enable debug logging - log_path = vim.fn.stdpath("cache") .. "/lsp_signature.log", -- log dir when debug is on - -- default is ~/.cache/nvim/lsp_signature.log - verbose = false, -- show debug line number - - bind = true, -- This is mandatory, otherwise border config won't get registered. - -- If you want to hook lspsaga or other signature handler, pls set to false - doc_lines = 10, - - floating_window = true, - - floating_window_above_cur_line = false, -- try to place the floating above the current line when possible Note: - -- will set to true when fully tested, set to false will use whichever side has more space - -- this setting will be helpful if you do not want the PUM and floating win overlap - - floating_window_off_x = 0, -- adjust float windows x position. - floating_window_off_y = -2, -- adjust float windows y position. e.g -2 move window up 2 lines; 2 move down 2 lines - - fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters - hint_enable = false, -- virtual hint enable - hint_scheme = "String", - hi_parameter = "LspSignatureActiveParameter", -- how your parameter will be highlight - max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down - -- to view the hiding contents - max_width = 80, -- max_width of signature floating_window, line will be wrapped if exceed max_width - handler_opts = { - border = "rounded" -- double, rounded, single, shadow, none - }, - - always_trigger = false, -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58 - - auto_close_after = nil, -- autoclose signature float win after x sec, disabled if nil. - extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","} - zindex = 200, -- by default it will be on top of all floating windows, set to <= 50 send it to bottom - - padding = '', -- character to pad on left and right of signature can be ' ', or '|' etc - - transparency = nil, -- disabled by default, allow floating win transparent value 1~100 - shadow_blend = 36, -- if you using shadow as border use this set the opacity - shadow_guibg = 'Black', -- if you using shadow as border use this set the color e.g. 'Green' or '#121315' - timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency - toggle_key = nil, -- toggle signature on and off in insert mode, e.g. toggle_key = '' - - select_signature_key = nil, -- cycle to next signature, e.g. '' function overloading - } -) diff --git a/nvim/lua/adam/telescope.lua b/nvim/lua/adam/telescope.lua deleted file mode 100644 index 54b4327..0000000 --- a/nvim/lua/adam/telescope.lua +++ /dev/null @@ -1,101 +0,0 @@ -local status_ok, telescope = pcall(require, "telescope") -if not status_ok then - return -end - -local actions = require("telescope.actions") - -telescope.setup({ - defaults = { - layout_config = { - width = 0.9, -- Adjust this value to make the Telescope window wider - preview_width = 0.6, -- Adjust this value to change the preview width - preview_cutoff = 10, -- Adjust this value to control when preview is cut off - }, - prompt_prefix = " ", - selection_caret = " ", - path_display = { "smart" }, - mappings = { - i = { - -- [""] = actions.cycle_history_next, - -- [""] = actions.cycle_history_prev, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - - [""] = actions.close, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - - [""] = actions.select_default, - [""] = actions.select_horizontal, - [""] = actions.select_vertical, - [""] = actions.select_tab, - - [""] = actions.preview_scrolling_up, - [""] = actions.preview_scrolling_down, - - [""] = actions.results_scrolling_up, - [""] = actions.results_scrolling_down, - - [""] = actions.toggle_selection + actions.move_selection_worse, - [""] = actions.toggle_selection + actions.move_selection_better, - [""] = actions.send_to_qflist + actions.open_qflist, - [""] = actions.send_selected_to_qflist + actions.open_qflist, - [""] = actions.complete_tag, - [""] = actions.which_key, -- keys from pressing - }, - - n = { - [""] = actions.close, - [""] = actions.select_default, - [""] = actions.select_horizontal, - [""] = actions.select_vertical, - [""] = actions.select_tab, - - [""] = actions.toggle_selection + actions.move_selection_worse, - [""] = actions.toggle_selection + actions.move_selection_better, - [""] = actions.send_to_qflist + actions.open_qflist, - [""] = actions.send_selected_to_qflist + actions.open_qflist, - - ["j"] = actions.move_selection_next, - ["k"] = actions.move_selection_previous, - ["H"] = actions.move_to_top, - ["M"] = actions.move_to_middle, - ["L"] = actions.move_to_bottom, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - ["gg"] = actions.move_to_top, - ["G"] = actions.move_to_bottom, - - [""] = actions.preview_scrolling_up, - [""] = actions.preview_scrolling_down, - - [""] = actions.results_scrolling_up, - [""] = actions.results_scrolling_down, - - ["?"] = actions.which_key, - }, - }, - }, - pickers = { - -- Default configuration for builtin pickers goes here: - -- picker_name = { - -- picker_config_key = value, - -- ... - -- } - -- Now the picker_config_key will be applied every time you call this - -- builtin picker - }, - extensions = { - fzf = { - fuzzy = true, -- false will only do exact matching - -- override_generic_sorter = true, -- override the generic sorter - -- override_file_sorter = true, -- override the file sorter - case_mode = "smart_case", -- or "ignore_case" or "respect_case" - }, - }, -}) -require("telescope").load_extension("fzf") diff --git a/nvim/lua/adam/treesitter.lua b/nvim/lua/adam/treesitter.lua deleted file mode 100644 index fbfca10..0000000 --- a/nvim/lua/adam/treesitter.lua +++ /dev/null @@ -1,21 +0,0 @@ -local status_ok, configs = pcall(require, "nvim-treesitter.configs") -if not status_ok then - return -end - -configs.setup({ - -- A list of parser names, or "all" - ensure_installed = { "c", "lua", "rust", "python", "html", "javascript", "bash" }, - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, - -- Automatically install missing parsers when entering buffer - -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = true, - highlight = { - -- `false` will disable the whole extension - enable = true, - disable = { "markdown" }, - }, -}) - -require("nvim-ts-autotag").setup() diff --git a/nvim/lua/adam/whichkey.lua b/nvim/lua/adam/whichkey.lua deleted file mode 100644 index 700fe28..0000000 --- a/nvim/lua/adam/whichkey.lua +++ /dev/null @@ -1,186 +0,0 @@ -local status_ok, which_key = pcall(require, "which-key") -if not status_ok then - return -end - -local setup = { - plugins = { - marks = true, -- shows a list of your marks on ' and ` - registers = true, -- shows your registers on " in NORMAL or in INSERT mode - spelling = { - enabled = false, -- enabling this will show WhichKey when pressing z= to select spelling suggestions - suggestions = 20, -- how many suggestions should be shown in the list? - }, - -- the presets plugin, adds help for a bunch of default keybindings in Neovim - -- No actual key bindings are created - presets = { - operators = true, -- adds help for operators like d, y, ... and registers them for motion / text object completion - motions = true, -- adds help for motions - text_objects = true, -- help for text objects triggered after entering an operator - windows = true, -- default bindings on - nav = true, -- misc bindings to work with windows - z = true, -- bindings for folds, spelling and others prefixed with z - g = true, -- bindings for prefixed with g - }, - }, - -- add operators that will trigger motion and text object completion - -- to enable all native operators, set the preset / operators plugin above - -- operators = { gc = "Comments" }, - key_labels = { - -- override the label used to display some keys. It doesn't effect WK in any other way. - -- For example: - -- [""] = "SPC", - -- [""] = "RET", - -- [""] = "TAB", - }, - icons = { - breadcrumb = "»", -- symbol used in the command line area that shows your active key combo - separator = "➜", -- symbol used between a key and it's label - group = "+", -- symbol prepended to a group - }, - popup_mappings = { - scroll_down = "", -- binding to scroll down inside the popup - scroll_up = "", -- binding to scroll up inside the popup - }, - window = { - border = "none", -- none, single, double, shadow - position = "bottom", -- bottom, top - margin = { 0, 0, 0, 0 }, -- extra window margin [top, right, bottom, left] - padding = { 0, 1, 0, 1 }, -- extra window padding [top, right, bottom, left] - winblend = 1, - }, - layout = { - height = { min = 3, max = 6 }, -- min and max height of the columns - width = { min = 20, max = 50 }, -- min and max width of the columns - spacing = 3, -- spacing between columns - align = "left", -- align columns left, center or right - }, - ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label - hidden = { "", "", "", "", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate - show_help = false, -- show help message on the command line when the popup is visible - triggers = "auto", -- automatically setup triggers - -- triggers = {""} -- or specify a list manually - triggers_blacklist = { - -- list of mode / prefixes that should never be hooked by WhichKey - -- this is mostly relevant for key maps that start with a native binding - -- most people should not need to change this - i = { "j", "k" }, - v = { "j", "k" }, - }, -} - -local opts = { - mode = "n", -- NORMAL mode - prefix = "", - buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings - silent = true, -- use `silent` when creating keymaps - noremap = true, -- use `noremap` when creating keymaps - nowait = true, -- use `nowait` when creating keymaps -} - -local mappings = { - -- ["b"] = { - -- "lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{previewer = false})", - -- "Buffers", - -- }, - ["e"] = { "NvimTreeToggle", "Explorer" }, - ["w"] = { "w!", "Save" }, - ["q"] = { "q!", "Quit" }, - ["c"] = { "Bdelete!", "Close Buffer" }, - ["h"] = { "nohlsearch", "No Highlight" }, - ["f"] = { - "lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})", - "Find files", - }, - ["F"] = { "Telescope live_grep theme=ivy", "Find Text" }, - ["P"] = { "lua require('telescope').extensions.projects.projects()", "Projects" }, - - p = { - name = "Packer", - c = { "PackerCompile", "Compile" }, - i = { "PackerInstall", "Install" }, - s = { "PackerSync", "Sync" }, - S = { "PackerStatus", "Status" }, - u = { "PackerUpdate", "Update" }, - }, - - g = { - name = "Git", - g = { "lua _LAZYGIT_TOGGLE()", "Lazygit" }, - j = { "lua require 'gitsigns'.next_hunk()", "Next Hunk" }, - k = { "lua require 'gitsigns'.prev_hunk()", "Prev Hunk" }, - l = { "lua require 'gitsigns'.blame_line()", "Blame" }, - p = { "lua require 'gitsigns'.preview_hunk()", "Preview Hunk" }, - r = { "lua require 'gitsigns'.reset_hunk()", "Reset Hunk" }, - R = { "lua require 'gitsigns'.reset_buffer()", "Reset Buffer" }, - s = { "lua require 'gitsigns'.stage_hunk()", "Stage Hunk" }, - u = { - "lua require 'gitsigns'.undo_stage_hunk()", - "Undo Stage Hunk", - }, - o = { "Telescope git_status", "Open changed file" }, - b = { "Telescope git_branches", "Checkout branch" }, - c = { "Telescope git_commits", "Checkout commit" }, - d = { - "Gitsigns diffthis HEAD", - "Diff", - }, - }, - - l = { - name = "LSP", - a = { "lua vim.lsp.buf.code_action()", "Code Action" }, - d = { - "Telescope lsp_document_diagnostics", - "Document Diagnostics", - }, - w = { - "Telescope lsp_workspace_diagnostics", - "Workspace Diagnostics", - }, - f = { "lua vim.lsp.buf.format{async=true}", "Format" }, - i = { "LspInfo", "Info" }, - I = { "LspInstallInfo", "Installer Info" }, - j = { - "lua vim.lsp.diagnostic.goto_next()", - "Next Diagnostic", - }, - k = { - "lua vim.lsp.diagnostic.goto_prev()", - "Prev Diagnostic", - }, - l = { "lua vim.lsp.codelens.run()", "CodeLens Action" }, - q = { "lua vim.lsp.diagnostic.set_loclist()", "Quickfix" }, - r = { "lua vim.lsp.buf.rename()", "Rename" }, - s = { "Telescope lsp_document_symbols", "Document Symbols" }, - S = { - "Telescope lsp_dynamic_workspace_symbols", - "Workspace Symbols", - }, - }, - s = { - name = "Search", - b = { "Telescope git_branches", "Checkout branch" }, - c = { "Telescope colorscheme", "Colorscheme" }, - h = { "Telescope help_tags", "Find Help" }, - M = { "Telescope man_pages", "Man Pages" }, - r = { "Telescope oldfiles", "Open Recent File" }, - R = { "Telescope registers", "Registers" }, - k = { "Telescope keymaps", "Keymaps" }, - C = { "Telescope commands", "Commands" }, - }, - - t = { - name = "Terminal", - n = { "lua _NODE_TOGGLE()", "Node" }, - u = { "lua _NCDU_TOGGLE()", "NCDU" }, - t = { "lua _HTOP_TOGGLE()", "Htop" }, - p = { "lua _PYTHON_TOGGLE()", "Python" }, - f = { "ToggleTerm direction=float", "Float" }, - h = { "ToggleTerm size=10 direction=horizontal", "Horizontal" }, - v = { "ToggleTerm size=80 direction=vertical", "Vertical" }, - }, -} - -which_key.setup(setup) -which_key.register(mappings, opts) diff --git a/nvim/lua/adam/keys.lua b/nvim/lua/config/keymaps.lua similarity index 95% rename from nvim/lua/adam/keys.lua rename to nvim/lua/config/keymaps.lua index 80f8be6..2205647 100644 --- a/nvim/lua/adam/keys.lua +++ b/nvim/lua/config/keymaps.lua @@ -6,8 +6,9 @@ local km = vim.api.nvim_set_keymap -- leader km("n", ",", "", opts) -vim.g.mapleader = "," -vim.g.maplocalleader = "," + +-- open file under cursor in new tab +km("n", "f", ":vsplit | ObsidianFollowLink", opts) km("n", "a", ":ArgWrap", opts) km("n", "c", ":Telescope find_files cwd=~/.nb/home", opts) @@ -64,8 +65,8 @@ vim.cmd("command Q quit") vim.cmd("command Wq write | quit!") --- stay in visual mode when indenting -km("v", "<", "", ">gv", opts) +km("v", "<", "< gv", opts) +km("v", ">", "> gv", opts) -- move around splits with ctrl-[hjkl] in normal mode km("n", "", "j", opts) diff --git a/nvim/lua/config/lazy.lua b/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..f5a25d5 --- /dev/null +++ b/nvim/lua/config/lazy.lua @@ -0,0 +1,187 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + }) +end +vim.opt.rtp:prepend(vim.env.LAZY or lazypath) + +opts = { + root = vim.fn.stdpath("data") .. "/lazy", -- directory where plugins will be installed + defaults = { + lazy = false, -- should plugins be lazy-loaded? + version = nil, + -- default `cond` you can use to globally disable a lot of plugins + -- when running inside vscode for example + cond = nil, ---@type boolean|fun(self:LazyPlugin):boolean|nil + -- version = "*", -- enable this to try installing the latest stable versions of plugins + }, + -- leave nil when passing the spec as the first argument to setup() + spec = nil, ---@type LazySpec + lockfile = vim.fn.stdpath("config") .. "/lazy-lock.json", -- lockfile generated after running update. + concurrency = jit.os:find("Windows") and (vim.loop.available_parallelism() * 2) or nil, ---@type number limit the maximum amount of concurrent tasks + git = { + -- defaults for the `Lazy log` command + -- log = { "-10" }, -- show the last 10 commits + log = { "-8" }, -- show commits from the last 3 days + timeout = 120, -- kill processes that take more than 2 minutes + url_format = "https://github.com/%s.git", + -- lazy.nvim requires git >=2.19.0. If you really want to use lazy with an older version, + -- then set the below to false. This should work, but is NOT supported and will + -- increase downloads a lot. + filter = true, + }, + dev = { + ---@type string | fun(plugin: LazyPlugin): string directory where you store your local plugin projects + path = "~/projects", + ---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub + patterns = {}, -- For example {"folke"} + fallback = false, -- Fallback to git when local plugin doesn't exist + }, + install = { + -- install missing plugins on startup. This doesn't increase startup time. + missing = true, + -- try to load one of these colorschemes when starting an installation during startup + colorscheme = { "dracula" }, + }, + ui = { + -- a number <1 is a percentage., >1 is a fixed size + size = { width = 0.8, height = 0.8 }, + wrap = true, -- wrap the lines in the ui + -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|. + border = "none", + title = nil, ---@type string only works when border is not "none" + title_pos = "center", ---@type "center" | "left" | "right" + -- Show pills on top of the Lazy window + pills = true, ---@type boolean + icons = { + cmd = " ", + config = "", + event = "", + ft = " ", + init = " ", + import = " ", + keys = " ", + lazy = "󰒲 ", + loaded = "●", + not_loaded = "○", + plugin = " ", + runtime = " ", + require = "󰢱 ", + source = " ", + start = "", + task = "✔ ", + list = { + "●", + "➜", + "★", + "‒", + }, + }, + -- leave nil, to automatically select a browser depending on your OS. + -- If you want to use a specific browser, you can define it here + browser = nil, ---@type string? + throttle = 20, -- how frequently should the ui process render events + custom_keys = { + -- You can define custom key maps here. If present, the description will + -- be shown in the help menu. + -- To disable one of the defaults, set it to false. + + ["l"] = { + function(plugin) + require("lazy.util").float_term({ "lazygit", "log" }, { + cwd = plugin.dir, + }) + end, + desc = "Open lazygit log", + }, + + ["t"] = { + function(plugin) + require("lazy.util").float_term(nil, { + cwd = plugin.dir, + }) + end, + desc = "Open terminal in plugin dir", + }, + }, + }, + diff = { + -- diff command can be one of: + -- * browser: opens the github compare view. Note that this is always mapped to as well, + -- so you can have a different command for diff + -- * git: will run git diff and open a buffer with filetype git + -- * terminal_git: will open a pseudo terminal with git diff + -- * diffview.nvim: will open Diffview to show the diff + cmd = "git", + }, + checker = { + -- automatically check for plugin updates + enabled = true, + concurrency = nil, ---@type number? set to 1 to check for updates very slowly + notify = false, -- get a notification when new updates are found + frequency = 3600, -- check for updates every hour + check_pinned = false, -- check for pinned packages that can't be updated + }, + change_detection = { + -- automatically check for config file changes and reload the ui + enabled = true, + -- get a notification when changes are found + notify = false, + }, + performance = { + cache = { + enabled = true, + }, + reset_packpath = true, -- reset the package path to improve startup time + rtp = { + reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory + ---@type string[] + paths = {}, -- add any custom paths here that you want to includes in the rtp + ---@type string[] list any plugins you want to disable here + disabled_plugins = { + -- "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + -- "tarPlugin", + -- "tohtml", + -- "tutor", + -- "zipPlugin", + }, + }, + }, + -- lazy can generate helptags from the headings in markdown readme files, + -- so :help works even for plugins that don't have vim docs. + -- when the readme opens with :help it will be correctly displayed as markdown + readme = { + enabled = true, + root = vim.fn.stdpath("state") .. "/lazy/readme", + files = { "README.md", "lua/**/README.md" }, + -- only generate markdown helptags for plugins that dont have docs + skip_if_doc_exists = true, + }, + state = vim.fn.stdpath("state") .. "/lazy/state.json", -- state info for checker and other things + build = { + -- Plugins can provide a `build.lua` file that will be executed when the plugin is installed + -- or updated. When the plugin spec also has a `build` command, the plugin's `build.lua` not be + -- executed. In this case, a warning message will be shown. + warn_on_override = true, + }, + -- Enable profiling of lazy.nvim. This will add some overhead, + -- so only enable this when you are debugging lazy.nvim + profiling = { + -- Enables extra stats on the debug tab related to the loader cache. + -- Additionally gathers stats about all package.loaders + loader = false, + -- Track each new require in the Lazy profiling tab + require = false, + }, +} + +require("lazy").setup("plugins", opts) diff --git a/nvim/lua/adam/options.lua b/nvim/lua/config/options.lua similarity index 88% rename from nvim/lua/adam/options.lua rename to nvim/lua/config/options.lua index 633a406..5c39920 100644 --- a/nvim/lua/adam/options.lua +++ b/nvim/lua/config/options.lua @@ -1,5 +1,8 @@ -- Options +vim.g.mapleader = "," +vim.g.maplocalleader = "," + -- File Handling Options -- Disable backup files vim.opt.backup = false @@ -161,7 +164,7 @@ vim.g["vim_markdown_no_default_key_mappings"] = 1 -- Co-pilot Plugin Settings -- Set the path to the Node.js executable for Co-pilot vim.g["copilot_node_command"] = "/Users/adam/dotfiles/nvm/versions/node/v16.17.0/bin/node" --- + -- Undotree Plugin Settings -- Set undotree to focus when toggled vim.g["undotree_SetFocusWhenToggle"] = 1 @@ -169,3 +172,24 @@ vim.g["undotree_SetFocusWhenToggle"] = 1 vim.g["undotree_DiffAutoOpen"] = 0 -- Use short indicators in the undotree vim.g["undotree_ShortIndicators"] = 1 + +-- Misc +-- create directories when needed, when saving a file +vim.api.nvim_create_autocmd("BufWritePre", { + group = vim.api.nvim_create_augroup("better_backup", { clear = true }), + callback = function(event) + local file = vim.loop.fs_realpath(event.match) or event.match + local backup = vim.fn.fnamemodify(file, ":p:~:h") + backup = backup:gsub("[/\\]", "%%") + vim.go.backupext = backup + end, +}) + +-- close quickfix with q +vim.cmd([[ + autocmd FileType qf nnoremap q :close +]]) + +vim.cmd([[ + command! -nargs=1 Tags execute 'grep -R "\- ' . . '" . > /tmp/greptags.txt' | execute 'cfile /tmp/greptags.txt' | copen +]]) diff --git a/nvim/lua/plugins/autopairs.lua b/nvim/lua/plugins/autopairs.lua new file mode 100644 index 0000000..5540c79 --- /dev/null +++ b/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,43 @@ +return { + { + + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = {}, + config = function() + -- Setup nvim-cmp. + local status_ok, npairs = pcall(require, "nvim-autopairs") + if not status_ok then + return + end + + npairs.setup({ + check_ts = true, + ts_config = { + lua = { "string", "source" }, + javascript = { "string", "template_string" }, + java = false, + }, + disable_filetype = { "TelescopePrompt", "spectre_panel" }, + fast_wrap = { + map = "", + chars = { "{", "[", "(", '"', "'" }, + pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), + offset = 0, -- Offset from pattern match + end_key = "$", + keys = "qwertyuiopzxcvbnmasdfghjkl", + check_comma = true, + highlight = "PmenuSel", + highlight_grey = "LineNr", + }, + }) + + 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 = "" } })) + end, + }, +} diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..1155232 --- /dev/null +++ b/nvim/lua/plugins/cmp.lua @@ -0,0 +1,160 @@ +---@diagnostic disable: missing-fields + +return { + { + "vrslev/cmp-pypi", + dependencies = { "nvim-lua/plenary.nvim" }, + ft = "toml", + }, + { + "hrsh7th/nvim-cmp", + event = { "BufReadPost", "BufNewFile" }, + dependencies = { + "L3MON4D3/LuaSnip", + "dmitmel/cmp-cmdline-history", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-cmdline", + "hrsh7th/cmp-emoji", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-nvim-lsp-signature-help", + "hrsh7th/cmp-path", + "onsails/lspkind.nvim", + "rafamadriz/friendly-snippets", + "saadparwaiz1/cmp_luasnip", + "uga-rosa/cmp-dictionary", + "windwp/nvim-autopairs", + "windwp/nvim-ts-autotag", + "davidsierradz/cmp-conventionalcommits", + "vrslev/cmp-pypi", + }, + config = function() + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + local cmp = require("cmp") + local luasnip = require("luasnip") + local lspkind = require("lspkind") + + require("cmp_dictionary").setup({ + paths = { "/usr/share/dict/words" }, + exact_length = 2, + first_case_insensitive = true, + document = { + enabled = true, + command = { "wn", "${label}", "-over" }, + }, + }) + + require("nvim-autopairs").setup() + + -- Integrate nvim-autopairs with cmp + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + + -- Load snippets + require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip/loaders/from_snipmate").load({ paths = "~/dotfiles/nvim/snippets" }) + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping(function() + if cmp.visible() then + cmp.select_prev_item() + else + cmp.complete() + end + end, { "i", "c" }), + [""] = cmp.mapping(function() + if cmp.visible() then + cmp.select_next_item() + else + cmp.complete() + end + end, { "i", "c" }), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + -- sources for autocompletion + sources = cmp.config.sources({ + { name = "nvim_lsp_signature_help" }, + { name = "copilot", max_item_count = 2 }, + { name = "luasnip", max_item_count = 3 }, + { name = "nvim_lsp", max_item_count = 5 }, + { name = "path", max_item_count = 5 }, + { name = "buffer", max_item_count = 5 }, + { name = "emoji", max_item_count = 5 }, + { name = "latex_symbols", max_item_count = 5 }, + { name = "npm", max_item_count = 5 }, + { name = "dictionary", max_item_count = 5, keyword_length = 3 }, + { name = "buffer-lines", option = { max_item_count = 2, words = true, comments = true } }, + { name = "pypi", keyword_length = 4 }, + }), + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }, + formatting = { + fields = { "abbr", "kind", "menu" }, + expandable_indicator = true, + format = lspkind.cmp_format({ + mode = "symbol", + maxwidth = 50, + ellipsis_char = "...", + symbol_map = { + Copilot = "", + }, + menu = { + nvim_lsp = "[LSP]", + luasnip = "[Snip]", + path = "[Path]", + buffer = "[Buff]", + dictionary = "[Dict]", + copilot = "[AI]", + conventionalcommits = "[Git]", + }, + }), + }, + experimental = { + ghost_text = true, + }, + }) + + -- special filetypes + cmp.setup.filetype("gitcommit", { + sources = cmp.config.sources({ + { name = "conventionalcommits" }, + -- Add more sources specific to gitcommit or modify as needed + { name = "buffer", max_item_count = 5 }, + { name = "emoji", max_item_count = 5 }, + -- You can mix and match sources as per the requirements of the gitcommit filetype + }), + }) + end, + }, +} diff --git a/nvim/lua/plugins/colorscheme.lua b/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..a9b06cf --- /dev/null +++ b/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,24 @@ +return { + { + "dracula/vim", + priority = 1000, + lazy = false, + config = function() + vim.cmd([[colorscheme dracula]]) + vim.cmd([[hi! link SpellBad ErrorMsg]]) + end, + }, + { + "norcalli/nvim-colorizer.lua", + config = function() + require("colorizer").setup({ + "css", + "javascript", + html = { + mode = "foreground", + }, + }) + end, + + } +} diff --git a/nvim/lua/plugins/copilot.lua b/nvim/lua/plugins/copilot.lua new file mode 100644 index 0000000..8c58e4f --- /dev/null +++ b/nvim/lua/plugins/copilot.lua @@ -0,0 +1,62 @@ +return { + { + + "zbirenbaum/copilot.lua", + event = { "BufEnter" }, + config = function() + require("copilot").setup({ + panel = { + enabled = false, + auto_refresh = true, + keymap = { + jump_prev = "[[", + jump_next = "]]", + accept = "", + refresh = "gr", + open = "", + }, + layout = { + position = "bottom", -- | top | left | right + ratio = 0.4, + event = { "BufEnter" }, + }, + }, + suggestion = { + enabled = false, + auto_trigger = false, + debounce = 75, + keymap = { + accept = "", + accept_word = false, + accept_line = false, + next = "", + prev = "", + dismiss = "", + }, + }, + filetypes = { + python = true, + markdown = true, + yaml = true, + help = false, + gitcommit = false, + gitrebase = false, + hgcommit = false, + svn = false, + cvs = false, + ["*"] = true, + }, + copilot_node_command = "/Users/adam/.nix-profile/bin/node", + server_opts_overrides = {}, + }) + end + }, + { + "zbirenbaum/copilot-cmp", + event = { "BufEnter" }, + dependencies = { "zbirenbaum/copilot.lua" }, + config = function() + require("copilot_cmp").setup() + end, + }, +} diff --git a/nvim/lua/plugins/formatting.lua b/nvim/lua/plugins/formatting.lua new file mode 100644 index 0000000..3400cfb --- /dev/null +++ b/nvim/lua/plugins/formatting.lua @@ -0,0 +1,63 @@ +return { + { + + "stevearc/conform.nvim", + config = function() + require("conform").setup({ + notify_on_error = true, + formatters_by_ft = { + bash = { "beautysh", "shellharden" }, + sh = { "beautysh", "shellharden" }, + html = { "djlintJinja", "prettier" }, + jinja = { "djlintJinja" }, + json = { "jq" }, + lua = { "stylua" }, + go = { "gofmt" }, + -- markdown = { "mdformat" }, + python = { "isort", "ruff_format", "ruff_lint" }, + javascript = { "prettier" }, + css = { "stylelint" }, + yaml = { "yamlfix" }, + sql = { "sql_formatter" }, + ["*"] = { + "codespell", + "trim_newlines", + -- "trim_whitespace" + }, + }, + }) + + -- setup format on save + vim.api.nvim_create_autocmd("BufWritePre", { + pattern = "*", + callback = function(args) + require("conform").format({ + bufnr = args.buf, + quiet = false, + lsp_fallback = false, + timeout_ms = 2000, + }) + end, + }) + + require("conform").formatters.djlintJinja = { + command = "djlint", + args = { + "--reformat", + "--profile", + "jinja", + "-", + }, + } + + require("conform").formatters.beautysh = { + command = "beautysh", + args = { + "--indent-size", + "2", + "-", + }, + } + end, + }, +} diff --git a/nvim/lua/plugins/linting.lua b/nvim/lua/plugins/linting.lua new file mode 100644 index 0000000..21b112d --- /dev/null +++ b/nvim/lua/plugins/linting.lua @@ -0,0 +1,25 @@ +return { + { + + "mfussenegger/nvim-lint", + event = "BufEnter", + config = function() + require("lint").linters_by_ft = { + json = { "jsonlint" }, + html = { "djlint" }, + docker = { "hadolint" }, + markdown = { "markdownlint", "codespell" }, + jinja = { "markdownlint", "codespell" }, + jinja2 = { "markdownlint", "codespell" }, + yaml = { "actionlint", "yamllint" }, + python = { "ruff", "mypy", "flake8", "pydocstyle", "pylint" }, + javascript = { "jshint" }, + } + vim.api.nvim_create_autocmd({ "BufWritePost" }, { + callback = function() + require("lint").try_lint() + end, + }) + end, + }, +} diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..003324c --- /dev/null +++ b/nvim/lua/plugins/lsp.lua @@ -0,0 +1,248 @@ +return { + { + "williamboman/mason.nvim", + }, + { + "williamboman/mason-lspconfig.nvim", + }, + { + "neovim/nvim-lspconfig", + dependencies = { + { + "hrsh7th/cmp-cmdline", + "dmitmel/cmp-cmdline-history", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + }, + }, + config = function() + -- Language Server Protocol (LSP) Settings + -- + -- Turn off logging by default for LSP + vim.lsp.set_log_level("off") + -- You can turn logging on with 'vim.lsp.set_log_level("debug")' + -- mason setup + local lspconfig = require("lspconfig") + + require("mason").setup() + require("mason-lspconfig").setup({ + ensure_installed = { + "pyright", + "tailwindcss", + "ruff_lsp", + "bashls", + "prosemd_lsp", + "marksman", + "lua_ls", + "html", + "docker_compose_language_service", + "ruff_lsp", + "bashls", + "dockerls", + "jsonls", + "prosemd_lsp", + "rnix", + "tsserver", + "emmet_language_server", + "pyright", + "rust_analyzer", + "jedi_language_server", + "sqlls", + }, + automatic_installation = true, + }) + + require("mason-lspconfig").setup_handlers({ + function(server) + lspconfig[server].setup({}) + end, + }) + + -- cmp commandline + local cmp = require("cmp") + local lspkind = require("lspkind") + cmp.setup.cmdline(":", { + sources = { + { name = "cmdline", max_item_count = 3 }, + { name = "cmdline_history", max_item_count = 5 }, + { name = "buffer", max_item_count = 3 }, + }, + -- Enable pictogram icons for lsp/autocompletion + formatting = { + expandable_indicator = true, + format = lspkind.cmp_format({ + mode = "symbol_text", + maxwidth = 50, + ellipsis_char = "...", + menu = { + cmdline_history = "[Hist]", + cmdline = "[CmdL]", + buffer = "[Buff]", + }, + }), + }, + }) + -- `/` cmdline setup. + cmp.setup.cmdline("/", { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, + }) + + -- 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 + + vim.diagnostic.config({ + virtual_text = false, + signs = { + active = signs, + }, + update_in_insert = true, + underline = true, + severity_sort = true, + float = { + focusable = true, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + height = 16, + width = 80, + max_height = 32, + }, + }) + + -- 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 + + -- On Attach + local on_attach = function(client, bufnr) + local bufopts = { noremap = true, silent = true, buffer = bufnr } + -- map the following keys after the language server attaches to the current buffer + 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", "rn", vim.lsp.buf.rename, bufopts) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, bufopts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts) + end + + -- Capabilities + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) + + -- Handlers + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { + border = "single", + height = 32, + width = 80, + focusable = true, + close_events = { "InsertEnter", "FocusLost" }, + }) + + vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { + border = "rounded", + focusable = false, + close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" }, + }) + + -- Flags + local lsp_flags = { + debounce_text_changes = 150, + } + + -- Servers + local servers = { + bashls = {}, + dockerls = {}, + jsonls = {}, + prosemd_lsp = {}, + ltex = { + filetypes = { "markdown" }, + settings = { + ltex = { + enabled = { "markdown" }, + language = { "en-NZ" }, + }, + }, + }, + emmet_language_server = {}, + jedi_language_server = {}, + html = {}, + lua_ls = { + settings = { + Lua = { + runtime = { + version = "LuaJIT", + }, + diagnostics = { + globals = { "vim" }, + }, + workspace = { + library = vim.api.nvim_get_runtime_file("", true), + checkThirdParty = false, + }, + telemetry = { + enable = false, + }, + }, + }, + }, + marksman = { + filetypes = { "markdown" }, + }, + rnix = {}, + rust_analyzer = { + settings = { + ["rust-analyzer"] = {}, + }, + }, + pyright = { + cmd = { "pyright-langserver", "--stdio" }, + }, + tsserver = {}, + tailwindcss = { + cmd = { "tailwindcss-language-server", "--stdio" }, + }, + sqlls = { + root_dir = function(fname) + return vim.loop.cwd() + end, + }, + } + 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 + end, + }, +} diff --git a/nvim/lua/plugins/noice.lua b/nvim/lua/plugins/noice.lua new file mode 100644 index 0000000..8c600e8 --- /dev/null +++ b/nvim/lua/plugins/noice.lua @@ -0,0 +1,36 @@ +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, + }, + lsp = { + progress = { + enabled = false, + }, + }, + presets = { + bottom_search = true, + 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 new file mode 100644 index 0000000..e00712d --- /dev/null +++ b/nvim/lua/plugins/obsidian.lua @@ -0,0 +1,49 @@ +return { + "epwalsh/obsidian.nvim", + version = "*", + lazy = true, + ft = "markdown", + dependencies = { + "nvim-lua/plenary.nvim", + }, + opts = {}, + config = function() + require("obsidian").setup({ + workspaces = { + { + name = "personal", + path = "~/personal/para", + }, + }, + completion = { + prepend_note_path = true, + }, + ui = { + enable = false, + bullets = { char = "•", hl_group = "ObsidianBullet" }, + checkboxes = { + -- NOTE: the 'char' value has to be a single character, and the highlight groups are defined below. + [" "] = { char = "󰄱", hl_group = "ObsidianTodo" }, + ["x"] = { char = "", hl_group = "ObsidianDone" }, + [">"] = { char = "", hl_group = "ObsidianRightArrow" }, + ["~"] = { char = "󰰱", hl_group = "ObsidianTilde" }, + -- Replace the above with this if you don't have a patched font: + -- [" "] = { char = "☐", hl_group = "ObsidianTodo" }, + -- ["x"] = { char = "✔", hl_group = "ObsidianDone" }, + + -- You can also add more custom ones... + }, + }, + daily_notes = { + -- Optional, if you keep daily notes in a separate directory. + folder = "day", + -- Optional, if you want to change the date format for the ID of daily notes. + date_format = "%Y-%m-%d", + -- Optional, if you want to change the date format of the default alias of daily notes. + alias_format = "%B %-d, %Y", + -- Optional, if you want to automatically insert a template from your template directory like 'daily.md' + template = nil, + }, + }) + end, +} diff --git a/nvim/lua/plugins/oil.lua b/nvim/lua/plugins/oil.lua new file mode 100644 index 0000000..a35f6b5 --- /dev/null +++ b/nvim/lua/plugins/oil.lua @@ -0,0 +1,161 @@ +return { + "stevearc/oil.nvim", + config = function() + require("oil").setup({ + -- Oil will take over directory buffers (e.g. `vim .` or `:e src/`) + -- Set to false if you still want to use netrw. + default_file_explorer = true, + -- Id is automatically added at the beginning, and name at the end + -- See :help oil-columns + columns = { + "icon", + -- "permissions", + -- "size", + -- "mtime", + }, + -- Buffer-local options to use for oil buffers + buf_options = { + buflisted = false, + bufhidden = "hide", + }, + -- Window-local options to use for oil buffers + win_options = { + wrap = false, + signcolumn = "no", + cursorcolumn = false, + foldcolumn = "0", + spell = false, + list = false, + conceallevel = 3, + concealcursor = "nvic", + }, + -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash) + delete_to_trash = false, + -- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits) + skip_confirm_for_simple_edits = false, + -- Selecting a new/moved/renamed file or directory will prompt you to save changes first + -- (:help prompt_save_on_select_new_entry) + prompt_save_on_select_new_entry = true, + -- Oil will automatically delete hidden buffers after this delay + -- You can set the delay to false to disable cleanup entirely + -- Note that the cleanup process only starts when none of the oil buffers are currently displayed + cleanup_delay_ms = 2000, + -- Set to true to autosave buffers that are updated with LSP willRenameFiles + -- Set to "unmodified" to only save unmodified buffers + lsp_rename_autosave = false, + -- Constrain the cursor to the editable parts of the oil buffer + -- Set to `false` to disable, or "name" to keep it on the file names + constrain_cursor = "editable", + -- Set to true to watch the filesystem for changes and reload oil + experimental_watch_for_changes = false, + -- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap + -- options with a `callback` (e.g. { callback = function() ... end, desc = "", mode = "n" }) + -- Additionally, if it is a string that matches "actions.", + -- it will use the mapping at require("oil.actions"). + -- Set to `false` to remove a keymap + -- See :help oil-actions for a list of all available actions + keymaps = { + ["g?"] = "actions.show_help", + [""] = "actions.select", + [""] = "actions.select_vsplit", + [""] = "actions.select_split", + [""] = "actions.select_tab", + [""] = "actions.preview", + [""] = "actions.close", + [""] = "actions.refresh", + ["-"] = "actions.parent", + ["_"] = "actions.open_cwd", + ["`"] = "actions.cd", + ["~"] = "actions.tcd", + ["gs"] = "actions.change_sort", + ["gx"] = "actions.open_external", + ["g."] = "actions.toggle_hidden", + ["g\\"] = "actions.toggle_trash", + }, + -- Configuration for the floating keymaps help window + keymaps_help = { + border = "rounded", + }, + -- Set to false to disable all of the above keymaps + use_default_keymaps = true, + view_options = { + -- Show files and directories that start with "." + show_hidden = true, + -- This function defines what is considered a "hidden" file + is_hidden_file = function(name, bufnr) + return vim.startswith(name, ".") + end, + -- This function defines what will never be shown, even when `show_hidden` is set + is_always_hidden = function(name, bufnr) + return false + end, + sort = { + -- sort order can be "asc" or "desc" + -- see :help oil-columns to see which columns are sortable + { "type", "asc" }, + { "name", "asc" }, + }, + }, + -- Configuration for the floating window in oil.open_float + float = { + -- Padding around the floating window + padding = 0, + max_width = 0, + max_height = 0, + border = "rounded", + win_options = { + winblend = 0, + }, + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + override = function(conf) + return conf + end, + }, + -- Configuration for the actions floating preview window + preview = { + -- Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_width and max_width can be a single value or a list of mixed integer/float types. + -- max_width = {100, 0.8} means "the lesser of 100 columns or 80% of total" + max_width = 0.9, + -- min_width = {40, 0.4} means "the greater of 40 columns or 40% of total" + min_width = { 40, 0.4 }, + -- optionally define an integer/float for the exact width of the preview window + width = nil, + -- Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_height and max_height can be a single value or a list of mixed integer/float types. + -- max_height = {80, 0.9} means "the lesser of 80 columns or 90% of total" + max_height = 0.9, + -- min_height = {5, 0.1} means "the greater of 5 columns or 10% of total" + min_height = { 20, 0.2 }, + -- optionally define an integer/float for the exact height of the preview window + height = nil, + border = "rounded", + win_options = { + winblend = 0, + }, + -- Whether the preview window is automatically updated when the cursor is moved + update_on_cursor_moved = true, + }, + -- Configuration for the floating progress window + progress = { + max_width = 0.9, + min_width = { 40, 0.4 }, + width = nil, + max_height = { 10, 0.9 }, + min_height = { 5, 0.1 }, + height = nil, + border = "rounded", + minimized_border = "none", + win_options = { + winblend = 0, + }, + }, + -- Configuration for the floating SSH window + ssh = { + border = "rounded", + }, + }) + vim.keymap.set("n", "d", "split | Oil") + end, +} diff --git a/nvim/lua/plugins/snippets.lua b/nvim/lua/plugins/snippets.lua new file mode 100644 index 0000000..da33475 --- /dev/null +++ b/nvim/lua/plugins/snippets.lua @@ -0,0 +1,12 @@ +return { + { + "L3MON4D3/LuaSnip", + dependencies = { + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + }, + config = function() + require("luasnip.loaders.from_snipmate").lazy_load() + end, + }, +} diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..2c8ee74 --- /dev/null +++ b/nvim/lua/plugins/telescope.lua @@ -0,0 +1,114 @@ +return { + { + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build", + cond = vim.fn.executable("cmake") == 1, + }, + "ptethng/telescope-makefile", + }, + config = function() + local status_ok, telescope = pcall(require, "telescope") + if not status_ok then + return + end + + local actions = require("telescope.actions") + + telescope.setup({ + defaults = { + layout_config = { + width = 0.9, -- Adjust this value to make the Telescope window wider + preview_width = 0.6, -- Adjust this value to change the preview width + preview_cutoff = 10, -- Adjust this value to control when preview is cut off + }, + prompt_prefix = " ", + selection_caret = " ", + path_display = { "smart" }, + mappings = { + i = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.close, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + [""] = actions.complete_tag, + [""] = actions.which_key, -- keys from pressing + }, + + n = { + [""] = actions.close, + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + + ["j"] = actions.move_selection_next, + ["k"] = actions.move_selection_previous, + ["H"] = actions.move_to_top, + ["M"] = actions.move_to_middle, + ["L"] = actions.move_to_bottom, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + ["gg"] = actions.move_to_top, + ["G"] = actions.move_to_bottom, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + + ["?"] = actions.which_key, + }, + }, + }, + pickers = { + -- Default configuration for builtin pickers goes here: + -- picker_name = { + -- picker_config_key = value, + -- ... + -- } + -- Now the picker_config_key will be applied every time you call this + -- builtin picker + }, + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + -- override_generic_sorter = true, -- override the generic sorter + -- override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + }, + }, + }) + require("telescope").load_extension("fzf") + end, + }, +} diff --git a/nvim/lua/plugins/text-editing.lua b/nvim/lua/plugins/text-editing.lua new file mode 100644 index 0000000..16cc047 --- /dev/null +++ b/nvim/lua/plugins/text-editing.lua @@ -0,0 +1,99 @@ +return { + { "mhinz/vim-grepper" }, + { "FooSoft/vim-argwrap" }, + { "nvim-tree/nvim-web-devicons" }, + { "tpope/vim-commentary" }, + { "mattn/emmet-vim" }, + { "tpope/vim-surround" }, + { "tpope/vim-repeat" }, + { "lewis6991/gitsigns.nvim" }, + { "farmergreg/vim-lastplace" }, + { "axelf4/vim-strip-trailing-whitespace" }, + { "mbbill/undotree" }, + { "norcalli/nvim-colorizer.lua" }, + { "windwp/nvim-ts-autotag" }, + { "kana/vim-textobj-user" }, + { + "lukas-reineke/indent-blankline.nvim", + opts = { + indent = { + char = "│", + tab_char = "│", + }, + scope = { enabled = false }, + exclude = { + filetypes = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + }, + }, + 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" }, + { + "RRethy/vim-illuminate", + }, + { + "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" }, + }, + }, +} diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..935644b --- /dev/null +++ b/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,57 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + dependencies = { + { + "windwp/nvim-ts-autotag", + }, + }, + config = function() + local status_ok, configs = pcall(require, "nvim-treesitter.configs") + if not status_ok then + return + end + + configs.setup({ + -- A list of parser names, or "all" + ensure_installed = { "c", "lua", "rust", "python", "html", "javascript", "bash" }, + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + highlight = { + -- `false` will disable the whole extension + enable = true, + disable = { "markdown" }, + }, + }) + end, + }, + { + + "windwp/nvim-ts-autotag", + config = function() + require("nvim-ts-autotag").setup() + end, + }, + { + "nvim-treesitter/nvim-treesitter-context", + config = function() + require("treesitter-context").setup({ + enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) + max_lines = 1, -- How many lines the window should span. Values <= 0 mean no limit. + min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit. + line_numbers = true, + multiline_threshold = 20, -- Maximum number of lines to show for a single context + trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' + mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline' + -- Separator between context and content. Should be a single character string, like '-'. + -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. + separator = nil, + zindex = 20, -- The Z-index of the context window + on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching + }) + end, + }, +} diff --git a/nvim/lua/plugins/trouble.lua b/nvim/lua/plugins/trouble.lua new file mode 100644 index 0000000..cd80726 --- /dev/null +++ b/nvim/lua/plugins/trouble.lua @@ -0,0 +1,16 @@ +return { + { + "folke/trouble.nvim", + requires = "kyazdani42/nvim-web-devicons", + config = function() + require("trouble").setup({ + height = 5, -- height of the trouble list when position is top or bottom + width = 50, -- width of the list when position is left or right + icons = false, -- use devicons for filenames + indent_lines = false, -- add an indent guide below the fold icons + auto_open = false, -- automatically open the list when you have diagnostics + auto_close = false, -- automatically close the list when you have no diagnostics + }) + end, + }, +} diff --git a/nvim/lua/plugins/ui.lua b/nvim/lua/plugins/ui.lua new file mode 100644 index 0000000..0799909 --- /dev/null +++ b/nvim/lua/plugins/ui.lua @@ -0,0 +1,232 @@ +return { + { "nvim-web-devicons" }, + -- Buffers in top bar + { + "romgrk/barbar.nvim", + dependencies = { "nvim-web-devicons" }, + config = function() + local km = vim.api.nvim_set_keymap + -- + -- automatic sort of buffers + local opts = { noremap = true, silent = true } + km("n", "1", "BufferOrderByBufferNumber", opts) + km("n", "2", "BufferOrderByDirectory", opts) + + require("barbar").setup({ + -- Enable/disable auto-hiding the tab bar when there is a single buffer + auto_hide = false, + clickable = false, + icons = { + -- Configure the base icons on the bufferline. + -- Valid options to display the buffer index and -number are `true`, 'superscript' and 'subscript' + buffer_index = true, + buffer_number = false, + button = "", + filetype = { + -- Sets the icon's highlight group. + -- If false, will use nvim-web-devicons colors + custom_colors = false, + -- Requires `nvim-web-devicons` if `true` + enabled = false, + }, + separator = { left = "", right = "" }, + -- If true, add an additional separator at the end of the buffer list + modified = { button = "" }, + separator_at_end = false, + -- Use a preconfigured buffer appearance— can be 'default', 'powerline', or 'slanted' + preset = "default", + -- Configure the icons on the bufferline based on the visibility of a buffer. + -- Supports all the base icon options, plus `modified` and `pinned`. + alternate = { filetype = { enabled = false } }, + current = { buffer_index = true }, + visible = { modified = { buffer_number = false } }, + }, + }) + + vim.cmd([[ + + + hi BufferCurrent gui=bold guibg='#282A36' + hi BufferVisible guibg='#282A36' + hi BufferInactive guibg='#282A36' + + hi BufferCurrentIndex guifg='#FF79C6' gui=bold + hi BufferVisibleIndex guifg='#FF79C6' guibg='#282A36' + hi BufferInactiveIndex guifg='#FF79C6' guibg='#282A36' + + hi BufferCurrentMod guifg='#51FA7B' gui=bold + hi BufferVisibleMod guifg='#51FA7B' guibg='#282A36' + hi BufferInactiveMod guifg='#51FA7B' guibg='#282A36' + + hi BufferCurrentSign guifg='#282A36' guibg='#282A36' + hi BufferVisibleSign guifg='#282A36' guibg='#282A36' + hi BufferInactiveSign guifg='#282A36' guibg='#282A36' + + hi BufferCurrentSignRight guifg='#282A36' guibg='#282A36' + hi BufferVisibleSignRight guifg='#282A36' guibg='#282A36' + hi BufferInactiveSignRight guifg='#282A36' guibg='#282A36' + + hi BufferTabpageFill guifg='#282A36' +]]) + + vim.cmd([[ + cnoreabbrev b1 BufferGoto 1 + cnoreabbrev b2 BufferGoto 2 + cnoreabbrev b3 BufferGoto 3 + cnoreabbrev b4 BufferGoto 4 + cnoreabbrev b5 BufferGoto 5 + cnoreabbrev b6 BufferGoto 6 + cnoreabbrev b7 BufferGoto 7 + cnoreabbrev b8 BufferGoto 8 + cnoreabbrev b9 BufferGoto 9 + cnoreabbrev b10 BufferGoto 10 + cnoreabbrev b11 BufferGoto 11 + cnoreabbrev b12 BufferGoto 12 +]]) + end, + }, + -- Status line in bottom bar + { "nvim-lualine/lualine.nvim" }, + -- Buffer and window management + { "kevinhwang91/nvim-bqf", ft = "qf" }, + { "simeji/winresizer" }, + { "qpkorr/vim-bufkill" }, + { + "lewis6991/gitsigns.nvim", + config = function() + local status_ok, gitsigns = pcall(require, "gitsigns") + if not status_ok then + return + end + + gitsigns.setup({ + signs = { + add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, + change = { + hl = "GitSignsChange", + text = "▎", + numhl = "GitSignsChangeNr", + linehl = "GitSignsChangeLn", + }, + delete = { + hl = "GitSignsDelete", + text = "▎", + numhl = "GitSignsDeleteNr", + linehl = "GitSignsDeleteLn", + }, + topdelete = { + hl = "GitSignsDelete", + text = "▎", + numhl = "GitSignsDeleteNr", + linehl = "GitSignsDeleteLn", + }, + changedelete = { + hl = "GitSignsChange", + text = "▎", + numhl = "GitSignsChangeNr", + linehl = "GitSignsChangeLn", + }, + }, + -- Toggle with `:Gitsigns toggle_signs` + signcolumn = true, + -- Toggle with `:Gitsigns toggle_numhl` + numhl = true, + -- Toggle with `:Gitsigns toggle_linehl` + linehl = false, + -- Toggle with `:Gitsigns toggle_word_diff` + word_diff = false, + watch_gitdir = { + interval = 1000, + follow_files = true, + }, + attach_to_untracked = true, + -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame = false, + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", + delay = 1000, + ignore_whitespace = false, + }, + current_line_blame_formatter_opts = { + relative_time = false, + }, + sign_priority = 6, + update_debounce = 100, + -- Use default + status_formtter = nil, + max_file_length = 40000, + preview_config = { + -- Options passed to nvim_open_win + border = "single", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, + yadm = { + enable = false, + }, + }) + end, + }, + { + "nvim-lualine/lualine.nvim", + config = function() + require("lualine").setup({ + options = { + theme = "nightfly", + icons_enabled = true, + section_separators = { left = " ", right = " " }, + component_separators = { left = " ", right = " " }, + disabled_filetypes = {}, + always_divide_middle = true, + globalstatus = false, + }, + sections = { + lualine_a = { + { + "mode", + fmt = function(str) + return str:sub(1, 1) + end, + }, + }, + lualine_b = { + { + "diagnostics", + colored = true, + symbols = { error = " ", warn = " ", info = "", hint = "" }, + always_visible = true, + sections = { "error", "warn" }, + update_in_insert = true, + }, + { + "diff", + colored = true, + symbols = { added = " ", modified = " ", removed = " " }, + }, + }, + lualine_c = { + { + "branch", + colored = true, + icon = "", + }, + { + "filename", + colored = true, + path = 3, + symbols = { modified = " ", readonly = " ", shorting_target = 4 }, + }, + }, + lualine_x = {}, + lualine_y = {}, + lualine_z = { "progress", "location" }, + }, + tabline = {}, + extensions = { "fzf" }, + }) + end, + }, +} diff --git a/nvim/plug.lua b/nvim/plug.lua new file mode 100644 index 0000000..7b31580 --- /dev/null +++ b/nvim/plug.lua @@ -0,0 +1,84 @@ +-- Plugin Management + +local fn = vim.fn + +-- Automatically install packer +local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" +if fn.empty(fn.glob(install_path)) > 0 then + PACKER_BOOTSTRAP = fn.system({ + "git", + "clone", + "--depth", + "1", + "https://github.com/wbthomason/packer.nvim", + install_path, + }) + print("Installing packer close and reopen Neovim...") + vim.cmd([[packadd packer.nvim]]) +end + +-- Autocommand that reloads neovim whenever you save the plugins.lua file +vim.cmd([[ + augroup packer_user_config + autocmd! + autocmd BufWritePost plugins.lua source | PackerSync + augroup end +]]) + +-- Use a protected call so we don't error out on first use +local status_ok, packer = pcall(require, "packer") +if not status_ok then + return +end + +-- Initialize Packer.nvim with a floating window display +packer.init({ + display = { + open_fn = function() + return require("packer.util").float({ border = "rounded" }) + end, + }, +}) + +-- Plugin list +return packer.startup(function(use) + -- Packer manages itself + use({ + "wbthomason/packer.nvim", + "nvim-lua/popup.nvim", + "nvim-lua/plenary.nvim", + }) + use({ "nvim-tree/nvim-web-devicons" }) + + -- LSP configures the servers + -- Mason sets up the servers + use({ + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "neovim/nvim-lspconfig", + run = ":MasonUpdate", + }) + + -- Completion with CMP + + use({ "norcalli/nvim-colorizer.lua" }) + use({ "windwp/nvim-ts-autotag" }) + use({ "kana/vim-textobj-user" }) + + -- Text editing - Python + use("Vimjas/vim-python-pep8-indent") + use({ "bps/vim-textobj-python" }) + + --- Text editing - Markdown + use({ "coachshea/vim-textobj-markdown" }) + use("dhruvasagar/vim-table-mode") + use("dkarter/bullets.vim") + + --- Text editing - HTML + use({ "alvan/vim-closetag" }) + use({ "Glench/Vim-Jinja2-Syntax" }) + + if PACKER_BOOTSTRAP then + require("packer").sync() + end +end) diff --git a/nvim/snippets/_.snippets b/nvim/snippets/_.snippets index 8955427..75deca8 100644 --- a/nvim/snippets/_.snippets +++ b/nvim/snippets/_.snippets @@ -1,6 +1,9 @@ snippet bang #!/usr/bin/env bash +snippet ! + #!/usr/bin/env bash + snippet date `strftime("%Y-%m-%d")` diff --git a/nvim/snippets/markdown.snippets b/nvim/snippets/markdown.snippets index a61f84e..888add0 100644 --- a/nvim/snippets/markdown.snippets +++ b/nvim/snippets/markdown.snippets @@ -3,3 +3,15 @@ snippet shell snippet lang lang:shell-session: + +snippet --- + --- + tags: + - $1 + --- + +snippet tags + --- + tags: + - $1 + --- diff --git a/scripts/day.sh b/scripts/day.sh new file mode 100644 index 0000000..f20b76d --- /dev/null +++ b/scripts/day.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +today=$(date +%Y-%m-%d) +tomorrow=$(gdate -d "tomorrow" '+%Y-%m-%d') +yesterday=$(gdate -d "yesterday" '+%Y-%m-%d') +file="$HOME/personal/para/day/$today.md" + +new_note() { + touch "$file" + + # Format the file with the daily template + cat <"$file" +--- +id: $today +tags: +- daily-notes +--- + +# Yesterday & Tomorrow + +[[$yesterday]] - [[$tomorrow]] + +## Today + +EOF +} + +# If the daily note does not exist, create a new one. +# this uses the test command with the -f flag. +if [ ! -f "$file" ]; then + new_note +fi + +"$EDITOR" "$file" diff --git a/scripts/funcs.sh b/scripts/funcs.sh index b658f45..a95e243 100644 --- a/scripts/funcs.sh +++ b/scripts/funcs.sh @@ -22,11 +22,21 @@ entrr() { ls "$directory"/* | entr -s "$cmd" } -# open a todo note +# open the todo note - either general or project specific todo() { bash ~/dotfiles/scripts/todo.sh $1 } +# open a daily note +day() { + bash ~/dotfiles/scripts/day.sh +} + +# open the weekly note +week() { + "$EDITOR" ~/personal/para/this-week.md +} + # change a github remote - useful when changing to ssh after cloning remote() { git remote set-url origin $1 diff --git a/scripts/start b/scripts/start index 58aa917..4cf4334 100755 --- a/scripts/start +++ b/scripts/start @@ -2,5 +2,5 @@ NAME="home" tmux new-session -d -s "$NAME" -n personal -c ~/personal tmux new-window -t "$NAME" -n todo -c ~/personal -tmux send-keys -t "$NAME:todo" 'nvim ~/personal/todo/todo.md ~/personal/this-week.md' C-m +tmux send-keys -t "$NAME:todo" 'nvim ~/personal/para/todo.md' C-m tmux -2 attach-session -d -t "$NAME" diff --git a/tests/test_todo.sh b/tests/test_todo.sh index 44ec3aa..b4e7b3d 100644 --- a/tests/test_todo.sh +++ b/tests/test_todo.sh @@ -12,11 +12,11 @@ testOpenTodoFileWithTodoFile() { echo "testOpenTodoFileWithTodoFile" - echo "Current directory: $(pwd)" + echo "Current directory: $PWD" echo "HOME variable: $HOME" todofile="$PWD/.todofile" - echo "data-science-south" > $todofile + echo "data-science-south" > "$todofile" echo ".todofile path: $todofile" # Verify the content echo ".todofile content: $(cat .todofile)" # Verify the content @@ -29,7 +29,7 @@ testOpenTodoFileWithTodoFile() { # expect a project specific file assertEquals "$TODO_DIR/data-science-south.md" "$result" - rm $todofile + rm "$todofile" } testOpenTodoFileWithExistingFile() { @@ -45,7 +45,7 @@ testOpenTodoFileWithNonExistingFile() { export TODO_DIR=$(mktemp -d) result=$(open_todo_file) # expect the default file - assertEquals "$TODO_DIR/todo.md" "$result" + assertEquals "$TODO_DIR/../todo.md" "$result" rm -r "$TODO_DIR" }