vim
This commit is contained in:
@@ -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";
|
||||
};
|
||||
|
||||
|
||||
163
home/neovim.nix
163
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 <expr> <Tab> pumvisible() ? "\<C-y>" : "\<Tab>"
|
||||
inoremap <expr> <S-Tab> "\<Tab>"
|
||||
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 <leader>m <Plug>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 <Leader>e
|
||||
vim.keymap.set('n', '<leader>e', ':NvimTreeToggle<CR>', { 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 <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>"
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
vim-nix
|
||||
vim-lastplace
|
||||
vim-yaml
|
||||
fzf-vim
|
||||
chadtree
|
||||
typst-vim
|
||||
typst-preview-nvim
|
||||
aider-nvim
|
||||
" 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>"
|
||||
|
||||
# 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 <leader>m <Plug>MarkdownPreviewToggle
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user