{ config, lib, pkgs, ... }: let inherit (lib) mkIf mkEnableOption; in { options = { editor.neovim.enable = mkEnableOption "enable neovim text editor"; }; config = mkIf config.editors.neovim.enable { # stylix.targets.nixvim.enable = true; home.packages = with pkgs; [neovide]; programs.nixvim = { enable = true; enableMan = true; # package = ; plugins.lualine.enable = true; plugins.treesitter = { enable = true; folding = true; }; plugins = { yazi.enable = true; noice = { enable = true; popupmenu.backend = "nui"; }; notify.enable = true; telescope.enable = true; transparent.enable = true; lsp-format.enable = true; lsp-lines.enable = true; lsp-status.enable = true; which-key.enable = true; web-devicons.enable = true; # vimtex = { # enable = true; # texlivePackage = pkgs.tectonic; #pkgs.texlive.combined.scheme-full; # settings = { # compiler_method = "tectonic"; # view_method = "zathura_simple"; # compiler_tectonic = { # "aux_dir" = {}; # "out_dir" = {}; # "callback" = 1; # "continuous" = 0; # "executable" = "latexmk"; # "hooks" = {}; # "options" = [ # "--synctex" # "--keep-logs" # "-Z shell-escape" # "-Z continue-on-errors" # ]; # }; # compiler_latexmk = { # "aux_dir" = {}; # "out_dir" = {}; # "callback" = 1; # "continuous" = 0; # "executable" = "latexmk"; # "hooks" = {}; # "options" = [ # "-xelatex" # "-recorder" # "-file-line-error" # "-synctex=1" # "-interaction=nonstopmode" # "-shell-escape" # ]; # }; # }; # }; treesitter-textobjects.enable = true; cmp-latex-symbols.enable = true; dap.enable = true; rustaceanvim.enable = true; lsp = { enable = true; servers = { clangd.enable = true; #rust_analyzer = { # enable = true; # installRustc = true; # installCargo = true; #}; lua_ls.enable = true; nil_ls.enable = true; }; }; }; plugins = { cmp-nvim-lsp = {enable = true;}; # lsp cmp-buffer = {enable = true;}; cmp-path = {enable = true;}; # file system paths cmp_luasnip = {enable = true;}; # snippets cmp-cmdline = {enable = true;}; # autocomplete for cmdline cmp = { enable = true; autoEnableSources = true; settings = { sources = [ {name = "nvim_lsp";} {name = "path";} {name = "buffer";} ]; mapping = { "" = "cmp.mapping.complete()"; "" = "cmp.mapping.scroll_docs(-4)"; "" = "cmp.mapping.close()"; "" = "cmp.mapping.scroll_docs(4)"; "" = "cmp.mapping.confirm({ select = true })"; "" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; }; experimental = { ghost_text = true; }; }; }; luasnip = { enable = true; settings = { enable_autosnippets = true; store_selection_keys = ""; }; }; }; clipboard = { providers.wl-copy.enable = true; }; globals.mapleader = " "; globals.maplocalleader = ","; opts = { # Show line numbers number = true; # Show relative line numbers relativenumber = true; # Use the system clipboard clipboard = "unnamedplus"; # Number of spaces that represent a tabstop = 2; softtabstop = 2; # Show tabline always showtabline = 2; # Use spaces instead of tabs expandtab = true; # Enable smart indentation smartindent = true; # Number of spaces to use for each step of (auto)indent shiftwidth = 2; # Enable break indent breakindent = true; # Highlight the screen line of the cursor cursorline = true; # Minimum number of screen lines to keep above and below the cursor scrolloff = 8; # Enable mouse support mouse = "a"; # Set folding method to manual foldmethod = "manual"; # Disable folding by default foldenable = false; # Wrap long lines at a character in 'breakat' linebreak = true; # Disable spell checking spell = false; # Disable swap file creation swapfile = false; # Time in milliseconds to wait for a mapped sequence to complete timeoutlen = 300; # Enable 24-bit RGB color in the TUI termguicolors = true; # Don't show mode in the command line showmode = false; # Open new split below the current window splitbelow = true; # Keep the screen when splitting splitkeep = "screen"; # Open new split to the right of the current window splitright = true; # Hide command line unless needed cmdheight = 0; # Remove EOB fillchars = { eob = " "; }; }; keymaps = [ { mode = "n"; key = "j"; action = "gj"; } { mode = "n"; key = "k"; action = "gk"; } { mode = "n"; key = "n"; action = "nzzzv"; } { mode = "n"; key = "N"; action = "Nzzzv"; } { mode = "n"; key = ""; action = "zz"; } { mode = "n"; key = ""; action = "zz"; } { mode = "n"; key = "yy"; action = "Yazi"; options = {desc = "open yazi";}; } { mode = "n"; key = "fo"; action = "Telescope oldfiles"; options = {desc = "Telescope oldfiles";}; } { mode = "n"; key = "ff"; action = "Telescope find_files"; options = {desc = "Telescope find files";}; } ]; }; }; }