editors: remove nvf and emcas

This commit is contained in:
Charlie Root 2024-10-25 14:03:25 +02:00
commit c315064e26
Signed by: faukah
SSH key fingerprint: SHA256:jpYIt4Vkz1NBTQcks/N9OPTfTFxE6KF2W/rV7hrfrIw
66 changed files with 0 additions and 1644 deletions

View file

@ -1,102 +0,0 @@
{
config,
lib,
pkgs,
inputs,
...
}: let
cfg = config.modules.system.programs.editors.emacs;
inherit (config.modules.other.system) username;
inherit (lib) mkIf;
# Taken from outfoxxed since figuring this out is really annoying.
newpkgs =
pkgs.appendOverlays
(with inputs.emacs-overlay.overlays; [
emacs
package
(_: prev: {
tree-sitter = prev.tree-sitter.override {
extraGrammars = {
tree-sitter-qmljs = {
version = "master";
src = pkgs.fetchFromGitHub {
owner = "yuja";
repo = "tree-sitter-qmljs";
rev = "35ead5b9955cdb29bcf709d622fa960ff33992b6";
sha256 = "jT47lEGuk6YUjcHB0ZMyL3i5PqyUaCQmt0j78cUpy8Q=";
};
};
};
};
})
]);
tree-sitter-parsers = grammars:
with grammars; [
tree-sitter-qmljs
];
emaks = with newpkgs;
(emacsPackagesFor (emacs-pgtk.override {withNativeCompilation = true;}))
.emacsWithPackages (epkgs:
with epkgs; let
qml-ts-mode = trivialBuild {
pname = "qml-ts-mode";
version = "master";
src = fetchFromGitHub {
owner = "outfoxxed";
repo = "qml-ts-mode";
rev = "b24b9e78305ed045baa136782623ad16de01b7b8";
sha256 = "PgXm/a92cX5zjA9blTrIRH7DfOUczRwb9oBcMMEzF2I=";
};
};
in [
vterm
treesit-grammars.with-all-grammars
(treesit-grammars.with-grammars (grammars: tree-sitter-parsers grammars))
qml-ts-mode
]);
in {
config = mkIf cfg.enable {
home-manager.users.${username} = {
home.packages = with pkgs; [
emaks
nil
clang-tools
# emacs30-pgtk
binutils
## Doom dependencies
git
ripgrep
gnutls # for TLS connectivity
## Optional dependencies
fd # faster projectile indexing
imagemagick # for image-dired
## Module dependencies
# :email mu4e
mu
isync
# :checkers spell
(aspellWithDicts (ds: with ds; [en en-computers en-science]))
# :tools editorconfig
editorconfig-core-c # per-project style config
# :tools lookup & :lang org +roam
sqlite
# :lang latex & :lang org (latex previews)
# texlive.combined.scheme-medium
# :lang nix
age
];
services.emacs = {
enable = true;
package = emaks;
};
};
};
}

View file

@ -1,7 +0,0 @@
_: {
imports = [
./emacs/module.nix
./helix/module.nix
./nvf
];
}

View file

@ -1,30 +0,0 @@
{
lib,
inputs,
...
}: let
inherit (builtins) filter map toString elem;
inherit (lib.filesystem) listFilesRecursive;
inherit (lib.strings) hasSuffix;
inherit (lib.lists) concatLists;
mkNeovimModule = {
path,
ignoredPaths ? [],
}:
filter (hasSuffix ".nix") (
map toString (
filter (path: path != ./default.nix && !elem path ignoredPaths) (listFilesRecursive path)
)
);
nvf = inputs.neovim-flake;
in {
imports = concatLists [
# neovim-flake home-manager module
[nvf.nixosModules.default]
# construct this entire directory as a module
# which means all default.nix files will be imported automtically
(mkNeovimModule {path = ./.;})
];
}

View file

@ -1,134 +0,0 @@
-- luacheck: ignore
-- alias for vim.api.nvim_create_autocmd
local create_autocmd = vim.api.nvim_create_autocmd
-- alias for vim.api.nvim_create_augroup
local create_augroup = vim.api.nvim_create_augroup
create_autocmd('BufWritePre', {
pattern = { '/tmp/*', 'COMMIT_EDITMSG', 'MERGE_MSG', '*.tmp', '*.bak' },
callback = function()
vim.opt_local.undofile = false
end,
})
-- Remove whitespaces on save
-- this is normally handled by the formatter
-- but this should help when the formatter
-- is not working or has timed out
-- create_autocmd('BufWritePre', {
-- pattern = '',
-- command = ':%s/\\s\\+$//e',
-- })
-- Disable line wrapping & spell checking
-- for the terminal buffer
create_autocmd({ 'FileType' }, {
pattern = { 'toggleterm' },
callback = function()
vim.opt_local.wrap = false
vim.opt_local.spell = false
end,
})
-- Enable spell checking & line wrapping
-- for git commit messages
create_autocmd({ 'FileType' }, {
pattern = { 'gitcommit' },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})
-- Highlight yank after yanking
local highlight_group = create_augroup('YankHighlight', { clear = true })
create_autocmd({ 'TextYankPost' }, {
pattern = { '*' },
group = highlight_group,
callback = function()
vim.highlight.on_yank({ higroup = 'Visual', timeout = 200 })
end,
})
-- Close terminal window if process exists with code 0
create_autocmd('TermClose', {
callback = function()
if not vim.b.no_auto_quit then
vim.defer_fn(function()
if vim.api.nvim_get_current_line() == '[Process exited 0]' then
vim.api.nvim_buf_delete(0, { force = true })
end
end, 50)
end
end,
})
-- Start insert mode automatically
-- when editing a Git commit message
create_augroup('AutoInsert', { clear = true })
create_autocmd('FileType', {
group = 'AutoInsert',
pattern = 'gitcommit',
command = 'startinsert',
})
-- Disable cursorline in insert mode
create_augroup('CursorLine', { clear = true })
create_autocmd({ 'InsertLeave', 'WinEnter' }, {
group = 'CursorLine',
callback = function()
vim.wo.cursorline = true
end,
})
create_autocmd({ 'InsertEnter', 'WinLeave' }, {
group = 'CursorLine',
callback = function()
vim.wo.cursorline = false
end,
})
-- Create the necessary directory structure for the file being saved.
create_augroup('AutoMkdir', { clear = true })
create_autocmd('BufWritePre', {
group = 'AutoMkdir',
callback = function(event)
local file = vim.loop.fs_realpath(event.match) or event.match
vim.fn.mkdir(vim.fn.fnamemodify(file, ':p:h'), 'p')
end,
})
-- Adjust the window size when the terminal is resized
create_autocmd('VimResized', {
command = 'wincmd =',
})
-- Allow closing certain windows with "q"
-- and remove them from the buffer list
create_augroup('close_with_q', { clear = true })
create_autocmd('FileType', {
group = 'close_with_q',
pattern = {
'help',
'lspinfo',
'TelescopePrompt',
},
callback = function(event)
vim.bo[event.buf].buflisted = false
vim.keymap.set('n', 'q', '<cmd>close<cr>', { buffer = event.buf, silent = true })
end,
})
-- Mark internally when nvim is focused
-- and when it is not
create_autocmd('FocusGained', {
callback = function()
vim.g.nvim_focused = true
end,
})
create_autocmd('FocusLost', {
callback = function()
vim.g.nvim_focused = false
end,
})

View file

@ -1,38 +0,0 @@
local opt = vim.opt
local options = {
showmode = false, -- disable the -- STATUS -- line
showtabline = 0, -- never show the tabline
startofline = true, -- motions like "G" also move to the first char
virtualedit = 'block', -- visual-block mode can select beyond end of line
showmatch = true, -- when closing a bracket, briefly flash the matching one
matchtime = 1, -- duration of that flashing n deci-seconds
signcolumn = 'yes:1', -- static width
report = 9001, -- disable "x more/fewer lines" messages
diffopt = opt.diffopt:append('vertical'), -- diff mode: vertical splits
backspace = { 'indent', 'eol', 'start' }, -- backspace through everything in insert mode
hidden = true, -- Enable background buffers
history = 100, -- Remember N lines in history
lazyredraw = false, -- Faster scrolling if enabled, breaks noice
synmaxcol = 240, -- Max column for syntax highlight
updatetime = 250, -- ms to wait for trigger an event
-- If 0, move cursor line will not scroll window.
-- If 999, cursor line will always be in middle of window.
scrolloff = 0,
}
-- iterate over the options table and set the options
-- for each key = value pair
for key, value in pairs(options) do
opt[key] = value
end
-- Don't auto-comment new lines automatically
-- that happens when you press enter at the end
-- of a comment line, and comments the next line
-- That's annoying and we don't want it!
-- don't continue comments automagically
-- https://neovim.io/doc/user/options.html#'formatoptions'
opt.formatoptions:remove('c')
opt.formatoptions:remove('r')
opt.formatoptions:remove('o')

View file

@ -1,17 +0,0 @@
-- disable the "how to disable mouse" message
-- in right click popups
vim.cmd.aunmenu([[PopUp.How-to\ disable\ mouse]])
vim.cmd.aunmenu([[PopUp.-1-]])
vim.cmd.amenu([[PopUp.Inspect <Cmd>Inspect<CR>]])
vim.cmd.amenu([[PopUp.Telescope <Cmd>Telescope<CR>]])
vim.cmd.amenu([[PopUp.Code\ action <Cmd>lua vim.lsp.buf.code_action()<CR>]])
vim.cmd.amenu([[PopUp.LSP\ Hover <Cmd>lua vim.lsp.buf.hover()<CR>]])
-- Add a blinking cursor in certain modes.
vim.opt.guicursor = {
'n-c-v:block-Cursor',
'i-ci-ve-r-o:blinkwait250-blinkon250-blinkoff250-Cursor',
'i-ci-ve:ver25-Cursor',
'r-cr-o:hor20-Cursor',
}

View file

@ -1,21 +0,0 @@
-- taken from https://github.com/sitiom/nvim-numbertoggle
vim.api.nvim_create_autocmd({ 'BufEnter', 'FocusGained', 'InsertLeave', 'CmdlineLeave', 'WinEnter' }, {
pattern = '*',
group = vim.api.nvim_create_augroup('NumberToggle', {}),
callback = function()
if vim.o.nu and vim.api.nvim_get_mode().mode ~= 'i' then
vim.opt.relativenumber = true
end
end,
})
vim.api.nvim_create_autocmd({ 'BufLeave', 'FocusLost', 'InsertEnter', 'CmdlineEnter', 'WinLeave' }, {
pattern = '*',
group = vim.api.nvim_create_augroup('NumberToggle', {}),
callback = function()
if vim.o.nu then
vim.opt.relativenumber = false
vim.cmd('redraw')
end
end,
})

View file

@ -1,3 +0,0 @@
-- More natural pane splitting
vim.o.splitbelow = true
vim.o.splitright = true

View file

@ -1,93 +0,0 @@
local opt = vim.opt
-- luacheck: ignore
-- When true, all the windows are automatically made the same size after splitting or closing a window.
-- When false, splitting a window will reduce the size of the current window and leave the other windows the same.
opt.equalalways = false
opt.cmdheight = 1 -- Better display for messages
opt.colorcolumn = '+0' -- Align text at 'textwidth'
opt.showtabline = 2 -- Always show the tabs line
opt.helpheight = 0 -- Disable help window resizing
opt.winwidth = 30 -- Minimum width for active window
opt.winminwidth = 1 -- Minimum width for inactive windows
opt.winheight = 1 -- Minimum height for active window
opt.winminheight = 1 -- Minimum height for inactive window
opt.pumheight = 10 -- Maximum number of items to show in the popup menu
opt.winminwidth = 1 -- min width of inactive window
-- opt.pumblend = 100 -- Popup blend, 100 means transparent
opt.cursorline = true
opt.whichwrap:append('<,>,h,l,[,]')
opt.list = true
-- characters to fill the statuslines, vertical separators and special
-- lines in the window.opt.whichwrap:append('<,>,h,l,[,]')
opt.fillchars:append({
-- replace window border with slightly thicker characters
-- although taking a bit of more space, it helps me better
-- identify the window borders
horiz = '',
horizup = '',
horizdown = '',
vert = '',
vertleft = '',
vertright = '',
verthoriz = '',
eob = ' ', -- suppress end of buffer lines (~)
diff = '', -- deleted lines of the 'diff' option
msgsep = '',
-- replace fold chars
fold = ' ',
foldopen = '',
foldclose = '',
})
-- List chars that would b shown on all modes
-- better kept simple, because it gets REALLY
-- noisy in an average buffer
local normal_listchars = {
extends = '', -- Alternatives: … ,»
precedes = '', -- Alternatives: … ,«
}
opt.listchars = normal_listchars
-- Show listchars while in Insert mode.
local insert_listchars = {
eol = nil,
tab = '▎·',
lead = '·',
space = '·',
trail = '.',
multispace = '',
nbsp = '¤',
}
-- Show listchars while in Insert mode.
vim.api.nvim_create_augroup('InsertModeListChars', { clear = true })
vim.api.nvim_create_autocmd({ 'InsertEnter', 'InsertLeavePre' }, {
group = 'InsertModeListChars',
pattern = '*',
callback = function(args)
if vim.tbl_contains({ 'quickfix', 'prompt' }, args.match) then
return
end
if args.event == 'InsertEnter' then
vim.opt_local.listchars = insert_listchars
else
vim.opt_local.listchars = normal_listchars
end
-- check if ibl is enabled
-- @diagnostic disable-next-line: no-unknown, unused-local
local status_ok, ibl = pcall(require, 'ibl')
if not status_ok then
return
end
require('ibl').debounced_refresh(0)
end,
})

View file

@ -1,18 +0,0 @@
-- luacheck: ignore
vim.g.markdown_fenced_languages = { 'shell=bash' }
local file_syntax_map = {
{ pattern = '*.rasi', syntax = 'scss' },
{ pattern = 'flake.lock', syntax = 'json' },
{ pattern = '*.ignore', syntax = 'gitignore' }, -- also ignore for fd/ripgrep
{ pattern = '*.ojs', syntax = 'javascript' },
{ pattern = '*.astro', syntax = 'astro' },
{ pattern = '*.mdx', syntax = 'mdx' }
}
for _, elem in ipairs(file_syntax_map) do
vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, {
pattern = elem.pattern,
command = 'set syntax=' .. elem.syntax,
})
end

View file

@ -1,22 +0,0 @@
local cmd = vim.cmd
-- luacheck: ignore
local abbreviations = {
Wq = 'wq', -- keep making those typos
WQ = 'wq',
Wqa = 'wqa',
W = 'w',
Q = 'q',
Qa = 'qa',
Bd = 'bd',
E = 'e',
q1 = 'q!', -- this is for when I don't want to reach to shift
qa1 = 'qa!',
mk = 'mark', -- make marks faster
st = 'sort', -- sort
}
-- add more abbreviations
for left, right in pairs(abbreviations) do
cmd.cnoreabbrev(('%s %s'):format(left, right))
end

View file

@ -1,13 +0,0 @@
-- If the cursor has been idle for some time, check if the current buffer
-- has been modified externally. prompt the user to reload it if has.
local bufnr = vim.api.nvim_get_current_buf()
-- luacheck: ignore
vim.opt_local.autoread = true
vim.api.nvim_create_autocmd('CursorHold', {
group = vim.api.nvim_create_augroup('Autoread', { clear = true }),
buffer = bufnr,
callback = function()
vim.cmd('silent! checktime')
end,
})

View file

@ -1,68 +0,0 @@
-- luacheck: ignore
vim.opt.spelllang:append('cjk') -- disable spellchecking for asian characters (VIM algorithm does not support it)
vim.opt.shortmess = {
t = true, -- truncate file messages at start
A = true, -- ignore annoying swap file messages
o = true, -- file-read message overwrites previous
O = true, -- file-read message overwrites previous
T = true, -- truncate non-file messages in middle
f = true, -- (file x of x) instead of just (x of x
F = true, -- Don't give file info when editing a file, NOTE: this breaks autocommand messages
s = true,
c = true,
W = true, -- Don't show [w] or written when writing
}
-- Disable nvim intro
vim.opt.shortmess:append('sI')
-- Some of those are already disasbled in the Neovim wrapper
-- as configured by nvf. I'm just making sure they are disabled
-- here as well.
local disable_distribution_plugins = function()
local disabled_built_ins = {
'2html_plugin',
'getscript',
'getscriptPlugin',
'gzip',
'logipat',
'matchit',
'matchparen',
'tar',
'tarPlugin',
'rrhelper',
'spellfile_plugin',
'vimball',
'vimballPlugin',
'zip',
'zipPlugin',
'tutor',
'rplugin',
'synmenu',
'optwin',
'compiler',
'bugreport',
'ftplugin',
'netrw',
'netrwPlugin',
'netrwSettings',
'netrwFileHandlers',
-- "skip_ts_context_commentstring_module"
}
for _, plugin in pairs(disabled_built_ins) do
g['loaded_' .. plugin] = 1
end
end
-- https://github.com/neovim/neovim/issues/14090#issuecomment-1177933661
-- vim.g.do_filetype_lua = 1
-- vim.g.did_load_filetypes = 0
-- Neovim should not be able to load from those paths since
-- we ultimately want to be able to *only* want the nvf config
-- to be the effective one
vim.opt.runtimepath:remove('/etc/xdg/nvim')
vim.opt.runtimepath:remove('/etc/xdg/nvim/after')
vim.opt.runtimepath:remove('/usr/share/vim/vimfiles')

View file

@ -1,22 +0,0 @@
-- Diagnostic settings:
-- see: `:help vim.diagnostic.config`
vim.diagnostic.config({
update_in_insert = true,
virtual_text = false,
signs = true,
underline = true,
severity_sort = true,
virtual_lines = {
only_current_line = true,
spacing = 2,
},
float = {
focusable = false,
style = 'minimal',
border = 'rounded',
source = 'always',
header = '',
prefix = '',
},
})

View file

@ -1,34 +0,0 @@
-- luacheck: ignore
local float_options = {
border = 'single',
max_width = math.ceil(vim.api.nvim_win_get_width(0) * 0.6),
max_height = math.ceil(vim.api.nvim_win_get_height(0) * 0.8),
}
vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = true,
signs = false,
underline = true,
update_in_insert = false,
severity_sort = true,
})
vim.lsp.handlers['textDocument/show_line_diagnostics'] = vim.lsp.with(vim.lsp.handlers.hover, float_options)
-- Prevent show notification
-- <https://github.com/neovim/neovim/issues/20457#issuecomment-1266782345>
vim.lsp.handlers['textDocument/hover'] = function(_, result, ctx, config)
config = config or float_options
config.focus_id = ctx.method
if not result then
return
end
local markdown_lines = vim.lsp.util.convert_input_to_markdown_lines(result.contents)
markdown_lines = vim.lsp.util.trim_empty_lines(markdown_lines)
if vim.tbl_isempty(markdown_lines) then
return
end
return vim.lsp.util.open_floating_preview(markdown_lines, 'markdown', config)
end
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, float_options)

View file

@ -1,30 +0,0 @@
if vim.g.neovide then
local vks = vim.keymap.set
vim.g.neovide_scale_factor = 1.0
vim.g.minianimate_disable = true
vim.g.neovide_window_blurred = true
vim.g.neovide_transparency = 0.80
vim.g.neovide_show_border = true
vim.g.neovide_input_macos_alt_is_meta = true
vim.g.neovide_cursor_animate_command_line = false -- noice incompat
vim.g.neovide_cursor_smooth_blink = true
vim.g.neovide_cursor_vfx_mode = 'ripple'
-- keymaps
vks('v', '<D-c>', '"+y') -- Copy
vks({ 'n', 'v' }, '<D-v>', '"+P') -- Paste
vks({ 'i', 'c' }, '<D-v>', '<C-R>+') -- Paste
vks('t', '<D-v>', [[<C-\><C-N>"+P]]) -- Paste
vks('n', '<D-+>', function()
vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * 1.1
end)
vks('n', '<D-->', function()
vim.g.neovide_scale_factor = vim.g.neovide_scale_factor / 1.1
end)
vks({ 'n', 'v', 't', 'i' }, '<D-}>', [[<C-\><C-N><Cmd>tabnext<CR>]])
vks({ 'n', 'v', 't', 'i' }, '<D-{>', [[<C-\><C-N><Cmd>tabprev<CR>]])
vks({ 'n', 'v', 't', 'i' }, '<D-l>', [[<C-\><C-N><Cmd>tabnext #<CR>]])
vks({ 'n', 'v', 't', 'i' }, '<D-t>', [[<C-\><C-N><Cmd>tabnew<CR>]])
vks({ 'n', 'v', 't', 'i' }, '<D-w>', [[<C-\><C-N><Cmd>tabclose<CR>]])
end

View file

@ -1,70 +0,0 @@
local noice = require('noice')
local no_top_text = {
opts = {
border = {
text = { top = '' },
},
},
}
-- luacheck: ignore
noice.setup({
cmdline = {
format = {
cmdline = no_top_text,
filter = no_top_text,
lua = no_top_text,
search_down = no_top_text,
search_up = no_top_text,
},
},
lsp = {
override = {
['cmp.entry.get_documentation'] = true,
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
['vim.lsp.util.stylize_markdown'] = true,
},
progress = {
enabled = false,
},
},
popupmenu = {
backend = 'cmp',
},
routes = {
{
filter = {
event = 'msg_show',
kind = 'search_count',
},
opts = { skip = true },
},
{
-- skip progress messages from noisy servers
filter = {
event = 'lsp',
kind = 'progress',
cond = function(message)
local client = vim.tbl_get(message.opts, 'progress', 'client')
return client == 'ltex'
end,
},
opts = { skip = true },
},
},
views = {
cmdline_popup = {
border = {
style = 'single',
},
},
confirm = {
border = {
style = 'single',
text = { top = '' },
},
},
},
})

View file

@ -1,9 +0,0 @@
{
programs.neovim-flake.settings.vim.maps = {
insert = {
# vsnip
#"<C-jn>".action = "<Plug>(vsnip-jump-next)";
#"<C-jp>".action = "<Plug>(vsnip-jump-prev)";
};
};
}

View file

@ -1,57 +0,0 @@
{
programs.neovim-flake.settings.vim.maps = {
normal = {
# "<leader>gg".action = "<cmd>LazyGit<CR>";
# General
"<leader>fd".action = "<cmd>lua vim.g.formatsave = not vim.g.formatsave<CR>";
"<leader>zt".action = ":<C-U>let g:default_terminal = v:count1<CR>";
# "<leader>ld".action = ":lua vim.diagnostic.setqflist({open = true})<CR>";
# "<leader>lf".action = ":lua vim.lsp.buf.format()<CR>";
# "<leader>li".action = ":lua vim.lsp.buf.implementation()<CR>";
"<leader>;".action = "A;<esc>"; # Append #
# Diffview
"<leader>gdq".action = "<cmd>DiffviewClose<CR>";
"<leader>gdd".action = "<cmd>DiffviewOpen ";
"<leader>gdm".action = "<cmd>DiffviewOpen<CR>";
"<leader>gdh".action = "<cmd>DiffviewFileHistory %<CR>";
"<leader>gde".action = "<cmd>DiffviewToggleFiles<CR>";
# Git
"<leader>gu".action = "<cmd>Gitsigns undo_stage_hunk<CR>";
"<leader>g<C-w>".action = "<cmd>Gitsigns preview_hunk<CR>";
"<leader>gp".action = "<cmd>Gitsigns prev_hunk<CR>";
"<leader>gn".action = "<cmd>Gitsigns next_hunk<CR>";
"<leader>gP".action = "<cmd>Gitsigns preview_hunk_inline<CR>";
"<leader>gR".action = "<cmd>Gitsigns reset_buffer<CR>";
"<leader>gb".action = "<cmd>Gitsigns blame_line<CR>";
"<leader>gD".action = "<cmd>Gitsigns diffthis HEAD<CR>";
"<leader>gw".action = "<cmd>Gitsigns toggle_word_diff<CR>";
# Movement
"<C-h>".action = "<C-W>h";
"<C-j>".action = "<C-W>j";
"<C-k>".action = "<C-W>k";
"<C-l>".action = "<C-W>l";
# Telescope
"<M-f>".action = "<cmd>Telescope resume<CR>";
"<leader>fq".action = "<cmd>Telescope quickfix<CR>";
"<leader>f/".action = "<cmd>Telescope live_grep<cr>";
};
normalVisualOp = {
"<leader>gs".action = "<cmd>Gitsigns stage_hunk<CR>";
"<leader>gr".action = "<cmd>Gitsigns reset_hunk<CR>";
"<leader>lr".action = "<cmd>lua vim.lsp.buf.references()<CR>";
# ssr.nvim
"<leader>sr".action = ":lua require('ssr').open()<CR>";
# Toggleterm
"<leader>ct" = {
# action = ":<C-U>ToggleTermSendVisualLines v:count<CR>";
action = "':ToggleTermSendVisualLines ' . v:count == 0 ? g:default_terminal : v:count";
expr = true;
};
};
};
}

View file

@ -1,9 +0,0 @@
{
programs.neovim-flake.settings.vim.maps = {
select = {
# vsnip
#"<C-jn>".action = "<Plug>(vsnip-jump-next)";
#"<C-jp>".action = "<Plug>(vsnip-jump-prev)";
};
};
}

View file

@ -1,7 +0,0 @@
{
programs.neovim-flake.settings.vim.maps = {
terminal = {
"<M-x>".action = "<cmd>q<CR>";
};
};
}

View file

@ -1,175 +0,0 @@
{pkgs, ...}: let
inherit (pkgs.vimPlugins) friendly-snippets aerial-nvim nvim-surround undotree mkdir-nvim harpoon ssr-nvim direnv-vim legendary-nvim lazygit-nvim;
inherit (pkgs) fetchFromGitHub;
inherit (pkgs.vimUtils) buildVimPlugin;
pluginSources = {
smart-splits = buildVimPlugin {
name = "smart-splits";
src = fetchFromGitHub {
owner = "mrjones2014";
repo = "smart-splits.nvim";
rev = "95833675cd92538bf9cded1d2d58d1fc271c5428";
hash = "sha256-TsEzHalLTLp9USV0aGRadAObViC/OpIJeuEJ95lJUL8=";
};
};
regexplainer = buildVimPlugin {
name = "nvim-regexplainer";
src = fetchFromGitHub {
owner = "bennypowers";
repo = "nvim-regexplainer";
rev = "4250c8f3c1307876384e70eeedde5149249e154f";
hash = "sha256-15DLbKtOgUPq4DcF71jFYu31faDn52k3P1x47GL3+b0=";
};
};
specs-nvim = buildVimPlugin {
name = "specs.nvim";
src = fetchFromGitHub {
owner = "notashelf";
repo = "specs.nvim";
rev = "0792aaebf8cbac0c8545c43ad648b98deb83af42";
hash = "sha256-doHE/3bRuC8lyYxMk927JmwLfiy7aR22+i+BNefEGJ4=";
};
};
deferred-clipboard = buildVimPlugin {
name = "deferred-clipboard";
src = fetchFromGitHub {
owner = "EtiamNullam";
repo = "deferred-clipboard.nvim";
rev = "810a29d166eaa41afc220cc7cd85eeaa3c43b37f";
hash = "sha256-nanNQEtpjv0YKEkkrPmq/5FPxq+Yj/19cs0Gf7YgKjU=";
};
};
vim-nftables = buildVimPlugin {
name = "vim-nftables";
src = fetchFromGitHub {
owner = "awisse";
repo = "vim-nftables";
rev = "bc29309080b4c7e1888ffb1a830846be16e5b8e7";
hash = "sha256-L1x3Hv95t/DBBrLtPBKrqaTbIPor/NhVuEHVIYo/OaA=";
};
};
neotab-nvim = buildVimPlugin {
name = "neotab.nvim";
src = fetchFromGitHub {
owner = "kawre";
repo = "neotab.nvim";
rev = "6c6107dddaa051504e433608f59eca606138269b";
hash = "sha256-bSFKbjj8fJHdfBzYoQ9l3NU0GAYfdfCbESKbwdbLNSw=";
};
};
};
in {
programs.neovim-flake.settings.vim.extraPlugins = {
# plugins that are pulled from nixpkgs
harpoon = {
package = harpoon;
setup = "require('harpoon').setup {}";
};
direnv = {package = direnv-vim;};
friendly-snippets = {package = friendly-snippets;};
mkdir-nvim = {package = mkdir-nvim;};
lazygit-nvim = {package = lazygit-nvim;};
aerial = {
package = aerial-nvim;
setup = "require('aerial').setup {}";
};
nvim-surround = {
package = nvim-surround;
setup = "require('nvim-surround').setup {}";
};
undotree = {
package = undotree;
setup = ''
vim.g.undotree_ShortIndicators = true
vim.g.undotree_TreeVertShape = ''
'';
};
ssr-nvim = {
package = ssr-nvim;
setup = "require('ssr').setup {}";
};
legendary = {
package = legendary-nvim;
setup = ''
require('legendary').setup {};
'';
};
# plugins that are built from their sources
# regexplainer = {package = pluginSources.regexplainer;};
smart-splits = {
package = pluginSources.smart-splits;
setup = "require('smart-splits').setup {}";
};
neotab-nvim = {
package = pluginSources.neotab-nvim;
setup = ''
require('neotab').setup {
tabkey = "<Tab>",
act_as_tab = true,
behavior = "nested", ---@type ntab.behavior
pairs = { ---@type ntab.pair[]
{ open = "(", close = ")" },
{ open = "[", close = "]" },
{ open = "{", close = "}" },
{ open = "'", close = "'" },
{ open = '"', close = '"' },
{ open = "`", close = "`" },
{ open = "<", close = ">" },
},
exclude = {},
smart_punctuators = {
enabled = false,
semicolon = {
enabled = false,
ft = { "cs", "c", "cpp", "java" },
},
escape = {
enabled = false,
triggers = {}, ---@type table<string, ntab.trigger>
},
},
}
'';
};
specs-nvim = {
package = pluginSources.specs-nvim;
setup = ''
require('specs').setup {
show_jumps = true,
popup = {
delay_ms = 0,
inc_ms = 15,
blend = 15,
width = 10,
winhl = "PMenu",
fader = require('specs').linear_fader,
resizer = require('specs').shrink_resizer
},
ignore_filetypes = {'NvimTree', 'undotree'},
ignore_buftypes = {nofile = true},
}
-- toggle specs using the <C-b> keybind
vim.api.nvim_set_keymap('n', '<C-b>', ':lua require("specs").show_specs()', { noremap = true, silent = true })
-- bind specs to navigation keys
vim.api.nvim_set_keymap('n', 'n', 'n:lua require("specs").show_specs()<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', 'N', 'N:lua require("specs").show_specs()<CR>', { noremap = true, silent = true })
'';
};
};
}

View file

@ -1,14 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
autocomplete = {
enable = true;
type = "nvim-cmp";
mappings = {
next = "<C-n>";
previous = "<C-p>";
scrollDocsDown = "<C-j>";
scrollDocsUp = "<C-k>";
};
};
};
}

View file

@ -1,5 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
autopairs.enable = true;
};
}

View file

@ -1,8 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
binds = {
whichKey.enable = false;
cheatsheet.enable = true;
};
};
}

View file

@ -1,5 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
comments.comment-nvim.enable = true;
};
}

View file

@ -1,7 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
dashboard = {
alpha.enable = true;
};
};
}

View file

@ -1,8 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
debugger.nvim-dap = {
enable = true;
ui.enable = true;
};
};
}

View file

@ -1,63 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
filetree = {
nvimTree = {
enable = true;
openOnSetup = true;
mappings = {
toggle = "<leader>e";
};
setupOpts = {
disable_netrw = true;
update_focused_file.enable = true;
hijack_unnamed_buffer_when_opening = true;
hijack_cursor = true;
hijack_directories = {
enable = true;
auto_open = true;
};
git = {
enable = true;
show_on_dirs = false;
timeout = 500;
};
view = {
cursorline = false;
width = 35;
};
renderer = {
indent_markers.enable = true;
root_folder_label = false; # inconsistent
icons = {
modified_placement = "after";
git_placement = "after";
show.git = true;
show.modified = true;
};
};
diagnostics.enable = true;
modified = {
enable = true;
show_on_dirs = false;
show_on_open_dirs = true;
};
actions = {
change_dir.enable = false;
change_dir.global = false;
open_file.window_picker.enable = true;
};
};
};
};
};
}

View file

@ -1,12 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
git = {
enable = true;
vim-fugitive.enable = true;
gitsigns = {
enable = true;
# codeActions.enable = true;
};
};
};
}

View file

@ -1,47 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
languages = {
enableLSP = true;
enableFormat = true;
enableTreesitter = true;
enableExtraDiagnostics = true;
markdown.enable = true;
html.enable = true;
java.enable = true;
css.enable = true;
# tailwind.enable = false;
# ts.enable = true;
# go.enable = true;
# python.enable = true;
bash.enable = true;
typst.enable = true;
zig.enable = true;
# dart.enable = false;
# elixir.enable = false;
# svelte.enable = false;
# sql.enable = false;
lua = {
enable = true;
lsp.neodev.enable = true;
};
nix = {
enable = true;
lsp.enable = true;
};
rust = {
enable = true;
crates.enable = true;
};
clang = {
enable = true;
lsp = {
enable = true;
server = "clangd";
};
};
};
};
}

View file

@ -1,15 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
lsp = {
formatOnSave = true;
lspkind.enable = true;
lsplines.enable = true;
lightbulb.enable = false;
lspsaga.enable = false;
lspSignature.enable = true;
# nvimCodeActionMenu.enable = true;
# trouble.enable = false;
# nvim-docs-view.enable = true;
};
};
}

View file

@ -1,7 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
notes = {
todo-comments.enable = true;
};
};
}

View file

@ -1,7 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
notify = {
nvim-notify.enable = true;
};
};
}

View file

@ -1,22 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
projects = {
project-nvim = {
enable = true;
setupOpts = {
manualMode = false;
detectionMethods = ["lsp" "pattern"];
patterns = [
".git"
".hg"
"Makefile"
"package.json"
"index.*"
".anchor"
"flake.nix"
];
};
};
};
};
}

View file

@ -1,10 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
statusline = {
lualine = {
enable = true;
theme = "catppuccin";
};
};
};
}

View file

@ -1,13 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
tabline = {
nvimBufferline = {
enable = true;
setupOpts = {
style_preset = "minimal";
themable = true;
};
};
};
};
}

View file

@ -1,5 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
telescope.enable = true;
};
}

View file

@ -1,4 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
};
}

View file

@ -1,17 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
terminal = {
toggleterm = {
enable = true;
mappings.open = "<C-t>";
lazygit = {
enable = true;
direction = "tab";
};
setupOpts = {
direction = "tab";
};
};
};
};
}

View file

@ -1,10 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
theme = {
enable = true;
name = "catppuccin";
style = "mocha";
transparent = true;
};
};
}

View file

@ -1,14 +0,0 @@
{pkgs, ...}: {
programs.neovim-flake.settings.vim = {
treesitter = {
fold = true;
context.enable = false; # FIXME: currently broken, I do not know why.
# extra grammars that will be installed by Nix
grammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
regex # for regexplainer
kdl # zellij configurations are in KDL, I want syntax highlighting
];
};
};
}

View file

@ -1,34 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
ui = {
noice.enable = true;
colorizer.enable = true;
modes-nvim.enable = false;
illuminate.enable = true;
breadcrumbs = {
enable = false;
source = "nvim-navic";
navbuddy.enable = false;
};
smartcolumn = {
enable = false;
setupOpts = {
columnAt.languages = {
markdown = [80];
nix = [120];
ruby = 110;
java = 120;
go = [130];
};
};
};
borders = {
enable = true;
globalStyle = "rounded";
};
};
};
}

View file

@ -1,24 +0,0 @@
{pkgs, ...}: {
programs.neovim-flake.settings.vim = {
utility = {
ccc.enable = true;
icon-picker.enable = true;
diffview-nvim.enable = true;
#
vim-wakatime = {
enable = true;
cli-package = pkgs.wakatime-cli;
};
motion = {
hop.enable = false;
leap.enable = false;
};
preview = {
glow.enable = true;
markdownPreview.enable = true;
};
};
};
}

View file

@ -1,20 +0,0 @@
_: {
programs.neovim-flake.settings.vim = {
visuals = {
enable = true;
nvimWebDevicons.enable = true;
indentBlankline.enable = false;
fidget-nvim = {
enable = false;
setupOpts = {
notification.window = {
winblend = 0;
border = "none";
};
};
};
};
};
}

View file

@ -1,8 +0,0 @@
-- luacheck: ignore
vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, {
pattern = 'gitconfig*,.gitconfig*',
callback = function()
vim.bo.filetype = 'gitconfig'
end,
once = false,
})

View file

@ -1,8 +0,0 @@
-- luacheck: ignore
vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, {
pattern = '*.graphql,*.graphqls,*.gql',
callback = function()
vim.bo.filetype = 'graphql'
end,
once = false,
})

View file

@ -1,4 +0,0 @@
-- luacheck: ignore
vim.filetype.add({
filename = { ['.envrc'] = 'bash' },
})

View file

@ -1,2 +0,0 @@
-- luacheck: ignore
vim.opt_local.textwidth = 80

View file

@ -1,5 +0,0 @@
-- luacheck: ignore
vim.opt_local.tabstop = 4
vim.opt_local.shiftwidth = 0
vim.opt_local.expandtab = false
vim.opt_local.list = false

View file

@ -1,14 +0,0 @@
vim.keymap.set('n', '<leader>jf', '<cmd>%!jq<cr>', { noremap = true, silent = true, desc = 'Format with jq' })
vim.keymap.set('n', '<leader>jm', '<cmd>%!jq -c<cr>', { noremap = true, silent = true, desc = 'Minify with jq' })
-- add comma to the end of the line on new line
vim.keymap.set('n', 'o', function()
local line = vim.api.nvim_get_current_line()
local should_add_comma = string.find(line, '[^,{[]$')
if should_add_comma then
return 'A,<cr>'
else
return 'o'
end
end, { buffer = true, expr = true })

View file

@ -1,13 +0,0 @@
-- luacheck: ignore
local opts = { noremap = true, silent = true, buffer = 0 }
local wincmd = vim.b.pager and 'q' or 'c'
vim.keymap.set('n', 'q', '<cmd>lclose<CR><C-W>' .. wincmd, opts)
vim.keymap.set('n', '<Leader>o', function()
-- TODO: can this be done in a floating window?
require('man').show_toc()
end, opts)
vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '')
.. (vim.b.undo_ftplugin ~= nil and ' | ' or '')
.. 'sil! nunmap <buffer> <Leader>o'
.. ' | sil! nunmap <buffer> q'

View file

@ -1,30 +0,0 @@
-- luacheck: ignore
vim.opt_local.textwidth = 80
local CR = vim.api.nvim_replace_termcodes('<cr>', true, true, true)
local function toggle_checkbox()
local cursor = vim.api.nvim_win_get_cursor(0)
local lineno = cursor[1]
local line = vim.api.nvim_buf_get_lines(0, lineno - 1, lineno, false)[1] or ''
if string.find(line, '%[ %]') then
line = line:gsub('%[ %]', '%[x%]')
else
line = line:gsub('%[x%]', '%[ %]')
end
vim.api.nvim_buf_set_lines(0, lineno - 1, lineno, false, { line })
vim.api.nvim_win_set_cursor(0, cursor)
pcall(vim.fn['repeat#set'], ':ToggleCheckbox' .. CR)
end
vim.api.nvim_create_user_command(
'ToggleCheckbox',
toggle_checkbox,
vim.tbl_extend('force', { desc = 'toggle checkboxes' }, {})
)
vim.keymap.set('n', '<leader>op', toggle_checkbox, {
noremap = true,
silent = true,
desc = 'Toggle checkbox',
buffer = 0,
})

View file

@ -1,2 +0,0 @@
-- luacheck: ignore
vim.wo.wrap = true

View file

@ -1,2 +0,0 @@
-- luacheck: ignore
vim.opt_local.shiftwidth = 2

View file

@ -1,30 +0,0 @@
; extends
; inject sql into any const string with word query in the name
; e.g. const query = `SELECT * FROM users WHERE name = 'John'`;
(const_spec
name: (identifier) @_name (#match? @_name "[Qq]uery")
value: (expression_list
(raw_string_literal) @injection.content)
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "sql"))
; inject sql in single line strings
(call_expression
(selector_expression
field: (field_identifier) @_field (#any-of? @_field "GetContext" "Get" "ExecContext" "Exec" "SelectContext" "Select" "In" "Rebind"))
(argument_list
(raw_string_literal) @injection.content)
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "sql")
)
; inject sql in multi line strings
(call_expression
(selector_expression
field: (field_identifier) @_field (#any-of? @_field "GetContext" "Get" "ExecContext" "Exec" "SelectContext" "Select" "In" "Rebind"))
(argument_list
(interpreted_string_literal) @injection.content)
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "sql")
)

View file

@ -1,2 +0,0 @@
;; extends
(( jsx_text ) @injection.content (#set! injection.language "markdown") )

View file

@ -1,5 +0,0 @@
;extends
(fenced_code_block (code_fence_content) @class.inner) @class.outer
(paragraph) @function.outer @function.inner

View file

@ -1,12 +0,0 @@
;extends
[
(shortcut_link)
] @nospell
(strikethrough
(emphasis_delimiter)
(strikethrough
(emphasis_delimiter)
(emphasis_delimiter))
(emphasis_delimiter))@markup.doublestrikethrough

View file

@ -1,9 +0,0 @@
((jsx_section)
@injection.content
(#set! injection.language "tsx")
(#set! injection.include-children))
((markdown_section)
@injection.content
(#set! injection.language "markdown")
(#set! injection.combined))

View file

@ -1,14 +0,0 @@
;extends
(macro_invocation
(scoped_identifier
path: (identifier) @path (#eq? @path "sqlx")
name: (identifier) @name (#match? @name "^query.*")
)
(token_tree
(raw_string_literal) @injection.content
(#set! injection.language "sql")
(#set! injection.include-children)
)
(#offset! @injection.content 0 3 0 -2)
)

View file

@ -1,5 +0,0 @@
;; extends
((ident) @constant
(#eq? @constant "lambda")
(#set! conceal "λ")
)

View file

@ -1,42 +0,0 @@
contrib
Contrib
gitignore
dotfiles
nyx
notashelf
utils
neovim
glab
gh
ripgrep
wip
thoughtbot
kubectl
CoC
config
Capybara
mailserver
Mailserver
anyrun
ags
spicetify
Spicetify
firefox
Firefox
Hyprland
Hyprwm
Xorg
X11
devShell
devshell
nixos
NixOS
nixpkgs
Nixpkgs
filetree
sourcetree
url
uri

View file

@ -1,87 +0,0 @@
# NOTE: Credits go to raf aka Notashelf, who wrote not only nvf
# but also most of this configuration, the
# link to his repo is in the README.md
{
config,
lib,
pkgs,
inputs,
...
}: let
inherit (builtins) filter map toString;
inherit (lib.filesystem) listFilesRecursive;
inherit (lib.strings) hasSuffix fileContents;
inherit (lib.attrsets) genAttrs;
inherit (lib) mkIf;
cfg = config.modules.system.programs.editors.neovim;
nvf = inputs.neovim-flake;
inherit (nvf.lib.nvim.dag) entryBefore;
in {
config = mkIf cfg.enable {
programs.neovim-flake = {
enable = true;
defaultEditor = true;
enableManpages = true;
settings = {
vim = {
# use neovim-unwrapped from nixpkgs
# alternatively, neovim-nightly from the neovim-nightly overlay
# via inputs.neovim-nightly.packages.${pkgs.stdenv.system}.neovim
package = pkgs.neovim-unwrapped;
viAlias = false;
vimAlias = true;
withNodeJs = false;
withPython3 = false;
withRuby = false;
preventJunkFiles = true;
useSystemClipboard = true;
tabWidth = 4;
autoIndent = true;
spellcheck = {
enable = true;
languages = ["en" "de"];
};
enableLuaLoader = true;
enableEditorconfig = true;
debugMode = {
enable = false;
logFile = "/tmp/nvim.log";
};
additionalRuntimePaths = [
./runtime
./runtime
];
# additional lua configuration that I can append
# or, to be more precise, randomly inject into
# the lua configuration of nvf.
# This is recursively read from the lua
# directory, so we do not need to use require
luaConfigRC = let
# get the name of each lua file in the lua directory, where setting files reside
# and import them recursively
configPaths = filter (hasSuffix ".lua") (map toString (listFilesRecursive ./lua));
# generates a key-value pair that looks roughly as follows:
# `<filePath> = entryAnywhere ''<contents of filePath>''`
# which is expected by neovim-flake's modified DAG library
luaConfig = genAttrs configPaths (file:
entryBefore ["luaScript"] ''
${fileContents "${file}"}
'');
in
luaConfig;
};
};
};
};
}