diff --git a/flake.nix b/flake.nix index 932e213..f1dd0fe 100644 --- a/flake.nix +++ b/flake.nix @@ -12,7 +12,7 @@ nix-colors.url = "github:misterio77/nix-colors"; stylix = { - url = "github:nix-community/stylix"; + url = "github:nix-community/stylix/release-25.11"; inputs.nixpkgs.follows = "nixpkgs"; }; diff --git a/home/neovim.nix b/home/neovim.nix index 942006e..fba1624 100644 --- a/home/neovim.nix +++ b/home/neovim.nix @@ -5,50 +5,100 @@ viAlias = true; vimAlias = true; defaultEditor = true; + + # Required for render-markdown and coc withPython3 = true; withNodeJs = true; + # Keep your python deps for latex rendering extraPython3Packages = ps: [ ps.pylatexenc ]; - extraConfig = '' - set backspace=indent,eol,start - syntax on - set tabstop=2 softtabstop=0 autoindent expandtab shiftwidth=2 smarttab - set wildmenu - set wildmode=longest:full,full + extraPackages = with pkgs; [ + fzf + wl-clipboard + xclip + ripgrep # Nvim-tree (and fzf) work better with ripgrep installed + ]; - inoremap pumvisible() ? "\" : "\" - inoremap "\" + plugins = with pkgs.vimPlugins; [ + # --- UI / File Explorer (Replaces Chadtree) --- + nvim-tree-lua + nvim-web-devicons - set clipboard=unnamed,unnamedplus - set mouse=a + # --- Fuzzy Finder --- + fzf-vim - " Browser Preview Hotkey - nmap m MarkdownPreviewToggle - ''; + # --- Editor Utilities --- + vim-lastplace + vim-nix + vim-yaml + + # --- Coding / LSP (CoC) --- + # Keeping CoC as requested (switching to Native LSP is a bigger task) + coc-nvim + coc-vimtex + coc-rust-analyzer + + # --- Markdown / LaTeX / Typst --- + vimtex + typst-vim + typst-preview-nvim + render-markdown-nvim + markdown-preview-nvim + + # --- AI --- + aider-nvim + # --- Treesitter --- + (nvim-treesitter.withPlugins (p: [ + p.markdown + p.markdown_inline + p.latex + p.yaml + p.bash + p.rust + p.nix + p.lua + ])) + ]; + + # We can consolidate most settings into Lua for simplicity extraLuaConfig = '' - vim.wo.number = true - vim.api.nvim_set_option("clipboard", "unnamedplus") + -- ============================ + -- 1. General Settings + -- ============================ + vim.opt.number = true + vim.opt.backspace = { "indent", "eol", "start" } + vim.opt.tabstop = 2 + vim.opt.softtabstop = 0 + vim.opt.shiftwidth = 2 + vim.opt.expandtab = true + vim.opt.smarttab = true + vim.opt.autoindent = true + + -- Clipboard setup + vim.opt.clipboard = "unnamedplus" - -- 2. CRITICAL: Set conceallevel to 2. - -- This hides the "$$" and allows the plugin to render the math. - vim.opt.conceallevel = 2 + -- ============================ + -- 2. File Explorer (Nvim-tree) + -- ============================ + -- This replaces Chadtree. It is much more stable. + require("nvim-tree").setup({ + sort = { sorter = "case_sensitive" }, + view = { width = 30 }, + renderer = { group_empty = true }, + filters = { dotfiles = false }, + }) - -- Optional: Ensure concealed text is not completely hidden if you want a cursor indicator - vim.opt.concealcursor = 'nc' -- Hide in Normal/Command, show in Insert - - require('nvim-treesitter.configs').setup { - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - } + -- Toggle file explorer with e + vim.keymap.set('n', 'e', ':NvimTreeToggle', { silent = true }) + -- ============================ + -- 3. Render Markdown Setup + -- ============================ require('render-markdown').setup({ latex = { enabled = true, - -- This requires the 'pylatexenc' python package added above converter = 'latex2text', highlight = 'RenderMarkdownMath', top_pad = 0, @@ -57,42 +107,31 @@ }) ''; - extraPackages = [ - pkgs.fzf - pkgs.wl-clipboard - pkgs.xclip - ]; + # Vimscript is still best for specific CoC and FZF tweaks + extraConfig = '' + syntax on + set mouse=a + + " --- CoC Configuration --- + " Use Tab to trigger completion and navigate + inoremap + \ coc#pum#visible() ? coc#pum#next(1) : + \ CheckBackspace() ? "\" : + \ coc#refresh() + inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" - plugins = with pkgs.vimPlugins; [ - vim-nix - vim-lastplace - vim-yaml - fzf-vim - chadtree - typst-vim - typst-preview-nvim - aider-nvim + " Make (Enter) accept the selected item + inoremap coc#pum#visible() ? coc#pum#confirm() + \: "\u\\=coc#on_enter()\" - # Icons - nvim-web-devicons + function! CheckBackspace() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' + endfunction - # Treesitter with REQUIRED parsers - (nvim-treesitter.withPlugins (p: [ - p.markdown - p.markdown_inline - p.latex - p.yaml - p.bash - p.rust - ])) - - render-markdown-nvim - markdown-preview-nvim - ]; - - coc.enable = true; - coc.settings = { - "coc.globalExtensions" = [ "coc-rust-analyzer" ]; - }; + " --- Keymaps --- + " Browser Preview Hotkey + nmap m MarkdownPreviewToggle + ''; }; } diff --git a/home/niri.nix b/home/niri.nix index 6f652dc..b9bb919 100644 --- a/home/niri.nix +++ b/home/niri.nix @@ -248,7 +248,7 @@ let spawn-at-startup "foot" "--server" spawn-at-startup "mako" spawn-at-startup "swww-daemon" - spawn-at-startup "sh" "-c" "while true; do waybar; done" //disabled to a systemd service. in a while because it sometimes crashes. + spawn-at-startup "waybar" spawn-at-startup "sh" "-c" "while true; do swww img -f Nearest --transition-step 2 \"$(find ~/Pictures/wallpapers/ -type l,f | shuf -n 1)\"; sleep 270; done"