Migrate configuration to nixvim
This commit is contained in:
parent
be9fe07ba1
commit
8772a4ca32
18 changed files with 759 additions and 0 deletions
38
config/plugins/cmp/cmp.nix
Normal file
38
config/plugins/cmp/cmp.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
# Autocompletion plugin
|
||||
plugins.cmp = {
|
||||
enable = true;
|
||||
# Options provided to the require('cmp').setup function.
|
||||
settings = {
|
||||
# The sources to use
|
||||
sources = [
|
||||
{ name = "nvim_lsp"; } # LSP source for cmp
|
||||
{ name = "luasnip"; } # Snippets source for cmp
|
||||
];
|
||||
# The snippet expansion function.
|
||||
snippet.expand = ''
|
||||
function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end
|
||||
'';
|
||||
# cmp mappings declaration
|
||||
mapping = {
|
||||
# Select next/previous item.
|
||||
"<C-e>" = "cmp.mapping.select_next_item()";
|
||||
"<C-o>" = "cmp.mapping.select_prev_item()";
|
||||
# Scroll through documentation.
|
||||
"<C-s>" = "cmp.mapping.scroll_docs(-4)";
|
||||
"<C-t>" = "cmp.mapping.scroll_docs(4)";
|
||||
# Confirm selection.
|
||||
"<C-CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })";
|
||||
# Exit completion.
|
||||
"<C-Esc>" = "cmp.mapping.abort()";
|
||||
};
|
||||
};
|
||||
# Scans the sources array and enable the corresponding plugins if they are known to nixvim.
|
||||
autoEnableSources = true;
|
||||
};
|
||||
}
|
||||
|
23
config/plugins/editor/bufdelete.nix
Normal file
23
config/plugins/editor/bufdelete.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
plugins.bufdelete = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>bd";
|
||||
action = "<cmd>Bdelete<cr>";
|
||||
options.desc = "Buffer Delete";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>bw";
|
||||
action = "<cmd>Bwipeout<cr>";
|
||||
options.desc = "Buffer Wipeout";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
8
config/plugins/editor/comment.nix
Normal file
8
config/plugins/editor/comment.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
plugins.comment = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
|
17
config/plugins/editor/neo-tree.nix
Normal file
17
config/plugins/editor/neo-tree.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
plugins.neo-tree = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "\\";
|
||||
action = "<cmd>Neotree toggle<cr>";
|
||||
options.desc = "Toggle Neotree";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
24
config/plugins/editor/treesitter.nix
Normal file
24
config/plugins/editor/treesitter.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
# Tree-sitter is a parser generator tool and an incremental parsing library.
|
||||
plugins.treesitter = {
|
||||
enable = true;
|
||||
|
||||
# Options provided to the require('nvim-treesitter.configs').setup function.
|
||||
settings = {
|
||||
highlight = {
|
||||
enable = true; # Enable syntax highlighing.
|
||||
};
|
||||
indent = {
|
||||
enable = true; # Enable auto indentation.
|
||||
};
|
||||
};
|
||||
|
||||
# Highlight `extraConfigLua` as lua.
|
||||
nixvimInjections = true;
|
||||
# Install all grammar packages.
|
||||
grammarPackages = pkgs.vimPlugins.nvim-treesitter.allGrammars;
|
||||
};
|
||||
}
|
||||
|
8
config/plugins/git/gitsigns.nix
Normal file
8
config/plugins/git/gitsigns.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
plugins.gitsigns = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
|
17
config/plugins/git/lazygit.nix
Normal file
17
config/plugins/git/lazygit.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
plugins.lazygit = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>lg";
|
||||
action = "<cmd>LazyGit<cr>";
|
||||
options.desc = "LazyGit";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
57
config/plugins/lsp/lsp.nix
Normal file
57
config/plugins/lsp/lsp.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
plugins.lsp = {
|
||||
enable = true; # Enable neovim's built-in LSP.
|
||||
|
||||
# Configure our language servers
|
||||
servers = {
|
||||
# C/C++
|
||||
clangd = {
|
||||
enable = true;
|
||||
};
|
||||
# Clojure
|
||||
clojure-lsp = {
|
||||
enable = true;
|
||||
};
|
||||
# Haskell
|
||||
hls = {
|
||||
enable = true;
|
||||
};
|
||||
# Lua
|
||||
lua-ls = {
|
||||
enable = true;
|
||||
};
|
||||
# Nix
|
||||
nil-ls = {
|
||||
enable = true;
|
||||
};
|
||||
# YAML
|
||||
yamlls = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
keymaps = {
|
||||
# nvim-lsp keymaps should be silent
|
||||
silent = true;
|
||||
# Configure keymaps for our diagnostics.
|
||||
diagnostic = {
|
||||
"<leader>n" = "open_float"; # Show diagnostics in floating window.
|
||||
"<leader>o" = "goto_prev"; # Jump to previous diagnostic.
|
||||
"<leader>e" = "goto_next"; # Jump to next diagnostic.
|
||||
};
|
||||
# Configure keymaps for our lspbuf.
|
||||
lspBuf = {
|
||||
K = "hover"; # Displays hover information¹
|
||||
gr = "references"; # Lists all the references¹
|
||||
gd = "definition"; # Jumps to the definition¹
|
||||
gD = "declaration"; # Jumps to the declaration¹
|
||||
gi = "implementation"; # Lists all the implementations¹
|
||||
gt = "type_definition"; # Jumps to the definition of the type¹
|
||||
# ¹ for the symbol under the cursor
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
12
config/plugins/snippets/luasnip.nix
Normal file
12
config/plugins/snippets/luasnip.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
plugins.luasnip = {
|
||||
enable = true;
|
||||
extraConfig = {
|
||||
enable_autosnippets = true;
|
||||
store_selection_keys = "<Tab>";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
15
config/plugins/themes/default.nix
Normal file
15
config/plugins/themes/default.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
gruvbox-material
|
||||
];
|
||||
|
||||
extraConfigLua = ''
|
||||
vim.o.termguicolors = true
|
||||
vim.g.gruvbox_material_background = 'hard'
|
||||
vim.g.gruvbox_material_enable_italic = 1
|
||||
vim.cmd.colorscheme('gruvbox-material')
|
||||
'';
|
||||
}
|
||||
|
75
config/plugins/ui/lualine.nix
Normal file
75
config/plugins/ui/lualine.nix
Normal file
|
@ -0,0 +1,75 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
plugins.lualine = {
|
||||
enable = true;
|
||||
globalstatus = true;
|
||||
theme = "gruvbox-material";
|
||||
|
||||
# Load our extensions
|
||||
extensions = [
|
||||
"nvim-tree"
|
||||
];
|
||||
|
||||
# Icons for our separators
|
||||
componentSeparators = { left = ""; right = ""; };
|
||||
sectionSeparators = { left = ""; right = ""; };
|
||||
|
||||
# Display components in tabline
|
||||
tabline.lualine_a = [ { name = "buffers"; } ];
|
||||
|
||||
# Lualine has sections as shown below
|
||||
# +-------------------------------------------------+
|
||||
# | A | B | C X | Y | Z |
|
||||
# +-------------------------------------------------+
|
||||
sections = {
|
||||
# Section A
|
||||
lualine_a = [ { name = "mode"; icon = ""; } ];
|
||||
|
||||
# Section B
|
||||
lualine_b = [
|
||||
# Git branch
|
||||
{ name = "branch"; icon = ""; }
|
||||
|
||||
# Git diff status
|
||||
{ name = "diff";
|
||||
extraConfig.symbols = {
|
||||
added = " ";
|
||||
modified = " ";
|
||||
removed = " ";
|
||||
};
|
||||
}
|
||||
|
||||
# Diagnostic count from nvim_lsp
|
||||
{ name = "diagnostics";
|
||||
extraConfig = {
|
||||
sources = [ "nvim_lsp" ];
|
||||
symbols = {
|
||||
error = " ";
|
||||
warn = " ";
|
||||
info = " ";
|
||||
hint = " ";
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
# Section C
|
||||
lualine_c = [ { name = "filename"; extraConfig = { path = 1; }; } ];
|
||||
|
||||
# Section X
|
||||
lualine_x = [
|
||||
{ name = "encoding"; }
|
||||
{ name = "fileformat"; }
|
||||
{ name = "filetype"; }
|
||||
];
|
||||
|
||||
# Section Y
|
||||
lualine_y = [ { name = "progress"; } ];
|
||||
|
||||
# Section Z
|
||||
lualine_z = [ { name = "location"; } ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
19
config/plugins/utils/telescope.nix
Normal file
19
config/plugins/utils/telescope.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
plugins.telescope = {
|
||||
enable = true;
|
||||
|
||||
keymaps = {
|
||||
"<leader>ff" = {
|
||||
action = "find_files";
|
||||
options.desc = "Find Files";
|
||||
};
|
||||
"<leader>fb" = {
|
||||
action = "buffers";
|
||||
options.desc = "Buffers";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
8
config/plugins/utils/whichkey.nix
Normal file
8
config/plugins/utils/whichkey.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
plugins.which-key = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue