Nvim: Rewrate with replaceVars.

This commit is contained in:
Dmitry Voronin 2024-12-18 13:45:27 +03:00
parent 72043f15d4
commit 4583b9b65b
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
96 changed files with 727 additions and 970 deletions

View file

@ -25,3 +25,7 @@ includes = [ "*.sh" ]
command = "prettier"
options = [ "-w" ]
includes = [ "*.css" ]
[formatter.stylua]
command = "stylua"
includes = [ "*.lua" ]

View file

@ -159,6 +159,7 @@
nodePackages.prettier
nodePackages.prettier-plugin-toml
shfmt
stylua
treefmt
];
# buildInputs = with pkgs; [ ];

View file

@ -1,21 +1,37 @@
{
config,
inputs,
pkgs,
util,
...
}@args:
}:
let
nvimRc =
{ runtimes, configs }:
let
accent = config.module.style.color.accent;
bg = config.module.style.color.bg.regular;
fg = config.module.style.color.fg.dark;
ollamaModel = config.module.ollama.primaryModel;
selection = config.module.style.color.selection;
# Plugin paths to install.
runtimeRc = builtins.foldl' (acc: r: acc + "set runtimepath+=${r}\n") "" runtimes;
# My configuration files combined into one big file.
config = pkgs.writeText "nvimRc" (util.catText configs args);
cfgRaw = pkgs.writeText "nvim-rc-raw" (util.readFiles configs);
cfg = pkgs.replaceVars cfgRaw {
inherit
accent
bg
fg
ollamaModel
selection
;
};
# Tell Neovim to load this file.
configRc = "lua dofile(\"${config}\")";
configRc = "lua dofile(\"${cfg}\")";
in
runtimeRc + configRc;
in
@ -45,49 +61,49 @@ in
];
configs = [
./module/key/Rekey.nix
./module/key/Leader.nix
./module/config/Autoread.nix
./module/config/Etc.nix
./module/config/Search.nix
./module/config/Tab.nix
./module/config/Highlight.nix
./module/plugin/Filetree.nix
./module/plugin/Gruvbox.nix
./module/plugin/Bufferline.nix
./module/plugin/Autoclose.nix
./module/plugin/Gitsigns.nix
./module/plugin/Trouble.nix
./module/plugin/Closebuffers.nix
./module/plugin/Telescope.nix
./module/plugin/Todo.nix
./module/plugin/Indent.nix
./module/plugin/Align.nix
./module/plugin/Treesitter.nix
./module/plugin/Fold.nix
./module/plugin/Gen.nix
./module/plugin/Colorizer.nix
./module/plugin/Dressing.nix
./module/plugin/lsp/Go.nix
./module/plugin/lsp/Haskell.nix
./module/plugin/lsp/Lua.nix
./module/plugin/lsp/Nix.nix
./module/plugin/lsp/Rust.nix
./module/plugin/lsp/Tex.nix
./module/key/Autocomplete.nix
./module/key/Buffer.nix
./module/key/Cmd.nix
./module/key/Colorscheme.nix
./module/key/Filetree.nix
./module/key/Gitsigns.nix
./module/key/Navigation.nix
./module/key/Prompt.nix
./module/key/Save.nix
./module/key/Sort.nix
./module/key/TabWidth.nix
./module/key/Telescope.nix
./module/key/Terminal.nix
./module/key/Trouble.nix
./module/key/Rekey.lua
./module/key/Leader.lua
./module/config/Autoread.lua
./module/config/Etc.lua
./module/config/Search.lua
./module/config/Tab.lua
./module/config/Highlight.lua
./module/plugin/Filetree.lua
./module/plugin/Gruvbox.lua
./module/plugin/Bufferline.lua
./module/plugin/Autoclose.lua
./module/plugin/Gitsigns.lua
./module/plugin/Trouble.lua
./module/plugin/Closebuffers.lua
./module/plugin/Telescope.lua
./module/plugin/Todo.lua
./module/plugin/Indent.lua
./module/plugin/Align.lua
./module/plugin/Treesitter.lua
./module/plugin/Fold.lua
./module/plugin/Gen.lua
./module/plugin/Colorizer.lua
./module/plugin/Dressing.lua
./module/plugin/lsp/Go.lua
./module/plugin/lsp/Haskell.lua
./module/plugin/lsp/Lua.lua
./module/plugin/lsp/Nix.lua
./module/plugin/lsp/Rust.lua
./module/plugin/lsp/Tex.lua
./module/key/Autocomplete.lua
./module/key/Buffer.lua
./module/key/Cmd.lua
./module/key/Colorscheme.lua
./module/key/Filetree.lua
./module/key/Gitsigns.lua
./module/key/Navigation.lua
./module/key/Prompt.lua
./module/key/Save.lua
./module/key/Sort.lua
./module/key/TabWidth.lua
./module/key/Telescope.lua
./module/key/Terminal.lua
./module/key/Trouble.lua
];
};
}

View file

@ -0,0 +1,5 @@
vim.o.autoread = true
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, {
command = "if mode() != 'c' | checktime | endif",
pattern = { "*" },
})

View file

@ -1,10 +0,0 @@
{ ... }:
{
text = ''
vim.o.autoread = true
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, {
command = "if mode() != 'c' | checktime | endif",
pattern = { "*" },
})
'';
}

View file

@ -0,0 +1,32 @@
-- TODO: Add comments and separate files.
vim.opt.clipboard = "unnamedplus"
vim.opt.cursorline = false
vim.opt.fixeol = false
vim.opt.incsearch = true
vim.opt.number = true
vim.opt.scrolloff = 4
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.termguicolors = true
vim.opt.ttyfast = true
vim.opt.wildmode = "longest,list"
-- vim.opt.completeopt = "menuone,noselect"
-- Disable continuing comments on newline.
vim.cmd("autocmd BufEnter * set fo-=c fo-=r fo-=o")
-- Disable mouse.
vim.cmd("set mouse=")
-- Disable signs for diagnostics.
vim.diagnostic.config({ signs = false })
-- Display invisible characters.
-- vim.cmd("set list listchars=tab:>\\ ,trail:-,eol:,lead:.")
vim.cmd("set list listchars=tab:>\\ ,trail:-,lead:·")
-- Relative line numbers.
vim.wo.relativenumber = true
-- Disable swap files.
vim.opt.swapfile = false

View file

@ -1,37 +0,0 @@
{ ... }:
{
text = ''
-- TODO: Add comments and separate files.
vim.opt.clipboard = "unnamedplus"
vim.opt.cursorline = false
vim.opt.fixeol = false
vim.opt.incsearch = true
vim.opt.number = true
vim.opt.scrolloff = 4
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.termguicolors = true
vim.opt.ttyfast = true
vim.opt.wildmode = "longest,list"
-- vim.opt.completeopt = "menuone,noselect"
-- Disable continuing comments on newline.
vim.cmd("autocmd BufEnter * set fo-=c fo-=r fo-=o")
-- Disable mouse.
vim.cmd("set mouse=")
-- Disable signs for diagnostics.
vim.diagnostic.config({ signs = false })
-- Display invisible characters.
-- vim.cmd("set list listchars=tab:>\\ ,trail:-,eol:,lead:.")
vim.cmd("set list listchars=tab:>\\ ,trail:-,lead:·")
-- Relative line numbers.
vim.wo.relativenumber = true
-- Disable swap files.
vim.opt.swapfile = false
'';
}

View file

@ -0,0 +1,23 @@
vim.api.nvim_create_autocmd({ "ColorScheme", "VimEnter" }, {
group = vim.api.nvim_create_augroup("Color", {}),
pattern = "*",
callback = function()
-- Background.
vim.api.nvim_set_hl(0, "CursorLine", { bg = "#@bg@" })
vim.api.nvim_set_hl(0, "Pmenu", { bg = "#@bg@" })
vim.api.nvim_set_hl(0, "PmenuExtra", { bg = "#@bg@" })
vim.api.nvim_set_hl(0, "TelescopeSelection", { bg = "#@bg@" })
-- Selection.
vim.api.nvim_set_hl(0, "Visual", { bg = "#@selection@", bold = true, fg = "#@fg@" })
vim.api.nvim_set_hl(0, "PmenuSel", { bg = "#@selection@", bold = true, fg = "#@fg@" })
-- Transparent.
vim.api.nvim_set_hl(0, "NormalFloat", { bg = clear })
-- Border.
vim.api.nvim_set_hl(0, "FloatBorder", { bg = clear, fg = "#@accent@" })
vim.api.nvim_set_hl(0, "FloatTitle", { bg = clear, fg = "#@accent@" })
vim.api.nvim_set_hl(0, "TelescopeBorder", { bg = clear, fg = "#@accent@" })
end,
})

View file

@ -1,54 +0,0 @@
{ config, lib, ... }:
let
color = config.module.style.color;
mkHighlight =
name: value:
''vim.api.nvim_set_hl(0, "${name}", ${
lib.generators.toLua {
multiline = false;
asBindings = false;
} value
})'';
bg = {
bg = "#${color.bg.regular}";
};
selection = {
bg = "#${color.selection}";
bold = true;
fg = "#${color.fg.dark}";
};
transparent = {
bg = lib.generators.mkLuaInline "clear";
};
border = {
bg = lib.generators.mkLuaInline "clear";
fg = "#${color.accent}";
};
in
{
text = ''
vim.api.nvim_create_autocmd({"ColorScheme", "VimEnter"}, {
group = vim.api.nvim_create_augroup('Color', {}),
pattern = "*",
callback = function ()
-- Background.
${mkHighlight "CursorLine" bg}
${mkHighlight "Pmenu" bg}
${mkHighlight "PmenuExtra" bg}
${mkHighlight "TelescopeSelection" bg}
-- Selection.
${mkHighlight "Visual" selection}
${mkHighlight "PmenuSel" selection}
-- Transparent.
${mkHighlight "NormalFloat" transparent}
-- Border.
${mkHighlight "FloatBorder" border}
${mkHighlight "FloatTitle" border}
${mkHighlight "TelescopeBorder" border}
end
})
'';
}

View file

@ -0,0 +1,5 @@
vim.opt.hlsearch = true
vim.opt.ignorecase = true
vim.opt.incsearch = true
vim.opt.showmatch = true
vim.opt.smartcase = true

View file

@ -1,10 +0,0 @@
{ ... }:
{
text = ''
vim.opt.hlsearch = true
vim.opt.ignorecase = true
vim.opt.incsearch = true
vim.opt.showmatch = true
vim.opt.smartcase = true
'';
}

View file

@ -0,0 +1,9 @@
vim.opt.autoindent = true
vim.opt.expandtab = false
-- vim.opt.smartindent = true
vim.opt.shiftwidth = 2
vim.opt.softtabstop = 2
vim.opt.tabstop = 2
-- Disable Markdown forced formatting.
vim.g.markdown_recommended_style = 0

View file

@ -1,17 +0,0 @@
{ ... }:
let
indentDefault = 2;
in
{
text = ''
vim.opt.autoindent = true
vim.opt.expandtab = false
-- vim.opt.smartindent = true
vim.opt.shiftwidth = ${toString indentDefault}
vim.opt.softtabstop = ${toString indentDefault}
vim.opt.tabstop = ${toString indentDefault}
-- Disable Markdown forced formatting.
vim.g.markdown_recommended_style = 0
'';
}

View file

@ -0,0 +1,5 @@
-- Autocomplete.
rekey_input("<C-space>", "<C-n>")
-- LSP autocomplete.
rekey_normal("<C-space>", "<cmd>lua vim.lsp.buf.code_action()<cr>")

View file

@ -1,10 +0,0 @@
{ ... }:
{
text = ''
-- Autocomplete.
rekey_input("<C-space>", "<C-n>")
-- LSP autocomplete.
rekey_normal("<C-space>", "<cmd>lua vim.lsp.buf.code_action()<cr>")
'';
}

View file

@ -0,0 +1,12 @@
-- New empty buffer.
remap_normal("<Leader>n", "<cmd>enew<cr>")
-- Close buffer.
function _buf_close()
pcall(vim.cmd, "w")
vim.cmd([[bp|sp|bn|bd!]])
end
rekey_normal("<Leader>x", "<cmd>lua _buf_close()<cr>")
-- Close all hidden buffers.
rekey_normal("<Leader>X", "<cmd>BDelete hidden<cr><C-l>")

View file

@ -1,17 +0,0 @@
{ ... }:
{
text = ''
-- New empty buffer.
remap_normal("<Leader>n", "<cmd>enew<cr>")
-- Close buffer.
function _buf_close()
pcall(vim.cmd, "w")
vim.cmd[[bp|sp|bn|bd!]]
end
rekey_normal("<Leader>x", "<cmd>lua _buf_close()<cr>")
-- Close all hidden buffers.
rekey_normal("<Leader>X", "<cmd>BDelete hidden<cr><C-l>")
'';
}

View file

@ -0,0 +1,7 @@
-- Remap ; to :.
rekey_normal(";", ":")
rekey_visual(";", ":")
-- Repeat previous command.
rekey_normal("<Leader>.", "@:")
rekey_visual("<Leader>.", "@:")

View file

@ -1,12 +0,0 @@
{ ... }:
{
text = ''
-- Remap ; to :.
rekey_normal(";", ":")
rekey_visual(";", ":")
-- Repeat previous command.
rekey_normal("<Leader>.", "@:")
rekey_visual("<Leader>.", "@:")
'';
}

View file

@ -0,0 +1,22 @@
function toggle_contrast()
if vim.g.gruvbox_material_background == "light" then
vim.g.gruvbox_material_background = "medium"
elseif vim.g.gruvbox_material_background == "medium" then
vim.g.gruvbox_material_background = "hard"
elseif vim.g.gruvbox_material_background == "hard" then
vim.g.gruvbox_material_background = "light"
end
vim.cmd("colorscheme gruvbox-material")
end
function toggle_light()
if vim.o.background == "light" then
vim.o.background = "dark"
elseif vim.o.background == "dark" then
vim.o.background = "light"
end
-- require("lualine").setup()
end
rekey_normal("<Leader>[", "<cmd>lua toggle_contrast()<cr>")
rekey_normal("<Leader>]", "<cmd>lua toggle_light()<cr>")

View file

@ -1,27 +0,0 @@
{ ... }:
{
text = ''
function toggle_contrast()
if vim.g.gruvbox_material_background == "light" then
vim.g.gruvbox_material_background = "medium"
elseif vim.g.gruvbox_material_background == "medium" then
vim.g.gruvbox_material_background = "hard"
elseif vim.g.gruvbox_material_background == "hard" then
vim.g.gruvbox_material_background = "light"
end
vim.cmd("colorscheme gruvbox-material")
end
function toggle_light()
if vim.o.background == "light" then
vim.o.background = "dark"
elseif vim.o.background == "dark" then
vim.o.background = "light"
end
-- require("lualine").setup()
end
rekey_normal("<Leader>[", "<cmd>lua toggle_contrast()<cr>")
rekey_normal("<Leader>]", "<cmd>lua toggle_light()<cr>")
'';
}

View file

@ -0,0 +1,2 @@
-- Toggle file tree.
rekey_normal("<Leader>1", "<cmd>NvimTreeToggle<cr>")

View file

@ -1,7 +0,0 @@
{ ... }:
{
text = ''
-- Toggle file tree.
rekey_normal("<Leader>1", "<cmd>NvimTreeToggle<cr>")
'';
}

View file

@ -0,0 +1,5 @@
-- Toggle Git inspection mode.
rekey_normal(
"<Leader>g",
"<cmd>Gitsigns toggle_current_line_blame<cr><cmd>Gitsigns toggle_word_diff<cr><cmd>Gitsigns toggle_linehl<cr>"
)

View file

@ -1,7 +0,0 @@
{ ... }:
{
text = ''
-- Toggle Git inspection mode.
rekey_normal("<Leader>g", "<cmd>Gitsigns toggle_current_line_blame<cr><cmd>Gitsigns toggle_word_diff<cr><cmd>Gitsigns toggle_linehl<cr>")
'';
}

View file

@ -0,0 +1,7 @@
leader = " "
vim.g.mapleader = leader
vim.g.maplocalleader = leader
-- Disable key press timeout.
vim.cmd("set notimeout nottimeout")

View file

@ -1,12 +0,0 @@
{ ... }:
{
text = ''
leader = " "
vim.g.mapleader = leader
vim.g.maplocalleader = leader
-- Disable key press timeout.
vim.cmd("set notimeout nottimeout")
'';
}

View file

@ -0,0 +1,29 @@
-- Switch windows.
rekey_normal("<Leader>a", "<C-w>h")
rekey_normal("<Leader>d", "<C-w>l")
rekey_normal("<Leader>s", "<C-w>j")
rekey_normal("<Leader>w", "<C-w>k")
-- Switch buffers.
rekey_normal("<Leader>E", "<cmd>BufferLineMoveNext<cr>")
rekey_normal("<Leader>Q", "<cmd>BufferLineMovePrev<cr>")
rekey_normal("<Leader>e", "<cmd>BufferLineCycleNext<cr>")
rekey_normal("<Leader>q", "<cmd>BufferLineCyclePrev<cr>")
-- Splits.
rekey_normal("<Leader>\\", "<cmd>vsplit<cr>")
rekey_normal("<Leader>-", "<cmd>split<cr>")
rekey_normal("<Leader>=", "<C-w>=") -- Equalize split sizes.
rekey_normal("<Leader>c", "<C-w>q") -- Close split.
-- Resize splits.
rekey_normal("<Leader>h", "4<C-w><")
rekey_normal("<Leader>l", "4<C-w>>")
rekey_normal("<Leader>j", "2<C-w>+")
rekey_normal("<Leader>k", "2<C-w>-")
-- Move splits.
rekey_normal("<Leader>A", "<C-w>A")
rekey_normal("<Leader>D", "<C-w>D")
rekey_normal("<Leader>S", "<C-w>S")
rekey_normal("<Leader>W", "<C-w>W")

View file

@ -1,38 +0,0 @@
{ ... }:
let
stepHorizontal = 4;
stepVertical = 2;
in
{
text = ''
-- Switch windows.
rekey_normal("<Leader>a", "<C-w>h")
rekey_normal("<Leader>d", "<C-w>l")
rekey_normal("<Leader>s", "<C-w>j")
rekey_normal("<Leader>w", "<C-w>k")
-- Switch buffers.
rekey_normal("<Leader>E", "<cmd>BufferLineMoveNext<cr>")
rekey_normal("<Leader>Q", "<cmd>BufferLineMovePrev<cr>")
rekey_normal("<Leader>e", "<cmd>BufferLineCycleNext<cr>")
rekey_normal("<Leader>q", "<cmd>BufferLineCyclePrev<cr>")
-- Splits.
rekey_normal("<Leader>\\", "<cmd>vsplit<cr>")
rekey_normal("<Leader>-", "<cmd>split<cr>")
rekey_normal("<Leader>=", "<C-w>=") -- Equalize split sizes.
rekey_normal("<Leader>c", "<C-w>q") -- Close split.
-- Resize splits.
rekey_normal("<Leader>h", "${toString stepHorizontal}<C-w><")
rekey_normal("<Leader>l", "${toString stepHorizontal}<C-w>>")
rekey_normal("<Leader>j", "${toString stepVertical}<C-w>+")
rekey_normal("<Leader>k", "${toString stepVertical}<C-w>-")
-- Move splits.
rekey_normal("<Leader>A", "<C-w>A")
rekey_normal("<Leader>D", "<C-w>D")
rekey_normal("<Leader>S", "<C-w>S")
rekey_normal("<Leader>W", "<C-w>W")
'';
}

View file

@ -0,0 +1,2 @@
rekey_normal("<Leader>p", ":Gen<cr>")
rekey_visual("<Leader>p", ":Gen<cr>")

View file

@ -1,7 +0,0 @@
{ ... }:
{
text = ''
rekey_normal("<Leader>p", ":Gen<cr>")
rekey_visual("<Leader>p", ":Gen<cr>")
'';
}

View file

@ -0,0 +1,49 @@
-- Base rekey function.
local function rekey(t, key, command)
vim.api.nvim_set_keymap(t, key, command, { noremap = true })
end
-- Base remap function.
local function remap(t, key, command)
vim.api.nvim_set_keymap(t, key, command, { noremap = false })
end
-- Rekey in normal mode.
function rekey_normal(key, command)
rekey("n", key, command)
end
-- Rekey in input mode.
function rekey_input(key, command)
rekey("i", key, command)
end
-- Rekey in visual mode.
function rekey_visual(key, command)
rekey("v", key, command)
end
-- Rekey in terminal mode.
function rekey_terminal(key, command)
rekey("t", key, command)
end
-- Remap in normal mode.
function remap_normal(key, command)
remap("n", key, command)
end
-- Remap in input mode.
function remap_input(key, command)
remap("i", key, command)
end
-- Remap in visual mode.
function remap_visual(key, command)
remap("v", key, command)
end
-- Remap in terminal mode.
function remap_terminal(key, command)
remap("t", key, command)
end

View file

@ -1,54 +0,0 @@
{ ... }:
{
text = ''
-- Base rekey function.
local function rekey(t, key, command)
vim.api.nvim_set_keymap(t, key, command, { noremap = true })
end
-- Base remap function.
local function remap(t, key, command)
vim.api.nvim_set_keymap(t, key, command, { noremap = false })
end
-- Rekey in normal mode.
function rekey_normal(key, command)
rekey("n", key, command)
end
-- Rekey in input mode.
function rekey_input(key, command)
rekey("i", key, command)
end
-- Rekey in visual mode.
function rekey_visual(key, command)
rekey("v", key, command)
end
-- Rekey in terminal mode.
function rekey_terminal(key, command)
rekey("t", key, command)
end
-- Remap in normal mode.
function remap_normal(key, command)
remap("n", key, command)
end
-- Remap in input mode.
function remap_input(key, command)
remap("i", key, command)
end
-- Remap in visual mode.
function remap_visual(key, command)
remap("v", key, command)
end
-- Remap in terminal mode.
function remap_terminal(key, command)
remap("t", key, command)
end
'';
}

View file

@ -0,0 +1,15 @@
-- Write all we can and exit. Created this to drop non-writable stuff when piping to nvim.
function bye()
pcall(vim.cmd, "wa")
vim.cmd([[qa!]])
end
-- Save everything.
rekey_normal("<C-s>", "<cmd>wa!<cr>")
rekey_input("<C-s>", "<cmd>wa!<cr>")
-- Save all we can and leave.
rekey_normal("<Leader>z", "<cmd>lua bye()<cr>")
-- Just leave, no saves.
rekey_normal("<Leader>Z", "<cmd>qa!<cr>")

View file

@ -1,20 +0,0 @@
{ ... }:
{
text = ''
-- Write all we can and exit. Created this to drop non-writable stuff when piping to nvim.
function bye()
pcall(vim.cmd, "wa")
vim.cmd[[qa!]]
end
-- Save everything.
rekey_normal("<C-s>", "<cmd>wa!<cr>")
rekey_input("<C-s>", "<cmd>wa!<cr>")
-- Save all we can and leave.
rekey_normal("<Leader>z", "<cmd>lua bye()<cr>")
-- Just leave, no saves.
rekey_normal("<Leader>Z", "<cmd>qa!<cr>")
'';
}

View file

@ -0,0 +1,2 @@
-- Sort visual selection alphabetically.
rekey_visual("<Leader>A", ":'<,'>sort<cr>")

View file

@ -1,7 +0,0 @@
{ ... }:
{
text = ''
-- Sort visual selection alphabetically.
rekey_visual("<Leader>A", ":'<,'>sort<cr>")
'';
}

View file

@ -0,0 +1,17 @@
function toggle_tab_width()
if vim.bo.shiftwidth == 2 then
vim.bo.shiftwidth = 4
vim.bo.tabstop = 4
vim.bo.softtabstop = 4
elseif vim.bo.shiftwidth == 4 then
vim.bo.shiftwidth = 8
vim.bo.tabstop = 8
vim.bo.softtabstop = 8
elseif vim.bo.shiftwidth == 8 then
vim.bo.shiftwidth = 2
vim.bo.tabstop = 2
vim.bo.softtabstop = 2
end
end
rekey_normal("<Leader><Tab>", "<cmd>lua toggle_tab_width()<cr>")

View file

@ -1,22 +0,0 @@
{ ... }:
{
text = ''
function toggle_tab_width()
if vim.bo.shiftwidth == 2 then
vim.bo.shiftwidth = 4
vim.bo.tabstop = 4
vim.bo.softtabstop = 4
elseif vim.bo.shiftwidth == 4 then
vim.bo.shiftwidth = 8
vim.bo.tabstop = 8
vim.bo.softtabstop = 8
elseif vim.bo.shiftwidth == 8 then
vim.bo.shiftwidth = 2
vim.bo.tabstop = 2
vim.bo.softtabstop = 2
end
end
rekey_normal("<Leader><Tab>", "<cmd>lua toggle_tab_width()<cr>")
'';
}

View file

@ -0,0 +1,6 @@
rekey_normal("<Leader>fa", "<cmd>Telescope<cr>")
rekey_normal("<Leader>fb", "<cmd>lua require('telescope.builtin').buffers()<cr>")
rekey_normal("<Leader>ff", "<cmd>lua require('telescope.builtin').find_files()<cr>")
rekey_normal("<Leader>fg", "<cmd>lua require('telescope.builtin').live_grep()<cr>")
rekey_normal("<Leader>fh", "<cmd>lua require('telescope.builtin').help_tags()<cr>")
rekey_normal("<Leader>ft", "<cmd>Telescope treesitter<cr>")

View file

@ -1,14 +0,0 @@
{ ... }:
let
mod = "f";
in
{
text = ''
rekey_normal("<Leader>${mod}a", "<cmd>Telescope<cr>")
rekey_normal("<Leader>${mod}b", "<cmd>lua require('telescope.builtin').buffers()<cr>")
rekey_normal("<Leader>${mod}f", "<cmd>lua require('telescope.builtin').find_files()<cr>")
rekey_normal("<Leader>${mod}g", "<cmd>lua require('telescope.builtin').live_grep()<cr>")
rekey_normal("<Leader>${mod}h", "<cmd>lua require('telescope.builtin').help_tags()<cr>")
rekey_normal("<Leader>${mod}t", "<cmd>Telescope treesitter<cr>")
'';
}

View file

@ -0,0 +1,5 @@
-- Open terminal window.
rekey_normal("<Leader>4", "<cmd>terminal<cr>")
-- Detach from terminal with Esc key.
rekey_terminal("<Esc>", "<C-\\><C-n>")

View file

@ -1,10 +0,0 @@
{ ... }:
{
text = ''
-- Open terminal window.
rekey_normal("<Leader>4", "<cmd>terminal<cr>")
-- Detach from terminal with Esc key.
rekey_terminal("<Esc>", "<C-\\><C-n>")
'';
}

View file

@ -0,0 +1,5 @@
-- Toggle diagnostics window.
rekey_normal("<Leader>2", "<cmd>Trouble diagnostics toggle focus=true<cr>")
-- Toggle To-do window.
rekey_normal("<Leader>3", "<cmd>Trouble todo toggle focus=true<cr>")

View file

@ -1,13 +0,0 @@
{ ... }:
let
focus = true;
in
{
text = ''
-- Toggle diagnostics window.
rekey_normal("<Leader>2", "<cmd>Trouble diagnostics toggle focus=${toString focus}<cr>")
-- Toggle To-do window.
rekey_normal("<Leader>3", "<cmd>Trouble todo toggle focus=${toString focus}<cr>")
'';
}

View file

@ -0,0 +1,6 @@
require("mini.align").setup({
mappings = {
start = "<Leader>a",
-- start_with_preview = '<Leader>A',
},
})

View file

@ -1,11 +0,0 @@
{ ... }:
{
text = ''
require("mini.align").setup {
mappings = {
start = "<Leader>a",
-- start_with_preview = '<Leader>A',
},
}
'';
}

View file

@ -0,0 +1,13 @@
require("autoclose").setup({
keys = {
["'"] = { escape = false, close = false, pair = "''''''", disabled_filetypes = {} },
["("] = { escape = true, close = true, pair = "()", disabled_filetypes = {} },
["<"] = { escape = true, close = true, pair = "<>", disabled_filetypes = {} },
['"'] = { escape = true, close = true, pair = '""', disabled_filetypes = {} },
["`"] = { escape = true, close = true, pair = "``", disabled_filetypes = {} },
["{"] = { escape = true, close = true, pair = "{}", disabled_filetypes = {} },
},
-- options = {
-- disabled_filetypes = { "text", "markdown" },
-- }
})

View file

@ -1,18 +0,0 @@
{ ... }:
{
text = ''
require("autoclose").setup({
keys = {
["'"] = { escape = false, close = false, pair = "''''''", disabled_filetypes = {} },
["("] = { escape = true, close = true, pair = "()", disabled_filetypes = {} },
["<"] = { escape = true, close = true, pair = "<>", disabled_filetypes = {} },
["\""] = { escape = true, close = true, pair = "\"\"", disabled_filetypes = {} },
["`"] = { escape = true, close = true, pair = "``", disabled_filetypes = {} },
["{"] = { escape = true, close = true, pair = "{}", disabled_filetypes = {} },
},
-- options = {
-- disabled_filetypes = { "text", "markdown" },
-- }
})
'';
}

View file

@ -0,0 +1 @@
require("bufferline").setup()

View file

@ -1,6 +0,0 @@
{ ... }:
{
text = ''
require("bufferline").setup()
'';
}

View file

@ -0,0 +1,7 @@
require("close_buffers").setup({
file_glob_ignore = {},
file_regex_ignore = {},
filetype_ignore = {},
next_buffer_cmd = nil,
preserve_window_layout = { "this", "nameless" },
})

View file

@ -1,12 +0,0 @@
{ ... }:
{
text = ''
require("close_buffers").setup({
file_glob_ignore = {},
file_regex_ignore = {},
filetype_ignore = {},
next_buffer_cmd = nil,
preserve_window_layout = { "this", "nameless" },
})
'';
}

View file

@ -0,0 +1,4 @@
-- Ensure termguicolors is enabled if not already
vim.opt.termguicolors = true
require("nvim-highlight-colors").setup({})

View file

@ -1,9 +0,0 @@
{ ... }:
{
text = ''
-- Ensure termguicolors is enabled if not already
vim.opt.termguicolors = true
require('nvim-highlight-colors').setup({})
'';
}

View file

@ -0,0 +1 @@
require("dressing").setup({})

View file

@ -1,6 +0,0 @@
{ ... }:
{
text = ''
require("dressing").setup({ })
'';
}

View file

@ -0,0 +1,36 @@
-- Disable netrw at the very start of your init.lua.
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
local function my_on_attach(bufnr)
local api = require("nvim-tree.api")
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- Default mappings.
api.config.mappings.default_on_attach(bufnr)
-- Custom mappings.
-- vim.keymap.set('n', '<Leader><Tab>', api.tree.change_root_to_node, opts('Cd into'))
end
-- Set termguicolors to enable highlight groups.
vim.opt.termguicolors = true
-- Setup nvim-tree.
require("nvim-tree").setup({
on_attach = my_on_attach,
sort_by = "case_sensitive",
view = {
width = 30,
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = false,
git_ignored = false,
},
})

View file

@ -1,41 +0,0 @@
{ ... }:
{
text = ''
-- Disable netrw at the very start of your init.lua.
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
local function my_on_attach(bufnr)
local api = require "nvim-tree.api"
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- Default mappings.
api.config.mappings.default_on_attach(bufnr)
-- Custom mappings.
-- vim.keymap.set('n', '<Leader><Tab>', api.tree.change_root_to_node, opts('Cd into'))
end
-- Set termguicolors to enable highlight groups.
vim.opt.termguicolors = true
-- Setup nvim-tree.
require("nvim-tree").setup({
on_attach = my_on_attach,
sort_by = "case_sensitive",
view = {
width = 30,
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = false,
git_ignored = false
},
})
'';
}

View file

@ -0,0 +1,3 @@
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
vim.opt.foldlevel = 99
vim.opt.foldmethod = "expr"

View file

@ -1,8 +0,0 @@
{ ... }:
{
text = ''
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
vim.opt.foldlevel = 99
vim.opt.foldmethod = "expr"
'';
}

View file

@ -0,0 +1,3 @@
require("gen").setup({
model = "@ollamaModel@",
})

View file

@ -1,8 +0,0 @@
{ config, ... }:
{
text = ''
require("gen").setup {
model = "${config.module.ollama.primaryModel}"
}
'';
}

View file

@ -0,0 +1,40 @@
require("gitsigns").setup({
signs = {
add = { text = "" },
change = { text = "" },
changedelete = { text = "~" },
delete = { text = "_" },
topdelete = { text = "" },
untracked = { text = "" },
},
linehl = false,
numhl = true,
signcolumn = false,
word_diff = false,
watch_gitdir = {
follow_files = true,
},
attach_to_untracked = true,
current_line_blame = false,
current_line_blame_opts = {
delay = 1000,
ignore_whitespace = false,
virt_text = true,
virt_text_pos = "eol",
},
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
max_file_length = 40000,
sign_priority = 6,
status_formatter = nil,
update_debounce = 100,
preview_config = {
border = "single",
col = 1,
relative = "cursor",
row = 0,
style = "minimal",
},
})
-- Set custom color.
vim.cmd("highlight gitsignscurrentlineblame guibg=#00000000 guifg=#aaaaaa")

View file

@ -1,45 +0,0 @@
{ ... }:
{
text = ''
require("gitsigns").setup {
signs = {
add = { text = "" },
change = { text = "" },
changedelete = { text = "~" },
delete = { text = "_" },
topdelete = { text = "" },
untracked = { text = "" },
},
linehl = false,
numhl = true,
signcolumn = false,
word_diff = false,
watch_gitdir = {
follow_files = true,
},
attach_to_untracked = true,
current_line_blame = false,
current_line_blame_opts = {
delay = 1000,
ignore_whitespace = false,
virt_text = true,
virt_text_pos = "eol",
},
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
max_file_length = 40000,
sign_priority = 6,
status_formatter = nil,
update_debounce = 100,
preview_config = {
border = "single",
col = 1,
relative = "cursor",
row = 0,
style = "minimal",
},
}
-- Set custom color.
vim.cmd("highlight gitsignscurrentlineblame guibg=#00000000 guifg=#aaaaaa")
'';
}

View file

@ -0,0 +1,15 @@
vim.cmd([[
if has('termguicolors')
set termguicolors
endif
]])
vim.o.background = "dark"
vim.g.gruvbox_material_background = "medium"
vim.g.gruvbox_material_foreground = "original"
vim.g.gruvbox_material_transparent_background = 2
-- vim.g.gruvbox_material_better_performance = 1 -- NOTE: Broken on NixOS.
-- vim.cmd("autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE")
vim.cmd("colorscheme gruvbox-material")
vim.cmd("let g:lightline = {'colorscheme' : 'gruvbox_material'}")

View file

@ -1,20 +0,0 @@
{ ... }:
{
text = ''
vim.cmd([[
if has('termguicolors')
set termguicolors
endif
]])
vim.o.background = "dark"
vim.g.gruvbox_material_background = "medium"
vim.g.gruvbox_material_foreground = "original"
vim.g.gruvbox_material_transparent_background = 2
-- vim.g.gruvbox_material_better_performance = 1 -- NOTE: Broken on NixOS.
-- vim.cmd("autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE")
vim.cmd("colorscheme gruvbox-material")
vim.cmd("let g:lightline = {'colorscheme' : 'gruvbox_material'}")
'';
}

View file

@ -0,0 +1,6 @@
-- Auto-detect indentation type.
require("indent-o-matic").setup({
max_lines = 1024,
skip_multiline = true,
standard_widths = { 2, 4, 8 },
})

View file

@ -1,11 +0,0 @@
{ ... }:
{
text = ''
-- Auto-detect indentation type.
require("indent-o-matic").setup {
max_lines = 1024,
skip_multiline = true,
standard_widths = { 2, 4, 8 },
}
'';
}

View file

@ -0,0 +1,49 @@
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({ "git", "clone", "--depth", "1", "https://git.voronind.com/mirror/packer.nvim.git", install_path })
vim.cmd([[packadd packer.nvim]])
return true
end
return false
end
local packer_bootstrap = ensure_packer()
local available = function(commands)
for _, command in ipairs(commands) do
if vim.fn.executable(command) ~= 1 then
return false
end
end
return true
end
return require("packer").startup(function(use)
use("https://git.voronind.com/mirror/SingleComment.nvim.git")
use("https://git.voronind.com/mirror/autoclose.nvim.git")
use("https://git.voronind.com/mirror/bufferline.nvim.git")
use("https://git.voronind.com/mirror/close-buffers.nvim.git")
use("https://git.voronind.com/mirror/gitsigns.nvim.git")
use("https://git.voronind.com/mirror/gruvbox-material.git")
use("https://git.voronind.com/mirror/indent-o-matic.git")
use("https://git.voronind.com/mirror/lualine.nvim.git")
use("https://git.voronind.com/mirror/mini.align.git")
use("https://git.voronind.com/mirror/nvim-lspconfig.git")
use("https://git.voronind.com/mirror/nvim-tree.lua.git")
use("https://git.voronind.com/mirror/nvim-treesitter.git")
use("https://git.voronind.com/mirror/nvim-web-devicons.git")
use("https://git.voronind.com/mirror/packer.nvim.git")
use("https://git.voronind.com/mirror/plenary.nvim.git")
use("https://git.voronind.com/mirror/telescope.nvim.git")
use("https://git.voronind.com/mirror/todo-comments.nvim.git")
use("https://git.voronind.com/mirror/tokyonight.nvim.git")
use("https://git.voronind.com/mirror/trouble.nvim.git")
use("https://git.voronind.com/mirror/which-key.nvim.git")
-- Auto-install.
if packer_bootstrap then
require("packer").sync()
end
end)

View file

@ -1,54 +0,0 @@
{ ... }:
{
text = ''
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath("data").."/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({"git", "clone", "--depth", "1", "https://git.voronind.com/mirror/packer.nvim.git", install_path})
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end
local packer_bootstrap = ensure_packer()
local available = function(commands)
for _, command in ipairs(commands) do
if vim.fn.executable(command) ~= 1 then
return false
end
end
return true
end
return require("packer").startup(function(use)
use "https://git.voronind.com/mirror/SingleComment.nvim.git"
use "https://git.voronind.com/mirror/autoclose.nvim.git"
use "https://git.voronind.com/mirror/bufferline.nvim.git"
use "https://git.voronind.com/mirror/close-buffers.nvim.git"
use "https://git.voronind.com/mirror/gitsigns.nvim.git"
use "https://git.voronind.com/mirror/gruvbox-material.git"
use "https://git.voronind.com/mirror/indent-o-matic.git"
use "https://git.voronind.com/mirror/lualine.nvim.git"
use "https://git.voronind.com/mirror/mini.align.git"
use "https://git.voronind.com/mirror/nvim-lspconfig.git"
use "https://git.voronind.com/mirror/nvim-tree.lua.git"
use "https://git.voronind.com/mirror/nvim-treesitter.git"
use "https://git.voronind.com/mirror/nvim-web-devicons.git"
use "https://git.voronind.com/mirror/packer.nvim.git"
use "https://git.voronind.com/mirror/plenary.nvim.git"
use "https://git.voronind.com/mirror/telescope.nvim.git"
use "https://git.voronind.com/mirror/todo-comments.nvim.git"
use "https://git.voronind.com/mirror/tokyonight.nvim.git"
use "https://git.voronind.com/mirror/trouble.nvim.git"
use "https://git.voronind.com/mirror/which-key.nvim.git"
-- Auto-install.
if packer_bootstrap then
require("packer").sync()
end
end)
'';
}

View file

@ -0,0 +1,12 @@
require("telescope").setup({
defaults = {
mappings = {
i = {
["<Tab>"] = "move_selection_previous",
["<S-Tab>"] = "move_selection_next",
},
},
},
extensions = {},
pickers = {},
})

View file

@ -1,17 +0,0 @@
{ ... }:
{
text = ''
require("telescope").setup{
defaults = {
mappings = {
i = {
["<Tab>"] = "move_selection_previous",
["<S-Tab>"] = "move_selection_next",
},
},
},
extensions = { },
pickers = { },
}
'';
}

View file

@ -0,0 +1,51 @@
require("todo-comments").setup({
sign_priority = 8,
signs = false,
keywords = {
FIX = { icon = "", color = "error", alt = { "FIXME", "BUG", "FIXIT", "ISSUE" } },
HACK = { icon = "", color = "warning", alt = { "WTF", "LOL", "KEKW" } },
LINK = { icon = "󰌷 ", color = "info", alt = { "REF", "SEE", "MORE", "ALSO", "SOURCE", "SRC" } },
NOTE = { icon = "󰎚 ", color = "hint", alt = { "INFO" } },
PERF = { icon = "", color = "default", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
TEST = { icon = "", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
TODO = { icon = "", color = "info", alt = { "LATER", "FUTURE", "ROADMAP" } },
WARN = { icon = "", color = "warning", alt = { "WARNING", "XXX" } },
WIP = { icon = "", color = "warning", alt = { "PROGRESS" } },
},
gui_style = {
bg = "BOLD",
fg = "NONE",
},
merge_keywords = true,
highlight = {
after = "fg",
before = "",
comments_only = true,
exclude = {},
keyword = "wide",
max_line_len = 400,
multiline = true,
multiline_context = 10,
multiline_pattern = "^.",
pattern = [[.*<(KEYWORDS)\s*:]],
},
colors = {
default = { "Identifier", "#7C3AED" },
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
hint = { "DiagnosticHint", "#10B981" },
info = { "DiagnosticInfo", "#2563EB" },
test = { "Identifier", "#FF00FF" },
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
},
search = {
command = "rg",
args = {
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
},
pattern = [[\b(KEYWORDS):]],
},
})

View file

@ -1,56 +0,0 @@
{ ... }:
{
text = ''
require("todo-comments").setup {
sign_priority = 8,
signs = false,
keywords = {
FIX = { icon = " ", color = "error", alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, },
HACK = { icon = " ", color = "warning", alt = { "WTF", "LOL", "KEKW" } },
LINK = { icon = "󰌷 ", color = "info", alt = { "REF", "SEE", "MORE", "ALSO", "SOURCE", "SRC" } },
NOTE = { icon = "󰎚 ", color = "hint", alt = { "INFO" } },
PERF = { icon = " ", color = "default", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
TEST = { icon = " ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
TODO = { icon = " ", color = "info", alt = { "LATER", "FUTURE", "ROADMAP" }},
WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
WIP = { icon = " ", color = "warning", alt = { "PROGRESS" } },
},
gui_style = {
bg = "BOLD",
fg = "NONE",
},
merge_keywords = true,
highlight = {
after = "fg",
before = "",
comments_only = true,
exclude = {},
keyword = "wide",
max_line_len = 400,
multiline = true,
multiline_context = 10,
multiline_pattern = "^.",
pattern = [[.*<(KEYWORDS)\s*:]],
},
colors = {
default = { "Identifier", "#7C3AED" },
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
hint = { "DiagnosticHint", "#10B981" },
info = { "DiagnosticInfo", "#2563EB" },
test = { "Identifier", "#FF00FF" },
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
},
search = {
command = "rg",
args = {
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
},
pattern = [[\b(KEYWORDS):]],
},
}
'';
}

View file

@ -0,0 +1,21 @@
require("nvim-treesitter.configs").setup({
parser_install_dir = "~/.cache/nvim/treesitter",
auto_install = true,
-- ensure_installed = "all",
sync_install = false,
highlight = {
additional_vim_regex_highlighting = false,
enable = true,
use_languagetree = true,
disable = { "lua" },
},
indent = {
enable = true,
},
autotag = {
enable = true,
},
rainbow = {
enable = true,
},
})

View file

@ -1,26 +0,0 @@
{ ... }:
{
text = ''
require("nvim-treesitter.configs").setup {
parser_install_dir = "~/.cache/nvim/treesitter",
auto_install = true,
-- ensure_installed = "all",
sync_install = false,
highlight = {
additional_vim_regex_highlighting = false,
enable = true,
use_languagetree = true,
disable = { "lua" },
},
indent = {
enable = true,
},
autotag = {
enable = true
},
rainbow = {
enable = true
},
}
'';
}

View file

@ -0,0 +1 @@
require("trouble").setup()

View file

@ -1,6 +0,0 @@
{ ... }:
{
text = ''
require("trouble").setup()
'';
}

View file

@ -0,0 +1,3 @@
local lspconfig = require("lspconfig")
lspconfig.gopls.setup({})

View file

@ -1,8 +0,0 @@
{ ... }:
{
text = ''
local lspconfig = require("lspconfig")
lspconfig.gopls.setup {}
'';
}

View file

@ -0,0 +1,5 @@
local lspconfig = require("lspconfig")
lspconfig.hls.setup({
filetypes = { "haskell", "lhaskell", "cabal" },
})

View file

@ -1,10 +0,0 @@
{ ... }:
{
text = ''
local lspconfig = require("lspconfig")
lspconfig.hls.setup {
filetypes = { 'haskell', 'lhaskell', 'cabal' },
}
'';
}

View file

@ -0,0 +1,3 @@
local lspconfig = require("lspconfig")
lspconfig.kotlin_language_server.setup({})

View file

@ -1,8 +0,0 @@
{ ... }:
{
text = ''
local lspconfig = require("lspconfig")
lspconfig.kotlin_language_server.setup {}
'';
}

View file

@ -0,0 +1,3 @@
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup({})

View file

@ -1,8 +0,0 @@
{ ... }:
{
text = ''
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup {}
'';
}

View file

@ -0,0 +1,13 @@
local lspconfig = require("lspconfig")
lspconfig.nixd.setup({
settings = {
nixd = {
diagnostic = {
suppress = {
"sema-escaping-with",
},
},
},
},
})

View file

@ -1,18 +0,0 @@
{ ... }:
{
text = ''
local lspconfig = require("lspconfig")
lspconfig.nixd.setup({
settings = {
nixd = {
diagnostic = {
suppress = {
"sema-escaping-with"
},
},
},
},
})
'';
}

View file

@ -0,0 +1,3 @@
local lspconfig = require("lspconfig")
lspconfig.pyright.setup({})

View file

@ -1,8 +0,0 @@
{ ... }:
{
text = ''
local lspconfig = require("lspconfig")
lspconfig.pyright.setup {}
'';
}

View file

@ -0,0 +1,16 @@
local lspconfig = require("lspconfig")
lspconfig.rust_analyzer.setup({
settings = {
["rust-analyzer"] = {
rustfmt = {
extraArgs = {
"--config",
"hard_tabs=true",
},
},
},
},
})
vim.g.rust_recommended_style = false

View file

@ -1,21 +0,0 @@
{ ... }:
{
text = ''
local lspconfig = require("lspconfig")
lspconfig.rust_analyzer.setup {
settings = {
["rust-analyzer"] = {
rustfmt = {
extraArgs = {
"--config",
"hard_tabs=true",
}
}
},
},
}
vim.g.rust_recommended_style = false
'';
}

View file

@ -0,0 +1,60 @@
local lspconfig = require("lspconfig")
local config = {
filetypes = {
"bib",
"gitcommit",
"markdown",
"org",
"pandoc",
"plaintex",
"rnoweb",
"rst",
"tex",
"text",
},
settings = {
["ltex"] = {
language = "auto",
},
},
}
lspconfig.ltex.setup(config)
-- Use TeX LSP for spellcheck.
vim.api.nvim_create_user_command("SCOn", function(args)
lspconfig.ltex.setup(config)
end, { desc = "Enable spellcheck." })
vim.api.nvim_create_user_command("SCOff", function(args)
lspconfig.ltex.setup({ filetypes = {} })
end, { desc = "Disable spellcheck." })
vim.api.nvim_create_user_command("SCLangRU", function(args)
config.settings["ltex"].language = "ru-RU"
lspconfig.ltex.setup(config)
end, { desc = "Set spellcheck to Russian." })
vim.api.nvim_create_user_command("SCLangEN", function(args)
config.settings["ltex"].language = "en-US"
lspconfig.ltex.setup(config)
end, { desc = "Set spellcheck to English." })
vim.api.nvim_create_user_command("SCLangAuto", function(args)
config.settings["ltex"].language = "auto"
lspconfig.ltex.setup(config)
end, { desc = "Set spellcheck to Auto." })
vim.api.nvim_create_user_command("SCForce", function(args)
vim.cmd("setfiletype text")
vim.cmd("SCOn")
end, { desc = "Set buffer type to text." })
vim.api.nvim_create_user_command("SCReset", function(args)
vim.cmd("filetype detect")
vim.cmd("SCLangAuto")
end, { desc = "Set buffer type to auto." })
vim.api.nvim_create_user_command("SCInfo", function(args)
vim.cmd("LspInfo")
end, { desc = "Show info about spellcheck." })

View file

@ -1,65 +0,0 @@
{ ... }:
{
text = ''
local lspconfig = require('lspconfig')
local config = {
filetypes = {
"bib",
"gitcommit",
"markdown",
"org",
"pandoc",
"plaintex",
"rnoweb",
"rst",
"tex",
"text",
},
settings = {
["ltex"] = {
language = "auto"
}
}
}
lspconfig.ltex.setup(config)
-- Use TeX LSP for spellcheck.
vim.api.nvim_create_user_command("SCOn", function (args)
lspconfig.ltex.setup(config)
end, { desc = "Enable spellcheck." })
vim.api.nvim_create_user_command("SCOff", function (args)
lspconfig.ltex.setup { filetypes = {} }
end, { desc = "Disable spellcheck." })
vim.api.nvim_create_user_command("SCLangRU", function (args)
config.settings['ltex'].language = "ru-RU"
lspconfig.ltex.setup(config)
end, { desc = "Set spellcheck to Russian." })
vim.api.nvim_create_user_command("SCLangEN", function (args)
config.settings['ltex'].language = "en-US"
lspconfig.ltex.setup(config)
end, { desc = "Set spellcheck to English." })
vim.api.nvim_create_user_command("SCLangAuto", function (args)
config.settings['ltex'].language = "auto"
lspconfig.ltex.setup(config)
end, { desc = "Set spellcheck to Auto." })
vim.api.nvim_create_user_command("SCForce", function (args)
vim.cmd("setfiletype text")
vim.cmd("SCOn")
end, { desc = "Set buffer type to text." })
vim.api.nvim_create_user_command("SCReset", function (args)
vim.cmd("filetype detect")
vim.cmd("SCLangAuto")
end, { desc = "Set buffer type to auto." })
vim.api.nvim_create_user_command("SCInfo", function (args)
vim.cmd("LspInfo")
end, { desc = "Show info about spellcheck." })
'';
}

View file

@ -190,25 +190,27 @@ let
]
);
swayRc = (pkgs.replaceVars swayRcRaw {
inherit
FullscreenRecording
FullscreenScreenshot
SelectRecording
SelectScreenshot
accent
border
borderSize
fg
fontName
keyboardLayouts
keyboardOptions
wallpaper
windowGap
;
}).overrideAttrs (old: {
doCheck = false;
});
swayRc =
(pkgs.replaceVars swayRcRaw {
inherit
FullscreenRecording
FullscreenScreenshot
SelectRecording
SelectScreenshot
accent
border
borderSize
fg
fontName
keyboardLayouts
keyboardOptions
wallpaper
windowGap
;
}).overrideAttrs
(old: {
doCheck = false;
});
in
{
text =