aboutsummaryrefslogtreecommitdiffstats
path: root/modules/tools/editor/neovim
diff options
context:
space:
mode:
Diffstat (limited to 'modules/tools/editor/neovim')
-rw-r--r--modules/tools/editor/neovim/config/default.nix4
-rw-r--r--modules/tools/editor/neovim/config/keybindings.lua5
-rw-r--r--modules/tools/editor/neovim/config/options.lua41
-rw-r--r--modules/tools/editor/neovim/default.nix36
-rw-r--r--modules/tools/editor/neovim/plugins/config/base16.mustache.lua12
-rw-r--r--modules/tools/editor/neovim/plugins/config/comment.lua1
-rw-r--r--modules/tools/editor/neovim/plugins/config/default.nix27
-rw-r--r--modules/tools/editor/neovim/plugins/config/dressing.lua1
-rw-r--r--modules/tools/editor/neovim/plugins/config/lsp-config.lua75
-rw-r--r--modules/tools/editor/neovim/plugins/config/lualine.mustache.lua61
-rw-r--r--modules/tools/editor/neovim/plugins/config/noice.mustache.lua10
-rw-r--r--modules/tools/editor/neovim/plugins/config/nvim-tree.lua15
-rw-r--r--modules/tools/editor/neovim/plugins/config/nvim-ufo.lua21
-rw-r--r--modules/tools/editor/neovim/plugins/config/treesitter.nix13
-rw-r--r--modules/tools/editor/neovim/plugins/config/which-key.lua5
-rw-r--r--modules/tools/editor/neovim/plugins/default.nix31
16 files changed, 0 insertions, 358 deletions
diff --git a/modules/tools/editor/neovim/config/default.nix b/modules/tools/editor/neovim/config/default.nix
deleted file mode 100644
index 4514d2f..0000000
--- a/modules/tools/editor/neovim/config/default.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-''
-${builtins.readFile ./options.lua}
-${builtins.readFile ./keybindings.lua}
-''
diff --git a/modules/tools/editor/neovim/config/keybindings.lua b/modules/tools/editor/neovim/config/keybindings.lua
deleted file mode 100644
index 3f2c9bf..0000000
--- a/modules/tools/editor/neovim/config/keybindings.lua
+++ /dev/null
@@ -1,5 +0,0 @@
--- Navigate splits
-vim.keymap.set("n", "<C-h>", ":wincmd h<CR>", { silent = true });
-vim.keymap.set("n", "<C-j>", ":wincmd j<CR>", { silent = true });
-vim.keymap.set("n", "<C-k>", ":wincmd k<CR>", { silent = true });
-vim.keymap.set("n", "<C-l>", ":wincmd l<CR>", { silent = true });
diff --git a/modules/tools/editor/neovim/config/options.lua b/modules/tools/editor/neovim/config/options.lua
deleted file mode 100644
index fc0b04c..0000000
--- a/modules/tools/editor/neovim/config/options.lua
+++ /dev/null
@@ -1,41 +0,0 @@
-vim.g.mapleader = " ";
-vim.g.maplocalleader = " ";
-
-vim.o.clipboard = "unnamedplus";
-
-vim.o.number = true;
-vim.o.list = true;
-vim.o.listchars = "tab:| ,trail:_,lead:_";
-
-vim.o.laststatus = 3;
-
-vim.o.signcolumn = "auto";
-vim.opt.fillchars = { eob = " " };
-
-vim.o.tabstop = 3;
-vim.o.shiftwidth = 0;
-vim.o.expandtab = false;
-
-vim.o.updatetime = 300;
-
-vim.o.mouse = "a";
-
--- Force all filetypes to use tabs
-vim.api.nvim_create_autocmd("FileType", {
- pattern = "*",
- callback = function()
- vim.bo.expandtab = false;
- vim.bo.tabstop = 3;
- vim.bo.shiftwidth = 0;
- end,
-});
-
--- Exception that use spaces
-vim.api.nvim_create_autocmd("FileType", {
- pattern = { "yaml" },
- callback = function()
- vim.bo.expandtab = true;
- vim.bo.tabstop = 2;
- vim.bo.shiftwidth = 2;
- end,
-});
diff --git a/modules/tools/editor/neovim/default.nix b/modules/tools/editor/neovim/default.nix
deleted file mode 100644
index 7d257ba..0000000
--- a/modules/tools/editor/neovim/default.nix
+++ /dev/null
@@ -1,36 +0,0 @@
-{ pkgs, config, lib, ... }:
-
-{
- options.tools.editor.neovim = {
- enable = lib.mkEnableOption "Enables neovim.";
- profile = lib.mkOption {
- type = lib.types.enum [
- "minimal"
- "full"
- ];
- default = "minimal";
- description = "The profile for neovim to use.";
- };
- };
-
- config =
- let
- plugins = import ./plugins { inherit config pkgs lib; };
- in lib.mkIf config.tools.editor.neovim.enable {
- programs.neovim.enable = true;
- programs.neovim.viAlias = true;
- programs.neovim.vimAlias = true;
- programs.neovim.vimdiffAlias = true;
- programs.neovim.defaultEditor = true;
-
- home.packages = plugins.requirements;
-
- programs.neovim.extraLuaConfig =
- ''
-${import ./config}
-${plugins.configuration}
- '';
-
- programs.neovim.plugins = plugins.list;
- };
-}
diff --git a/modules/tools/editor/neovim/plugins/config/base16.mustache.lua b/modules/tools/editor/neovim/plugins/config/base16.mustache.lua
deleted file mode 100644
index 3c13fcc..0000000
--- a/modules/tools/editor/neovim/plugins/config/base16.mustache.lua
+++ /dev/null
@@ -1,12 +0,0 @@
-vim.o.termguicolors = true;
-vim.opt.termguicolors = true;
-vim.o.background = "dark";
-vim.g.base16colorspace = 256
-vim.cmd.colorscheme("base16-scheme");
-
--- Overrides
--- disable the background of line numbers
-vim.api.nvim_set_hl(0, "LineNr", { link = "Normal" });
-
--- change the color of the pane separator
-vim.api.nvim_set_hl(0, "WinSeparator", { fg = "#{{base02-hex}}", bg = "None" });
diff --git a/modules/tools/editor/neovim/plugins/config/comment.lua b/modules/tools/editor/neovim/plugins/config/comment.lua
deleted file mode 100644
index 9086261..0000000
--- a/modules/tools/editor/neovim/plugins/config/comment.lua
+++ /dev/null
@@ -1 +0,0 @@
-require("Comment").setup();
diff --git a/modules/tools/editor/neovim/plugins/config/default.nix b/modules/tools/editor/neovim/plugins/config/default.nix
deleted file mode 100644
index dcdb371..0000000
--- a/modules/tools/editor/neovim/plugins/config/default.nix
+++ /dev/null
@@ -1,27 +0,0 @@
-{ config }:
-
-let
- fullExtra = if config.tools.editor.neovim.profile == "full" then
-''
-${builtins.readFile ./lsp-config.lua}
-${builtins.readFile ./dressing.lua}
-${builtins.readFile (config.scheme {
- template = builtins.readFile ./noice.mustache.lua;
-})}
-${builtins.readFile ./nvim-ufo.lua}
-${builtins.readFile ./which-key.lua}
-''
- else "";
-in
-''
-${builtins.readFile ./comment.lua}
-${builtins.readFile (config.scheme {
- template = builtins.readFile ./lualine.mustache.lua;
-})}
-${import ./treesitter.nix { inherit config; }}
-${builtins.readFile (config.scheme {
- template = builtins.readFile ./base16.mustache.lua;
-})}
-${builtins.readFile ./nvim-tree.lua}
-${fullExtra}
-''
diff --git a/modules/tools/editor/neovim/plugins/config/dressing.lua b/modules/tools/editor/neovim/plugins/config/dressing.lua
deleted file mode 100644
index 6d14d47..0000000
--- a/modules/tools/editor/neovim/plugins/config/dressing.lua
+++ /dev/null
@@ -1 +0,0 @@
-require("dressing").setup();
diff --git a/modules/tools/editor/neovim/plugins/config/lsp-config.lua b/modules/tools/editor/neovim/plugins/config/lsp-config.lua
deleted file mode 100644
index cca4116..0000000
--- a/modules/tools/editor/neovim/plugins/config/lsp-config.lua
+++ /dev/null
@@ -1,75 +0,0 @@
-local lspconfig = require("lspconfig");
-
-local filetype_to_lsp = {
- lua = { server = "lua_ls", executable = "lua-language-server" },
- cpp = { server = "clangd", executable = "clangd" },
- c = { server = "clangd", executable = "clangd" },
- python = { server = "pyright", executable = "pyright-langserver" },
- javascript = { server = "tsserver", executable = "typescript-language-server" },
- typescript = { server = "tsserver", executable = "typescript-language-server" },
- go = { server = "gopls", executable = "gopls" },
- html = { server = "html", executable = "vscode-html-language-server" },
- css = { server = "cssls", executable = "vscode-css-language-server" },
- json = { server = "jsonls", executable = "vscode-json-language-server" },
- bash = { server = "bashls", executable = "bash-language-server" },
- graphql = { server = "graphql", executable = "graphql-lsp" },
- dockerfile = { server = "dockerls", executable = "docker-langserver" },
- php = { server = "phpactor", executable = "phpactor" },
- rust = { server = "rust_analyzer", executable = "rust-analyzer" },
- haskell = { server = "hls", executable = "haskell-language-server-wrapper" },
- deno = { server = "denols", executable = "deno" },
- vim = { server = "vimls", executable = "vim-language-server" },
- elixir = { server = "elixirls", executable = "elixir-ls" },
- clojure = { server = "clojure_lsp", executable = "clojure-lsp" },
- scala = { server = "scala_metals", executable = "metals" },
- ruby = { server = "sorbet", executable = "srb" },
- zig = { server = "zls", executable = "zls" },
- kotlin = { server = "kotlin_language_server", executable = "kotlin-language-server" },
- java = { server = "jdtls", executable = "jdtls" },
- dart = { server = "dartls", executable = "dart" },
- yaml = { server = "yamlls", executable = "yaml-language-server" },
- perl = { server = "perlls", executable = "perl" },
- r = { server = "r_language_server", executable = "R" },
- tex = { server = "texlab", executable = "texlab" },
- swift = { server = "sourcekit", executable = "sourcekit-lsp" },
- svelte = { server = "svelteserver", executable = "svelteserver" },
- terraform = { server = "terraformls", executable = "terraform-ls" },
- vue = { server = "vls", executable = "vls" },
- markdown = { server = "marksman", executable = "marksman" },
- yaml = { server = "yamlls", executable = "yaml-language-server" },
-};
-
--- Keeping track of all the lsps that have been already configured
-local lsp_setup_done = {};
-
--- Function to setup LSP based on filetype
-local function setup_lsp(filetype)
- local lsp = filetype_to_lsp[filetype];
- if lsp ~= nil and not lsp_setup_done[lsp.server] then
- lsp_setup_done[lsp.server] = true;
- if vim.fn.executable(lsp.executable) == 1 then
- lspconfig[lsp.server].setup({});
- end
- end
-end
-
-vim.api.nvim_create_autocmd("FileType", {
- pattern = "*", -- Match all file types
- callback = function()
- setup_lsp(vim.bo.filetype); -- Call the setup_lsp function only if the filetype is in the mapping
- end,
-});
-
--- Show diagnostics in a floating window when hovering over the line
-vim.api.nvim_create_autocmd("CursorHold", {
- callback = function()
- vim.diagnostic.open_float(nil, { focusable = false })
- end,
-})
-
-local lsp_keymap_opts = { noremap = true, silent = true };
-
-vim.keymap.set("n", "<leader>d", vim.lsp.buf.definition, lsp_keymap_opts);
-vim.keymap.set("n", "<leader>i", vim.lsp.buf.implementation, lsp_keymap_opts);
-vim.keymap.set("n", "<leader>r", vim.lsp.buf.references, lsp_keymap_opts);
-vim.keymap.set("n", "<leader>k", vim.lsp.buf.hover, lsp_keymap_opts);
diff --git a/modules/tools/editor/neovim/plugins/config/lualine.mustache.lua b/modules/tools/editor/neovim/plugins/config/lualine.mustache.lua
deleted file mode 100644
index bf4f1d1..0000000
--- a/modules/tools/editor/neovim/plugins/config/lualine.mustache.lua
+++ /dev/null
@@ -1,61 +0,0 @@
-local lualine_theme = {
- normal = {
- a = { fg = "#{{base0D-hex}}", bg = "none", gui = "bold" },
- b = { fg = "#{{base05-hex}}", bg = "none" },
- c = { fg = "#{{base05-hex}}", bg = "none" },
- },
- insert = {
- a = { fg = "#{{base0B-hex}}", bg = "none", gui = "bold" },
- },
- visual = {
- a = { fg = "#{{base0E-hex}}", bg = "none", gui = "bold" },
- },
- replace = {
- a = { fg = "#{{base08-hex}}", bg = "none", gui = "bold" },
- },
- command = {
- a = { fg = "#{{base0A-hex}}", bg = "none", gui = "bold" },
- },
- inactive = {
- a = { fg = "#{{base04-hex}}", bg = "none" },
- b = { fg = "#{{base04-hex}}", bg = "none" },
- c = { fg = "#{{base04-hex}}", bg = "none" },
- },
-};
-
-local function macro_recording()
- local recording_register = vim.fn.reg_recording()
- if recording_register ~= "" then
- return "@" .. recording_register
- else
- return ""
- end
-end
-
-require("lualine").setup {
- options = {
- icons_enabled = true,
- theme = lualine_theme,
- section_separators = "",
- component_separators = "",
- },
- sections = {
- lualine_a = { "mode" },
- lualine_b = {
- "branch",
- {
- "diff",
- colored = true,
- symbols = {
- added = " ",
- modified = " ",
- removed = " ",
- }
- }
- },
- lualine_c = { "filename" },
- lualine_x = { macro_recording, "encoding", "fileformat", "filetype" },
- lualine_y = { "progress" },
- lualine_z = { "location" },
- },
-};
diff --git a/modules/tools/editor/neovim/plugins/config/noice.mustache.lua b/modules/tools/editor/neovim/plugins/config/noice.mustache.lua
deleted file mode 100644
index a258c8e..0000000
--- a/modules/tools/editor/neovim/plugins/config/noice.mustache.lua
+++ /dev/null
@@ -1,10 +0,0 @@
-require("noice").setup();
-
-vim.api.nvim_set_hl(0, "NoiceCommandOutput", { fg = "#{{base05-hex}}", bg = "#{{base00-hex}}" });
-vim.api.nvim_set_hl(0, "NoiceCmdline", { fg = "#{{base05-hex}}", bg = "#{{base00-hex}}" });
-vim.api.nvim_set_hl(0, "NoiceCmdlinePopup", { fg = "#{{base05-hex}}", bg = "#{{base00-hex}}" });
-vim.api.nvim_set_hl(0, "NoiceCmdlinePopupBorder", { fg = "#{{base03-hex}}", bg = "#{{base00-hex}}" });
-vim.api.nvim_set_hl(0, "NoiceError", { fg = "#{{base08-hex}}", bg = "#{{base00-hex}}" });
-vim.api.nvim_set_hl(0, "NoiceWarning", { fg = "#{{base0A-hex}}", bg = "#{{base00-hex}}" });
-vim.api.nvim_set_hl(0, "NoiceInfo", { fg = "#{{base0C-hex}}", bg = "#{{base00-hex}}" });
-vim.api.nvim_set_hl(0, "NoiceHint", { fg = "#{{base0B-hex}}", bg = "#{{base00-hex}}" });
diff --git a/modules/tools/editor/neovim/plugins/config/nvim-tree.lua b/modules/tools/editor/neovim/plugins/config/nvim-tree.lua
deleted file mode 100644
index cdbef6a..0000000
--- a/modules/tools/editor/neovim/plugins/config/nvim-tree.lua
+++ /dev/null
@@ -1,15 +0,0 @@
-require("nvim-tree").setup {
- filters = {
- enable = false
- },
- renderer = {
- indent_markers = {
- enable = true
- },
- root_folder_label = function(path)
- return vim.fn.fnamemodify(path, ":t")
- end,
- },
-};
-
-vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>", { silent = true });
diff --git a/modules/tools/editor/neovim/plugins/config/nvim-ufo.lua b/modules/tools/editor/neovim/plugins/config/nvim-ufo.lua
deleted file mode 100644
index 641373f..0000000
--- a/modules/tools/editor/neovim/plugins/config/nvim-ufo.lua
+++ /dev/null
@@ -1,21 +0,0 @@
-require("ufo").setup {
- provider_selector = function(bufnr, filetype, buftype)
- return {
- "treesitter",
- "indent"
- }
- end,
-};
-
-vim.o.foldenable = true
-vim.o.foldcolumn = '0'
-vim.o.foldlevel = 99 -- Ensure all folds start open
-vim.o.foldlevelstart = 99
-
--- press <Shift>K or capslockK
-vim.keymap.set("n", "<S-K>", function()
- local winid = ufo.peekFoldedLinesUnderCursor()
- if not winid then
- vim.lsp.buf.hover()
- end
-end)
diff --git a/modules/tools/editor/neovim/plugins/config/treesitter.nix b/modules/tools/editor/neovim/plugins/config/treesitter.nix
deleted file mode 100644
index be0bdb6..0000000
--- a/modules/tools/editor/neovim/plugins/config/treesitter.nix
+++ /dev/null
@@ -1,13 +0,0 @@
-{ config }:
-
-''
-require("nvim-treesitter.configs").setup {
- auto_install = true,
- highlight = {
- enable = true,
- },
- parser_install_dir = "${config.xdg.dataHome}/nvim",
-};
-
-vim.opt.runtimepath:append("${config.xdg.dataHome}/nvim");
-''
diff --git a/modules/tools/editor/neovim/plugins/config/which-key.lua b/modules/tools/editor/neovim/plugins/config/which-key.lua
deleted file mode 100644
index 1290432..0000000
--- a/modules/tools/editor/neovim/plugins/config/which-key.lua
+++ /dev/null
@@ -1,5 +0,0 @@
-local wk = require("which-key");
-
-vim.keymap.set("n", "<leader>h", function()
- wk.show({ global = true })
-end, { silent = true });
diff --git a/modules/tools/editor/neovim/plugins/default.nix b/modules/tools/editor/neovim/plugins/default.nix
deleted file mode 100644
index f801519..0000000
--- a/modules/tools/editor/neovim/plugins/default.nix
+++ /dev/null
@@ -1,31 +0,0 @@
-{ config, pkgs, lib }:
-
-{
- configuration = import ./config { inherit config; };
-
- list = with pkgs.vimPlugins; lib.mkMerge [
- [
- comment-nvim
- lualine-nvim
- nvim-treesitter
- nvim-web-devicons
- nvim-tree-lua
- which-key-nvim
- (base16-vim.overrideAttrs (old: {
- patchPhase = "ln -s ${config.scheme base16-vim} colors/base16-scheme.vim";
- }))
- ]
- (if config.tools.editor.neovim.profile == "full" then
- [
- noice-nvim
- dressing-nvim
- nvim-lspconfig
- nvim-ufo
- ]
- else [])
- ];
-
- requirements = with pkgs; [
- gcc # for treesitter
- ];
-}