more neovim stuff
This commit is contained in:
parent
dbface588a
commit
814f9a1bea
11 changed files with 286 additions and 85 deletions
|
@ -5,16 +5,20 @@
|
||||||
|
|
||||||
./plugins/autoclose.nix
|
./plugins/autoclose.nix
|
||||||
./plugins/cmp.nix
|
./plugins/cmp.nix
|
||||||
|
./plugins/codesnap.nix
|
||||||
./plugins/conform.nix
|
./plugins/conform.nix
|
||||||
|
./plugins/dap.nix
|
||||||
./plugins/dashboard.nix
|
./plugins/dashboard.nix
|
||||||
./plugins/devcontainer.nix
|
./plugins/devcontainer.nix
|
||||||
|
./plugins/floatterm.nix
|
||||||
|
./plugins/hover.nix
|
||||||
./plugins/lazygit.nix
|
./plugins/lazygit.nix
|
||||||
./plugins/lsp.nix
|
./plugins/lsp.nix
|
||||||
./plugins/lualine.nix
|
./plugins/lualine.nix
|
||||||
./plugins/oil.nix
|
|
||||||
./plugins/profile.nix
|
./plugins/profile.nix
|
||||||
./plugins/rooter.nix
|
./plugins/rooter.nix
|
||||||
./plugins/snacks.nix
|
./plugins/snacks.nix
|
||||||
|
./plugins/surround.nix
|
||||||
./plugins/telescope.nix
|
./plugins/telescope.nix
|
||||||
./plugins/treesitter.nix
|
./plugins/treesitter.nix
|
||||||
];
|
];
|
||||||
|
|
|
@ -6,7 +6,12 @@
|
||||||
};
|
};
|
||||||
keymaps = [
|
keymaps = [
|
||||||
{
|
{
|
||||||
mode = "n"; # Normal mode
|
mode = [
|
||||||
|
"n"
|
||||||
|
"s"
|
||||||
|
"x"
|
||||||
|
"v"
|
||||||
|
];
|
||||||
key = "<Space>";
|
key = "<Space>";
|
||||||
action = "<Nop>";
|
action = "<Nop>";
|
||||||
options.silent = true;
|
options.silent = true;
|
||||||
|
@ -50,7 +55,7 @@
|
||||||
{
|
{
|
||||||
mode = "n";
|
mode = "n";
|
||||||
key = "<Tab>";
|
key = "<Tab>";
|
||||||
action = ":bnext<CR>";
|
action = "<CMD>bnext<CR>";
|
||||||
options = {
|
options = {
|
||||||
desc = "Next Buffer";
|
desc = "Next Buffer";
|
||||||
silent = true;
|
silent = true;
|
||||||
|
@ -59,16 +64,38 @@
|
||||||
{
|
{
|
||||||
mode = "n";
|
mode = "n";
|
||||||
key = "<S-Tab>";
|
key = "<S-Tab>";
|
||||||
action = ":bprevious<CR>";
|
action = "<CMD>bprevious<CR>";
|
||||||
options = {
|
options = {
|
||||||
desc = "Previous Buffer";
|
desc = "Previous Buffer";
|
||||||
silent = true;
|
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";
|
mode = "n";
|
||||||
key = "<leader>w";
|
key = "<leader>w";
|
||||||
action = ":w<CR>";
|
action = "<CMD>w<CR>";
|
||||||
options = {
|
options = {
|
||||||
desc = "Save Buffer to File";
|
desc = "Save Buffer to File";
|
||||||
silent = false;
|
silent = false;
|
||||||
|
@ -77,7 +104,7 @@
|
||||||
{
|
{
|
||||||
mode = "n";
|
mode = "n";
|
||||||
key = "<leader>q";
|
key = "<leader>q";
|
||||||
action = ":bd<CR>";
|
action = "<CMD>bd<CR>";
|
||||||
options = {
|
options = {
|
||||||
desc = "Close Buffer";
|
desc = "Close Buffer";
|
||||||
silent = false;
|
silent = false;
|
||||||
|
@ -86,7 +113,7 @@
|
||||||
{
|
{
|
||||||
mode = "n";
|
mode = "n";
|
||||||
key = "<leader>Q";
|
key = "<leader>Q";
|
||||||
action = ":bd!<CR>";
|
action = "<CMD>bd!<CR>";
|
||||||
options = {
|
options = {
|
||||||
desc = "Force Close Buffer";
|
desc = "Force Close Buffer";
|
||||||
silent = false;
|
silent = false;
|
||||||
|
@ -95,7 +122,7 @@
|
||||||
{
|
{
|
||||||
mode = "n";
|
mode = "n";
|
||||||
key = "<leader>`";
|
key = "<leader>`";
|
||||||
action = ":qa<CR>";
|
action = "<CMD>qa<CR>";
|
||||||
options = {
|
options = {
|
||||||
desc = "Quit All";
|
desc = "Quit All";
|
||||||
silent = false;
|
silent = false;
|
||||||
|
|
|
@ -20,7 +20,13 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
copilot-lua.enable = true;
|
copilot-lua = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
suggestion.enabled = false;
|
||||||
|
panel.enabled = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
copilot-cmp.enable = true;
|
copilot-cmp.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
39
nixos/nvim/plugins/codesnap.nix
Normal file
39
nixos/nvim/plugins/codesnap.nix
Normal 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;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
13
nixos/nvim/plugins/dap.nix
Normal file
13
nixos/nvim/plugins/dap.nix
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{ pkgs, lib, ... }:
|
||||||
|
{
|
||||||
|
programs.nixvim = {
|
||||||
|
plugins = {
|
||||||
|
dap = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
dap-python = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
36
nixos/nvim/plugins/floatterm.nix
Normal file
36
nixos/nvim/plugins/floatterm.nix
Normal 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;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
91
nixos/nvim/plugins/hover.nix
Normal file
91
nixos/nvim/plugins/hover.nix
Normal 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;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
|
@ -2,21 +2,7 @@
|
||||||
{
|
{
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
extraPackages = with pkgs; [
|
extraPackages = with pkgs; [
|
||||||
basedpyright
|
|
||||||
ruff
|
|
||||||
nil
|
|
||||||
nixfmt-rfc-style
|
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 = {
|
plugins = {
|
||||||
luasnip = {
|
luasnip = {
|
||||||
|
@ -25,9 +11,47 @@
|
||||||
lsp-status = {
|
lsp-status = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
schemastore = {
|
||||||
|
enable = true;
|
||||||
|
json.enable = true;
|
||||||
|
yaml.enable = true;
|
||||||
|
};
|
||||||
lsp = {
|
lsp = {
|
||||||
enable = true;
|
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", {
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
group = vim.api.nvim_create_augroup('lsp_attach_disable_ruff_hover', { clear = true }),
|
group = vim.api.nvim_create_augroup('lsp_attach_disable_ruff_hover', { clear = true }),
|
||||||
|
@ -37,48 +61,12 @@
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if client.name == 'ruff' then
|
if client.name == 'ruff' then
|
||||||
-- Disable hover in favor of Pyright
|
-- Disable hover in favor of basedpyright
|
||||||
client.server_capabilities.hoverProvider = false
|
client.server_capabilities.hoverProvider = false
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
desc = 'LSP: Disable hover capability from Ruff',
|
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 = {
|
trouble = {
|
||||||
|
|
|
@ -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;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
9
nixos/nvim/plugins/surround.nix
Normal file
9
nixos/nvim/plugins/surround.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
programs.nixvim = {
|
||||||
|
plugins = {
|
||||||
|
nvim-surround = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -13,7 +13,7 @@
|
||||||
byteCompileLua = {
|
byteCompileLua = {
|
||||||
enable = true;
|
enable = true;
|
||||||
configs = true;
|
configs = true;
|
||||||
initLua = true;
|
initLua = false;
|
||||||
nvimRuntime = true;
|
nvimRuntime = true;
|
||||||
plugins = true;
|
plugins = true;
|
||||||
};
|
};
|
||||||
|
@ -61,6 +61,17 @@
|
||||||
sqlite-lua.enable = true;
|
sqlite-lua.enable = true;
|
||||||
lazydev.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 = ''
|
extraConfigVim = ''
|
||||||
set number " enable number lines
|
set number " enable number lines
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Add table
Reference in a new issue