several small updates

This commit is contained in:
RingOfStorms (Joshua Bell) 2024-05-02 23:51:15 -05:00
parent 545b3d492f
commit b0c61768db
9 changed files with 432 additions and 415 deletions

View file

@ -14,6 +14,7 @@ nix run 'github:ringofstorms/nvim/nix-flake'
``` ```
in NixOS in NixOS
```nix ```nix
-- in flake.nix#inputs -- in flake.nix#inputs
ringofstorms-nvim = { ringofstorms-nvim = {
@ -26,8 +27,8 @@ environment.systemPackages = with pkgs; [
]; ];
``` ```
### Without Nix ### Without Nix
TODO update this section TODO update this section
- Must have all required programs installed and available on path - Must have all required programs installed and available on path
@ -35,18 +36,23 @@ TODO update this section
- Evertying listed in flake.nix `runtime dependencies` variable near the top of the file - Evertying listed in flake.nix `runtime dependencies` variable near the top of the file
- These must be available on the path - These must be available on the path
- Treesitter/Lazy/Mason will install all other requirements needed on other systems - Treesitter/Lazy/Mason will install all other requirements needed on other systems
```sh ```sh
git clone https://github.com/RingOfStorms/nvim ~/.config/nvim git clone https://github.com/RingOfStorms/nvim ~/.config/nvim
nvim --headless "+Lazy! sync" +qa nvim --headless "+Lazy! sync" +qa
``` ```
Backup existing config: Backup existing config:
```sh ```sh
DATE=$(date +"%Y%m%d") DATE=$(date +"%Y%m%d")
mv ~/.config/nvim ~/.config/nvim_$DATE.bak mv ~/.config/nvim ~/.config/nvim_$DATE.bak
mv ~/.local/share/nvim ~/.local/share/nvim_$DATE.bak mv ~/.local/share/nvim ~/.local/share/nvim_$DATE.bak
mv ~/.local/state/nvim ~/.local/state/nvim_$DATE.bak mv ~/.local/state/nvim ~/.local/state/nvim_$DATE.bak
``` ```
or remove existing config: or remove existing config:
```sh ```sh
rm -rf ~/.config/nvim rm -rf ~/.config/nvim
rm -rf ~/.local/share/nvim rm -rf ~/.local/share/nvim
@ -55,21 +61,26 @@ rm -rf ~/.local/state/nvim
## NOTES/TODOS ## NOTES/TODOS
- h/l movement broken in insert mode, probably due to cmp hotkeys
- h/l in telescope
- arrows still work in insert mode and telescope, need to remove trying to break arrow key habit
FUTURE FUTURE
- Make a new HTTP plugin for running curl commands from .http files - Make a new HTTP plugin for running curl commands from .http files
- similar to est-nvim/rest.nvim but support streaming etc and show command output - similar to est-nvim/rest.nvim but support streaming etc and show command output
- Execute selected command and open output into a buffer/popup window? <leader>cx - Execute selected command and open output into a buffer/popup window? <leader>cx
- generate command, like scratch open a popup of things that can be generated. UUID/other stuff? - generate command, like scratch open a popup of things that can be generated. UUID/other stuff?
- https://github.com/mawkler/nvim/blob/06cde9dbaedab2bb36c06025c07589c93d2c6d6b/lua/configs/luasnip.lua#L37-L50 - <https://github.com/mawkler/nvim/blob/06cde9dbaedab2bb36c06025c07589c93d2c6d6b/lua/configs/luasnip.lua#L37-L50>
- Checkout cargo-bloat, cargo-cache, cargo-outdated - memcache sccache - Checkout cargo-bloat, cargo-cache, cargo-outdated - memcache sccache
- For scratches, just make an input box for custom extension rather than predefined list - For scratches, just make an input box for custom extension rather than predefined list
- freaking learn to use surround more often https://github.com/tpope/vim-surround/tree/master - freaking learn to use surround more often <https://github.com/tpope/vim-surround/tree/master>
- make my own session saving impl - make my own session saving impl
- Only save visible buffers/tabs/splits - Only save visible buffers/tabs/splits
- per branch per directory - per branch per directory
- something like https://github.com/gennaro-tedesco/nvim-possession/tree/main but fully managed - something like <https://github.com/gennaro-tedesco/nvim-possession/tree/main> but fully managed
- copilot? local llm? - copilot? local llm?
- check out - check out
- https://github.com/onsails/lspkind.nvim - <https://github.com/onsails/lspkind.nvim>
- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-align.md - <https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-align.md>
- https://github.com/tpope/vim-abolish - <https://github.com/tpope/vim-abolish>

34
flake.lock generated
View file

@ -1,23 +1,5 @@
{ {
"nodes": { "nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1714635257, "lastModified": 1714635257,
@ -68,26 +50,10 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nvim_plugin-chrisgrieser/nvim-early-retirement": "nvim_plugin-chrisgrieser/nvim-early-retirement", "nvim_plugin-chrisgrieser/nvim-early-retirement": "nvim_plugin-chrisgrieser/nvim-early-retirement",
"nvim_plugin-declancm/cinnamon.nvim": "nvim_plugin-declancm/cinnamon.nvim" "nvim_plugin-declancm/cinnamon.nvim": "nvim_plugin-declancm/cinnamon.nvim"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -3,7 +3,6 @@
# Nixpkgs / NixOS version to use. # Nixpkgs / NixOS version to use.
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
# Names should always be `nvim_plugin-[lazy plugin name]` # Names should always be `nvim_plugin-[lazy plugin name]`
# Only need to add plugins as flake inputs if they are: # Only need to add plugins as flake inputs if they are:
@ -18,18 +17,36 @@
flake = false; flake = false;
}; };
}; };
outputs = { self, nixpkgs, flake-utils, ... } @ inputs: outputs =
# Takes all top level attributes and changes them to `attribute.${system} = old value` { self, nixpkgs, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system: let
let # Anytime there is a huge breaking change that old state files wont
# Anytime there is a huge breaking change that old state files wont # work then we make a new version name. Helps separate any files and
# work then we make a new version name. Helps separate any files. # "version" my neovim flake
version = "hydrogen"; # ==================
pkgs = nixpkgs.legacyPackages.${system}; version = "helium";
lib = nixpkgs.lib; # ===================
inherit (nixpkgs) lib;
withSystem =
f:
lib.fold lib.recursiveUpdate { } (
map f [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
]
);
in
# Takes all top level attributes and changes them to `attribute.${system} = old value`
withSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
lazyPath = pkgs.vimPlugins.lazy-nvim; # inputs."nvim_plugin-folke/lazy.nvim"
# Plugins provided in nixpkgs, match the naming scheme above for keys # Plugins provided in nixpkgs, match the naming scheme above for keys
lazyPath = pkgs.vimPlugins.lazy-nvim;
nixPkgsPlugins = with pkgs.vimPlugins; { nixPkgsPlugins = with pkgs.vimPlugins; {
"nvim_plugin-folke/lazy.nvim" = lazyPath; "nvim_plugin-folke/lazy.nvim" = lazyPath;
"nvim_plugin-nvim-treesitter/nvim-treesitter" = nvim-treesitter.withAllGrammars; "nvim_plugin-nvim-treesitter/nvim-treesitter" = nvim-treesitter.withAllGrammars;
@ -73,19 +90,21 @@
"nvim_plugin-folke/neodev.nvim" = neodev-nvim; "nvim_plugin-folke/neodev.nvim" = neodev-nvim;
}; };
# This will be how we put any nix related stuff into our lua config # This will be how we put any nix related stuff into our lua config
luaNixGlobal = "NIX=" + lib.generators.toLua { multiline = false; indent = false; } ({ luaNixGlobal =
storePath = "${./.}"; "NIX="
# This will look at all inputs and grab any prefixed with `nvim_plugin-` +
pluginPaths = builtins.foldl' lib.generators.toLua
(dirs: name:
{ {
"${name}" = inputs.${name}.outPath; multiline = false;
} // dirs) indent = false;
nixPkgsPlugins }
(builtins.filter ({
(n: builtins.substring 0 12 n == "nvim_plugin-") storePath = "${./.}";
(builtins.attrNames inputs)); # This will look at all inputs and grab any prefixed with `nvim_plugin-`
}); pluginPaths =
builtins.foldl' (dirs: name: { "${name}" = inputs.${name}.outPath; } // dirs) nixPkgsPlugins
(builtins.filter (n: builtins.substring 0 12 n == "nvim_plugin-") (builtins.attrNames inputs));
});
runtimeDependencies = with pkgs; [ runtimeDependencies = with pkgs; [
# tools # tools
@ -100,7 +119,9 @@
biome # (t|s)j[x] biome # (t|s)j[x]
# formatters # formatters
stylua stylua
nixfmt-rfc-style
nodePackages.prettier nodePackages.prettier
markdownlint-cli2
# LSPs # LSPs
lua-language-server lua-language-server
nodePackages.typescript-language-server nodePackages.typescript-language-server
@ -111,20 +132,19 @@
]; ];
in in
{ {
packages = { packages.${system} = {
default = self.packages.${system}.neovim; default = self.packages.${system}.neovim;
neovim = neovim =
(pkgs.wrapNeovimUnstable (pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped (
pkgs.neovim-unwrapped pkgs.neovimUtils.makeNeovimConfig {
(pkgs.neovimUtils.makeNeovimConfig {
withPython3 = false; withPython3 = false;
customRC = '' customRC = ''
lua ${luaNixGlobal} lua ${luaNixGlobal}
luafile ${./.}/init.lua luafile ${./.}/init.lua
set runtimepath^=${builtins.concatStringsSep "," (builtins.attrValues pkgs.vimPlugins.nvim-treesitter.grammarPlugins)} set runtimepath^=${builtins.concatStringsSep "," (builtins.attrValues pkgs.vimPlugins.nvim-treesitter.grammarPlugins)}
''; '';
}) }
).overrideAttrs )).overrideAttrs
(old: { (old: {
generatedWrapperArgs = old.generatedWrapperArgs or [ ] ++ [ generatedWrapperArgs = old.generatedWrapperArgs or [ ] ++ [
# Add runtime dependencies to neovim path # Add runtime dependencies to neovim path
@ -140,20 +160,20 @@
# All things at runtime should be deletable since we are using nix to handle downloads and bins # All things at runtime should be deletable since we are using nix to handle downloads and bins
# so I've chosen to put everything into the local state directory. # so I've chosen to put everything into the local state directory.
"--run" "--run"
"export NVIM_FLAKE_BASE_DIR=\"\${XDG_STATE_HOME:-\$HOME/.local/state}\"" ''export NVIM_FLAKE_BASE_DIR="''${XDG_STATE_HOME:-$HOME/.local/state}"''
"--run" "--run"
"export XDG_CONFIG_HOME=\"$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/config\"" ''export XDG_CONFIG_HOME="$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/config"''
"--run" "--run"
"export XDG_DATA_HOME=\"$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/share\"" ''export XDG_DATA_HOME="$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/share"''
"--run" "--run"
"export XDG_RUNTIME_DIR=\"$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/run\"" ''export XDG_RUNTIME_DIR="$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/run"''
"--run" "--run"
"export XDG_STATE_HOME=\"$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/state\"" ''export XDG_STATE_HOME="$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/state"''
"--run" "--run"
"export XDG_CACHE_HOME=\"$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/cache\"" ''export XDG_CACHE_HOME="$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/cache"''
]; ];
}); });
}; };
}); }
);
} }

View file

@ -13,112 +13,117 @@ vim.g.maplocalleader = " "
local nvx = { "n", "v", "x" } local nvx = { "n", "v", "x" }
-- TODO remove this notify and replace with a <nop> once I have trained well enough
local hjklNotid = nil
local hjklNotification = function()
hjklNotid = vim.notify("use h/j/k/l to move", 4, { replace = hjklNotid })
end
U.keymaps({ U.keymaps({
-- Basic -- Basic
{ "<left>", '<cmd>echo "use h/j/k/l to move!"<cr>', mode = nvx }, { "<left>", hjklNotification, mode = { "n", "v", "x", "i" } },
{ "<right>", '<cmd>echo "use h/j/k/l to move!"<cr>', mode = nvx }, { "<right>", hjklNotification, mode = { "n", "v", "x", "i" } },
{ "<up>", '<cmd>echo "use h/j/k/l to move!"<cr>', mode = nvx }, { "<up>", hjklNotification, mode = { "n", "v", "x", "i" } },
{ "<down>", '<cmd>echo "use h/j/k/l to move!"<cr>', mode = nvx }, { "<down>", hjklNotification, mode = { "n", "v", "x", "i" } },
{ ";", ":", desc = "No shift to enter command mode with semicolon. Alias ; to :", mode = nvx }, { ";", ":", desc = "No shift to enter command mode with semicolon. Alias ; to :", mode = nvx },
{ "<leader>Q", "<nop>", mode = nvx }, -- don't do normal Q quit { "<leader>Q", "<nop>", mode = nvx }, -- don't do normal Q quit
{ "<leader>a", "<esc>ggVG", desc = "Select all", mode = nvx }, { "<leader>a", "<esc>ggVG", desc = "Select all", mode = nvx },
{ "Q", "<cmd>SessionSave<cr><cmd>qa!<cr>", desc = "Quit all", mode = nvx }, { "Q", "<cmd>SessionSave<cr><cmd>qa!<cr>", desc = "Quit all", mode = nvx },
{ "<leader>y", '"+y', desc = "Copy to system clipboard", mode = nvx }, { "<leader>y", '"+y', desc = "Copy to system clipboard", mode = nvx },
{ "<leader>p", '"+p', desc = "Paste from system clipboard", mode = nvx }, { "<leader>p", '"+p', desc = "Paste from system clipboard", mode = nvx },
{ "<esc>", "<cmd>nohlsearch<cr><esc>", desc = "Clear search on escape" }, { "<esc>", "<cmd>nohlsearch<cr><esc>", desc = "Clear search on escape" },
{ "<return>", "<cmd>nohlsearch<cr><return>", desc = "Clear search on return" }, { "<return>", "<cmd>nohlsearch<cr><return>", desc = "Clear search on return" },
{ "|", "<cmd>vsplit<cr>", desc = "Vertical Split" }, { "|", "<cmd>vsplit<cr>", desc = "Vertical Split" },
{ "\\", "<cmd>split<cr>", desc = "Horizontal Split" }, { "\\", "<cmd>split<cr>", desc = "Horizontal Split" },
{ "<S-Tab>", "<C-o>", desc = "Go back <C-o>" }, { "<S-Tab>", "<C-o>", desc = "Go back <C-o>" },
{ {
"J", "J",
":m '>+1<cr>gv=gv", ":m '>+1<cr>gv=gv",
desc = "Visually move block down", desc = "Visually move block down",
mode = "v", mode = "v",
}, },
{ {
"K", "K",
":m '<-2<cr>gv=gv", ":m '<-2<cr>gv=gv",
desc = "Visually move block up", desc = "Visually move block up",
mode = "v", mode = "v",
}, },
{ "<Esc>", "<C-\\><C-n>", desc = "Escape the terminal", mode = "t" }, { "<Esc>", "<C-\\><C-n>", desc = "Escape the terminal", mode = "t" },
-- Buffers -- Buffers
{ "<leader>b", "<cmd>b#<cr>", desc = "Switch to last buffer", mode = nvx }, { "<leader>b", "<cmd>b#<cr>", desc = "Switch to last buffer", mode = nvx },
{ {
"<leader>q", "<leader>q",
function() function()
-- Custom close/quit -- Custom close/quit
-- * if non empty buffer, we will simply open a new empty buffer unless -- * if non empty buffer, we will simply open a new empty buffer unless
-- it is in the close always list -- it is in the close always list
-- * if empty buffer, then we will quit this buffer -- * if empty buffer, then we will quit this buffer
local close_always = { "quickfix", "help", "nofile", "noice", "httpResult" } local close_always = { "quickfix", "help", "nofile", "noice", "httpResult" }
if if
U.table_contains(close_always, vim.bo.buftype) U.table_contains(close_always, vim.bo.buftype)
or (vim.api.nvim_buf_line_count(0) == 1 and vim.api.nvim_buf_get_lines(0, 0, 1, -1)[1] == "") or (vim.api.nvim_buf_line_count(0) == 1 and vim.api.nvim_buf_get_lines(0, 0, 1, -1)[1] == "")
then then
vim.cmd("silent confirm q") vim.cmd("silent confirm q")
else else
vim.cmd("enew") vim.cmd("enew")
end end
end, end,
desc = "Quit/Close current", desc = "Quit/Close current",
mode = nvx, mode = nvx,
}, },
{ {
"<leader>S", "<leader>S",
"<cmd>set equalalways<cr><cmd>set noequalalways<cr>", "<cmd>set equalalways<cr><cmd>set noequalalways<cr>",
desc = "Equalize/resize screens evenly", desc = "Equalize/resize screens evenly",
mode = nvx, mode = nvx,
}, },
{ "<C-h>", "<C-W>h", desc = "Move window left current", mode = nvx }, { "<C-h>", "<C-W>h", desc = "Move window left current", mode = nvx },
{ "<C-j>", "<C-W>j", desc = "Move window below current", mode = nvx }, { "<C-j>", "<C-W>j", desc = "Move window below current", mode = nvx },
{ "<C-k>", "<C-W>k", desc = "Move window above current", mode = nvx }, { "<C-k>", "<C-W>k", desc = "Move window above current", mode = nvx },
{ "<C-l>", "<C-W>l", desc = "Move window right current", mode = nvx }, { "<C-l>", "<C-W>l", desc = "Move window right current", mode = nvx },
-- Editor -- Editor
{ "J", "mzJ`z", desc = "Move line below onto this line" }, { "J", "mzJ`z", desc = "Move line below onto this line" },
{ -- TODO stay here, are these already mapped? { -- TODO stay here, are these already mapped?
"]d", "]d",
vim.diagnostic.goto_next, vim.diagnostic.goto_next,
desc = "Go to next diagnostic message", desc = "Go to next diagnostic message",
}, },
{ {
"[d", "[d",
vim.diagnostic.goto_prev, vim.diagnostic.goto_prev,
desc = "Go to previous diagnostic message", desc = "Go to previous diagnostic message",
}, },
{ ">", "> gv", desc = "Indent selection", mode = "v" }, { ">", "> gv", desc = "Indent selection", mode = "v" },
{ "<", "< gv", desc = "Outdent selection", mode = "v" }, { "<", "< gv", desc = "Outdent selection", mode = "v" },
{ "p", '"_dP', desc = "Paste without yanking replaced content", mode = "v" }, { "p", '"_dP', desc = "Paste without yanking replaced content", mode = "v" },
-- TODO take <leader>r from http requests? -- TODO take <leader>r from http requests?
{ "<C-r>", '"hy:%s/<C-r>h//g<left><left>', desc = "Replace current selection", mode = "v" }, { "<C-r>", '"hy:%s/<C-r>h//g<left><left>', desc = "Replace current selection", mode = "v" },
{ "<C-k>", "<Up>", desc = "Up", mode = { "i", "c" }, desc = "Movements in insert/command mode" }, { "<C-k>", "<Up>", mode = { "i", "c" }, desc = "Movements in insert/command mode" },
{ "<C-j>", "<Down>", desc = "Down", mode = { "i", "c" }, desc = "Movements in insert/command mode" }, { "<C-j>", "<Down>", mode = { "i", "c" }, desc = "Movements in insert/command mode" },
{ "<C-h>", "<Left>", desc = "Left", mode = { "i", "c" }, desc = "Movements in insert/command mode" }, { "<C-h>", "<Left>", mode = { "i", "c" }, desc = "Movements in insert/command mode" },
{ "<C-l>", "<Right>", desc = "Right", mode = { "i", "c" }, desc = "Movements in insert/command mode" }, { "<C-l>", "<Right>", mode = { "i", "c" }, desc = "Movements in insert/command mode" },
{ "<C-4>", "<End>", desc = "End", mode = { "i", "c" }, desc = "Movements in insert/command mode" }, { "<C-4>", "<End>", mode = { "i", "c" }, desc = "Movements in insert/command mode" },
{ "<C-6>", "<Home>", desc = "Home", mode = { "i", "c" }, desc = "Movements in insert/command mode" }, { "<C-6>", "<Home>", mode = { "i", "c" }, desc = "Movements in insert/command mode" },
-- Tabs -- Tabs
-- TODO revisit, do I even need these tab things? -- TODO revisit, do I even need these tab things?
{ "<leader>tn", "<cmd>tabnew<cr>", desc = "Create new tab", mode = nvx }, { "<leader>tn", "<cmd>tabnew<cr>", desc = "Create new tab", mode = nvx },
{ "<leader>tq", "<cmd>tabclose<cr>", desc = "Close current tab", mode = nvx }, { "<leader>tq", "<cmd>tabclose<cr>", desc = "Close current tab", mode = nvx },
{ "H", "<cmd>tabprevious<cr>", desc = "Move to previous tab" }, { "H", "<cmd>tabprevious<cr>", desc = "Move to previous tab" },
{ "L", "<cmd>tabnext<cr>", desc = "Move to next tab" }, { "L", "<cmd>tabnext<cr>", desc = "Move to next tab" },
-- LSP/IDE/etc TODO move to lsp config file -- LSP/IDE/etc TODO move to lsp config file
{ {
"<leader>ld", "<leader>ld",
vim.diagnostic.open_float, vim.diagnostic.open_float,
desc = "Show diagnostic message", desc = "Show diagnostic message",
mode = nvx, mode = nvx,
}, },
{ {
"<leader>ll", "<leader>ll",
vim.diagnostic.setloclist, vim.diagnostic.setloclist,
desc = "Show diagnostics in quickfix list", desc = "Show diagnostics in quickfix list",
mode = nvx, mode = nvx,
}, },
}) })

View file

@ -70,6 +70,7 @@ return {
-- completions whenever it has completion options available. -- completions whenever it has completion options available.
["<C-c>"] = cmp.mapping.complete({}), ["<C-c>"] = cmp.mapping.complete({}),
-- TODO remove these or make them soemthing else, this collided with my normal movements in insert mode
-- Think of <c-l> as moving to the right of your snippet expansion. -- Think of <c-l> as moving to the right of your snippet expansion.
-- So if you have a snippet that's like: -- So if you have a snippet that's like:
-- function $name($args) -- function $name($args)
@ -78,16 +79,16 @@ return {
-- --
-- <c-l> will move you to the right of each of the expansion locations. -- <c-l> will move you to the right of each of the expansion locations.
-- <c-h> is similar, except moving you backwards. -- <c-h> is similar, except moving you backwards.
["<C-l>"] = cmp.mapping(function() -- ["<C-l>"] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then -- if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump() -- luasnip.expand_or_jump()
end -- end
end, { "i", "s" }), -- end, { "i", "s" }),
["<C-h>"] = cmp.mapping(function() -- ["<C-h>"] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then -- if luasnip.locally_jumpable(-1) then
luasnip.jump(-1) -- luasnip.jump(-1)
end -- end
end, { "i", "s" }), -- end, { "i", "s" }),
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps

View file

@ -1,36 +1,37 @@
return { return {
"folke/noice.nvim", "folke/noice.nvim",
dependencies = { dependencies = {
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
"rcarriga/nvim-notify", "rcarriga/nvim-notify",
{ "nvim-telescope/telescope.nvim", optional = true }, { "nvim-telescope/telescope.nvim", optional = true },
}, },
event = "VeryLazy", event = "VeryLazy",
opts = { opts = {
routes = { routes = {
-- I want telescope-ui-select to trigger here not noice -- I want telescope-ui-select to trigger here not noice
{ filter = { event = "lsp", kind = "search_count" }, opts = { skip = true } }, { filter = { event = "lsp", kind = "search_count" }, opts = { skip = true } },
}, { filter = { event = "lsp" }, opts = { skip = true } }, -- TODO come back to this, im having weird issues with insert mode getting broken.
messages = { },
view = "mini", -- default view for messages messages = {
view_error = "notify", -- view for errors view = "mini", -- default view for messages
view_warn = "mini", -- view for warnings view_error = "notify", -- view for errors
view_history = "messages", -- view for :messages view_warn = "mini", -- view for warnings
view_search = false, -- view for search count messages. Set to `false` to disable view_history = "messages", -- view for :messages
}, view_search = false, -- view for search count messages. Set to `false` to disable
lsp = { },
-- override markdown rendering so that **cmp** and other plugins use **Treesitter** lsp = {
override = { -- override markdown rendering so that **cmp** and other plugins use **Treesitter**
["vim.lsp.util.convert_input_to_markdown_lines"] = true, override = {
["vim.lsp.util.stylize_markdown"] = true, ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp ["vim.lsp.util.stylize_markdown"] = true,
}, ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
}, },
}, },
config = function(_, opts) },
require("noice").setup(opts) config = function(_, opts)
U.safeRequire("telescope", function(t) require("noice").setup(opts)
t.load_extension("noice") U.safeRequire("telescope", function(t)
end) t.load_extension("noice")
end, end)
end,
} }

View file

@ -1,30 +1,38 @@
return { return {
"stevearc/conform.nvim", "stevearc/conform.nvim",
opts = { opts = {
-- https://github.com/stevearc/conform.nvim?tab=readme-ov-file#setup -- https://github.com/stevearc/conform.nvim?tab=readme-ov-file#setup
notify_on_error = true, notify_on_error = true,
formatters_by_ft = { -- Note that all these need to be available at runtime, add them to flake.nix#runtimeDependencies
lua = { "stylua" }, formatters_by_ft = {
typescript = { { "prettierd", "prettier" } }, lua = { "stylua" },
typescriptreact = { { "prettierd", "prettier" } }, nix = { "nixfmt" },
javascript = { { "prettierd", "prettier" } }, typescript = { { "prettierd", "prettier" } },
javascriptreact = { { "prettierd", "prettier" } }, typescriptreact = { { "prettierd", "prettier" } },
}, javascript = { { "prettierd", "prettier" } },
}, javascriptreact = { { "prettierd", "prettier" } },
keys = { -- TODO revisit these I'd like to use them but they are not in nixpkgs yet
{ -- https://nixos.org/guides/nix-pills/
"<leader>l<leader>", -- markdown = { "mdslw", "mdsf"},
function() markdown = { "markdownlint-cli2" },
require("conform").format({ async = true, lsp_fallback = true }, function(err, edited) },
if edited then },
print("Formatted!") keys = {
else {
print("Nothing to format!") "<leader>l<leader>",
end function()
end) require("conform").format({ async = true, lsp_fallback = true }, function(err, edited)
end, if edited then
mode = { "n", "v", "x" }, print("Formatted!")
desc = "Format buffer", elseif err then
}, print(err)
}, else
print("Nothing to format!")
end
end)
end,
mode = { "n", "v", "x" },
desc = "Format buffer",
},
},
} }

View file

@ -1,163 +1,169 @@
return { return {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
dependencies = { dependencies = {
{ "nvim-lua/plenary.nvim" }, { "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope-fzf-native.nvim" }, { "nvim-telescope/telescope-fzf-native.nvim" },
{ "nvim-telescope/telescope-ui-select.nvim" }, { "nvim-telescope/telescope-ui-select.nvim" },
}, },
init = function() init = function()
U.cmd_executable("rg", { U.cmd_executable("rg", {
[false] = function() [false] = function()
vim.notify("rg not installed, live grep will not function.", 2) vim.notify("rg not installed, live grep will not function.", 2)
end, end,
}) })
end, end,
cmd = "Telescope", cmd = "Telescope",
opts = function() opts = function()
return { return {
pickers = { pickers = {
buffers = { buffers = {
sort_lastused = true, sort_lastused = true,
}, },
find_files = { find_files = {
hidden = true, hidden = true,
sort_lastused = true, sort_lastused = true,
}, },
live_grep = { live_grep = {
hidden = true, hidden = true,
}, },
}, },
defaults = { defaults = {
file_ignore_patterns = { "node_modules", "package-lock.json", "target", ".git" }, file_ignore_patterns = { "node_modules", "package-lock.json", "target", ".git" },
mappings = { mappings = {
i = { i = {
["<C-j>"] = "move_selection_next", ["<C-j>"] = "move_selection_next",
["<C-k>"] = "move_selection_previous", ["<C-k>"] = "move_selection_previous",
}, ["<C-h>"] = false,
}, ["<C-l>"] = false,
vimgrep_arguments = { ["<up>"] = false,
"rg", ["<down>"] = false,
"--hidden", ["<left>"] = false,
"--color=never", ["<right>"] = false,
"--no-heading", },
"--with-filename", },
"--line-number", vimgrep_arguments = {
"--column", "rg",
"--smart-case", "--hidden",
}, "--color=never",
}, "--no-heading",
extensions = { "--with-filename",
["ui-select"] = { "--line-number",
require("telescope.themes").get_cursor(), "--column",
}, "--smart-case",
["notify"] = {}, },
}, },
} extensions = {
end, ["ui-select"] = {
config = function(_, opts) require("telescope.themes").get_cursor(),
local ts = require("telescope") },
ts.setup(opts) ["notify"] = {},
ts.load_extension("ui-select") },
}
end,
config = function(_, opts)
local ts = require("telescope")
ts.setup(opts)
ts.load_extension("ui-select")
if package.loaded["notify"] then if package.loaded["notify"] then
ts.load_extension("notify") ts.load_extension("notify")
U.keymaps({ U.keymaps({
{ {
"<leader>fn", "<leader>fn",
"<cmd>Telescope notify<cr>", "<cmd>Telescope notify<cr>",
desc = "Telescope search notifications", desc = "Telescope search notifications",
mode = { "n", "v", "x" }, mode = { "n", "v", "x" },
}, },
}) })
end end
end, end,
-- https://github.com/nvim-telescope/telescope.nvim?tab=readme-ov-file#pickers -- https://github.com/nvim-telescope/telescope.nvim?tab=readme-ov-file#pickers
keys = { keys = {
{ {
"<leader>fr", "<leader>fr",
function() function()
require("telescope.builtin").resume() require("telescope.builtin").resume()
end, end,
desc = "Resume last telescope", desc = "Resume last telescope",
}, },
{ {
"<leader>f/", "<leader>f/",
function() function()
require("telescope.builtin").current_buffer_fuzzy_find( require("telescope.builtin").current_buffer_fuzzy_find(
require("telescope.themes").get_dropdown({ winblend = 10, previewer = false }) require("telescope.themes").get_dropdown({ winblend = 10, previewer = false })
) )
end, end,
desc = "Fuzzy find/search in current buffer fuzzy.", desc = "Fuzzy find/search in current buffer fuzzy.",
}, },
{ {
"<leader>fh", "<leader>fh",
function() function()
require("telescope.builtin").help_tags() require("telescope.builtin").help_tags()
end, end,
desc = "Find help", desc = "Find help",
}, },
{ {
"<leader>ff", "<leader>ff",
function() function()
require("telescope.builtin").find_files({ require("telescope.builtin").find_files({
hidden = true, hidden = true,
}) })
end, end,
desc = "Find Files", desc = "Find Files",
}, },
{ {
"<leader>fg", "<leader>fg",
function() function()
require("telescope.builtin").git_files({ require("telescope.builtin").git_files({
hidden = true, hidden = true,
}) })
end, end,
desc = "Find Git only Files", desc = "Find Git only Files",
}, },
{ {
"<leader>fw", "<leader>fw",
function() function()
U.cmd_executable("rg", { U.cmd_executable("rg", {
function() function()
require("telescope.builtin").live_grep({ require("telescope.builtin").live_grep({
hidden = true, hidden = true,
}) })
end, end,
function() function()
vim.notify("rg not installed, find words will not function.", 3) vim.notify("rg not installed, find words will not function.", 3)
end, end,
}) })
end, end,
desc = "Find Words", desc = "Find Words",
}, },
{ {
"<leader>fc", "<leader>fc",
function() function()
require("telescope.builtin").commands() require("telescope.builtin").commands()
end, end,
desc = "Find Commands", desc = "Find Commands",
}, },
{ {
"<leader>fk", "<leader>fk",
function() function()
require("telescope.builtin").keymaps() require("telescope.builtin").keymaps()
end, end,
desc = "Find Keymap", desc = "Find Keymap",
}, },
{ {
"<leader>fb", "<leader>fb",
function() function()
require("telescope.builtin").buffers() require("telescope.builtin").buffers()
end, end,
desc = "Find Buffer", desc = "Find Buffer",
}, },
{ {
"<leader>lfr", "<leader>lfr",
function() function()
require("telescope.builtin").lsp_references() require("telescope.builtin").lsp_references()
end, end,
desc = "Find LSP References", desc = "Find LSP References",
mode = { "n", "v", "x" }, mode = { "n", "v", "x" },
}, },
}, },
} }

View file

@ -10,7 +10,7 @@ return {
{ {
"<leader>,c", "<leader>,c",
function() function()
if next(vim.lsp.buf_get_clients()) ~= nil then if next(vim.lsp.get_active_clients()) ~= nil then
-- TODO test that this works -- TODO test that this works
vim.cmd("TextCaseOpenTelescopeLSPChange") vim.cmd("TextCaseOpenTelescopeLSPChange")
else else
@ -19,7 +19,6 @@ return {
end, end,
desc = "Change case of selection", desc = "Change case of selection",
mode = { "n", "v", "x" }, mode = { "n", "v", "x" },
silent = true, -- TODO add this to most things....
}, },
}, },
} }