adding helix, vanilla neovim

This commit is contained in:
cnst
2024-09-03 15:56:23 +02:00
parent ba1772e041
commit 18fb237ac6
42 changed files with 1088 additions and 534 deletions

View File

@@ -0,0 +1,63 @@
{
inputs,
pkgs,
lib,
config,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.devtools.helix;
in {
imports = [./languages.nix];
options = {
modules.devtools.helix.enable = mkEnableOption "Enable helix";
};
config = mkIf cfg.enable {
programs.helix = {
enable = true;
package = inputs.helix.packages.${pkgs.system}.default;
settings = {
theme = "gruvbox_material_dark_soft";
editor = {
color-modes = true;
cursorline = true;
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
indent-guides.render = true;
inline-diagnostics = {
cursor-line = "hint";
other-lines = "error";
};
lsp.display-inlay-hints = true;
statusline.center = ["position-percentage"];
true-color = true;
whitespace.characters = {
newline = "";
tab = "";
};
};
keys = {
normal = {
y = "yank_to_clipboard";
p = "paste_clipboard_after";
space.u = {
f = ":format"; # format using LSP formatter
w = ":set whitespace.render all";
W = ":set whitespace.render none";
};
};
insert = {
C-v = "paste_clipboard_after";
};
};
};
};
};
}

View File

@@ -0,0 +1,188 @@
{
pkgs,
lib,
...
}: {
programs.helix.languages = {
language = let
deno = lang: {
command = lib.getExe pkgs.deno;
args = ["fmt" "-" "--ext" lang];
};
prettier = lang: {
command = lib.getExe pkgs.nodePackages.prettier;
args = ["--parser" lang];
};
prettierLangs = map (e: {
name = e;
formatter = prettier e;
});
langs = ["css" "scss" "html"];
in
[
{
name = "bash";
auto-format = true;
formatter = {
command = lib.getExe pkgs.shfmt;
args = ["-i" "2"];
};
}
{
name = "clojure";
injection-regex = "(clojure|clj|edn|boot|yuck)";
file-types = ["clj" "cljs" "cljc" "clje" "cljr" "cljx" "edn" "boot" "yuck"];
}
{
name = "cmake";
auto-format = true;
language-servers = ["cmake-language-server"];
formatter = {
command = lib.getExe pkgs.cmake-format;
args = ["-"];
};
}
{
name = "lua";
auto-format = true;
language-servers = ["lua-language-server"];
formatter = {
command = lib.getExe pkgs.stylua;
};
}
{
name = "javascript";
auto-format = true;
language-servers = ["dprint" "typescript-language-server"];
}
{
name = "json";
formatter = deno "json";
}
{
name = "markdown";
auto-format = true;
formatter = deno "md";
}
{
name = "python";
language-servers = ["pyright"];
formatter = {
command = lib.getExe pkgs.black;
args = ["-" "--quiet" "--line-length 100"];
};
}
{
name = "typescript";
auto-format = true;
language-servers = ["dprint" "typescript-language-server"];
}
]
++ prettierLangs langs;
language-server = {
bash-language-server = {
command = lib.getExe pkgs.bash-language-server;
args = ["start"];
};
clangd = {
command = "${pkgs.clang-tools}/bin/clangd";
clangd.fallbackFlags = ["-std=c++2b"];
};
cmake-language-server = {
command = lib.getExe pkgs.cmake-language-server;
};
lua-language-server = {
command = lib.getExe pkgs.lua-language-server;
};
deno-lsp = {
command = lib.getExe pkgs.deno;
args = ["lsp"];
environment.NO_COLOR = "1";
config.deno = {
enable = true;
lint = true;
unstable = true;
suggest = {
completeFunctionCalls = false;
imports = {hosts."https://deno.land" = true;};
};
inlayHints = {
enumMemberValues.enabled = true;
functionLikeReturnTypes.enabled = true;
parameterNames.enabled = "all";
parameterTypes.enabled = true;
propertyDeclarationTypes.enabled = true;
variableTypes.enabled = true;
};
};
};
dprint = {
command = lib.getExe pkgs.dprint;
args = ["lsp"];
};
nil = {
command = lib.getExe pkgs.nil;
config.nil.formatting.command = ["${lib.getExe pkgs.alejandra}" "-q"];
};
pyright = {
command = "${pkgs.pyright}/bin/pyright-langserver";
args = ["--stdio"];
config = {
reportMissingTypeStubs = false;
analysis = {
typeCheckingMode = "basic";
autoImportCompletions = true;
};
};
};
typescript-language-server = {
command = lib.getExe pkgs.nodePackages.typescript-language-server;
args = ["--stdio"];
config = let
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
in {
typescript-language-server.source = {
addMissingImports.ts = true;
fixAll.ts = true;
organizeImports.ts = true;
removeUnusedImports.ts = true;
sortImports.ts = true;
};
typescript = {inherit inlayHints;};
javascript = {inherit inlayHints;};
hostInfo = "helix";
};
};
vscode-css-language-server = {
command = "${pkgs.nodePackages.vscode-langservers-extracted}/bin/vscode-css-languageserver";
args = ["--stdio"];
config = {
provideFormatter = true;
css.validate.enable = true;
scss.validate.enable = true;
};
};
};
};
}

View File

@@ -1,4 +1,3 @@
# Yanked from Misterio77's great config: https://github.com/Misterio77/nix-config
{
pkgs,
config,
@@ -12,7 +11,9 @@ in {
./plugins
./lsp.nix
./syntaxes.nix
./keybindings.nix
];
options = {
modules.devtools.neovim.enable = mkEnableOption "Enable neovim";
};
@@ -20,145 +21,75 @@ in {
config = mkIf cfg.enable {
programs.neovim = {
enable = true;
extraConfig =
/*
vim
*/
''
"Use system clipboard
set clipboard=unnamedplus
"colorscheme
colorscheme gruvbox-material
set number
"Lets us easily trigger completion from binds
set wildcharm=<tab>
"Folding
set foldmethod=manual
"Should be expr, but it's slow. So just use ':set fdm=expr' when it's needed.
"Tabs
set tabstop=4 "4 char-wide tab
set expandtab "Use spaces
set softtabstop=0 "Use same length as 'tabstop'
set shiftwidth=0 "Use same length as 'tabstop'
"2 char-wide overrides
augroup two_space_tab
autocmd!
autocmd FileType json,html,htmldjango,hamlet,nix,scss,typescript,php,haskell,terraform setlocal tabstop=2
augroup END
"Set tera to use htmldjango syntax
augroup tera_htmldjango
autocmd!
autocmd BufRead,BufNewFile *.tera setfiletype htmldjango
augroup END
"Options when composing mutt mail
augroup mail_settings
autocmd FileType mail set noautoindent wrapmargin=0 textwidth=0 linebreak wrap formatoptions +=w
augroup END
"Fix nvim size according to terminal
"(https://github.com/neovim/neovim/issues/11330)
augroup fix_size
autocmd VimEnter * silent exec "!kill -s SIGWINCH" getpid()
augroup END
"Scroll up and down
nmap <C-j> <C-e>
nmap <C-k> <C-y>
"Buffers
nmap <space>b :buffers<CR>
nmap <C-l> :bnext<CR>
nmap <C-h> :bprev<CR>
nmap <C-q> :bdel<CR>
"Navigate
nmap <space>e :e<space>
nmap <space>e :e %:h<tab>
"CD to current dir
nmap <space>c :cd<space>
nmap <space>C :cd %:h<tab>
"Loclist
nmap <space>l :lwindow<cr>
nmap [l :lprev<cr>
nmap ]l :lnext<cr>
nmap <space>L :lhistory<cr>
nmap [L :lolder<cr>
nmap ]L :lnewer<cr>
"Quickfix
nmap <space>q :cwindow<cr>
nmap [q :cprev<cr>
nmap ]q :cnext<cr>
nmap <space>Q :chistory<cr>
nmap [Q :colder<cr>
nmap ]Q :cnewer<cr>
"Make
nmap <space>m :make<cr>
"Grep (replace with ripgrep)
nmap <space>g :grep<space>
if executable('rg')
set grepprg=rg\ --vimgrep
set grepformat=%f:%l:%c:%m
endif
"Close other splits
nmap <space>o :only<cr>
"Sudo save
cmap w!! w !sudo tee > /dev/null %
'';
extraLuaConfig =
/*
lua
*/
''
vim.g.have_nerd_font = true
vim.wo.relativenumber = false
-- Use system clipboard
vim.opt.clipboard = "unnamedplus"
-- Colorscheme
vim.cmd("colorscheme gruvbox-material")
-- Line Numbers and Cursorline
vim.opt.number = true
vim.opt.cursorline = true
vim.wo.relativenumber = false
vim.keymap.set("n", "<C-a>", "ggVG", { desc = "Select all" })
vim.keymap.set("n", "<C-v>", "p", { desc = "Paste" })
vim.keymap.set("i", "<C-v>", "<esc>p", { desc = "Paste" })
vim.keymap.set("v", "<C-c>", "y", { desc = "Yank" })
-- Nerd Font
vim.g.have_nerd_font = true
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "Go to declaration" })
vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" })
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Go to implementation" })
vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Hover Documentation" })
vim.keymap.set("n", "<space>a", vim.lsp.buf.code_action, { desc = "Code action" })
-- Enable persistent undo
vim.opt.undofile = true
vim.opt.undodir = vim.fn.expand("~/.config/nvim/undo")
-- Diagnostic
vim.keymap.set("n", "<space>d", vim.diagnostic.open_float, { desc = "Floating diagnostic" })
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Previous diagnostic" })
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Next diagnostic" })
vim.keymap.set("n", "gl", vim.diagnostic.setloclist, { desc = "Diagnostics on loclist" })
vim.keymap.set("n", "gq", vim.diagnostic.setqflist, { desc = "Diagnostics on quickfix" })
function add_sign(name, text)
vim.fn.sign_define(name, { text = text, texthl = name, numhl = name })
end
add_sign("DiagnosticSignError", "󰅚 ")
add_sign("DiagnosticSignWarn", " ")
add_sign("DiagnosticSignHint", "󰌶 ")
add_sign("DiagnosticSignInfo", " ")
-- Set wildcharm to tab for triggering completion
vim.opt.wildcharm = vim.fn.char2nr(vim.api.nvim_replace_termcodes("<Tab>", true, true, true))
-- Folding
vim.opt.foldmethod = "manual"
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
-- When it releases
-- vim.opt.foldexpr = "v:lua.vim.treesitter.foldtext()"
-- Tabs
vim.opt.tabstop = 4
vim.opt.expandtab = true
vim.opt.softtabstop = 0
vim.opt.shiftwidth = 0
-- 2 char-wide overrides for specific file types
vim.api.nvim_create_augroup("two_space_tab", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
pattern = { "json", "html", "htmldjango", "hamlet", "nix", "scss", "typescript", "php", "haskell", "terraform" },
command = "setlocal tabstop=2",
group = "two_space_tab",
})
-- Set tera to use htmldjango syntax
vim.api.nvim_create_augroup("tera_htmldjango", { clear = true })
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
pattern = "*.tera",
command = "setfiletype htmldjango",
group = "tera_htmldjango",
})
-- Options when composing mutt mail
vim.api.nvim_create_augroup("mail_settings", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
pattern = "mail",
command = "set noautoindent wrapmargin=0 textwidth=0 linebreak wrap formatoptions+=w",
group = "mail_settings",
})
-- Fix nvim size according to terminal
vim.api.nvim_create_augroup("fix_size", { clear = true })
vim.api.nvim_create_autocmd("VimEnter", {
pattern = "*",
command = "silent exec '!kill -s SIGWINCH' getpid()",
group = "fix_size",
})
-- Highlight when yanking (copying) text
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking (copying) text",
@@ -167,24 +98,24 @@ in {
vim.highlight.on_yank()
end,
})
'';
-- Diagnostic signs
function add_sign(name, text)
vim.fn.sign_define(name, { text = text, texthl = name, numhl = name })
end
add_sign("DiagnosticSignError", "󰅚 ")
add_sign("DiagnosticSignWarn", " ")
add_sign("DiagnosticSignHint", "󰌶 ")
add_sign("DiagnosticSignInfo", " ")
'';
plugins = with pkgs.vimPlugins; [
vim-table-mode
editorconfig-nvim
vim-surround
gruvbox-material-nvim
{
plugin = nvim-autopairs;
type = "lua";
config =
/*
lua
*/
''
require("nvim-autopairs").setup({})
'';
}
];
};

View File

@@ -0,0 +1,79 @@
{
config = {
programs.neovim = {
extraLuaConfig =
/*
lua
*/
''
-- Key mappings for various commands and navigation
vim.api.nvim_set_keymap("n", "<C-j>", "<C-e>", { noremap = true })
vim.api.nvim_set_keymap("n", "<C-k>", "<C-y>", { noremap = true })
-- Buffers
vim.api.nvim_set_keymap("n", "<space>b", ":buffers<CR>", { noremap = true })
vim.api.nvim_set_keymap("n", "<C-l>", ":bnext<CR>", { noremap = true })
vim.api.nvim_set_keymap("n", "<C-h>", ":bprev<CR>", { noremap = true })
vim.api.nvim_set_keymap("n", "<C-q>", ":bdel<CR>", { noremap = true })
-- Navigation
vim.api.nvim_set_keymap("n", "<space>e", ":e<space>", { noremap = true })
vim.api.nvim_set_keymap("n", "<space>E", ":e %:h<tab>", { noremap = true })
vim.api.nvim_set_keymap("n", "<space>c", ":cd<space>", { noremap = true })
vim.api.nvim_set_keymap("n", "<space>C", ":cd %:h<tab>", { noremap = true })
-- Loclist
vim.api.nvim_set_keymap("n", "<space>l", ":lwindow<cr>", { noremap = true })
vim.api.nvim_set_keymap("n", "[l", ":lprev<cr>", { noremap = true })
vim.api.nvim_set_keymap("n", "]l", ":lnext<cr>", { noremap = true })
vim.api.nvim_set_keymap("n", "<space>L", ":lhistory<cr>", { noremap = true })
vim.api.nvim_set_keymap("n", "[L", ":lolder<cr>", { noremap = true })
vim.api.nvim_set_keymap("n", "]L", ":lnewer<cr>", { noremap = true })
-- Quickfix
vim.api.nvim_set_keymap("n", "<space>q", ":cwindow<cr>", { noremap = true })
vim.api.nvim_set_keymap("n", "[q", ":cprev<cr>", { noremap = true })
vim.api.nvim_set_keymap("n", "]q", ":cnext<cr>", { noremap = true })
vim.api.nvim_set_keymap("n", "<space>Q", ":chistory<cr>", { noremap = true })
vim.api.nvim_set_keymap("n", "[Q", ":colder<cr>", { noremap = true })
vim.api.nvim_set_keymap("n", "]Q", ":cnewer<cr>", { noremap = true })
-- Make
vim.api.nvim_set_keymap("n", "<space>m", ":make<cr>", { noremap = true })
-- Grep (replace with ripgrep)
vim.api.nvim_set_keymap("n", "<space>g", ":grep<space>", { noremap = true })
if vim.fn.executable("rg") == 1 then
vim.opt.grepprg = "rg --vimgrep"
vim.opt.grepformat = "%f:%l:%c:%m"
end
-- Close other splits
vim.api.nvim_set_keymap("n", "<space>o", ":only<cr>", { noremap = true })
-- Sudo save
vim.api.nvim_set_keymap("c", "w!!", "w !sudo tee > /dev/null %", { noremap = true })
-- Other utility key mappings
vim.keymap.set("n", "<C-a>", "ggVG", { desc = "Select all" })
vim.keymap.set("n", "<C-v>", "p", { desc = "Paste" })
vim.keymap.set("i", "<C-v>", "<esc>p", { desc = "Paste" })
vim.keymap.set("v", "<C-c>", "y", { desc = "Yank" })
-- LSP-related mappings
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "Go to declaration" })
vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" })
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Go to implementation" })
vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Hover Documentation" })
vim.keymap.set("n", "<space>a", vim.lsp.buf.code_action, { desc = "Code action" })
-- Diagnostics
vim.keymap.set("n", "<space>d", vim.diagnostic.open_float, { desc = "Floating diagnostic" })
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Previous diagnostic" })
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Next diagnostic" })
vim.keymap.set("n", "gl", vim.diagnostic.setloclist, { desc = "Diagnostics on loclist" })
vim.keymap.set("n", "gq", vim.diagnostic.setqflist, { desc = "Diagnostics on quickfix" })
'';
};
};
}

View File

@@ -27,19 +27,6 @@
end
end
-- Add LSPs with lsp-format attached
add_lsp(lspconfig.lua_ls, {})
add_lsp(lspconfig.nixd, {
settings = {
nixd = {
formatting = {
command = { "alejandra" },
},
},
},
})
-- Other LSPs
add_lsp(lspconfig.bashls, {})
add_lsp(lspconfig.clangd, {})
@@ -51,6 +38,8 @@
add_lsp(lspconfig.kotlin_language_server, {})
add_lsp(lspconfig.phpactor, { init_options = { ["language_server_php_cs_fixer.enabled"] = true } })
add_lsp(lspconfig.rust_analyzer, {})
add_lsp(lspconfig.nixd, {})
add_lsp(lspconfig.lua_ls, {})
add_lsp(lspconfig.pylsp, {})
add_lsp(lspconfig.solargraph, {})
add_lsp(lspconfig.terraformls, {})

View File

@@ -1,38 +0,0 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = alpha-nvim;
type = "lua";
config =
/*
lua
*/
''
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = {
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
}
dashboard.section.header.opts.hl = "Title"
dashboard.section.buttons.val = {
dashboard.button( "n", "󰈔 New file" , ":enew<CR>"),
dashboard.button( "e", " Explore", ":Explore<CR>"),
dashboard.button( "g", " Git summary", ":Git | :only<CR>"),
dashboard.button( "c", " Nix config flake" , ":e ~/.nix-config/flake.nix<CR>"),
}
alpha.setup(dashboard.opts)
vim.keymap.set("n", "<space>h", ":Alpha<CR>", { desc = "Open home dashboard" })
'';
}
];
}

View File

@@ -0,0 +1,38 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = alpha-nvim;
type = "lua";
config =
/*
lua
*/
''
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = {
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
}
dashboard.section.header.opts.hl = "Title"
dashboard.section.buttons.val = {
dashboard.button("n", "󰈔 New file", ":enew<CR>"),
dashboard.button("e", " Explore", ":Explore<CR>"),
dashboard.button("g", " Git summary", ":Git | :only<CR>"),
dashboard.button("c", " Nix config flake", ":e ~/.nix-config/flake.nix<CR>"),
}
alpha.setup(dashboard.opts)
vim.keymap.set("n", "<space>h", ":Alpha<CR>", { desc = "Open home dashboard" })
'';
}
];
}

View File

@@ -0,0 +1,15 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = nvim-autopairs;
type = "lua";
config =
/*
lua
*/
''
require("nvim-autopairs").setup({})
'';
}
];
}

View File

@@ -8,7 +8,7 @@
lua
*/
''
require('bqf').setup{}
require("bqf").setup({})
'';
}
];

View File

@@ -8,7 +8,7 @@
lua
*/
''
require('bufferline').setup{}
require("bufferline").setup({})
'';
}
];

View File

@@ -8,7 +8,7 @@
lua
*/
''
require('colorizer').setup{}
require("colorizer").setup({})
'';
}
];

View File

@@ -8,14 +8,14 @@
lua
*/
''
require('Comment').setup{
opleader = {
line = '<C-b>'
},
toggler = {
line = '<C-b>'
},
}
require("Comment").setup({
opleader = {
line = "<C-b>",
},
toggler = {
line = "<C-b>",
},
})
'';
}
];

View File

@@ -9,6 +9,12 @@
*/
''
require("conform").setup({
default_format_opts = {
timeout_ms = 3000,
async = false, -- not recommended to change
quiet = false, -- not recommended to change
lsp_format = "fallback", -- not recommended to change
},
formatters_by_ft = {
bash = { "shfmt" },
css = { "prettierd" },
@@ -18,7 +24,7 @@
lua = { "stylua" },
nix = { "alejandra" },
php = { "php_cs_fixer" },
python = { "black" },
python = { "black" },
rust = { "rustfmt" },
sh = { "shfmt" },
typescript = { "prettierd" },
@@ -31,8 +37,8 @@
-- Optionally, set up a command or auto-command to format on save
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*",
callback = function(args)
require("conform").format({ bufnr = args.buf })
callback = function()
require("conform").format()
end,
})
'';

View File

@@ -1,45 +0,0 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = copilot-lua;
type = "lua";
config =
/*
lua
*/
''
require('copilot').setup({
panel = {
enabled = true,
auto_refresh = true,
keymap = {
jump_prev = "[[",
jump_next = "]]",
accept = "<CR>",
refresh = "gr",
open = "<M-CR>"
},
layout = {
position = "bottom", -- | top | left | right
ratio = 0.4
},
},
suggestion = {
enabled = true,
auto_trigger = true,
hide_during_completion = true,
debounce = 75,
keymap = {
accept = "<C-CR>",
accept_word = false,
accept_line = false,
next = "<M-]>",
prev = "<M-[>",
dismiss = "<C-]>",
},
},
})
'';
}
];
}

View File

@@ -0,0 +1,45 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = copilot-lua;
type = "lua";
config =
/*
lua
*/
''
require("copilot").setup({
panel = {
enabled = true,
auto_refresh = true,
keymap = {
jump_prev = "[[",
jump_next = "]]",
accept = "<CR>",
refresh = "gr",
open = "<M-CR>",
},
layout = {
position = "bottom", -- | top | left | right
ratio = 0.4,
},
},
suggestion = {
enabled = true,
auto_trigger = true,
hide_during_completion = true,
debounce = 75,
keymap = {
accept = "<C-CR>",
accept_word = false,
accept_line = false,
next = "<M-]>",
prev = "<M-[>",
dismiss = "<C-]>",
},
},
})
'';
}
];
}

View File

@@ -3,22 +3,23 @@
vim-illuminate
];
imports = [
./alpha-nvim.nix
./bufferline-nvim.nix
./comment-nvim.nix
./copilot-lua.nix
./fidget-nvim.nix
./gitsigns-nvim.nix
./alpha.nix
./bufferline.nix
./comment.nix
./copilot.nix
./fidget.nix
./gitsigns.nix
./treesitter.nix
./conform-nvim.nix
./gx-nvim.nix
./nvim-bqf.nix
./nvim-colorizer-lua.nix
./nvim-web-devicons.nix
./conform.nix
./gx.nix
./bqf.nix
./colorizer.nix
./web-devicons.nix
./oil.nix
./lualine.nix
./range-highlight-nvim.nix
./vim-fugitive.nix
./range-highlight.nix
./fugitive.nix
./which-key.nix
./autopairs.nix
];
}

View File

@@ -8,13 +8,13 @@
lua
*/
''
require('fidget').setup{
progress = {
display = {
progress_icon = { pattern = "dots", period = 1 },
},
},
}
require("fidget").setup({
progress = {
display = {
progress_icon = { pattern = "dots", period = 1 },
},
},
})
'';
}
];

View File

@@ -1,23 +0,0 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = gitsigns-nvim;
type = "lua";
config =
/*
lua
*/
''
require('gitsigns').setup{
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
}
'';
}
];
}

View File

@@ -0,0 +1,23 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = gitsigns-nvim;
type = "lua";
config =
/*
lua
*/
''
require("gitsigns").setup({
signs = {
add = { text = "+" },
change = { text = "~" },
delete = { text = "_" },
topdelete = { text = "" },
changedelete = { text = "~" },
},
})
'';
}
];
}

View File

@@ -18,9 +18,9 @@ in {
lua
*/
''
require('gx').setup{}
vim.keymap.set({"n", "x"}, "gx", ":Browse<CR>", {
desc = "Open the file under cursor with system app"
require("gx").setup({})
vim.keymap.set({ "n", "x" }, "gx", ":Browse<CR>", {
desc = "Open the file under cursor with system app",
})
'';
}

View File

@@ -8,46 +8,46 @@
lua
*/
''
require('lualine').setup{
options = {
icons_enabled = true,
theme = 'gruvbox-material',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}
require("lualine").setup({
options = {
icons_enabled = true,
theme = "gruvbox-material",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
},
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = { "filename" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {},
})
'';
}
];

View File

@@ -0,0 +1,51 @@
{pkgs, ...}: {
programs.neovim = {
plugins = with pkgs.vimPlugins; [
none-ls-nvim
plenary-nvim
nvim-treesitter.withAllGrammars
];
extraConfig =
/*
lua
*/
''
-- Require necessary plugins
require("plenary")
require("nvim-treesitter.configs").setup({
highlight = {
enable = true,
},
indent = {
enable = true,
},
})
local null_ls = require("null-ls")
-- Setup null-ls with stylua and other formatters
null_ls.setup({
sources = {
null_ls.builtins.formatting.alejandra,
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.isort,
null_ls.builtins.formatting.phpcsfixer,
null_ls.builtins.formatting.pint,
null_ls.builtins.formatting.prettier,
null_ls.builtins.formatting.sql_formatter,
null_ls.builtins.formatting.xmllint,
null_ls.builtins.formatting.shfmt,
},
})
-- Function to format on save
local function format_on_save()
vim.cmd([[autocmd BufWritePre * lua vim.lsp.buf.format({ async = true })]])
end
-- Call the function to enable auto format on save
format_on_save()
'';
};
}

View File

@@ -8,27 +8,27 @@
lua
*/
''
require('oil').setup{
buf_options = {
buflisted = true,
bufhidden = "delete",
},
cleanup_delay_ms = false,
use_default_keymaps = false,
keymaps = {
["<CR>"] = "actions.select",
["-"] = "actions.parent",
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["gc"] = "actions.close",
["gr"] = "actions.refresh",
["gs"] = "actions.change_sort",
["gx"] = "actions.open_external",
["g."] = "actions.toggle_hidden",
["g\\"] = "actions.toggle_trash",
},
}
require("oil").setup({
buf_options = {
buflisted = true,
bufhidden = "delete",
},
cleanup_delay_ms = false,
use_default_keymaps = false,
keymaps = {
["<CR>"] = "actions.select",
["-"] = "actions.parent",
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["gc"] = "actions.close",
["gr"] = "actions.refresh",
["gs"] = "actions.change_sort",
["gx"] = "actions.open_external",
["g."] = "actions.toggle_hidden",
["g\\"] = "actions.toggle_trash",
},
})
'';
}
];

View File

@@ -0,0 +1,15 @@
{pkgs, ...}: {
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = plenary-nvim;
type = "lua";
config =
/*
lua
*/
''
require("plenary").setup({})
'';
}
];
}

View File

@@ -8,7 +8,7 @@
lua
*/
''
require('range-highlight').setup{}
require("range-highlight").setup({})
'';
}
];

View File

@@ -9,15 +9,10 @@
*/
''
require("nvim-treesitter.configs").setup({
-- ensure_installed = { "nix", "lua" },
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
disable = function(lang, bufnr)
return vim.fn.getfsize(vim.api.nvim_buf_get_name(bufnr)) > 1048576
end,
},
parser_install_dir = vim.fn.stdpath("data") .. "/parsers",
})
'';
}

View File

@@ -8,7 +8,7 @@
lua
*/
''
require('nvim-web-devicons').setup{}
require("nvim-web-devicons").setup({})
'';
}
];

View File

@@ -8,7 +8,7 @@
lua
*/
''
require('which-key').setup{}
require("which-key").setup({})
'';
}
];