From 27eec5cf2c7ed2117485b6a46d697060a77ba91a Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Mon, 3 Jun 2024 21:10:12 +0200 Subject: [PATCH] Neovim: Delete lazyvim module --- home/modules/default.nix | 1 - home/modules/lazyvim/default.nix | 238 ---------- home/modules/lazyvim/extraConfigLua.lua | 58 --- home/modules/lazyvim/extraConfigLuaPost.lua | 24 - home/modules/lazyvim/keybinds.nix | 493 -------------------- home/modules/lazyvim/options.nix | 11 - home/modules/lazyvim/vim_opts.nix | 64 --- 7 files changed, 889 deletions(-) delete mode 100644 home/modules/lazyvim/default.nix delete mode 100644 home/modules/lazyvim/extraConfigLua.lua delete mode 100644 home/modules/lazyvim/extraConfigLuaPost.lua delete mode 100644 home/modules/lazyvim/keybinds.nix delete mode 100644 home/modules/lazyvim/options.nix delete mode 100644 home/modules/lazyvim/vim_opts.nix diff --git a/home/modules/default.nix b/home/modules/default.nix index 523a6d16..6140c446 100644 --- a/home/modules/default.nix +++ b/home/modules/default.nix @@ -11,7 +11,6 @@ ./helix ./hyprland ./kitty - ./lazyvim ./misc ./neovim ./nextcloud diff --git a/home/modules/lazyvim/default.nix b/home/modules/lazyvim/default.nix deleted file mode 100644 index 86caadee..00000000 --- a/home/modules/lazyvim/default.nix +++ /dev/null @@ -1,238 +0,0 @@ -{ - config, - nixosConfig, - lib, - mylib, - pkgs, - ... -}: -with lib; -with mylib.modules; let - cfg = config.modules.lazyvim; -in { - options.modules.lazyvim = import ./options.nix {inherit lib mylib;}; - - config = mkIf cfg.enable { - home.sessionVariables = { - EDITOR = "nvim"; - VISUAL = "nvim"; - }; - - home.packages = with pkgs; - builtins.concatLists [ - (optionals cfg.neovide [neovide]) - - [ - (pkgs.ripgrep.override {withPCRE2 = true;}) - - # Dependencies - lua51Packages.lua-curl # For rest - lua51Packages.xml2lua # For rest - lua51Packages.mimetypes # For rest - lua51Packages.jsregexp # For tree-sitter - - # Language servers - clang-tools_18 - clojure-lsp - cmake-language-server - haskell-language-server - lua-language-server - nil - pyright - rust-analyzer - texlab - - # Linters - checkstyle # java - clippy # rust - clj-kondo # clojure - eslint_d # javascript - python311Packages.flake8 - lua51Packages.luacheck - vale # text - statix # nix - - # Formatters - alejandra # nix - python311Packages.black - google-java-format - html-tidy - jq # json - prettierd # html/css/js - rustfmt - stylua - ] - ]; - - home.file.".config/nvim/parser".source = let - parsers = pkgs.symlinkJoin { - name = "treesitter-parsers"; - paths = pkgs.vimPlugins.nvim-treesitter.withAllGrammars.dependencies; - }; - in "${parsers}/parser"; - - home.file.".config/neovide/config.toml".text = '' - fork = true # Start neovide detached - frame = "none" # full, buttonless, none - idle = true # Don't render frames without changes - # maximized = true - title-hidden = true - # vsync = true - ''; - - home.file.".config/vale/.vale.ini".text = '' - # Core settings appear at the top - # (the "global" section). - - [formats] - # Format associations appear under - # the optional "formats" section. - - [*] - # Format-specific settings appear - # under a user-provided "glob" - # pattern. - ''; - - programs.nixvim = { - enable = true; - defaultEditor = true; - enableMan = true; - luaLoader.enable = true; - # colorschemes.catppuccin.enable = true; - viAlias = cfg.alias; - vimAlias = cfg.alias; - - globals = { - mapleader = " "; - mallocalleader = " "; - }; - - opts = import ./vim_opts.nix {inherit lib mylib;}; - extraConfigLuaPost = builtins.readFile ./extraConfigLuaPost.lua; - - # extraLuaPackages = with pkgs.lua51Packages; []; - - # extraPython3Packages = p: [ - # # For CHADtree - # p.pyyaml - # p.pynvim-pp - # p.std2 - # ]; - - extraPlugins = with pkgs.vimPlugins; [ - lazy-nvim - ]; - - autoCmd = [ - { - event = ["BufWritePost"]; - # pattern = "*"; - callback = {__raw = "function() require('lint').try_lint() end";}; - } - { - event = ["BufWritePre"]; - callback = {__raw = "function() require('conform').format() end";}; - } - ]; - - # TODO: Toggle wrapping - # TODO: Toggle format on save - # TODO: Toggle format on paste - keymaps = import ./keybinds.nix {inherit lib mylib;}; - - extraConfigLua = let - plugins = with pkgs.vimPlugins; [ - LazyVim # Sets many vim options - - bufferline-nvim - cmp-buffer - cmp-nvim-lsp - cmp-path - cmp_luasnip - conform-nvim - dashboard-nvim - dressing-nvim - flash-nvim - friendly-snippets - gitsigns-nvim - indent-blankline-nvim - lualine-nvim - neo-tree-nvim - neoconf-nvim - neodev-nvim - noice-nvim - nui-nvim - nvim-cmp - nvim-lint - nvim-lspconfig - nvim-notify - nvim-spectre - nvim-treesitter - nvim-treesitter-context - nvim-treesitter-textobjects - nvim-ts-autotag - nvim-ts-context-commentstring - nvim-web-devicons - persistence-nvim - plenary-nvim - telescope-fzf-native-nvim - telescope-nvim - todo-comments-nvim - tokyonight-nvim - trouble-nvim - vim-illuminate - vim-startuptime - which-key-nvim - { - name = "LuaSnip"; - path = luasnip; - } - { - name = "catppuccin"; - path = catppuccin-nvim; - } - { - name = "mini.ai"; - path = mini-nvim; - } - { - name = "mini.bufremove"; - path = mini-nvim; - } - { - name = "mini.comment"; - path = mini-nvim; - } - { - name = "mini.indentscope"; - path = mini-nvim; - } - { - name = "mini.pairs"; - path = mini-nvim; - } - { - name = "mini.surround"; - path = mini-nvim; - } - ]; - - mkEntryFromDrv = drv: - if lib.isDerivation drv - then { - name = "${lib.getName drv}"; - path = drv; - } - else drv; - - lazyPath = pkgs.linkFarm "lazy-plugins" (builtins.map mkEntryFromDrv plugins); - in ( - builtins.replaceStrings - ["@lazyPath@"] - ["${lazyPath}"] - (builtins.readFile ./extraConfigLua.lua) - ); - }; - }; -} diff --git a/home/modules/lazyvim/extraConfigLua.lua b/home/modules/lazyvim/extraConfigLua.lua deleted file mode 100644 index 3224c71c..00000000 --- a/home/modules/lazyvim/extraConfigLua.lua +++ /dev/null @@ -1,58 +0,0 @@ --- Skip loading LazyVim options -package.loaded["lazyvim.config.options"] = true - --- Hide inline diagnostics and show border -vim.diagnostic.config({ - virtual_text = false, - float = { border = "rounded" }, -}) - --- Allow navigating popupmenu completion with Up/Down -vim.api.nvim_set_keymap("c", "", 'v:lua.get_wildmenu_key("", "")', { expr = true }) -vim.api.nvim_set_keymap("c", "", 'v:lua.get_wildmenu_key("", "")', { expr = true }) -function _G.get_wildmenu_key(key_wildmenu, key_regular) - return vim.fn.wildmenumode() ~= 0 and key_wildmenu or key_regular -end - --- Package manager setup -require("lazy").setup({ - defaults = { - lazy = true, - }, - - dev = { - -- reuse files from pkgs.vimPlugins.* - path = "@lazyPath@", -- NOTE: Will be replaced by the nix path - - patterns = { "." }, - - -- fallback to download - fallback = true, - }, - - spec = { - { - "LazyVim/LazyVim", - import = "lazyvim.plugins", - opts = { - defaults = { - autocmds = false, -- Skip loading LazyVim cmds - keymaps = false, -- Skip loading LazyVim keymaps - }, - }, - }, - - -- force enable telescope-fzf-native.nvim on nix - { "nvim-telescope/telescope-fzf-native.nvim", enabled = true }, - - -- disable mason.nvim, use config.extraPackages on nix - { "williamboman/mason-lspconfig.nvim", enabled = false }, - { "williamboman/mason.nvim", enabled = false }, - - -- uncomment to import/override with your plugins - -- { import = "plugins" }, - - -- put this line at the end of spec to clear ensure_installed on nix - { "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = {} } }, - }, -}) diff --git a/home/modules/lazyvim/extraConfigLuaPost.lua b/home/modules/lazyvim/extraConfigLuaPost.lua deleted file mode 100644 index e3a3a695..00000000 --- a/home/modules/lazyvim/extraConfigLuaPost.lua +++ /dev/null @@ -1,24 +0,0 @@ -local opt = vim.opt -local g = vim.g -local o = vim.o - --- Neovide -if g.neovide then - -- require("notify").notify("Running in NeoVide") - - g.neovide_cursor_animate_command_line = true - g.neovide_cursor_animate_in_insert_mode = true - -- g.neovide_fullscreen = false - g.neovide_hide_mouse_when_typing = true - g.neovide_padding_top = 0 - g.neovide_padding_bottom = 0 - g.neovide_padding_right = 0 - g.neovide_padding_left = 0 - g.neovide_refresh_rate = 144 - -- g.neovide_theme = "light" - - -- Neovide Fonts - o.guifont = "JetBrainsMono Nerd Font:h13:Medium" -else - -- require("notify").notify("Not running in NeoVide") -end diff --git a/home/modules/lazyvim/keybinds.nix b/home/modules/lazyvim/keybinds.nix deleted file mode 100644 index c2f1ef14..00000000 --- a/home/modules/lazyvim/keybinds.nix +++ /dev/null @@ -1,493 +0,0 @@ -{ - lib, - mylib, - ... -}: [ - # No Leader - { - mode = "n"; - key = ""; - action = "w"; - options.desc = "Save current buffer"; - } - { - mode = "n"; - key = ""; - action = "wa"; - options.desc = "Save all buffers"; - } - { - mode = "v"; - key = "<"; - action = " - { - mode = "n"; - key = "qq"; - action = "quitall"; - options.desc = "Quit"; - } - { - mode = "n"; - key = "q!"; - action = "quitall!"; - options.desc = "Forceful quit"; - } - { - mode = "n"; - key = "L"; - action = "Lazy"; - options.desc = "Show Lazy"; - } - { - mode = "n"; - key = ""; - action = "Telescope buffers"; - options.desc = "Show open buffers"; - } - { - mode = "n"; - key = "S"; - action = "wa"; - options.desc = "Save all buffers"; - } - { - mode = "n"; - key = "f"; - action = "Telescope find_files"; - options.desc = "Find file"; - } - { - mode = "n"; - key = "o"; - action = "Telescope vim_options"; - options.desc = "Show Vim options"; - } - { - mode = "n"; - key = "u"; - action = "Telescope undo"; - options.desc = "Show undo history"; - } - { - mode = "n"; - key = "/"; - action = "Telescope current_buffer_fuzzy_find"; - options.desc = "Find in current buffer"; - } - { - mode = "n"; - key = "n"; - action = "Telescope notify"; - options.desc = "Show notify history"; - } - { - mode = "n"; - key = "s"; - action = "Telescope live_grep"; - options.desc = "Find in working directory"; - } - { - mode = "n"; - key = "r"; - action = "Telescope resume"; - options.desc = "Show last telescope picker"; - } - { - mode = "n"; - key = "?"; - action = "Telescope keymaps"; - options.desc = "Show keymaps"; - } - { - mode = "n"; - key = ":"; - action = "Telescope commands"; - options.desc = "Execute command"; - } - { - mode = "n"; - key = "M"; - action = "Telescope marks"; - options.desc = "Show marks"; - } - { - mode = "n"; - key = "J"; - action = "Telescope jumplist"; - options.desc = "Show jumplist"; - } - { - mode = "n"; - key = "m"; - action = "Telescope man_pages"; - options.desc = "Show manpages"; - } - { - mode = "n"; - key = "h"; - action = "Telescope help_tags"; - options.desc = "Show help tags"; - } - - # Quit q - { - mode = "n"; - key = "q"; - action = "+quit"; - } - - # Buffers b - { - mode = "n"; - key = "b"; - action = "+buffers"; - } - { - mode = "n"; - key = "bb"; - action = "Telescope buffers"; - options.desc = "Show open buffers"; - } - { - mode = "n"; - key = "bn"; - action = "bnext"; - options.desc = "Goto next buffer"; - } - { - mode = "n"; - key = "bp"; - action = "bprevious"; - options.desc = "Goto previous buffer"; - } - { - mode = "n"; - key = "bd"; - action = "Bdelete"; - options.desc = "Close current buffer"; - } - - # Windows w - { - mode = "n"; - key = "w"; - action = "+windows"; - } - { - mode = "n"; - key = "ws"; - action = "s"; - options.desc = "Split window horizontally"; - } - { - mode = "n"; - key = "wv"; - action = "v"; - options.desc = "Split window vertically"; - } - { - mode = "n"; - key = "wd"; - action = "c"; - options.desc = "Close current window"; - } - # { - # mode = "n"; - # key = "wh"; - # action = "s"; - # options.desc = "Split window horizontally"; - # } - { - mode = "n"; - key = "wh"; - action = "h"; - options.desc = "Goto left window"; - } - { - mode = "n"; - key = "wl"; - action = "l"; - options.desc = "Goto right window"; - } - { - mode = "n"; - key = "wj"; - action = "j"; - options.desc = "Goto bottom window"; - } - { - mode = "n"; - key = "wk"; - action = "k"; - options.desc = "Goto top window"; - } - { - mode = "n"; - key = "ww"; - action = "p"; - options.desc = "Goto other window"; - } - - # Toggles t - { - mode = "n"; - key = "t"; - action = "+toggle"; - } - # { - # mode = "n"; - # key = "tt"; - # action = "Neotree action=show toggle=true"; - # options.desc = "Toggle NeoTree"; - # } - { - mode = "n"; - key = "tt"; - action = "CHADopen --nofocus"; - options.desc = "Toggle CHADtree"; - } - { - mode = "n"; - key = "tn"; - action = "Navbuddy"; - options.desc = "Toggle NavBuddy"; - } - { - mode = "n"; - key = "td"; - action = "TroubleToggle focus=false"; - options.desc = "Toggle Trouble"; - } - # { - # mode = "n"; - # key = "tg"; - # action = "LazyGit"; - # } - # { - # mode = "n"; - # key = "tp"; - # action = "TroubleToggle"; - # } - - # Git g - { - mode = "n"; - key = "g"; - action = "+git"; - } - { - mode = "n"; - key = "gg"; - action = "LazyGit"; - options.desc = "Show LazyGit"; - } - { - mode = "n"; - key = "gm"; - action = "GitMessenger"; - options.desc = "Show GitMessenger"; - } - # { - # mode = "n"; - # key = "gs"; - # action = "Git status"; - # } - { - mode = "n"; - key = "gs"; - action = "Telescope git_status"; - options.desc = "Show Git status"; - } - { - mode = "n"; - key = "gc"; - action = "Telescope git_commits"; - options.desc = "Show Git log"; - } - { - mode = "n"; - key = "gb"; - action = "Telescope git_branches"; - options.desc = "Show Git branches"; - } - { - mode = "n"; - key = "gf"; - action = "Telescope git_bcommits"; - options.desc = "Show Git log for current file"; - } - - # LSP l - { - mode = "n"; - key = "l"; - action = "+lsp"; - } - { - mode = "n"; - key = "lr"; - action = "Telescope lsp_references"; - options.desc = "Goto references"; - } - { - mode = "n"; - key = "ld"; - action = "Telescope lsp_definitions"; - options.desc = "Goto definition"; - } - { - mode = "n"; - key = "li"; - action = "Telescope lsp_implementations"; - options.desc = "Goto implementation"; - } - { - mode = "n"; - key = "lt"; - action = "Telescope lsp_type_definitions"; - options.desc = "Goto type definition"; - } - { - mode = "n"; - key = "lI"; - action = "Telescope lsp_incoming_calls"; - options.desc = "Show incoming calls"; - } - { - mode = "n"; - key = "lO"; - action = "Telescope lsp_outgoing_calls"; - options.desc = "Show outgoing calls"; - } - - # Code c - { - mode = "n"; - key = "c"; - action = "+code"; - } - { - mode = "n"; - key = "cf"; - action = "lua require('conform').format()"; - options.desc = "Format current buffer"; - } - { - mode = "n"; - key = "cd"; - action = "Telescope diagnostics"; - options.desc = "Show diagnostics"; - } - { - mode = "n"; - key = "cr"; - action = "lua vim.lsp.buf.rename()"; - options.desc = "Rename LSP symbol"; - } - { - mode = "n"; - key = "ca"; - action = "lua vim.lsp.buf.code_action()"; - options.desc = "Show LSP code actions"; - } - { - mode = "n"; - key = "cD"; - action = "lua vim.diagnostic.open_float()"; - options.desc = "Show LSP line diagnostics"; - } -] diff --git a/home/modules/lazyvim/options.nix b/home/modules/lazyvim/options.nix deleted file mode 100644 index 3ce19223..00000000 --- a/home/modules/lazyvim/options.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - lib, - mylib, - ... -}: -with lib; -with mylib.modules; { - enable = mkEnableOpt "LazyVim"; - alias = mkBoolOpt false "Link nvim to vim/vi"; - neovide = mkEnableOpt "NeoVide"; -} diff --git a/home/modules/lazyvim/vim_opts.nix b/home/modules/lazyvim/vim_opts.nix deleted file mode 100644 index 78456cac..00000000 --- a/home/modules/lazyvim/vim_opts.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ - lib, - mylib, - ... -}: { - showmode = false; # Status line already shows this - backspace = ["indent" "eol" "start"]; - termguicolors = true; # Required by multiple plugins - hidden = true; # Don't unload buffers immediately - mouse = "a"; - completeopt = ["menuone" "noselect" "noinsert"]; - timeoutlen = 50; - pumheight = 0; - formatexpr = "v:lua.require('conform').formatexpr()"; - laststatus = 3; - # winblend = 30; - - # Cursor - ruler = true; # Show cursor position in status line - number = true; - relativenumber = true; - signcolumn = "yes"; - cursorline = true; - scrolloff = 10; - - # Folding - foldcolumn = "0"; - foldlevel = 99; - foldlevelstart = 99; - foldenable = true; - # foldmethod = "expr"; - # foldexpr = "nvim_treesitter#foldexpr()"; - - # Files - encoding = "utf-8"; - fileencoding = "utf-8"; - # swapfile = true; - # backup = false; - undofile = true; - undodir = "/home/christoph/.vim/undo"; - # autochdir = true; - - # Search - incsearch = true; # Already highlight results while typing - hlsearch = true; - ignorecase = true; - smartcase = true; - grepprg = "rg --vimgrep"; - grepformat = "%f:%l:%c:%m"; - - # Indentation - autoindent = false; # Use previous line indentation level - Might mess up comment indentation - smartindent = false; # Like autoindent but recognizes some C syntax - Might mess up comment indentation - cindent = true; - cinkeys = "0{,0},0),0],:,!^F,o,O,e"; # Fix comment (#) indentation and intellitab (somehow) - smarttab = true; - expandtab = true; - shiftwidth = 4; - tabstop = 4; - softtabstop = 4; - - splitbelow = true; - splitright = true; -}