refactor: consolidate to nixvim, remove minuet/ai, add image support
This commit is contained in:
@@ -2,4 +2,4 @@ first install enable lanzaboote 'sudo sbctl create-keys'
|
||||
|
||||
rebuild 'sudo nixos-rebuild switch --flake .# --no-write-lock-file -L --builders ""'
|
||||
|
||||
|
||||

|
||||
|
||||
-139
@@ -1,139 +0,0 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
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 ];
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
fzf
|
||||
wl-clipboard
|
||||
xclip
|
||||
ripgrep # Nvim-tree (and fzf) work better with ripgrep installed
|
||||
];
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
vim-indent-guides
|
||||
|
||||
# --- UI / File Explorer (Replaces Chadtree) ---
|
||||
nvim-tree-lua
|
||||
nvim-web-devicons
|
||||
|
||||
# --- Fuzzy Finder ---
|
||||
fzf-vim
|
||||
|
||||
# --- 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 = ''
|
||||
-- ============================
|
||||
-- 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. 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 },
|
||||
})
|
||||
|
||||
-- Toggle file explorer with <Leader>e
|
||||
vim.keymap.set('n', '<leader>e', ':NvimTreeToggle<CR>', { silent = true })
|
||||
|
||||
-- ============================
|
||||
-- 3. Render Markdown Setup
|
||||
-- ============================
|
||||
require('render-markdown').setup({
|
||||
latex = {
|
||||
enabled = true,
|
||||
converter = 'latex2text',
|
||||
highlight = 'RenderMarkdownMath',
|
||||
top_pad = 0,
|
||||
bottom_pad = 0,
|
||||
},
|
||||
})
|
||||
'';
|
||||
|
||||
# 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 <silent><expr> <TAB>
|
||||
\ coc#pum#visible() ? coc#pum#next(1) :
|
||||
\ CheckBackspace() ? "\<Tab>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
|
||||
|
||||
" Make <CR> (Enter) accept the selected item
|
||||
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
|
||||
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
||||
|
||||
function! CheckBackspace() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
" --- Keymaps ---
|
||||
" Browser Preview Hotkey
|
||||
nmap <leader>m <Plug>MarkdownPreviewToggle
|
||||
'';
|
||||
};
|
||||
}
|
||||
+31
-64
@@ -14,6 +14,7 @@
|
||||
xclip
|
||||
ripgrep
|
||||
tree-sitter
|
||||
imagemagick
|
||||
];
|
||||
|
||||
globals.mapleader = " ";
|
||||
@@ -38,7 +39,7 @@
|
||||
|
||||
userCommands = {
|
||||
E = {
|
||||
command = "require('oil').open()";
|
||||
command = "Oil";
|
||||
desc = "Open oil file explorer";
|
||||
};
|
||||
};
|
||||
@@ -87,43 +88,17 @@
|
||||
autoEnableSources = true;
|
||||
settings = {
|
||||
mapping = {
|
||||
"<Tab>" = {
|
||||
__raw = ''
|
||||
cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require('minuet.virtualtext').action.is_visible() then
|
||||
require('minuet.virtualtext').action.accept()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' })
|
||||
'';
|
||||
};
|
||||
"<S-Tab>" = {
|
||||
__raw = ''
|
||||
cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require('minuet.virtualtext').action.is_visible() then
|
||||
require('minuet.virtualtext').action.dismiss()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' })
|
||||
'';
|
||||
};
|
||||
"<Tab>" = "cmp.mapping.select_next_item()";
|
||||
"<S-Tab>" = "cmp.mapping.select_prev_item()";
|
||||
"<CR>" = "cmp.mapping.confirm({ select = true })";
|
||||
"<C-Space>" = "cmp.mapping.complete()";
|
||||
"<C-e>" = "cmp.mapping.abort()";
|
||||
};
|
||||
sources = [
|
||||
{ name = "nvim_lsp"; }
|
||||
{ name = "minuet"; }
|
||||
{ name = "path"; }
|
||||
{ name = "buffer"; }
|
||||
];
|
||||
performance.fetching_timeout = 3000;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -173,48 +148,40 @@
|
||||
indent-blankline.enable = true;
|
||||
nix.enable = true;
|
||||
|
||||
minuet = {
|
||||
clipboard-image = {
|
||||
enable = true;
|
||||
clipboardPackage = pkgs.wl-clipboard;
|
||||
settings = {
|
||||
provider = "openai_fim_compatible";
|
||||
n_completions = 1;
|
||||
context_window = 1024;
|
||||
throttle = 1500;
|
||||
debounce = 600;
|
||||
virtualtext = {
|
||||
auto_trigger_ft = [ "*" ];
|
||||
show_on_completion_menu = false;
|
||||
};
|
||||
provider_options = {
|
||||
openai_fim_compatible = {
|
||||
name = "Galadriel";
|
||||
end_point = "http://galadriel:11112/v1/completions";
|
||||
model = "qwen3.5";
|
||||
api_key = "supersecret";
|
||||
stream = true;
|
||||
optional = {
|
||||
max_tokens = 32;
|
||||
};
|
||||
template = {
|
||||
prompt = {
|
||||
__raw = ''
|
||||
function(context_before_cursor, context_after_cursor, _)
|
||||
return '<|fim_prefix|>'
|
||||
.. context_before_cursor
|
||||
.. '<|fim_suffix|>'
|
||||
.. context_after_cursor
|
||||
.. '<|fim_middle|>'
|
||||
end
|
||||
'';
|
||||
};
|
||||
suffix = false;
|
||||
};
|
||||
};
|
||||
default = {
|
||||
img_dir = "assets";
|
||||
img_dir_txt = "assets";
|
||||
affix = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
image.enable = true;
|
||||
};
|
||||
|
||||
extraConfigLua = ''
|
||||
require("image").setup({
|
||||
backend = "sixel",
|
||||
processor = "magick_cli",
|
||||
integrations = {
|
||||
markdown = {
|
||||
enabled = true,
|
||||
only_render_image_at_cursor = true,
|
||||
only_render_image_at_cursor_mode = "popup",
|
||||
},
|
||||
typst = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
max_height_window_percentage = 50,
|
||||
hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.avif" },
|
||||
})
|
||||
'';
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
|
||||
@@ -17,7 +17,7 @@ let
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://dl.google.com/android/cli/latest/linux_x86_64/android";
|
||||
hash = "sha256-louoe5M/sj0OXsiMFqjv1PJcTyJ0xuRM9j2lOv3hZzA=";
|
||||
hash = "sha256-JtvdSQKKluLE/D/Asow2afsQCmOZ62xIMyIMElNl1l8=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ autoPatchelfHook ];
|
||||
|
||||
Reference in New Issue
Block a user