aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2026-10-02 15:16:23 +0200
committerMartin Fischer <martin@push-f.com>2026-10-02 18:38:11 +0200
commit1113c658b2285cb939e7ab479aabfaba880c99dc (patch)
treede8f73cfa75f59e9f818feb4ad5abc35036c8813
parent11732a457b69c6cd72a38ac17fa6762e221e1ce6 (diff)
tweak(workstation): use neovim instead of vim
-rw-r--r--nixos/profiles/common/basics.nix2
-rw-r--r--nixos/profiles/server/default.nix4
-rw-r--r--nixos/profiles/workstation/default.nix2
-rw-r--r--nixos/profiles/workstation/pkgs/nvim.nix17
-rw-r--r--user/nvim/init.lua33
-rw-r--r--user/vim/ftdetect/djot.vim1
-rw-r--r--user/vim/syntax/djot.vim85
-rw-r--r--user/vim/syntax/jjdescription.vim31
-rw-r--r--user/vim/vimrc26
9 files changed, 55 insertions, 146 deletions
diff --git a/nixos/profiles/common/basics.nix b/nixos/profiles/common/basics.nix
index 7facee9..afbeb7b 100644
--- a/nixos/profiles/common/basics.nix
+++ b/nixos/profiles/common/basics.nix
@@ -3,8 +3,6 @@
{
environment.systemPackages = with pkgs; [
git
- # lowPrio because we use vim-full in the workstation profile
- (lib.lowPrio vim)
file
htop
diff --git a/nixos/profiles/server/default.nix b/nixos/profiles/server/default.nix
index 6e744a6..fbdb9da 100644
--- a/nixos/profiles/server/default.nix
+++ b/nixos/profiles/server/default.nix
@@ -6,6 +6,10 @@
./detect-hostname-change.nix
];
+ environment.systemPackages = with pkgs; [
+ vim
+ ];
+
services = {
openssh = {
enable = true;
diff --git a/nixos/profiles/workstation/default.nix b/nixos/profiles/workstation/default.nix
index 9332bca..78d70d2 100644
--- a/nixos/profiles/workstation/default.nix
+++ b/nixos/profiles/workstation/default.nix
@@ -74,7 +74,7 @@ in
(callPackage (sources.my-vdf { inherit pkgs; }) {})
nixfmt
- vim-full
+ (callPackage ./pkgs/nvim.nix {})
cmd50
(writeShellScriptBin "xdg-open" ''
diff --git a/nixos/profiles/workstation/pkgs/nvim.nix b/nixos/profiles/workstation/pkgs/nvim.nix
new file mode 100644
index 0000000..330ee82
--- /dev/null
+++ b/nixos/profiles/workstation/pkgs/nvim.nix
@@ -0,0 +1,17 @@
+{ neovim, vimPlugins }:
+
+neovim.override {
+ vimAlias = true;
+ configure = {
+ # This Nix wrapper set VIMINIT which stops neovim from reading the normal user config.
+ customRC = ''
+ lua dofile(vim.fn.expand("~/.config/nvim/init.lua"))
+ '';
+ packages.myPlugins = {
+ start = with vimPlugins; [
+ mini-pick
+ vscode-nvim
+ ];
+ };
+ };
+}
diff --git a/user/nvim/init.lua b/user/nvim/init.lua
new file mode 100644
index 0000000..a69e742
--- /dev/null
+++ b/user/nvim/init.lua
@@ -0,0 +1,33 @@
+-- Don't break words in the middle.
+vim.opt.linebreak = true
+
+-- Use the system clipboard.
+vim.opt.clipboard = "unnamedplus"
+
+-- Color scheme
+require('vscode').setup({
+ -- Enable transparent background.
+ transparent = true,
+})
+vim.cmd.colorscheme "vscode"
+
+-- File picker
+local pick = require('mini.pick')
+vim.keymap.set('n', '<C-p>', function()
+ pick.builtin.files()
+end, { desc = 'Pick files' })
+-- Disable icons in mini.pick (my font doesn't have them).
+pick.setup({ source = { show = pick.default_show } })
+-- Reuse Neovim's popup-menu selection color for mini.pick's selected item.
+vim.api.nvim_set_hl(0, 'MiniPickMatchCurrent', { link = 'PmenuSel' })
+
+-- Shortcut for Hugo TOML frontmatter.
+vim.api.nvim_create_autocmd('FileType', {
+ pattern = 'markdown',
+ callback = function(args)
+ vim.keymap.set('n', '<C-f>', 'i+++<CR>title = ""<CR>+++<CR><Esc>kk$i', {
+ buffer = args.buf,
+ desc = 'Insert Hugo TOML frontmatter',
+ })
+ end,
+})
diff --git a/user/vim/ftdetect/djot.vim b/user/vim/ftdetect/djot.vim
deleted file mode 100644
index bcb5082..0000000
--- a/user/vim/ftdetect/djot.vim
+++ /dev/null
@@ -1 +0,0 @@
-au BufNewFile,BufRead *.dj set filetype=djot
diff --git a/user/vim/syntax/djot.vim b/user/vim/syntax/djot.vim
deleted file mode 100644
index 6ec3816..0000000
--- a/user/vim/syntax/djot.vim
+++ /dev/null
@@ -1,85 +0,0 @@
-" Vim syntax file
-" Language: Djot
-" Maintainer: John MacFarlane
-" Latest Revision: 2022-10-06
-
-if exists("b:current_syntax")
- finish
-endif
-
-syn match heading '^##* .*$'
-syn match blockquote '^\s*>\%(\s\|$\)'
-
-syn region math matchgroup=delimiter skip='[^`]{1,}' start='[$][$]\?\z(``*\)' end='\z1\|^\s*$'
-syn region codespan matchgroup=delimiter skip='[^`]{1,}' start='\z(``*\)' end='\z1\|^\s*$'
-
-syn region comment matchgroup=delimiter start='%' end='%' contained
-syn region string start='"' end='"' skip='\\"'
-syn region attributes matchgroup=delimiter start="{[^\[\]_*'\"=\\+-]\@=" end="}" contains=string,comment
-
-syn region emphasis matchgroup=delimiter start='_[^[:blank:]}]\@=\|{_' end='_}\|[^[:blank:]{]\@=_\|^\s*$' contains=@inline
-syn region strong matchgroup=delimiter start='\*[^[:blank:]}]\@=\|{\*' end='[^[:blank:]{]\@=\*\|\*}\|^\s*$' contains=@inline
-
-syn region superscript matchgroup=delimiter start='\^[^[:blank:]}]\@=\|{\^' end='\^}\|[^[:blank:]{]\@=\^\|^\s*$' contains=@inline
-syn region subscript matchgroup=delimiter start='\~[^[:blank:]}]\@=\|{\~' end='\~}\|[^[:blank:]{]\@=\~\|^\s*$' contains=@inline
-
-syn region highlight matchgroup=delimiter start='{=' end='=}\|^\s*$' contains=@inline
-syn match rawattribute "`\@<={=[A-Za-z0-9]*}"
-
-syn region insert matchgroup=delimiter start='{+' end='+}\|^\s*$' contains=@inline
-syn region delete matchgroup=delimiter start='{-' end='-}\|^\s*$' contains=@inline
-
-syn match inlinelink '\[\%([^\]\\]\|\\[\]\\]\|[\r\n]\)*\](\%([^)\\]\|\\[)\\]\)*)' contains=@inline transparent
-syn match linkurl '(\%([^)\\]\|\\[)\\]\)*)'hs=s+1,he=e-1 containedin=inlinelink contained
-
-syn match referencelink '\[\%([^\]\\]\|\\[\]\\]\|[\r\n]\)*\]\[\%([^]\\]\|\\[]\\]\)*\]' contains=@inline transparent
-syn match linklabel '\]\zs\[\%([^]\\]\|\\[]\\]\)*\]'hs=s+1,he=e-1 containedin=referencelink contained
-
-syn match span '\[\%([^\]\\]\|\\[\]\\]\|[\r\n]\)*\][{]\@=' contains=@inline transparent
-
-syn match footnoteref '\[\^[^]]*\]'
-
-syn match openbrace /[{]["']/he=e-1
-syn match closebrace /["'][}]/hs=s+1
-
-syn match emoji ':[a-zA-Z0-9_+-]\+:'
-
-syn match escape '\\[\r\n ~!@#$%^&*(){}`\[\]/=\\?+|\'",<-]'he=e-1
-
-syn region djotautolinkurl matchgroup=delimiter start=/</ end=/>/
-
-syn cluster inline contains=linkurl,emphasis,strong,codespan,attributes,rawattribute,insert,delete,superscript,subscript,highlight,math,smartquote,openbrace,closebrace,emoji,escape,footnoteref,span
-
-syn region codeblock matchgroup=delimiter start='^\s*\z(````*\)\s*=\?\w*\s*$' end='^\s*\z1`*\s*$'
-
-hi emphasis term=italic cterm=italic gui=italic
-hi strong term=bold cterm=bold gui=bold
-hi def link insert Todo
-hi def link delete Error
-hi def link superscript Statement
-hi def link subscript Statement
-hi def link highlight Todo
-hi def link heading Label
-hi def link codespan Tag
-hi def link math Statement
-hi def link emoji Statement
-hi def link span Statement
-hi def link codeblock Tag
-hi def link string String
-hi def link inlinelink Typedef
-hi def link footnoteref Statement
-hi def link linkurl Underlined
-hi def link djotautolinkurl Underlined
-hi def link comment Comment
-hi def link linklabel Underlined
-hi def link escaped Typedef
-hi def link attributes Identifier
-hi def link rawattribute Identifier
-hi def link delimiter Ignore
-hi def link escape Ignore
-hi def link openbrace Ignore
-hi def link closebrace Ignore
-hi def link blockquote Comment
-
-let b:current_syntax = "djot"
-
diff --git a/user/vim/syntax/jjdescription.vim b/user/vim/syntax/jjdescription.vim
deleted file mode 100644
index ddbdfd5..0000000
--- a/user/vim/syntax/jjdescription.vim
+++ /dev/null
@@ -1,31 +0,0 @@
-" workaround for https://github.com/vim/vim/commit/86dcb1878cdbd0a8af61664b14f034398e319026
-" FUTURE: delete this file when updating to vim >=v9.2.0341
-" Vim syntax file
-" Language: jj description
-" Maintainer: Gregory Anders <greg@gpanders.com>
-" Last Change: 2024 May 8
-" 2025 Apr 17 by Vim Project (don't require space to start comments, #17130)
-" 2026 Apr 09 by Vim Project (anchor status regex to beginning of line, #19879)
-" 2026 Apr 09 by Vim Project (detect renames of files, #19879)
-
-if exists('b:current_syntax')
- finish
-endif
-
-syn match jjAdded "^JJ:\s\+\zsA\s.*" contained
-syn match jjRemoved "^JJ:\s\+\zsD\s.*" contained
-syn match jjChanged "^JJ:\s\+\zsM\s.*" contained
-syn match jjRenamed "^JJ:\s\+\zsR\s.*" contained
-
-syn region jjComment start="^JJ:" end="$" contains=jjAdded,jjRemoved,jjChanged,jjRenamed
-
-syn include @jjCommitDiff syntax/diff.vim
-syn region jjCommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|@@\@!\|[^[:alnum:]\ +-]\S\@!\)\@=/ fold contains=@jjCommitDiff
-
-hi def link jjComment Comment
-hi def link jjAdded Added
-hi def link jjRemoved Removed
-hi def link jjChanged Changed
-hi def link jjRenamed Changed
-
-let b:current_syntax = 'jjdescription'
diff --git a/user/vim/vimrc b/user/vim/vimrc
deleted file mode 100644
index fce7814..0000000
--- a/user/vim/vimrc
+++ /dev/null
@@ -1,26 +0,0 @@
-syntax on
-
-" Don't break words in the middle.
-set linebreak
-
-" Enable easy copying between different vim instances.
-set clipboard=unnamed
-
-" Wayland clipboard workaround (see https://github.com/vim/vim/issues/5157).
-if !empty($WAYLAND_DISPLAY) && executable('wl-copy') && executable('wl-paste')
- " enable focus reporting
- let &t_fe = "\<Esc>[?1004h"
- let &t_fd = "\<Esc>[?1004l"
-
- augroup wl-clipboard
- autocmd!
- autocmd FocusLost * if @" != '' | call system('wl-copy --trim-newline', @") | endif
- autocmd FocusGained * let @" = system('wl-paste -n')
- augroup END
-endif
-
-" Enable pasting with middle mouse click in insert mode.
-set mouse=
-
-" Shortcut for Hugo TOML frontmatter
-autocmd FileType markdown nnoremap <buffer> <C-f> i+++<CR>title = ""<CR>+++<CR><ESC>kk$i