more neovim stuff

This commit is contained in:
cswimr 2025-02-06 23:23:02 -06:00
parent dbface588a
commit 814f9a1bea
Signed by: cswimr
GPG key ID: 0EC431A8DA8F8087
11 changed files with 286 additions and 85 deletions

View file

@ -5,16 +5,20 @@
./plugins/autoclose.nix
./plugins/cmp.nix
./plugins/codesnap.nix
./plugins/conform.nix
./plugins/dap.nix
./plugins/dashboard.nix
./plugins/devcontainer.nix
./plugins/floatterm.nix
./plugins/hover.nix
./plugins/lazygit.nix
./plugins/lsp.nix
./plugins/lualine.nix
./plugins/oil.nix
./plugins/profile.nix
./plugins/rooter.nix
./plugins/snacks.nix
./plugins/surround.nix
./plugins/telescope.nix
./plugins/treesitter.nix
];

View file

@ -6,7 +6,12 @@
};
keymaps = [
{
mode = "n"; # Normal mode
mode = [
"n"
"s"
"x"
"v"
];
key = "<Space>";
action = "<Nop>";
options.silent = true;
@ -50,7 +55,7 @@
{
mode = "n";
key = "<Tab>";
action = ":bnext<CR>";
action = "<CMD>bnext<CR>";
options = {
desc = "Next Buffer";
silent = true;
@ -59,16 +64,38 @@
{
mode = "n";
key = "<S-Tab>";
action = ":bprevious<CR>";
action = "<CMD>bprevious<CR>";
options = {
desc = "Previous Buffer";
silent = true;
};
}
{
mode = "n";
key = "<leader>c";
action = "<CMD>%y+<CR>";
options = {
desc = "Copy Buffer to Clipboard";
silent = true;
};
}
{
mode = [
"v"
"x"
"s"
];
key = "<leader>c";
action = "<CMD>\"+y<CR>";
options = {
desc = "Copy Selection to Clipboard";
silent = true;
};
}
{
mode = "n";
key = "<leader>w";
action = ":w<CR>";
action = "<CMD>w<CR>";
options = {
desc = "Save Buffer to File";
silent = false;
@ -77,7 +104,7 @@
{
mode = "n";
key = "<leader>q";
action = ":bd<CR>";
action = "<CMD>bd<CR>";
options = {
desc = "Close Buffer";
silent = false;
@ -86,7 +113,7 @@
{
mode = "n";
key = "<leader>Q";
action = ":bd!<CR>";
action = "<CMD>bd!<CR>";
options = {
desc = "Force Close Buffer";
silent = false;
@ -95,7 +122,7 @@
{
mode = "n";
key = "<leader>`";
action = ":qa<CR>";
action = "<CMD>qa<CR>";
options = {
desc = "Quit All";
silent = false;

View file

@ -20,7 +20,13 @@
};
};
};
copilot-lua.enable = true;
copilot-lua = {
enable = true;
settings = {
suggestion.enabled = false;
panel.enabled = false;
};
};
copilot-cmp.enable = true;
};
};

View file

@ -0,0 +1,39 @@
{
programs.nixvim = {
plugins = {
codesnap = {
enable = true;
settings = {
bg_theme = "grape";
breadcrumbs_separator = "/";
has_breadcrumbs = true;
show_workspace = true;
has_line_number = true;
mac_window_bar = false;
# https://github.com/mistricky/codesnap.nvim/issues/135
# code_font_family = "ComicCodeLigatures Nerd Font";
title = "Nixvim";
watermark = "";
# half of defaults (122, 82)
bg_x_padding = 61;
bg_y_padding = 41;
};
};
};
keymaps = [
{
mode = [
"v"
"x"
"s"
];
key = "<leader>s";
action = "<CMD>CodeSnap<CR>";
options = {
desc = "Copy Selection as CodeSnap Image";
silent = true;
};
}
];
};
}

View file

@ -0,0 +1,13 @@
{ pkgs, lib, ... }:
{
programs.nixvim = {
plugins = {
dap = {
enable = true;
};
dap-python = {
enable = true;
};
};
};
}

View file

@ -0,0 +1,36 @@
{ pkgs, ... }:
{
programs.nixvim = {
extraPlugins = [
(pkgs.vimUtils.buildVimPlugin {
# https://github.com/EmilOhlsson/FloatTerm.nvim
name = "FloatTerm";
src = pkgs.fetchFromGitHub {
owner = "EmilOhlsson";
repo = "FloatTerm.nvim";
rev = "b6b8f43c097d9edd923a6442e9aca71949cfe6ea";
sha256 = "sha256-g6qQn2NA3nsTVE8+/9Vc2BCLCcZnKJfryRUXCw/Lp4g=";
};
})
];
extraConfigLua = # lua
''
require("FloatTerm").setup({
window_config = {
title = "Terminal",
},
})
'';
keymaps = [
{
mode = "n";
key = "<leader>s";
action = "<CMD>FloatTerm<CR>";
options = {
desc = "Toggle Floating Terminal";
silent = true;
};
}
];
};
}

View file

@ -0,0 +1,91 @@
{ pkgs, ... }:
{
programs.nixvim = {
extraPlugins = with pkgs.vimPlugins; [
hover-nvim
];
extraConfigLua = # lua
''
require("hover").setup({
init = function()
require("hover.providers.lsp")
require("hover.providers.diagnostic")
require("hover.providers.man")
require("hover.providers.dictionary")
end,
preview_opts = {
border = 'single',
},
preview_window = true,
title = true,
mouse_providers = {
'LSP',
},
mouse_delay = 100
})
vim.o.mousemoveevent = true
'';
# autoCmd = [
# {
# desc = "Open Hover window when hovering over a word";
# event = "CursorHold";
# pattern = "*";
# callback.__raw = ''
# function(_)
# local word = vim.fn.expand("<cword>")
# if word ~= "" then
# require('hover').hover()
# end
# end
# '';
# }
# ];
keymaps = [
{
mode = "n";
key = "K";
action = "<CMD>lua require('hover').hover()<CR>";
options = {
desc = "Open Hover Window";
silent = true;
};
}
{
mode = "n";
key = "gK";
action = "<CMD>lua require('hover').hover()<CR>";
options = {
desc = "Select Hover Source";
silent = true;
};
}
{
mode = "n";
key = "<C-p>";
action = "<CMD>lua require('hover').hover_switch('previous')<CR>";
options = {
desc = "Previous Hover Source";
silent = true;
};
}
{
mode = "n";
key = "<C-n>";
action = "<CMD>lua require('hover').hover_switch('next')<CR>";
options = {
desc = "Next Hover Source";
silent = true;
};
}
{
mode = "n";
key = "<MouseMove>";
action = "<CMD>lua require('hover').hover_mouse()<CR>";
options = {
desc = "Hover Mouse Support";
silent = true;
};
}
];
};
}

View file

@ -2,21 +2,7 @@
{
programs.nixvim = {
extraPackages = with pkgs; [
basedpyright
ruff
nil
nixfmt-rfc-style
(callPackage ../../../packages/luau-lsp.nix { inherit pkgs; })
dockerfile-language-server-nodejs
docker-compose-language-service
csharp-ls
deno
bash-language-server
powershell
powershell-editor-services
vscode-langservers-extracted
tailwindcss-language-server
typos-lsp
];
plugins = {
luasnip = {
@ -25,9 +11,47 @@
lsp-status = {
enable = true;
};
schemastore = {
enable = true;
json.enable = true;
yaml.enable = true;
};
lsp = {
enable = true;
postConfig = # lua
capabilities = # lua
''capabilities.textDocument.completion.completionItem.snippetSupport = true'';
inlayHints = true;
servers = {
basedpyright = {
enable = true; # Python
settings = {
pyright.disableOrganizeImports = true;
};
};
ruff.enable = true; # Python
csharp_ls.enable = true;
nil_ls = {
enable = true; # Nix
settings.formatting.command = [ "${lib.getExe pkgs.nixfmt-rfc-style}" ];
};
luau_lsp = {
enable = true;
package = pkgs.callPackage ../../../packages/luau-lsp.nix { inherit pkgs; };
};
html.enable = true;
jsonls.enable = true;
yamlls.enable = true;
taplo.enable = true; # TOML
cssls.enable = true;
tailwindcss.enable = true;
dockerls.enable = true;
docker_compose_language_service.enable = true;
bashls.enable = true;
denols.enable = true; # JavaScript / TypeScript (Deno)
eslint.enable = true; # JavaScript / TypeScript
typos_lsp.enable = true;
};
preConfig = # lua
''
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup('lsp_attach_disable_ruff_hover', { clear = true }),
@ -37,48 +61,12 @@
return
end
if client.name == 'ruff' then
-- Disable hover in favor of Pyright
-- Disable hover in favor of basedpyright
client.server_capabilities.hoverProvider = false
end
end,
desc = 'LSP: Disable hover capability from Ruff',
})
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
require('lspconfig').basedpyright.setup { settings = { pyright = { disableOrganizeImports = true } } }
require('lspconfig').ruff.setup { }
require('lspconfig').csharp_ls.setup { }
require('lspconfig').nil_ls.setup {
cmd = { "${lib.getExe pkgs.nil}" },
settings = {
['nil'] = {
formatting = {
command = { "${lib.getExe pkgs.nixfmt-rfc-style}" },
},
},
},
}
require('lspconfig').luau_lsp.setup { }
require('lspconfig').denols.setup { }
require('lspconfig').eslint.setup { }
require('lspconfig').html.setup {
capabilities = capabilities,
}
require('lspconfig').cssls.setup {
capabilities = capabilities,
}
require('lspconfig').jsonls.setup {
capabilities = capabilities,
}
require('lspconfig').tailwindcss.setup { }
require('lspconfig').dockerls.setup { }
require('lspconfig').docker_compose_language_service.setup { }
require('lspconfig').bashls.setup { }
require('lspconfig').powershell_es.setup {
bundle_path = "${lib.getExe pkgs.powershell-editor-services}",
shell = "${lib.getExe pkgs.powershell}",
}
require('lspconfig').typos_lsp.setup { }
'';
};
trouble = {

View file

@ -1,23 +0,0 @@
{
programs.nixvim = {
plugins = {
oil = {
enable = true;
settings = {
default_file_explorer = false;
};
};
};
keymaps = [
{
mode = "n";
key = "<leader>o";
action = "<CMD>Oil --float<CR>";
options = {
desc = "Manage Files";
silent = true;
};
}
];
};
}

View file

@ -0,0 +1,9 @@
{
programs.nixvim = {
plugins = {
nvim-surround = {
enable = true;
};
};
};
}

View file

@ -13,7 +13,7 @@
byteCompileLua = {
enable = true;
configs = true;
initLua = true;
initLua = false;
nvimRuntime = true;
plugins = true;
};
@ -61,6 +61,17 @@
sqlite-lua.enable = true;
lazydev.enable = true;
};
userCommands = {
ViewInit = {
desc = "Open the Neovim init.lua file";
command = "lua vim.cmd('view '.. InitPath)";
};
};
extraConfigLua = # lua
''
InitPath = debug.getinfo(1, "S").source:sub(2)
print("Neovim init file location: " .. InitPath)
'';
extraConfigVim = ''
set number " enable number lines
'';