aboutsummaryrefslogtreecommitdiffstats
path: root/home-manager/soispha/config/neovim/nixvim/plugins
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-08-03 21:34:16 +0200
committerSoispha <soispha@vhack.eu>2023-08-19 17:34:47 +0200
commitbe1cc38bdb83e6716b08d24cc1201fffc6649311 (patch)
treec3691569e0e8858b672b501096b6cb5edd39daf6 /home-manager/soispha/config/neovim/nixvim/plugins
parentFeat(treewide): Import nixVim (diff)
downloadnixos-config-be1cc38bdb83e6716b08d24cc1201fffc6649311.zip
Feat(hm/conf/nvim): Add basic nix config [REBASE TARGET]
Diffstat (limited to '')
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/default.nix5
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/lsp/default.nix33
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/lsp/keymaps/default.nix80
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/lsp/servers/default.nix5
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/lualine/default.nix103
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/treesitter/default.nix35
6 files changed, 261 insertions, 0 deletions
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/default.nix b/home-manager/soispha/config/neovim/nixvim/plugins/default.nix
new file mode 100644
index 00000000..150798c3
--- /dev/null
+++ b/home-manager/soispha/config/neovim/nixvim/plugins/default.nix
@@ -0,0 +1,5 @@
+{...}: {
+ imports = [
+ ./treesiter
+ ];
+}
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/lsp/default.nix b/home-manager/soispha/config/neovim/nixvim/plugins/lsp/default.nix
new file mode 100644
index 00000000..8fd09e3d
--- /dev/null
+++ b/home-manager/soispha/config/neovim/nixvim/plugins/lsp/default.nix
@@ -0,0 +1,33 @@
+{...}: {
+ imports = [
+ ./keymaps
+ ./servers
+ ];
+ programs.nixvim.plugins.lsp = {
+ enable = true;
+ onAttach =
+ ""
+ # + ''
+ # function(client, bufnr)
+ # -- Enable completion triggered by <c-x><c-o>
+ # -- vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
+ # end
+ # ''
+ ;
+ # TODO only for cmp_nvim_lsp
+ capabilities = ''
+ capabilities = require('cmp_nvim_lsp').default_capabilities();
+ '';
+ preConfig = ''
+ vim.diagnostic.config({
+ underline = true,
+ -- virtual_text = true,
+ virtual_text = {
+ source = "always", -- Or "if_many"
+ },
+ update_in_insert = true,
+ severity_sort = true,
+ }, nil);
+ '';
+ };
+}
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/lsp/keymaps/default.nix b/home-manager/soispha/config/neovim/nixvim/plugins/lsp/keymaps/default.nix
new file mode 100644
index 00000000..b11492b4
--- /dev/null
+++ b/home-manager/soispha/config/neovim/nixvim/plugins/lsp/keymaps/default.nix
@@ -0,0 +1,80 @@
+{...}: {
+ programs.nixvim.plugins.lsp.keymaps = {
+ diagnostic = {
+ "N" = {
+ action = "goto_prev";
+ desc = "go to previous diagnostic message";
+ };
+ "T" = {
+ action = "goto_next";
+ desc = "go to next diagnostic message";
+ };
+ "<space>e" = {
+ action = "open_float";
+ desc = "open float for the symbol";
+ };
+ "<space>q" = {
+ action = "setloclist";
+ desc = "add buffer diagnostic to the location list (quick-fix)";
+ };
+ };
+ lspBuf = {
+ "<space>gD" = {
+ action = "declaration";
+ desc = "[G]o to [d]eclaration";
+ };
+ "<space>gd" = {
+ action = "definition";
+ desc = "[G]o to [d]efinition";
+ };
+ "<space>hi" = {
+ action = "hover";
+ desc = "Display [h]over [i]nformation";
+ };
+ "<space>gi" = {
+ action = "implementation";
+ desc = "[G]o to the [i]mplementations";
+ };
+ "<space>sh" = {
+ action = "signature_help";
+ desc = "Display [s]ignature [h]elp";
+ };
+ "<space>wa" = {
+ action = "add_workspace_folder";
+ desc = "[W]orkspace folder [a]dd";
+ };
+ "<space>wr" = {
+ action = "remove_workspace_folder";
+ desc = "[W]orkspace folder [r]emove";
+ };
+ "<space>wl" = {
+ action = ''
+ function()
+ print(vim.inspect(list_workspace_folders()))
+ end
+ '';
+ desc = "[W]orkspace folders [l]ist";
+ };
+ "<space>gtd" = {
+ action = "type_definition";
+ desc = "[G]o to the [t]ype [d]efinition under the cursor";
+ };
+ "<space>rn" = {
+ action = "rename";
+ desc = "[R]e[n]ame the item under the cursor";
+ };
+ "<space>ca" = {
+ action = "code_action";
+ desc = "Open the [c]ode [a]ction menu";
+ };
+ "<space>gr" = {
+ action = "references";
+ desc = "[G]o to all [r]eferences to the symbol";
+ };
+ "<space>f" = {
+ action = "function() vim.lsp.buf.format { async = true } end";
+ desc = "[F]ormat the current buffer (asynchronously)";
+ };
+ };
+ };
+}
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/lsp/servers/default.nix b/home-manager/soispha/config/neovim/nixvim/plugins/lsp/servers/default.nix
new file mode 100644
index 00000000..8d5cfaf1
--- /dev/null
+++ b/home-manager/soispha/config/neovim/nixvim/plugins/lsp/servers/default.nix
@@ -0,0 +1,5 @@
+{...}: {
+ programs.nixvim.plugins.lsp.servers = {
+
+ };
+}
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/lualine/default.nix b/home-manager/soispha/config/neovim/nixvim/plugins/lualine/default.nix
new file mode 100644
index 00000000..0ec255db
--- /dev/null
+++ b/home-manager/soispha/config/neovim/nixvim/plugins/lualine/default.nix
@@ -0,0 +1,103 @@
+{...}: {
+ programs.nixvim.plugins.lualine = let
+ get_location_of_file = {
+ __raw = ''
+ function get_location_of_file()
+ local file_lines = vim.fn.line('$');
+ local file_current_cursor_positon = vim.fn.getcurpos();
+ return file_current_cursor_positon[3] .. ":" .. file_current_cursor_positon[2] .. "/" .. file_lines
+ end
+ '';
+ };
+
+ get_trailing_whitespace = {
+ __raw = ''
+ function()
+ local space = vim.fn.search([[\s\+$]], 'nwc')
+ return space ~= 0 and "TW:" .. space or ""
+ end
+ '';
+ };
+ get_mixed_indent = {
+ __raw = ''
+ function()
+ local space_pat = [[\v^ +]]
+ local tab_pat = [[\v^\t+]]
+ local space_indent = vim.fn.search(space_pat, 'nwc')
+ local tab_indent = vim.fn.search(tab_pat, 'nwc')
+ local mixed = (space_indent > 0 and tab_indent > 0)
+ local mixed_same_line
+ if not mixed then
+ mixed_same_line = vim.fn.search([[\v^(\t+ | +\t)]], 'nwc')
+ mixed = mixed_same_line > 0
+ end
+ if not mixed then return \'\' end
+ if mixed_same_line ~= nil and mixed_same_line > 0 then
+ return 'MI:' .. mixed_same_line
+ end
+ local space_indent_cnt = vim.fn.searchcount({ pattern = space_pat, max_count = 1e3 }).total
+ local tab_indent_cnt = vim.fn.searchcount({ pattern = tab_pat, max_count = 1e3 }).total
+ if space_indent_cnt > tab_indent_cnt then
+ return 'MI:' .. tab_indent
+ else
+ return 'MI:' .. space_indent
+ end
+ end
+ '';
+ };
+ in {
+ options = {
+ icons_enabled = true;
+ theme = "nightfox";
+ component_separators = {
+ left = "";
+ right = "";
+ };
+ section_separators = {
+ left = "";
+ right = "";
+ };
+ disabled_filetypes = {
+ statusline = [];
+ winbar = [];
+ };
+ ignore_focus = {};
+ always_divide_middle = true;
+ globalstatus = false;
+ refresh = {
+ statusline = 1000;
+ tabline = 1000;
+ winbar = 1000;
+ };
+ };
+ sections = {
+ lualine_a = ["mode"];
+ lualine_b = [
+ {
+ name = "FugitiveHead";
+ icon = "";
+ }
+ "diff"
+ "diagnostics"
+ ];
+ lualine_c = ["filename"];
+ lualine_x = ["searchcount" "filetype"];
+ lualine_y = ["encoding" "fileformat" get_mixed_indent get_trailing_whitespace];
+ lualine_z = [get_location_of_file];
+ };
+ inactive_sections = {
+ lualine_a = [];
+ lualine_b = [];
+ lualine_c = ["filename"];
+ lualine_x = [get_location_of_file];
+ lualine_y = [];
+ lualine_z = [];
+ };
+ tabline = {};
+ winbar = {};
+ inactive_winbar = {};
+
+ # TODO add all installed and supported extensions here
+ extensions = ["fugitive"];
+ };
+}
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/treesitter/default.nix b/home-manager/soispha/config/neovim/nixvim/plugins/treesitter/default.nix
new file mode 100644
index 00000000..7a8a3a26
--- /dev/null
+++ b/home-manager/soispha/config/neovim/nixvim/plugins/treesitter/default.nix
@@ -0,0 +1,35 @@
+{...}: {
+ programs.nixvim.plugins.treesitter = {
+ enable = true;
+ # A list of parser names; or "all"
+ # ensure_installed = [ "c" "lua" "rust" ];
+ ensure_installed = "all";
+
+ # TODO make this work
+ highlight = {
+ # `false` will disable the whole extension
+ enable = true;
+ disable = ["latex"];
+
+ # Setting this to true will run `:h syntax` and tree-sitter at the same time.
+ # Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
+ # Using this option may slow down your editor; and you may see some duplicate highlights.
+ # Instead of true it can also be a list of languages
+ additional_vim_regex_highlighting = [""];
+ };
+
+ indent = {
+ enable = true;
+ };
+ incremental_selection = {
+ enable = true;
+ keymaps = {
+ # TODO include these
+ init_selection = "gnn"; # set to `false` to disable one of the mappings
+ node_incremental = "grn";
+ scope_incremental = "grc";
+ node_decremental = "grm";
+ };
+ };
+ };
+}