Ported config from nixvim.

Made some changes to taste along the way,
though there are some still to come.
This commit is contained in:
Gabe Venberg 2025-07-03 02:18:39 +02:00
parent 9a78fd2d53
commit 3bd72ab98f
13 changed files with 601 additions and 740 deletions

5
.editorconfig Normal file
View file

@ -0,0 +1,5 @@
root = true
[*]
indent_size = 2
indent_style = space

View file

@ -1 +0,0 @@
vim.cmd([[hi LineNr guifg=#bb9af7]])

607
flake.nix
View file

@ -1,66 +1,23 @@
# Copyright (c) 2023 BirdeeHub
# Copyright (c) 2023 BirdeeHub and Gabriel Venberg
# Licensed under the MIT license
# Welcome to the main example config of nixCats!
# there is a minimal flake the starter templates use
# within the nix directory without the nixpkgs input,
# but this one would work too!
# Every config based on nixCats is a full nixCats.
# This example config doesnt use lazy.nvim, and
# it loads everything via nix.
# It has some useful tricks
# in it, especially for lsps, so if you have any questions,
# first look through the docs, and then here!
# It has examples of most of the things you would want to do
# in your main nvim configuration.
# If there is still not adequate info, ask in discussions
# on the nixCats repo (or open a PR to add the info to the help!)
{
description = "A Lua-natic's neovim flake, with extra cats! nixCats!";
description = "Gabes neovim config, based on NixCats";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixCats.url = "github:BirdeeHub/nixCats-nvim";
# see :help nixCats.flake.inputs
# If you want your plugin to be loaded by the standard overlay,
# i.e. if it wasnt on nixpkgs, but doesnt have an extra build step.
# Then you should name it "plugins-something"
# If you wish to define a custom build step not handled by nixpkgs,
# then you should name it in a different format, and deal with that in the
# overlay defined for custom builds in the overlays directory.
# for specific tags, branches and commits, see:
# https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#examples
# No longer fetched to avoid forcing people to import it, but this remains here as a tutorial.
# How to import it into your config is shown farther down in the startupPlugins set.
# You put it here like this, and then below you would use it with `pkgs.neovimPlugins.hlargs`
# "plugins-hlargs" = {
# url = "github:m-demare/hlargs.nvim";
# flake = false;
# };
# neovim-nightly-overlay = {
# url = "github:nix-community/neovim-nightly-overlay";
# };
};
# see :help nixCats.flake.outputs
outputs = { self, nixpkgs, ... }@inputs: let
outputs = {
self,
nixpkgs,
...
} @ inputs: let
inherit (inputs.nixCats) utils;
luaPath = ./.;
# this is flake-utils eachSystem
forEachSystem = utils.eachSystem nixpkgs.lib.platforms.all;
# the following extra_pkg_config contains any values
# which you want to pass to the config set of nixpkgs
# import nixpkgs { config = extra_pkg_config; inherit system; }
# will not apply to module imports
# as that will have your system values
extra_pkg_config = {
# allowUnfree = true;
};
@ -74,26 +31,31 @@
# without fear.
# see :help nixCats.flake.outputs.overlays
dependencyOverlays = /* (import ./overlays inputs) ++ */ [
# This overlay grabs all the inputs named in the format
# `plugins-<pluginName>`
# Once we add this overlay to our nixpkgs, we are able to
# use `pkgs.neovimPlugins`, which is a set of our plugins.
(utils.standardPluginOverlay inputs)
# add any other flake overlays here.
# when other people mess up their overlays by wrapping them with system,
# you may instead call this function on their overlay.
# it will check if it has the system in the set, and if so return the desired overlay
# (utils.fixSystemizedOverlay inputs.codeium.overlays
# (system: inputs.codeium.overlays.${system}.default)
# )
];
dependencyOverlays =
/*
(import ./overlays inputs) ++
*/
[
# This overlay grabs all the inputs named in the format
# `plugins-<pluginName>`
# Once we add this overlay to our nixpkgs, we are able to
# use `pkgs.neovimPlugins`, which is a set of our plugins.
(utils.standardPluginOverlay inputs)
# add any other flake overlays here.
];
# see :help nixCats.flake.outputs.categories
# and
# :help nixCats.flake.outputs.categoryDefinitions.scheme
categoryDefinitions = { pkgs, settings, categories, extra, name, mkPlugin, ... }@packageDef: {
categoryDefinitions = {
pkgs,
settings,
categories,
extra,
name,
mkPlugin,
...
} @ packageDef: {
# to define and use a new category, simply add a new list to a set here,
# and later, you will include categoryname = true; in the set you
# provide when you build the package using this builder function.
@ -103,71 +65,88 @@
# this section is for dependencies that should be available
# at RUN TIME for plugins. Will be available to PATH within neovim terminal
# this includes LSPs
lspsAndRuntimeDeps = {
lspsAndRuntimeDeps = with pkgs; {
# some categories of stuff.
general = with pkgs; [
always = [
universal-ctags
ripgrep
fd
fzf
];
# these names are arbitrary.
lint = with pkgs; [
telescope = [
zoxide
];
# but you can choose which ones you want
# per nvim package you export
debug = with pkgs; {
go = [ delve ];
lsp = {
rust = [
rust-analyzer
cargo
];
lua = [
lua-language-server
];
nix = [
nix-doc
nixd
alejandra
];
python = [
basedpyright
ruff
];
C = [
libclang
];
};
go = with pkgs; [
gopls
gotools
go-tools
gccgo
format = [
];
# and easily check if they are included in lua
format = with pkgs; [
];
neonixdev = {
# also you can do this.
inherit (pkgs) nix-doc lua-language-server nixd;
# and each will be its own sub category
};
};
# This is for plugins that will load at startup without using packadd:
startupPlugins = {
debug = with pkgs.vimPlugins; [
nvim-nio
startupPlugins = with pkgs.vimPlugins; {
always = [
lze
lzextras
plenary-nvim
oil-nvim
nvim-web-devicons
snacks-nvim
nvim-numbertoggle
lualine-nvim
which-key-nvim
todo-comments-nvim
marks-nvim
];
general = with pkgs.vimPlugins; {
# you can make subcategories!!!
# (always isnt a special name, just the one I chose for this subcategory)
always = [
lze
lzextras
vim-repeat
plenary-nvim
nvim-notify
];
extra = [
oil-nvim
nvim-web-devicons
lsp={
rust = [
rustaceanvim
];
};
debug = [
nvim-nio
];
treesitter = [
comment-nvim
rainbow-delimiters-nvim
nvim-treesitter-context
nvim-treesitter.withAllGrammars
treesj
];
# You can retreive information from the
# packageDefinitions of the package this was packaged with.
# :help nixCats.flake.outputs.categoryDefinitions.scheme
themer = with pkgs.vimPlugins;
(builtins.getAttr (categories.colorscheme or "onedark") {
# Theme switcher without creating a new category
"onedark" = onedark-nvim;
"catppuccin" = catppuccin-nvim;
"catppuccin-mocha" = catppuccin-nvim;
"tokyonight" = tokyonight-nvim;
"tokyonight-day" = tokyonight-nvim;
}
);
# This is obviously a fairly basic usecase for this, but still nice.
themer = with pkgs.vimPlugins; (
builtins.getAttr (categories.colorscheme or "gruvbox") {
# Theme switcher without creating a new category
"onedark" = onedark-nvim;
"catppuccin" = catppuccin-nvim;
"tokyonight" = tokyonight-nvim;
"nord" = nord-nvim;
"gruvbox" = gruvbox-nvim;
"solarized" = solarized-nvim;
}
);
# This is obviously a fairly basic usecase for this, but still nice.
};
# not loaded automatically at startup.
@ -175,127 +154,85 @@
# or a tool for organizing this like lze or lz.n!
# to get the name packadd expects, use the
# `:NixCats pawsible` command to see them all
optionalPlugins = {
debug = with pkgs.vimPlugins; {
# it is possible to add default values.
# there is nothing special about the word "default"
# but we have turned this subcategory into a default value
# via the extraCats section at the bottom of categoryDefinitions.
optionalPlugins = with pkgs.vimPlugins; {
debug = {
default = [
nvim-dap
nvim-dap-ui
nvim-dap-virtual-text
telescope-dap-nvim
];
go = [ nvim-dap-go ];
};
lint = with pkgs.vimPlugins; [
lint = [
nvim-lint
];
format = with pkgs.vimPlugins; [
format = [
conform-nvim
];
markdown = with pkgs.vimPlugins; [
markdown = [
markdown-preview-nvim
];
neonixdev = with pkgs.vimPlugins; [
lazydev-nvim
];
general = {
blink = with pkgs.vimPlugins; [
luasnip
cmp-cmdline
blink-cmp
blink-compat
colorful-menu-nvim
];
treesitter = with pkgs.vimPlugins; [
nvim-treesitter-textobjects
nvim-treesitter.withAllGrammars
# This is for if you only want some of the grammars
# (nvim-treesitter.withPlugins (
# plugins: with plugins; [
# nix
# lua
# ]
# ))
];
telescope = with pkgs.vimPlugins; [
telescope-fzf-native-nvim
telescope-ui-select-nvim
telescope-nvim
];
always = with pkgs.vimPlugins; [
lsp = {
default = [
trouble-nvim
lualine-lsp-progress
nvim-lspconfig
lualine-nvim
gitsigns-nvim
vim-sleuth
vim-fugitive
vim-rhubarb
nvim-surround
];
extra = with pkgs.vimPlugins; [
fidget-nvim
# lualine-lsp-progress
which-key-nvim
comment-nvim
undotree
indent-blankline-nvim
vim-startuptime
# If it was included in your flake inputs as plugins-hlargs,
# this would be how to add that plugin in your config.
# pkgs.neovimPlugins.hlargs
zk = [
zk-nvim
];
lua = [
lazydev-nvim
];
};
always = [
gitsigns-nvim
nvim-surround
leap-nvim
toggleterm-nvim
];
tree = [
nvim-tree-lua
fidget-nvim
];
completion = [
luasnip
friendly-snippets
cmp-cmdline
blink-cmp
blink-compat
colorful-menu-nvim
];
telescope = [
telescope-ui-select-nvim
telescope-nvim
telescope-zoxide
telescope-file-browser-nvim
];
extra = [
vim-startuptime
];
};
# shared libraries to be added to LD_LIBRARY_PATH
# variable available to nvim runtime
sharedLibraries = {
general = with pkgs; [ # <- this would be included if any of the subcategories of general are
# libgit2
];
};
# environmentVariables:
# this section is for environmentVariables that should be available
# at RUN TIME for plugins. Will be available to path within neovim terminal
environmentVariables = {
test = {
default = {
CATTESTVARDEFAULT = "It worked!";
};
subtest1 = {
CATTESTVAR = "It worked!";
};
subtest2 = {
CATTESTVAR3 = "It didn't work!";
};
};
};
# If you know what these are, you can provide custom ones by category here.
# If you dont, check this link out:
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/make-wrapper.sh
extraWrapperArgs = {
test = [
'' --set CATTESTVAR2 "It worked again!"''
];
};
# lists of the functions you would have passed to
# python.withPackages or lua.withPackages
# do not forget to set `hosts.python3.enable` in package settings
# get the path to this python environment
# in your lua config via
# vim.g.python3_host_prog
# or run from nvim terminal via :!<packagename>-python3
python3.libraries = {
test = (_:[]);
};
# populates $LUA_PATH and $LUA_CPATH
extraLuaPackages = {
general = [ (_:[]) ];
};
# see :help nixCats.flake.outputs.categoryDefinitions.default_values
@ -305,21 +242,17 @@
# The categories argument of this function is the FINAL value.
# You may use it in any of the other sets.
extraCats = {
test = [
[ "test" "default" ]
];
debug = [
[ "debug" "default" ]
["debug" "default"]
["telescope"]
];
go = [
[ "debug" "go" ] # yes it has to be a list of lists
lsp = [
["lsp" "default"]
["telescope"]
];
};
};
# packageDefinitions:
# Now build a package with specific categories from above
@ -333,124 +266,69 @@
packageDefinitions = {
# the name here is the name of the package
# and also the default command name for it.
nixCats = { pkgs, name, ... }@misc: {
nvim = {
pkgs,
name,
...
} @ misc: {
# these also recieve our pkgs variable
# see :help nixCats.flake.outputs.packageDefinitions
settings = {
suffix-path = true;
suffix-LD = true;
# The name of the package, and the default launch name,
# and the name of the .desktop file, is `nixCats`,
# or, whatever you named the package definition in the packageDefinitions set.
# WARNING: MAKE SURE THESE DONT CONFLICT WITH OTHER INSTALLED PACKAGES ON YOUR PATH
# That would result in a failed build, as nixos and home manager modules validate for collisions on your path
aliases = [ "vim" "vimcat" ];
aliases = [];
# explained below in the `regularCats` package's definition
# OR see :help nixCats.flake.outputs.settings for all of the settings available
wrapRc = true;
configDirName = "nixCats-nvim";
# neovim-unwrapped = inputs.neovim-nightly-overlay.packages.${pkgs.system}.neovim;
hosts.python3.enable = true;
hosts.node.enable = true;
configDirName = "nvim";
};
# enable the categories you want from categoryDefinitions
categories = {
always = true;
treesitter = true;
markdown = true;
general = true;
lint = true;
format = true;
neonixdev = true;
test = {
subtest1 = true;
};
# enabling this category will enable the go category,
# and ALSO debug.go and debug.default due to our extraCats in categoryDefinitions.
# go = true; # <- disabled but you could enable it with override or module on install
# this does not have an associated category of plugins,
# but lua can still check for it
lsp = true;
completion = true;
telescope = true;
tree = true;
debug = true;
lspDebugMode = false;
# you could also pass something else:
# see :help nixCats
themer = true;
colorscheme = "onedark";
colorscheme = "gruvbox";
};
extra = {
# to keep the categories table from being filled with non category things that you want to pass
# there is also an extra table you can use to pass extra stuff.
# but you can pass all the same stuff in any of these sets and access it in lua
nixdExtras = {
nixpkgs = ''import ${pkgs.path} {}'';
# or inherit nixpkgs;
};
};
};
regularCats = { pkgs, ... }@misc: {
nvim-minimal = {
pkgs,
name,
...
} @ misc: {
settings = {
suffix-path = true;
suffix-LD = true;
# IMPURE PACKAGE: normal config reload
# include same categories as main config,
# will load from vim.fn.stdpath('config')
wrapRc = false;
# or tell it some other place to load
# unwrappedCfgPath = "/some/path/to/your/config";
# configDirName: will now look for nixCats-nvim within .config and .local and others
# this can be changed so that you can choose which ones share data folders for auths
# :h $NVIM_APPNAME
configDirName = "nixCats-nvim";
aliases = [ "testCat" ];
# If you wanted nightly, uncomment this, and the flake input.
# neovim-unwrapped = inputs.neovim-nightly-overlay.packages.${pkgs.system}.neovim;
# Probably add the cache stuff they recommend too.
# WARNING: MAKE SURE THESE DONT CONFLICT WITH OTHER INSTALLED PACKAGES ON YOUR PATH
# That would result in a failed build, as nixos and home manager modules validate for collisions on your path
aliases = ["vim"];
wrapRc = true;
configDirName = "nvim-minimal";
};
categories = {
markdown = true;
general = true;
neonixdev = true;
lint = true;
format = true;
test = true;
# go = true; # <- disabled but you could enable it with override or module on install
always = true;
treesitter = true;
completion = true;
telescope = true;
tree = true;
lspDebugMode = false;
themer = true;
colorscheme = "catppuccin";
colorscheme = "gruvbox";
};
extra = {
# nixCats.extra("path.to.val") will perform vim.tbl_get(nixCats.extra, "path" "to" "val")
# this is different from the main nixCats("path.to.cat") in that
# the main nixCats("path.to.cat") will report true if `path.to = true`
# even though path.to.cat would be an indexing error in that case.
# this is to mimic the concept of "subcategories" but may get in the way of just fetching values.
nixdExtras = {
nixpkgs = ''import ${pkgs.path} {}'';
# or inherit nixpkgs;
};
# yes even tortured inputs work.
theBestCat = "says meow!!";
theWorstCat = {
thing'1 = [ "MEOW" '']]' ]=][=[HISSS]]"[['' ];
thing2 = [
{
thing3 = [ "give" "treat" ];
}
"I LOVE KEYBOARDS"
(utils.mkLuaInline ''[[I am a]] .. [[ lua ]] .. type("value")'')
];
thing4 = "couch is for scratching";
};
};
};
};
defaultPackageName = "nixCats";
# I did not here, but you might want to create a package named nvim.
defaultPackageName = "nvim";
# defaultPackageName is also passed to utils.mkNixosModules and utils.mkHomeModules
# and it controls the name of the top level option set.
# If you made a package named `nixCats` your default package as we did here,
@ -463,73 +341,90 @@
# In addition, every package exports its own module via passthru, and is overrideable.
# so you can yourpackage.homeModule and then the namespace would be that packages name.
in
# you shouldnt need to change much past here, but you can if you wish.
# but you should at least eventually try to figure out whats going on here!
# see :help nixCats.flake.outputs.exports
forEachSystem (system: let
# and this will be our builder! it takes a name from our packageDefinitions as an argument, and builds an nvim.
nixCatsBuilder = utils.baseBuilder luaPath {
# we pass in the things to make a pkgs variable to build nvim with later
inherit nixpkgs system dependencyOverlays extra_pkg_config;
# and also our categoryDefinitions and packageDefinitions
} categoryDefinitions packageDefinitions;
# call it with our defaultPackageName
defaultPackage = nixCatsBuilder defaultPackageName;
# see :help nixCats.flake.outputs.exports
forEachSystem (system: let
# and this will be our builder! it takes a name from our packageDefinitions as an argument, and builds an nvim.
nixCatsBuilder =
utils.baseBuilder luaPath {
# we pass in the things to make a pkgs variable to build nvim with later
inherit nixpkgs system dependencyOverlays extra_pkg_config;
# and also our categoryDefinitions and packageDefinitions
}
categoryDefinitions
packageDefinitions;
# call it with our defaultPackageName
defaultPackage = nixCatsBuilder defaultPackageName;
# this pkgs variable is just for using utils such as pkgs.mkShell
# within this outputs set.
pkgs = import nixpkgs { inherit system; };
# The one used to build neovim is resolved inside the builder
# and is passed to our categoryDefinitions and packageDefinitions
in {
# these outputs will be wrapped with ${system} by utils.eachSystem
# this pkgs variable is just for using utils such as pkgs.mkShell
# within this outputs set.
pkgs = import nixpkgs {inherit system;};
# The one used to build neovim is resolved inside the builder
# and is passed to our categoryDefinitions and packageDefinitions
in {
# these outputs will be wrapped with ${system} by utils.eachSystem
# this will generate a set of all the packages
# in the packageDefinitions defined above
# from the package we give it.
# and additionally output the original as default.
packages = utils.mkAllWithDefault defaultPackage;
# this will generate a set of all the packages
# in the packageDefinitions defined above
# from the package we give it.
# and additionally output the original as default.
packages = utils.mkAllWithDefault defaultPackage;
# choose your package for devShell
# and add whatever else you want in it.
devShells = {
default = pkgs.mkShell {
name = defaultPackageName;
packages = [ defaultPackage ];
inputsFrom = [ ];
shellHook = ''
'';
# choose your package for devShell
# and add whatever else you want in it.
devShells = {
default = pkgs.mkShell {
name = defaultPackageName;
packages = [defaultPackage];
inputsFrom = [];
shellHook = ''
'';
};
};
};
})
// (let
# we also export a nixos module to allow reconfiguration from configuration.nix
nixosModule = utils.mkNixosModules {
moduleNamespace = [defaultPackageName];
inherit
defaultPackageName
dependencyOverlays
luaPath
categoryDefinitions
packageDefinitions
extra_pkg_config
nixpkgs
;
};
# and the same for home manager
homeModule = utils.mkHomeModules {
moduleNamespace = [defaultPackageName];
inherit
defaultPackageName
dependencyOverlays
luaPath
categoryDefinitions
packageDefinitions
extra_pkg_config
nixpkgs
;
};
in {
# these outputs will be NOT wrapped with ${system}
}) // (let
# we also export a nixos module to allow reconfiguration from configuration.nix
nixosModule = utils.mkNixosModules {
moduleNamespace = [ defaultPackageName ];
inherit defaultPackageName dependencyOverlays luaPath
categoryDefinitions packageDefinitions extra_pkg_config nixpkgs;
};
# and the same for home manager
homeModule = utils.mkHomeModules {
moduleNamespace = [ defaultPackageName ];
inherit defaultPackageName dependencyOverlays luaPath
categoryDefinitions packageDefinitions extra_pkg_config nixpkgs;
};
in {
# this will make an overlay out of each of the packageDefinitions defined above
# and set the default overlay to the one named here.
overlays =
utils.makeOverlays luaPath {
inherit nixpkgs dependencyOverlays extra_pkg_config;
}
categoryDefinitions
packageDefinitions
defaultPackageName;
# these outputs will be NOT wrapped with ${system}
# this will make an overlay out of each of the packageDefinitions defined above
# and set the default overlay to the one named here.
overlays = utils.makeOverlays luaPath {
inherit nixpkgs dependencyOverlays extra_pkg_config;
} categoryDefinitions packageDefinitions defaultPackageName;
nixosModules.default = nixosModule;
homeModules.default = homeModule;
inherit utils nixosModule homeModule;
inherit (utils) templates;
});
nixosModules.default = nixosModule;
homeModules.default = homeModule;
inherit utils nixosModule homeModule;
inherit (utils) templates;
});
}

View file

@ -2,6 +2,47 @@ local catUtils = require('nixCatsUtils')
if (catUtils.isNixCats and nixCats('lspDebugMode')) then
vim.lsp.set_log_level("debug")
end
-- we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local lspmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
-- all of our LSP keybindings will be namespaced under <leader>l
keys = '<leader>l' .. keys
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
end
lspmap('r', vim.lsp.buf.rename, '[R]ename')
lspmap('a', vim.lsp.buf.code_action, '[C]ode Action')
lspmap('d', vim.lsp.buf.definition, 'Goto [D]efinition')
-- NOTE: why are these functions that call the telescope builtin?
-- because otherwise they would load telescope eagerly when this is defined.
-- due to us using the on_require handler to make sure it is available.
if nixCats('telescope') then
lspmap('R', function() require('telescope.builtin').lsp_references() end, 'Goto [R]eferences')
lspmap('I', function() require('telescope.builtin').lsp_implementations() end, 'Goto [I]mplementation')
lspmap('s', function() require('telescope.builtin').lsp_document_symbols() end, 'Document [S]ymbols')
lspmap('ws', function() require('telescope.builtin').lsp_dynamic_workspace_symbols() end, '[W]orkspace [S]ymbols')
end -- TODO: Investigate whether I can replace these with snacsk.nvim.
lspmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition')
lspmap('h', vim.lsp.buf.hover, 'Hover Documentation')
lspmap('s', vim.lsp.buf.signature_help, 'Signature Documentation')
lspmap('f', vim.lsp.buf.format, 'Format buffer')
-- Lesser used LSP functionality
lspmap('D', vim.lsp.buf.declaration, 'Goto [D]eclaration')
lspmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
lspmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
lspmap('wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, '[W]orkspace [L]ist Folders')
-- NOTE: This file uses lzextras.lsp handler https://github.com/BirdeeHub/lzextras?tab=readme-ov-file#lsp-handler
-- This is a slightly more performant fallback function
@ -9,7 +50,8 @@ end
-- nixCats gives us the paths, which is faster than searching the rtp!
local old_ft_fallback = require('lze').h.lsp.get_ft_fallback()
require('lze').h.lsp.set_ft_fallback(function(name)
local lspcfg = nixCats.pawsible({ "allPlugins", "opt", "nvim-lspconfig" }) or nixCats.pawsible({ "allPlugins", "start", "nvim-lspconfig" })
local lspcfg = nixCats.pawsible({ "allPlugins", "opt", "nvim-lspconfig" }) or
nixCats.pawsible({ "allPlugins", "start", "nvim-lspconfig" })
if lspcfg then
local ok, cfg = pcall(dofile, lspcfg .. "/lsp/" .. name .. ".lua")
if not ok then
@ -23,7 +65,7 @@ end)
require('lze').load {
{
"nvim-lspconfig",
for_cat = "general.core",
for_cat = "lsp",
on_require = { "lspconfig" },
-- NOTE: define a function for lsp,
-- and it will run for all specs with type(plugin.lsp) == table
@ -32,11 +74,6 @@ require('lze').load {
vim.lsp.config(plugin.name, plugin.lsp or {})
vim.lsp.enable(plugin.name)
end,
before = function(_)
vim.lsp.config('*', {
on_attach = require('myLuaConf.LSPs.on_attach'),
})
end,
},
{
"mason.nvim",
@ -54,7 +91,7 @@ require('lze').load {
{
-- lazydev makes your lsp way better in your config without needing extra lsp configuration.
"lazydev.nvim",
for_cat = "neonixdev",
for_cat = "lua",
cmd = { "LazyDev" },
ft = "lua",
after = function(_)
@ -68,7 +105,7 @@ require('lze').load {
{
-- name of the lsp
"lua_ls",
enabled = nixCats('lua') or nixCats('neonixdev') or false,
enabled = nixCats('lua'),
-- provide a table containing filetypes,
-- and then whatever your functions defined in the function type specs expect.
-- in our case, it just expects the normal lspconfig setup options,
@ -93,33 +130,9 @@ require('lze').load {
},
-- also these are regular specs and you can use before and after and all the other normal fields
},
{
"gopls",
for_cat = "go",
-- if you don't provide the filetypes it asks lspconfig for them
lsp = {
filetypes = { "go", "gomod", "gowork", "gotmpl" },
},
},
{
"rnix",
-- mason doesn't have nixd
enabled = not catUtils.isNixCats,
lsp = {
filetypes = { "nix" },
},
},
{
"nil_ls",
-- mason doesn't have nixd
enabled = not catUtils.isNixCats,
lsp = {
filetypes = { "nix" },
},
},
{
"nixd",
enabled = catUtils.isNixCats and (nixCats('nix') or nixCats('neonixdev')) or false,
enabled = catUtils.isNixCats and nixCats('lsp.nix'),
lsp = {
filetypes = { "nix" },
settings = {
@ -132,7 +145,7 @@ require('lze').load {
nixpkgs = {
-- in the extras set of your package definition:
-- nixdExtras.nixpkgs = ''import ${pkgs.path} {}''
expr = nixCats.extra("nixdExtras.nixpkgs") or [[import <nixpkgs> {}]],
expr = nixCats.extra("nixdExtras.nixpkgs")
},
options = {
-- If you integrated with your system flake,
@ -152,7 +165,7 @@ require('lze').load {
}
},
formatting = {
command = { "nixfmt" }
command = { "alejandra" }
},
diagnostic = {
suppress = {
@ -163,4 +176,8 @@ require('lze').load {
},
},
},
{
"rustaceanvim",
for_cat = "lsp.rust",
},
}

View file

@ -1,47 +0,0 @@
return function(_, bufnr)
-- we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
end
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
-- NOTE: why are these functions that call the telescope builtin?
-- because otherwise they would load telescope eagerly when this is defined.
-- due to us using the on_require handler to make sure it is available.
if nixCats('general.telescope') then
nmap('gr', function() require('telescope.builtin').lsp_references() end, '[G]oto [R]eferences')
nmap('gI', function() require('telescope.builtin').lsp_implementations() end, '[G]oto [I]mplementation')
nmap('<leader>ds', function() require('telescope.builtin').lsp_document_symbols() end, '[D]ocument [S]ymbols')
nmap('<leader>ws', function() require('telescope.builtin').lsp_dynamic_workspace_symbols() end, '[W]orkspace [S]ymbols')
end -- TODO: someone who knows the builtin versions of these to do instead help me out please.
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
-- See `:help K` for why this keymap
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
-- Lesser used LSP functionality
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
nmap('<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, '[W]orkspace [L]ist Folders')
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.lsp.buf.format()
end, { desc = 'Format current buffer with LSP' })
end

View file

@ -7,15 +7,14 @@ require('lze').load {
-- event = "",
-- ft = "",
keys = {
{ "<F5>", desc = "Debug: Start/Continue" },
{ "<F1>", desc = "Debug: Step Into" },
{ "<F2>", desc = "Debug: Step Over" },
{ "<F3>", desc = "Debug: Step Out" },
{ "<F5>", desc = "Debug: Start/Continue" },
{ "<F1>", desc = "Debug: Step Into" },
{ "<F2>", desc = "Debug: Step Over" },
{ "<F3>", desc = "Debug: Step Out" },
{ "<leader>b", desc = "Debug: Toggle Breakpoint" },
{ "<leader>B", desc = "Debug: Set Breakpoint" },
{ "<F7>", desc = "Debug: See last session result." },
{ "<F7>", desc = "Debug: See last session result." },
},
-- colorscheme = "",
load = (require('nixCatsUtils').isNixCats and function(name)
vim.cmd.packadd(name)
vim.cmd.packadd("nvim-dap-ui")
@ -26,9 +25,10 @@ require('lze').load {
vim.cmd.packadd("nvim-dap-virtual-text")
vim.cmd.packadd("mason-nvim-dap.nvim")
end,
after = function (plugin)
after = function(plugin)
local dap = require 'dap'
local dapui = require 'dapui'
require('telescope').load_extension('dap')
-- Basic debugging keymaps, feel free to change to your liking!
vim.keymap.set('n', '<F5>', dap.continue, { desc = 'Debug: Start/Continue' })
@ -70,15 +70,15 @@ require('lze').load {
}
require("nvim-dap-virtual-text").setup {
enabled = true, -- enable this plugin (the default)
enabled_commands = true, -- create commands DapVirtualTextEnable, DapVirtualTextDisable, DapVirtualTextToggle, (DapVirtualTextForceRefresh for refreshing when debug adapter did not notify its termination)
highlight_changed_variables = true, -- highlight changed values with NvimDapVirtualTextChanged, else always NvimDapVirtualText
highlight_new_as_changed = false, -- highlight new variables in the same way as changed variables (if highlight_changed_variables)
show_stop_reason = true, -- show stop reason when stopped for exceptions
commented = false, -- prefix virtual text with comment string
only_first_definition = true, -- only show virtual text at first definition (if there are multiple)
all_references = false, -- show virtual text on all all references of the variable (not only definitions)
clear_on_continue = false, -- clear virtual text on "continue" (might cause flickering when stepping)
enabled = true, -- enable this plugin (the default)
enabled_commands = true, -- create commands DapVirtualTextEnable, DapVirtualTextDisable, DapVirtualTextToggle, (DapVirtualTextForceRefresh for refreshing when debug adapter did not notify its termination)
highlight_changed_variables = true, -- highlight changed values with NvimDapVirtualTextChanged, else always NvimDapVirtualText
highlight_new_as_changed = false, -- highlight new variables in the same way as changed variables (if highlight_changed_variables)
show_stop_reason = true, -- show stop reason when stopped for exceptions
commented = false, -- prefix virtual text with comment string
only_first_definition = true, -- only show virtual text at first definition (if there are multiple)
all_references = false, -- show virtual text on all all references of the variable (not only definitions)
clear_on_continue = false, -- clear virtual text on "continue" (might cause flickering when stepping)
--- A callback that determines how a variable is displayed or whether it should be omitted
--- variable Variable https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable
--- buf number
@ -97,23 +97,15 @@ require('lze').load {
virt_text_pos = vim.fn.has 'nvim-0.10' == 1 and 'inline' or 'eol',
-- experimental features:
all_frames = false, -- show virtual text for all stack frames not only current. Only works for debugpy on my machine.
virt_lines = false, -- show virtual lines instead of virtual text (will flicker!)
virt_text_win_col = nil -- position the virtual text at a fixed window column (starting from the first text column) ,
all_frames = false, -- show virtual text for all stack frames not only current. Only works for debugpy on my machine.
virt_lines = false, -- show virtual lines instead of virtual text (will flicker!)
virt_text_win_col = nil -- position the virtual text at a fixed window column (starting from the first text column) ,
-- e.g. 80 to position at column 80, see `:h nvim_buf_set_extmark()`
}
-- NOTE: Install lang specific config
-- either in here, or in a separate plugin spec as demonstrated for go below.
end,
},
end,
},
{
"nvim-dap-go",
for_cat = { cat = 'debug.go', default = false },
on_plugin = { "nvim-dap", },
after = function(plugin)
require("dap-go").setup()
end,
},
}

View file

@ -15,12 +15,6 @@ require('lze').load {
-- javascript = { 'eslint' },
-- typescript = { 'eslint' },
}
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
callback = function()
require("lint").try_lint()
end,
})
end,
},
}

View file

@ -24,7 +24,7 @@ require('nixCatsUtils.catPacker').setup({
{ "BirdeeHub/lze", },
{ "BirdeeHub/lzextras", },
{ "stevearc/oil.nvim", },
{ 'joshdick/onedark.vim', },
{ 'ellisonleao/gruvbox.nvim', },
{ 'nvim-tree/nvim-web-devicons', },
{ 'nvim-lua/plenary.nvim', },
{ 'tpope/vim-repeat', },

View file

@ -1,6 +1,6 @@
-- NOTE: These 2 need to be set up before any plugins are loaded.
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
vim.g.mapleader = ';'
vim.g.maplocalleader = ';'
-- [[ Setting options ]]
-- See `:help vim.o`
@ -10,66 +10,77 @@ vim.g.maplocalleader = ' '
-- See `:help 'list'`
-- and `:help 'listchars'`
vim.opt.list = true
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '' }
vim.opt.listchars = { eol = "", extends = "", nbsp = "", precedes = "", tab = ">-", trail = "" }
vim.opt.showbreak = "";
-- Set highlight on search
vim.opt.hlsearch = true
vim.opt.incsearch = true
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Preview substitutions live, as you type!
vim.opt.inccommand = 'split'
-- Automatically load changed files
vim.opt.autoread = true
-- Minimal number of screen lines to keep above and below the cursor.
vim.opt.scrolloff = 10
-- Make line numbers default
vim.wo.number = true
vim.opt.number = true
-- Enable mouse mode
vim.o.mouse = 'a'
vim.opt.mouse = 'a'
-- no hard wrapping
vim.opt.textwidth = 0
vim.opt.wrapmargin = 0
-- get nice visual guides for 80, 100, and 120 cols.
vim.opt.colorcolumn = { "90", "100", "120", }
-- add line numbers
vim.opt.number = true
vim.opt.numberwidth = 3
-- Indent
-- vim.o.smarttab = true
vim.opt.cpoptions:append('I')
vim.o.expandtab = true
-- vim.o.smartindent = true
-- vim.o.autoindent = true
-- vim.o.tabstop = 4
-- vim.o.softtabstop = 4
-- vim.o.shiftwidth = 4
vim.opt.smarttab = true
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.autoindent = true
vim.opt.tabstop = 4
vim.opt.softtabstop = -1
vim.opt.shiftwidth = 4
-- stops line wrapping from being confusing
vim.o.breakindent = true
-- Save undo history
vim.o.undofile = true
vim.opt.breakindent = true
-- Case-insensitive searching UNLESS \C or capital in search
vim.o.ignorecase = true
vim.o.smartcase = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- Keep signcolumn on by default
vim.wo.signcolumn = 'yes'
vim.wo.relativenumber = true
vim.opt.signcolumn = 'yes'
vim.opt.relativenumber = true
-- Decrease update time
vim.o.updatetime = 250
vim.o.timeoutlen = 300
vim.opt.updatetime = 250
vim.opt.timeoutlen = 300
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menu,preview,noselect'
vim.opt.completeopt = { 'menu', 'preview', 'noselect' }
-- NOTE: You should make sure your terminal supports this
vim.o.termguicolors = true
vim.opt.termguicolors = true
-- disable unneded files
vim.opt.swapfile = false
-- [[ Disable auto comment on enter ]]
-- See :help formatoptions
vim.api.nvim_create_autocmd("FileType", {
desc = "remove formatoptions",
callback = function()
vim.opt.formatoptions:remove({ "c", "r", "o" })
end,
})
-- set options for auto-commenting and using gq
vim.opt.formatoptions = "rojq"
-- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()`
@ -82,33 +93,16 @@ vim.api.nvim_create_autocmd('TextYankPost', {
pattern = '*',
})
vim.g.netrw_liststyle=0
vim.g.netrw_banner=0
vim.g.netrw_liststyle = 0
vim.g.netrw_banner = 0
-- [[ Basic Keymaps ]]
-- Keymaps for better default experience
-- See `:help vim.keymap.set()`
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", { desc = 'Moves Line Down' })
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", { desc = 'Moves Line Up' })
vim.keymap.set("n", "<C-d>", "<C-d>zz", { desc = 'Scroll Down' })
vim.keymap.set("n", "<C-u>", "<C-u>zz", { desc = 'Scroll Up' })
vim.keymap.set("n", "n", "nzzzv", { desc = 'Next Search Result' })
vim.keymap.set("n", "N", "Nzzzv", { desc = 'Previous Search Result' })
vim.keymap.set("n", "<leader><leader>[", "<cmd>bprev<CR>", { desc = 'Previous buffer' })
vim.keymap.set("n", "<leader><leader>]", "<cmd>bnext<CR>", { desc = 'Next buffer' })
vim.keymap.set("n", "<leader><leader>l", "<cmd>b#<CR>", { desc = 'Last buffer' })
vim.keymap.set("n", "<leader><leader>d", "<cmd>bdelete<CR>", { desc = 'delete buffer' })
-- see help sticky keys on windows
vim.cmd([[command! W w]])
vim.cmd([[command! Wq wq]])
vim.cmd([[command! WQ wq]])
vim.cmd([[command! Q q]])
-- Remap for dealing with word wrap
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
-- make quick system clipboard opts easier
vim.keymap.set({ 'n', 'v', 'x' }, '<leader>p', '"+p', { noremap = true, silent = true, desc = 'Paste from clipboard' })
vim.keymap.set({ "v", "x", "n" }, '<leader>y', '"+y', { noremap = true, silent = true, desc = 'Yank to clipboard' })
vim.keymap.set({ "n", "v", "x" }, '<leader>Y', '"+yy', { noremap = true, silent = true, desc = 'Yank line to clipboard' })
vim.keymap.set('i', '<C-p>', '<C-r><C-p>+',
{ noremap = true, silent = true, desc = 'Paste from clipboard from within insert mode' })
-- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
@ -116,21 +110,8 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnos
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
-- kickstart.nvim starts you with this.
-- But it constantly clobbers your system clipboard whenever you delete anything.
-- Sync clipboard between OS and Neovim.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
-- vim.o.clipboard = 'unnamedplus'
-- You should instead use these keybindings so that they are still easy to use, but dont conflict
vim.keymap.set({"v", "x", "n"}, '<leader>y', '"+y', { noremap = true, silent = true, desc = 'Yank to clipboard' })
vim.keymap.set({"n", "v", "x"}, '<leader>Y', '"+yy', { noremap = true, silent = true, desc = 'Yank line to clipboard' })
vim.keymap.set({"n", "v", "x"}, '<C-a>', 'gg0vG$', { noremap = true, silent = true, desc = 'Select all' })
vim.keymap.set({'n', 'v', 'x'}, '<leader>p', '"+p', { noremap = true, silent = true, desc = 'Paste from clipboard' })
vim.keymap.set('i', '<C-p>', '<C-r><C-p>+', { noremap = true, silent = true, desc = 'Paste from clipboard from within insert mode' })
vim.keymap.set("x", "<leader>P", '"_dP', { noremap = true, silent = true, desc = 'Paste over selection without erasing unnamed register' })
-- moving between splits
vim.keymap.set('n', '<C-h>', '<C-w>h', { desc = 'move to right split' })
vim.keymap.set('n', '<C-j>', '<C-w>j', { desc = 'move to below split' })
vim.keymap.set('n', '<C-k>', '<C-w>k', { desc = 'move to above split' })
vim.keymap.set('n', '<C-l>', '<C-w>l', { desc = 'move to left split' })

View file

@ -6,20 +6,21 @@ end
return {
{
"cmp-cmdline",
for_cat = "general.blink",
for_cat = "completion",
on_plugin = { "blink.cmp" },
load = load_w_after,
},
{
"blink.compat",
for_cat = "general.blink",
for_cat = "completion",
dep_of = { "cmp-cmdline" },
},
{
"luasnip",
for_cat = "general.blink",
for_cat = "completion",
dep_of = { "blink.cmp" },
after = function (_)
after = function(_)
vim.cmd.packadd("friendly-snippets")
local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {}
@ -27,31 +28,39 @@ return {
local ls = require('luasnip')
vim.keymap.set({ "i", "s" }, "<M-n>", function()
if ls.choice_active() then
ls.change_choice(1)
end
if ls.choice_active() then
ls.change_choice(1)
end
end)
end,
},
{
"colorful-menu.nvim",
for_cat = "general.blink",
for_cat = "completion",
on_plugin = { "blink.cmp" },
},
{
"blink.cmp",
for_cat = "general.blink",
for_cat = "completion",
event = "DeferredUIEnter",
after = function (_)
after = function(_)
require("blink.cmp").setup({
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
-- See :h blink-cmp-config-keymap for configuring keymaps
keymap = {
preset = 'default',
keymap = {
preset = "enter",
["<Tab>"] = { "select_next", "fallback" },
["<S-Tab>"] = { "select_prev", "fallback" },
},
cmdline = {
enabled = true,
completion = {
list = {
selection = {
preselect = false,
-- auto_insert = false,
},
},
menu = {
auto_show = true,
},

View file

@ -1,6 +1,6 @@
local colorschemeName = nixCats('colorscheme')
if not require('nixCatsUtils').isNixCats then
colorschemeName = 'onedark'
colorschemeName = 'gruvbox'
end
-- Could I lazy load on colorscheme with lze?
-- sure. But I was going to call vim.cmd.colorscheme() during startup anyway
@ -16,12 +16,12 @@ if ok then
})
vim.notify = notify
vim.keymap.set("n", "<Esc>", function()
notify.dismiss({ silent = true, })
notify.dismiss({ silent = true, })
end, { desc = "dismiss notify popup and clear hlsearch" })
end
-- NOTE: you can check if you included the category with the thing wherever you want.
if nixCats('general.extra') then
if nixCats('always') then
-- I didnt want to bother with lazy loading this.
-- I could put it in opt and put it in a spec anyway
-- and then not set any handlers and it would load at startup,
@ -74,56 +74,45 @@ require('lze').load {
-- it is defined in luaUtils template in lua/nixCatsUtils/lzUtils.lua
-- you could replace this with enabled = nixCats('cat.name') == true
-- if you didnt care to set a different default for when not using nix than the default you already set
for_cat = 'general.markdown',
for_cat = 'markdown',
cmd = { "MarkdownPreview", "MarkdownPreviewStop", "MarkdownPreviewToggle", },
ft = "markdown",
keys = {
{"<leader>mp", "<cmd>MarkdownPreview <CR>", mode = {"n"}, noremap = true, desc = "markdown preview"},
{"<leader>ms", "<cmd>MarkdownPreviewStop <CR>", mode = {"n"}, noremap = true, desc = "markdown preview stop"},
{"<leader>mt", "<cmd>MarkdownPreviewToggle <CR>", mode = {"n"}, noremap = true, desc = "markdown preview toggle"},
{ "<leader>mp", "<cmd>MarkdownPreview <CR>", mode = { "n" }, noremap = true, desc = "markdown preview" },
{ "<leader>ms", "<cmd>MarkdownPreviewStop <CR>", mode = { "n" }, noremap = true, desc = "markdown preview stop" },
{ "<leader>mt", "<cmd>MarkdownPreviewToggle <CR>", mode = { "n" }, noremap = true, desc = "markdown preview toggle" },
},
before = function(plugin)
vim.g.mkdp_auto_close = 0
end,
},
{
"undotree",
for_cat = 'general.extra',
cmd = { "UndotreeToggle", "UndotreeHide", "UndotreeShow", "UndotreeFocus", "UndotreePersistUndo", },
keys = { { "<leader>U", "<cmd>UndotreeToggle<CR>", mode = { "n" }, desc = "Undo Tree" }, },
before = function(_)
vim.g.undotree_WindowLayout = 1
vim.g.undotree_SplitWidth = 40
end,
},
{
"comment.nvim",
for_cat = 'general.extra',
"leap.nvim",
for_cat = 'always',
event = "DeferredUIEnter",
after = function(plugin)
require('Comment').setup()
end,
},
{
"indent-blankline.nvim",
for_cat = 'general.extra',
event = "DeferredUIEnter",
after = function(plugin)
require("ibl").setup()
require('leap').set_default_mappings()
end,
},
{
"nvim-surround",
for_cat = 'general.always',
for_cat = 'always',
event = "DeferredUIEnter",
-- keys = "",
after = function(plugin)
require('nvim-surround').setup()
end,
},
{
"marks.nvim",
for_cat = "always",
after = function(plugin)
require('marks').setup({})
end
},
{
"vim-startuptime",
for_cat = 'general.extra',
for_cat = 'extra',
cmd = { "StartupTime" },
before = function(_)
vim.g.startuptime_event_width = 0
@ -133,77 +122,92 @@ require('lze').load {
},
{
"fidget.nvim",
for_cat = 'general.extra',
for_cat = 'always',
event = "DeferredUIEnter",
-- keys = "",
after = function(plugin)
require('fidget').setup({})
end,
},
-- {
-- "hlargs",
-- for_cat = 'general.extra',
-- event = "DeferredUIEnter",
-- -- keys = "",
-- dep_of = { "nvim-lspconfig" },
-- after = function(plugin)
-- require('hlargs').setup {
-- color = '#32a88f',
-- }
-- vim.cmd([[hi clear @lsp.type.parameter]])
-- vim.cmd([[hi link @lsp.type.parameter Hlargs]])
-- end,
-- },
{
"toggleterm.nvim",
for_cat = "always",
after = function(plugin)
require("toggleterm").setup({
direction = "horizontal",
insert_mappings = false,
open_mapping = [[<c-\>]],
terminal_mappings = false,
})
local Terminal = require("toggleterm.terminal").Terminal
Floatingterm = Terminal:new({
hidden = true,
direction = "float",
})
vim.keymap.set(
"n",
"<leader>s",
function()
Floatingterm:toggle()
end,
{ desc = "toggle [S]cratch terminal", }
)
end
},
{
"lualine.nvim",
for_cat = 'general.always',
for_cat = 'always',
-- cmd = { "" },
event = "DeferredUIEnter",
-- ft = "",
-- keys = "",
-- colorscheme = "",
after = function (plugin)
after = function(plugin)
require('lualine').setup({
options = {
icons_enabled = false,
theme = colorschemeName,
component_separators = '|',
section_separators = '',
},
sections = {
lualine_c = {
{
'filename', path = 1, status = true,
},
},
alwaysDivideMiddle = true,
icons_enabled = true,
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
},
inactive_sections = {
lualine_b = {
{
'filename', path = 3, status = true,
},
},
lualine_x = {'filetype'},
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { "filetype" },
lualine_y = {},
lualine_z = {},
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = { { "filename", path = 1 } },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" },
},
tabline = {
lualine_a = { 'buffers' },
-- if you use lualine-lsp-progress, I have mine here instead of fidget
-- lualine_b = { 'lsp_progress', },
lualine_z = { 'tabs' }
lualine_a = { { "buffers", mode = 4 } },
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = { { "tabs", mode = 2 } }
},
})
end,
},
{
"gitsigns.nvim",
for_cat = 'general.always',
for_cat = 'always',
event = "DeferredUIEnter",
-- cmd = { "" },
-- ft = "",
-- keys = "",
-- colorscheme = "",
after = function (plugin)
after = function(plugin)
require('gitsigns').setup({
-- See `:help gitsigns.txt`
signs = {
@ -281,35 +285,80 @@ require('lze').load {
},
{
"which-key.nvim",
for_cat = 'general.extra',
-- cmd = { "" },
event = "DeferredUIEnter",
-- ft = "",
-- keys = "",
-- colorscheme = "",
after = function (plugin)
for_cat = 'always',
after = function(plugin)
require('which-key').setup({
})
require('which-key').add {
{ "<leader><leader>", group = "buffer commands" },
{ "<leader><leader>_", hidden = true },
{ "<leader>c", group = "[c]ode" },
{ "<leader>c_", hidden = true },
{ "<leader>d", group = "[d]ocument" },
{ "<leader>d_", hidden = true },
{ "<leader>g", group = "[g]it" },
{ "<leader>g_", hidden = true },
{ "<leader>gt", group = "[t]oggle" },
{ "<leader>m", group = "[m]arkdown" },
{ "<leader>m_", hidden = true },
{ "<leader>r", group = "[r]ename" },
{ "<leader>r_", hidden = true },
{ "<leader>s", group = "[s]earch" },
{ "<leader>s_", hidden = true },
{ "<leader>t", group = "[t]oggles" },
{ "<leader>t_", hidden = true },
{ "<leader>w", group = "[w]orkspace" },
{ "<leader>w_", hidden = true },
{ "<leader>f", group = "[f]ind" },
{ "<leader>t", group = "[t]ree" },
{ "<leader>c", group = "[c]heck" },
{ "<leader>l", group = "[l]sp" },
{ "<leader>lw", group = "[l]sp [w]orkspace" },
}
end,
},
{
"nvim-tree.lua",
for_cat = "tree",
keys = {
{ "<leader>t", "<cmd>NvimTreeToggle<CR>", desc = "Toggle file tree", },
},
after = function(plugin)
require("nvim-tree").setup()
end
},
{
-- TODO: Replace toggle term and nvim-tree with snacks equivilants?
-- Potentially checkout the lazygit module. Might even be able to replace
-- telescope?
-- if you do replace telescope, the picker module has a *ton* of interesting pickers, such as an undotree.
"snacks.nvim",
for_cat = "always",
priority = 10,
after = function()
local Snacks = require("snacks")
Snacks.setup({
input = {},
image = {},
notifier = {},
scroll = {},
picker = {
enabled = true,
ui_select = true,
},
terminal = {},
indent = {
animate = { enabled = true },
scope = { enabled = true },
chunk = { enabled = true },
},
})
-- setup rename autocmds
local prev = { new_name = "", old_name = "" } -- Prevents duplicate events
vim.api.nvim_create_autocmd("User", {
pattern = "NvimTreeSetup",
callback = function()
local events = require("nvim-tree.api").events
events.subscribe(events.Event.NodeRenamed, function(data)
if prev.new_name ~= data.new_name or prev.old_name ~= data.old_name then
data = data
Snacks.rename.on_rename_file(data.old_name, data.new_name)
end
end)
end,
})
vim.api.nvim_create_autocmd("User", {
pattern = "OilActionsPost",
callback = function(event)
if event.data.actions.type == "move" then
Snacks.rename.on_rename_file(event.data.actions.src_url, event.data.actions.dest_url)
end
end,
})
end
},
}

View file

@ -57,7 +57,7 @@ end
return {
{
"telescope.nvim",
for_cat = 'general.telescope',
for_cat = 'telescope',
cmd = { "Telescope", "LiveGrepGitRoot" },
-- NOTE: our on attach function defines keybinds that call telescope.
-- so, the on_require handler will load telescope when we use those.
@ -65,49 +65,37 @@ return {
-- event = "",
-- ft = "",
keys = {
{ "<leader>sM", '<cmd>Telescope notify<CR>', mode = {"n"}, desc = '[S]earch [M]essage', },
{ "<leader>sp",live_grep_git_root, mode = {"n"}, desc = '[S]earch git [P]roject root', },
{ "<leader>/", function()
-- Slightly advanced example of overriding default behavior and theme
-- You can pass additional configuration to telescope to change theme, layout, etc.
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, mode = {"n"}, desc = '[/] Fuzzily search in current buffer', },
{ "<leader>s/", function()
{ "<leader>fM", '<cmd>Telescope notify<CR>', mode = {"n"}, desc = '[F]ind [M]essage', },
{ "<leader>fp",live_grep_git_root, mode = {"n"}, desc = '[F]ind git [P]roject root', },
{ "<leader>f/", function()
require('telescope.builtin').live_grep {
grep_open_files = true,
prompt_title = 'Live Grep in Open Files',
}
end, mode = {"n"}, desc = '[S]earch [/] in Open Files' },
{ "<leader><leader>s", function() return require('telescope.builtin').buffers() end, mode = {"n"}, desc = '[ ] Find existing buffers', },
{ "<leader>s.", function() return require('telescope.builtin').oldfiles() end, mode = {"n"}, desc = '[S]earch Recent Files ("." for repeat)', },
{ "<leader>sr", function() return require('telescope.builtin').resume() end, mode = {"n"}, desc = '[S]earch [R]esume', },
{ "<leader>sd", function() return require('telescope.builtin').diagnostics() end, mode = {"n"}, desc = '[S]earch [D]iagnostics', },
{ "<leader>sg", function() return require('telescope.builtin').live_grep() end, mode = {"n"}, desc = '[S]earch by [G]rep', },
{ "<leader>sw", function() return require('telescope.builtin').grep_string() end, mode = {"n"}, desc = '[S]earch current [W]ord', },
{ "<leader>ss", function() return require('telescope.builtin').builtin() end, mode = {"n"}, desc = '[S]earch [S]elect Telescope', },
{ "<leader>sf", function() return require('telescope.builtin').find_files() end, mode = {"n"}, desc = '[S]earch [F]iles', },
{ "<leader>sk", function() return require('telescope.builtin').keymaps() end, mode = {"n"}, desc = '[S]earch [K]eymaps', },
{ "<leader>sh", function() return require('telescope.builtin').help_tags() end, mode = {"n"}, desc = '[S]earch [H]elp', },
end, mode = {"n"}, desc = '[F]ind [/] in Open Files' },
{ "<leader>fb", function() return require('telescope.builtin').buffers() end, mode = {"n"}, desc = '[F]ind [B]uffers', },
{ "<leader>fr", function() return require('telescope.builtin').resume() end, mode = {"n"}, desc = '[F]ind [R]esume', },
{ "<leader>fd", function() return require('telescope.builtin').diagnostics() end, mode = {"n"}, desc = '[F]ind [D]iagnostics', },
{ "<leader>fg", function() return require('telescope.builtin').live_grep() end, mode = {"n"}, desc = '[F]ind by [G]rep', },
{ "<leader>fs", function() return require('telescope.builtin').builtin() end, mode = {"n"}, desc = '[F]ind [S]elect Telescope', },
{ "<leader>ff", function() return require('telescope.builtin').find_files() end, mode = {"n"}, desc = '[F]ind [F]iles', },
{ "<leader>fk", function() return require('telescope.builtin').keymaps() end, mode = {"n"}, desc = '[F]ind [K]eymaps', },
{ "<leader>fh", function() return require('telescope.builtin').help_tags() end, mode = {"n"}, desc = '[F]ind [H]elp', },
{ "<leader>fz", function() require("telescope").extensions.zoxide.list() end, mode = {"n"}, desc = '[F]ind [Z]oxide',},
{ "<leader>fi", function() require("telescope").extensions.file_browser.file_browser() end, mode={"n"}, desc = '[F]ind [I]nteractive file browser',},
},
-- colorscheme = "",
load = function (name)
vim.cmd.packadd(name)
vim.cmd.packadd("telescope-fzf-native.nvim")
vim.cmd.packadd("telescope-ui-select.nvim")
vim.cmd.packadd("telescope-file-browser.nvim")
vim.cmd.packadd("telescope-zoxide")
end,
after = function (plugin)
require('telescope').setup {
local telescope = require("telescope")
telescope.setup {
-- You can put your default mappings / updates / etc. in here
-- All the info you're looking for is in `:help telescope.setup()`
--
defaults = {
mappings = {
i = { ['<c-enter>'] = 'to_fuzzy_refine' },
},
},
-- pickers = {}
extensions = {
['ui-select'] = {
@ -117,8 +105,9 @@ return {
}
-- Enable telescope extensions, if they are installed
pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'ui-select')
telescope.load_extension('ui-select')
telescope.load_extension('zoxide')
telescope.load_extension('file_browser')
vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {})
end,

View file

@ -3,17 +3,17 @@
return {
{
"nvim-treesitter",
for_cat = 'general.treesitter',
for_cat = 'treesitter',
-- cmd = { "" },
event = "DeferredUIEnter",
-- ft = "",
-- keys = "",
-- colorscheme = "",
load = function (name)
vim.cmd.packadd(name)
vim.cmd.packadd("nvim-treesitter-textobjects")
load = function(name)
vim.cmd.packadd(name)
vim.cmd.packadd("rainbow-delimiters.nvim")
end,
after = function (plugin)
after = function(plugin)
-- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup {
@ -28,51 +28,29 @@ return {
node_decremental = '<M-space>',
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
}
end,
},
{
"comment.nvim",
for_cat = 'telescope',
after = function(plugin)
require('Comment').setup()
end,
},
{
"nvim-treesitter-context",
for_cat = 'treesitter',
keys = { { "<leader>x", "<cmd>TsContext toggle<CR>", mode = { "n" }, desc = "Toggle Context" }, },
},
{
"treesj",
for_cat = 'treesitter',
keys = { { "<leader>j", "<cmd>TSJToggle<CR>", mode = { "n" }, desc = "Treesitter join" }, },
after = function(_)
require("treesj").setup({
use_default_keymaps = false
})
end
},
}