Use nixvim
This commit is contained in:
parent
f0217e4640
commit
ecb2a05d60
72 changed files with 691 additions and 1664 deletions
58
modules/home-manager/coding/neovim/plugins/cmp.nix
Normal file
58
modules/home-manager/coding/neovim/plugins/cmp.nix
Normal file
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
plugins.cmp = {
|
||||
enable = true;
|
||||
|
||||
autoEnableSources = true;
|
||||
|
||||
settings = {
|
||||
mapping = {
|
||||
"<C-e>" = "cmp.mapping.close()";
|
||||
|
||||
"<C-h>" = ''
|
||||
cmp.mapping(function()
|
||||
if ls.locally_jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
end)
|
||||
'';
|
||||
|
||||
"<C-l>" = ''
|
||||
cmp.mapping(function()
|
||||
if ls.expand_or_locally_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
end
|
||||
end)
|
||||
'';
|
||||
|
||||
"<C-n>" = "cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select })";
|
||||
"<C-p>" = "cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select })";
|
||||
|
||||
"<C-y>" = "cmp.mapping.confirm({ select = true })";
|
||||
|
||||
"<CR>" = "nil";
|
||||
"<S-Tab>" = "nil";
|
||||
"<Tab>" = "nil";
|
||||
};
|
||||
|
||||
snippet.expand = ''
|
||||
function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end
|
||||
'';
|
||||
|
||||
sources = [
|
||||
{ name = "nvim_lsp"; }
|
||||
{ name = "nvim_lua"; }
|
||||
{
|
||||
name = "luasnip";
|
||||
keyword_length = 2;
|
||||
}
|
||||
{
|
||||
name = "buffer";
|
||||
keyword_length = 3;
|
||||
}
|
||||
{ name = "calc"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
3
modules/home-manager/coding/neovim/plugins/conform.nix
Normal file
3
modules/home-manager/coding/neovim/plugins/conform.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
plugins.conform-nvim.enable = true;
|
||||
}
|
3
modules/home-manager/coding/neovim/plugins/fidget.nix
Normal file
3
modules/home-manager/coding/neovim/plugins/fidget.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
plugins.fidget.enable = true;
|
||||
}
|
18
modules/home-manager/coding/neovim/plugins/fugitive.nix
Normal file
18
modules/home-manager/coding/neovim/plugins/fugitive.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
plugins.fugitive.enable = true;
|
||||
|
||||
keymaps = lib.mkIf config.plugins.fugitive.enable [
|
||||
{
|
||||
key = "<leader>gc";
|
||||
action = "<cmd>Git commit<CR><C-w>K";
|
||||
}
|
||||
|
||||
{
|
||||
# Open the ":Git" window in its own buffer, not a split.
|
||||
key = "<leader>gs";
|
||||
action = "<cmd>0Git<CR>";
|
||||
}
|
||||
];
|
||||
}
|
45
modules/home-manager/coding/neovim/plugins/gitsigns.nix
Normal file
45
modules/home-manager/coding/neovim/plugins/gitsigns.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
plugins.gitsigns.enable = true;
|
||||
|
||||
keymaps = lib.mkIf config.plugins.gitsigns.enable [
|
||||
{
|
||||
action = "<cmd>Gitsigns prev_hunk<CR>";
|
||||
key = "[h";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>Gitsigns next_hunk<CR>";
|
||||
key = "]h";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>Gitsigns reset_hunk<CR>";
|
||||
key = "<leader>hr";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>Gitsigns reset_buffer<CR>";
|
||||
key = "<leader>hR";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>Gitsigns stage_hunk<CR>";
|
||||
key = "<leader>hs";
|
||||
mode = ["n" "v"];
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>Gitsigns stage_buffer<CR>";
|
||||
key = "<leader>hS";
|
||||
mode = "x";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>Gitsigns undo_stage_hunk<CR>";
|
||||
key = "<leader>hu";
|
||||
mode = "x";
|
||||
}
|
||||
];
|
||||
}
|
47
modules/home-manager/coding/neovim/plugins/harpoon.nix
Normal file
47
modules/home-manager/coding/neovim/plugins/harpoon.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
leaderBinding = key: command: {
|
||||
key = "<leader>${key}";
|
||||
action = "<cmd>${command}<CR>";
|
||||
options.silent = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
plugins.harpoon = {
|
||||
enable = true;
|
||||
enableTelescope = true;
|
||||
};
|
||||
|
||||
keymaps = lib.mkIf config.plugins.harpoon.enable (
|
||||
[
|
||||
{
|
||||
key = "<leader>a";
|
||||
action.__raw = "function() require'harpoon':list():add() end";
|
||||
}
|
||||
|
||||
{
|
||||
key = "<C-e>";
|
||||
action.__raw = ''
|
||||
function()
|
||||
require 'harpoon'.ui:toggle_quick_menu(require'harpoon':list())
|
||||
end
|
||||
'';
|
||||
}
|
||||
]
|
||||
++ (map
|
||||
(num: leaderBinding "${toString num}" "lua require(\"harpoon\"):list():select(${toString num})")
|
||||
[
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
3
modules/home-manager/coding/neovim/plugins/lint.nix
Normal file
3
modules/home-manager/coding/neovim/plugins/lint.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
plugins.lint.enable = true;
|
||||
}
|
3
modules/home-manager/coding/neovim/plugins/lsp.nix
Normal file
3
modules/home-manager/coding/neovim/plugins/lsp.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
plugins.lsp.enable = true;
|
||||
}
|
11
modules/home-manager/coding/neovim/plugins/lualine.nix
Normal file
11
modules/home-manager/coding/neovim/plugins/lualine.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
plugins.lualine = {
|
||||
enable = true;
|
||||
|
||||
settings.options = {
|
||||
component_separators = "";
|
||||
icons_enabled = false;
|
||||
section_separators = "";
|
||||
};
|
||||
};
|
||||
}
|
3
modules/home-manager/coding/neovim/plugins/luasnip.nix
Normal file
3
modules/home-manager/coding/neovim/plugins/luasnip.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
plugins.luasnip.enable = true;
|
||||
}
|
15
modules/home-manager/coding/neovim/plugins/mini.nix
Normal file
15
modules/home-manager/coding/neovim/plugins/mini.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
plugins.mini = {
|
||||
enable = true;
|
||||
|
||||
modules = {
|
||||
ai = {};
|
||||
align = {};
|
||||
bracketed = {};
|
||||
move = {};
|
||||
operators = {};
|
||||
splitjoin = {};
|
||||
surround = {};
|
||||
};
|
||||
};
|
||||
}
|
20
modules/home-manager/coding/neovim/plugins/oil.nix
Normal file
20
modules/home-manager/coding/neovim/plugins/oil.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
plugins.oil = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
delete_to_trash = true;
|
||||
|
||||
keymaps."-" = "actions.parent";
|
||||
|
||||
skip_confirm_for_simple_edits = true;
|
||||
view_options.show_hidden = true;
|
||||
};
|
||||
};
|
||||
|
||||
keymaps = lib.mkIf config.plugins.oil.enable [
|
||||
{ action = "<cmd>Oil<CR>"; key = "-"; }
|
||||
];
|
||||
}
|
17
modules/home-manager/coding/neovim/plugins/phpactor.nix
Normal file
17
modules/home-manager/coding/neovim/plugins/phpactor.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
extraPlugins = with pkgs.vimPlugins; [ phpactor ];
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
key = "<leader>pm";
|
||||
action = "<cmd>PhpactorContextMenu<CR>";
|
||||
}
|
||||
|
||||
{
|
||||
key = "<leader>pn";
|
||||
action = "<cmd>PhpactorClassNew<CR>";
|
||||
}
|
||||
];
|
||||
}
|
47
modules/home-manager/coding/neovim/plugins/refactoring.nix
Normal file
47
modules/home-manager/coding/neovim/plugins/refactoring.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
plugins.refactoring = {
|
||||
enable = true;
|
||||
enableTelescope = true;
|
||||
};
|
||||
|
||||
keymaps =
|
||||
lib.mkIf config.plugins.refactoring.enable ([
|
||||
{
|
||||
key = "<leader>ri";
|
||||
action = "<cmd>Refactor inline_var<CR>";
|
||||
mode = "n";
|
||||
}
|
||||
|
||||
{
|
||||
key = "<leader>re";
|
||||
action = "<cmd>Refactor extract<CR>";
|
||||
mode = "x";
|
||||
}
|
||||
|
||||
{
|
||||
key = "<leader>ri";
|
||||
action = "<cmd>Refactor inline_var<CR>";
|
||||
mode = "x";
|
||||
}
|
||||
|
||||
{
|
||||
key = "<leader>rv";
|
||||
action = "<cmd>Refactor extract_var<CR>";
|
||||
mode = "x";
|
||||
}
|
||||
]
|
||||
++ lib.optionals (config.plugins.refactoring.enable && config.plugins.refactoring.enableTelescope) [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>rR";
|
||||
action.__raw = ''
|
||||
function()
|
||||
require('telescope').extensions.refactoring.refactors()
|
||||
end
|
||||
'';
|
||||
options.silent = true;
|
||||
}
|
||||
]);
|
||||
}
|
28
modules/home-manager/coding/neovim/plugins/telescope.nix
Normal file
28
modules/home-manager/coding/neovim/plugins/telescope.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
plugins.telescope = {
|
||||
enable = true;
|
||||
|
||||
extensions = {
|
||||
live-grep-args.enable = true;
|
||||
fzf-native.enable = true;
|
||||
ui-select.enable = true;
|
||||
};
|
||||
|
||||
keymaps = {
|
||||
"<leader>fb" = "buffers";
|
||||
"<leader>fd" = "find_files";
|
||||
"<leader>fg" = "live_grep";
|
||||
|
||||
"<leader>gw" = {
|
||||
action = "grep_string";
|
||||
mode = [
|
||||
"n"
|
||||
"v"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
settings.defaults.layout_config.prompt_position = "top";
|
||||
};
|
||||
}
|
||||
|
47
modules/home-manager/coding/neovim/plugins/treesitter.nix
Normal file
47
modules/home-manager/coding/neovim/plugins/treesitter.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
plugins = {
|
||||
treesitter = {
|
||||
enable = true;
|
||||
|
||||
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
||||
bash
|
||||
comment
|
||||
css
|
||||
csv
|
||||
dockerfile
|
||||
gitattributes
|
||||
gitignore
|
||||
go
|
||||
html
|
||||
javascript
|
||||
json
|
||||
kdl
|
||||
lua
|
||||
luadoc
|
||||
make
|
||||
markdown
|
||||
markdown_inline
|
||||
nix
|
||||
php
|
||||
phpdoc
|
||||
query
|
||||
rst
|
||||
scss
|
||||
sql
|
||||
terraform
|
||||
twig
|
||||
typescript
|
||||
vim
|
||||
vimdoc
|
||||
vue
|
||||
xml
|
||||
yaml
|
||||
];
|
||||
};
|
||||
|
||||
treesitter-textobjects.enable = true;
|
||||
};
|
||||
}
|
||||
|
9
modules/home-manager/coding/neovim/plugins/undotree.nix
Normal file
9
modules/home-manager/coding/neovim/plugins/undotree.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
plugins.undotree.enable = true;
|
||||
|
||||
keymaps = lib.mkIf config.plugins.undotree.enable [
|
||||
{ action = "<cmd>UndotreeToggle<CR>"; key = "<leader>u"; }
|
||||
];
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
plugins = {
|
||||
vim-dadbod.enable = true;
|
||||
vim-dadbod-completion.enable = true;
|
||||
vim-dadbod-ui.enable = true;
|
||||
};
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
extraPlugins = with pkgs.vimPlugins; [ vim-highlightedyank ];
|
||||
|
||||
extraConfigVim = ''
|
||||
let g:highlightedyank_highlight_duration = 100
|
||||
'';
|
||||
}
|
11
modules/home-manager/coding/neovim/plugins/vim-test.nix
Normal file
11
modules/home-manager/coding/neovim/plugins/vim-test.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
plugins.vim-test.enable = true;
|
||||
|
||||
keymaps = lib.mkIf config.plugins.vim-test.enable [
|
||||
{ key = "<leader>tf"; action = "<cmd>TestFile<CR>"; }
|
||||
{ key = "<leader>tl"; action = "<cmd>TestLast<CR>"; }
|
||||
{ key = "<leader>tn"; action = "<cmd>TestNearest<CR>"; }
|
||||
];
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
plugins.web-devicons.enable = false;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue