mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-05 06:50:13 +00:00
move nixos and darwin back into modules dir
This commit is contained in:
22
modules/common/neovim/config/bufferline.nix
Normal file
22
modules/common/neovim/config/bufferline.nix
Normal file
@ -0,0 +1,22 @@
|
||||
{ pkgs, ... }: {
|
||||
plugins = [
|
||||
pkgs.vimPlugins.bufferline-nvim
|
||||
pkgs.vimPlugins.vim-bbye # Better closing of buffers
|
||||
];
|
||||
setup.bufferline = {
|
||||
options = {
|
||||
diagnostics = "nvim_lsp";
|
||||
always_show_bufferline = false;
|
||||
separator_style = "slant";
|
||||
offsets = [{ filetype = "NvimTree"; }];
|
||||
};
|
||||
};
|
||||
lua = ''
|
||||
-- Move buffers
|
||||
vim.keymap.set("n", "L", ":BufferLineCycleNext<CR>", { silent = true })
|
||||
vim.keymap.set("n", "H", ":BufferLineCyclePrev<CR>", { silent = true })
|
||||
|
||||
-- Kill buffer
|
||||
vim.keymap.set("n", "<Leader>x", " :Bdelete<CR>", { silent = true })
|
||||
'';
|
||||
}
|
155
modules/common/neovim/config/completion.nix
Normal file
155
modules/common/neovim/config/completion.nix
Normal file
@ -0,0 +1,155 @@
|
||||
{ pkgs, dsl, ... }: {
|
||||
|
||||
plugins = [
|
||||
pkgs.vimPlugins.cmp-nvim-lsp
|
||||
pkgs.vimPlugins.cmp-buffer
|
||||
pkgs.vimPlugins.cmp-path
|
||||
pkgs.vimPlugins.cmp-cmdline
|
||||
pkgs.vimPlugins.cmp-nvim-lua
|
||||
pkgs.vimPlugins.luasnip
|
||||
pkgs.vimPlugins.cmp_luasnip
|
||||
pkgs.vimPlugins.cmp-rg
|
||||
pkgs.vimPlugins.friendly-snippets
|
||||
];
|
||||
|
||||
use.cmp.setup = dsl.callWith {
|
||||
|
||||
# Disable in telescope buffers
|
||||
enabled = dsl.rawLua ''
|
||||
function()
|
||||
if vim.bo.buftype == "prompt" then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
'';
|
||||
|
||||
snippet.expand = dsl.rawLua ''
|
||||
function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end
|
||||
'';
|
||||
|
||||
mapping = {
|
||||
"['<C-n>']" = dsl.rawLua
|
||||
"require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert })";
|
||||
"['<C-p>']" = dsl.rawLua
|
||||
"require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert })";
|
||||
"['<Down>']" = dsl.rawLua
|
||||
"require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Select })";
|
||||
"['<Up>']" = dsl.rawLua
|
||||
"require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Select })";
|
||||
"['<C-d>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(-4)";
|
||||
"['<C-f>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(4)";
|
||||
"['<C-e>']" = dsl.rawLua "require('cmp').mapping.abort()";
|
||||
"['<CR>']" = dsl.rawLua
|
||||
"require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
|
||||
"['<C-r>']" = dsl.rawLua
|
||||
"require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
|
||||
"['<Esc>']" = dsl.rawLua ''
|
||||
function(_)
|
||||
cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
})
|
||||
vim.cmd("stopinsert") --- Abort and leave insert mode
|
||||
end
|
||||
'';
|
||||
"['<C-l>']" = dsl.rawLua ''
|
||||
cmp.mapping(function(_)
|
||||
if require("luasnip").expand_or_jumpable() then
|
||||
require("luasnip").expand_or_jump()
|
||||
end
|
||||
end, { "i", "s" })
|
||||
'';
|
||||
};
|
||||
|
||||
sources = [
|
||||
{ name = "nvim_lua"; }
|
||||
{ name = "nvim_lsp"; }
|
||||
{ name = "luasnip"; }
|
||||
{ name = "path"; }
|
||||
{
|
||||
name = "buffer";
|
||||
keyword_length = 3;
|
||||
max_item_count = 10;
|
||||
}
|
||||
{
|
||||
name = "rg";
|
||||
keyword_length = 6;
|
||||
max_item_count = 10;
|
||||
option = { additional_arguments = "--ignore-case"; };
|
||||
}
|
||||
];
|
||||
|
||||
formatting = {
|
||||
fields = [ "kind" "abbr" "menu" ];
|
||||
format = dsl.rawLua ''
|
||||
function(entry, vim_item)
|
||||
local kind_icons = {
|
||||
Text = "",
|
||||
Method = "m",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Class = "",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
}
|
||||
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
|
||||
vim_item.menu = ({
|
||||
luasnip = "[Snippet]",
|
||||
buffer = "[Buffer]",
|
||||
path = "[Path]",
|
||||
rg = "[Grep]",
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[Lua]",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
experimental = {
|
||||
native_menu = false; # Use cmp menu instead of Vim menu
|
||||
ghost_text = true; # Show preview auto-completion
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
lua = ''
|
||||
-- Use buffer source for `/`
|
||||
require('cmp').setup.cmdline("/", {
|
||||
sources = {
|
||||
{ name = "buffer", keyword_length = 5 },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':'
|
||||
require('cmp').setup.cmdline(":", {
|
||||
sources = require('cmp').config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
'';
|
||||
|
||||
}
|
35
modules/common/neovim/config/gitsigns.lua
Normal file
35
modules/common/neovim/config/gitsigns.lua
Normal file
@ -0,0 +1,35 @@
|
||||
vim.keymap.set("", "<Space>", "<Nop>", { silent = true })
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
local gitsigns = require("gitsigns")
|
||||
vim.keymap.set("n", "<Leader>gB", gitsigns.blame_line)
|
||||
vim.keymap.set("n", "<Leader>gp", gitsigns.preview_hunk)
|
||||
vim.keymap.set("v", "<Leader>gp", gitsigns.preview_hunk)
|
||||
vim.keymap.set("n", "<Leader>gd", gitsigns.diffthis)
|
||||
vim.keymap.set("v", "<Leader>gd", gitsigns.diffthis)
|
||||
vim.keymap.set("n", "<Leader>rgf", gitsigns.reset_buffer)
|
||||
vim.keymap.set("v", "<Leader>hs", gitsigns.stage_hunk)
|
||||
vim.keymap.set("n", "<Leader>hr", gitsigns.reset_hunk)
|
||||
vim.keymap.set("v", "<Leader>hr", gitsigns.reset_hunk)
|
||||
|
||||
-- Navigation
|
||||
vim.keymap.set("n", "]g", function()
|
||||
if vim.wo.diff then
|
||||
return "]g"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gitsigns.next_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true })
|
||||
|
||||
vim.keymap.set("n", "[g", function()
|
||||
if vim.wo.diff then
|
||||
return "[g"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gitsigns.prev_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true })
|
5
modules/common/neovim/config/gitsigns.nix
Normal file
5
modules/common/neovim/config/gitsigns.nix
Normal file
@ -0,0 +1,5 @@
|
||||
{ pkgs, ... }: {
|
||||
plugins = [ pkgs.vimPlugins.gitsigns-nvim ];
|
||||
setup.gitsigns = { };
|
||||
lua = builtins.readFile ./gitsigns.lua;
|
||||
}
|
10
modules/common/neovim/config/lsp.lua
Normal file
10
modules/common/neovim/config/lsp.lua
Normal file
@ -0,0 +1,10 @@
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition)
|
||||
vim.keymap.set("n", "gT", vim.lsp.buf.type_definition)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation)
|
||||
vim.keymap.set("n", "gh", vim.lsp.buf.hover)
|
||||
-- vim.keymap.set("n", "gr", telescope.lsp_references)
|
||||
vim.keymap.set("n", "<Leader>R", vim.lsp.buf.rename)
|
||||
vim.keymap.set("n", "]e", vim.diagnostic.goto_next)
|
||||
vim.keymap.set("n", "[e", vim.diagnostic.goto_prev)
|
||||
vim.keymap.set("n", "<Leader>de", vim.diagnostic.open_float)
|
||||
vim.keymap.set("n", "<Leader>E", vim.lsp.buf.code_action)
|
66
modules/common/neovim/config/lsp.nix
Normal file
66
modules/common/neovim/config/lsp.nix
Normal file
@ -0,0 +1,66 @@
|
||||
{ pkgs, dsl, ... }: {
|
||||
|
||||
plugins = [
|
||||
pkgs.vimPlugins.nvim-lspconfig
|
||||
pkgs.vimPlugins.lsp-colors-nvim
|
||||
pkgs.vimPlugins.null-ls-nvim
|
||||
];
|
||||
|
||||
use.lspconfig.sumneko_lua.setup = dsl.callWith {
|
||||
settings = { Lua = { diagnostics = { globals = [ "vim" "hs" ]; }; }; };
|
||||
capabilities = dsl.rawLua "require('cmp_nvim_lsp').default_capabilities()";
|
||||
cmd = [ "${pkgs.sumneko-lua-language-server}/bin/lua-language-server" ];
|
||||
};
|
||||
|
||||
use.lspconfig.nil_ls.setup = dsl.callWith {
|
||||
cmd = [ "${pkgs.nil}/bin/nil" ];
|
||||
capabilities = dsl.rawLua "require('cmp_nvim_lsp').default_capabilities()";
|
||||
};
|
||||
|
||||
use.lspconfig.pyright.setup = dsl.callWith {
|
||||
cmd = [ "${pkgs.pyright}/bin/pyright-langserver" "--stdio" ];
|
||||
};
|
||||
|
||||
use.lspconfig.terraformls.setup =
|
||||
dsl.callWith { cmd = [ "${pkgs.terraform-ls}/bin/terraform-ls" "serve" ]; };
|
||||
|
||||
vim.api.nvim_create_augroup = dsl.callWith [ "LspFormatting" { } ];
|
||||
|
||||
lua = ''
|
||||
${builtins.readFile ./lsp.lua}
|
||||
|
||||
require("null-ls").setup({
|
||||
sources = {
|
||||
require("null-ls").builtins.formatting.stylua.with({ command = "${pkgs.stylua}/bin/stylua" }),
|
||||
require("null-ls").builtins.formatting.black.with({ command = "${pkgs.black}/bin/black" }),
|
||||
require("null-ls").builtins.diagnostics.flake8.with({ command = "${pkgs.python310Packages.flake8}/bin/flake8" }),
|
||||
require("null-ls").builtins.formatting.fish_indent.with({ command = "${pkgs.fish}/bin/fish_indent" }),
|
||||
require("null-ls").builtins.formatting.nixfmt.with({ command = "${pkgs.nixfmt}/bin/nixfmt" }),
|
||||
require("null-ls").builtins.formatting.rustfmt.with({ command = "${pkgs.rustfmt}/bin/rustfmt" }),
|
||||
require("null-ls").builtins.diagnostics.shellcheck.with({ command = "${pkgs.shellcheck}/bin/shellcheck" }),
|
||||
require("null-ls").builtins.formatting.shfmt.with({
|
||||
command = "${pkgs.shfmt}/bin/shfmt",
|
||||
extra_args = { "-i", "4", "-ci" },
|
||||
}),
|
||||
require("null-ls").builtins.formatting.terraform_fmt.with({
|
||||
command = "${pkgs.terraform}/bin/terraform",
|
||||
extra_filetypes = { "hcl" },
|
||||
}),
|
||||
},
|
||||
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
'';
|
||||
|
||||
}
|
70
modules/common/neovim/config/misc.nix
Normal file
70
modules/common/neovim/config/misc.nix
Normal file
@ -0,0 +1,70 @@
|
||||
{ pkgs, dsl, lib, ... }: {
|
||||
plugins = [
|
||||
pkgs.vimPlugins.vim-surround # Keybinds for surround characters
|
||||
pkgs.vimPlugins.vim-eunuch # File manipulation commands
|
||||
pkgs.vimPlugins.vim-fugitive # Git commands
|
||||
pkgs.vimPlugins.vim-repeat # Better repeat using .
|
||||
pkgs.vimPlugins.comment-nvim # Smart comment commands
|
||||
pkgs.vimPlugins.impatient-nvim # Faster load times
|
||||
pkgs.vimPlugins.glow-nvim # Markdown preview popup
|
||||
pkgs.vimPlugins.nvim-colorizer-lua # Hex color previews
|
||||
];
|
||||
|
||||
setup.Comment = { };
|
||||
setup.colorizer = { };
|
||||
|
||||
vim.o = {
|
||||
termguicolors = true; # Set to truecolor
|
||||
hidden = true; # Don't unload buffers when leaving them
|
||||
list = true; # Reveal whitespace with dashes
|
||||
expandtab = true; # Tabs into spaces
|
||||
shiftwidth = 4; # Amount to shift with > key
|
||||
softtabstop = 4; # Amount to shift with <TAB> key
|
||||
ignorecase = true; # Ignore case when searching
|
||||
smartcase = true; # Check case when using capitals in search
|
||||
infercase = true; # Don't match cases when completing suggestions
|
||||
incsearch = true; # Search while typing
|
||||
visualbell = true; # No sounds
|
||||
scrolljump = 1; # Number of lines to scroll
|
||||
scrolloff = 3; # Margin of lines to see while scrolling
|
||||
splitright = true; # Vertical splits on the right side
|
||||
splitbelow = true; # Horizontal splits on the bottom side
|
||||
pastetoggle = "<F3>"; # Use F3 to enter raw paste mode
|
||||
clipboard = "unnamedplus"; # Uses system clipboard for yanking
|
||||
updatetime = 300; # Faster diagnostics
|
||||
mouse = "nv"; # Mouse interaction / scrolling
|
||||
inccommand = "split"; # Live preview search and replace
|
||||
};
|
||||
|
||||
vim.wo = {
|
||||
number = true; # Show line numbers
|
||||
relativenumber = true; # Relative numbers instead of absolute
|
||||
};
|
||||
|
||||
# Better backup, swap and undo storage
|
||||
vim.o.backup = true; # Easier to recover and more secure
|
||||
vim.bo.swapfile = false; # Instead of swaps, create backups
|
||||
vim.bo.undofile = true; # Keeps undos after quit
|
||||
vim.o.backupdir = dsl.rawLua ''vim.fn.stdpath("cache") .. "/backup"'';
|
||||
|
||||
# Required for nvim-cmp completion
|
||||
vim.opt.completeopt = [ "menu" "menuone" "noselect" ];
|
||||
|
||||
lua = lib.mkBefore ''
|
||||
require("impatient")
|
||||
${builtins.readFile ../lua/keybinds.lua};
|
||||
${builtins.readFile ../lua/settings.lua};
|
||||
'';
|
||||
|
||||
vimscript = ''
|
||||
" Remember last position when reopening file
|
||||
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
||||
|
||||
" LaTeX options
|
||||
au FileType tex inoremap ;bf \textbf{}<Esc>i
|
||||
au BufWritePost *.tex silent! execute "!pdflatex -output-directory=%:p:h % >/dev/null 2>&1" | redraw!
|
||||
|
||||
" Flash highlight when yanking
|
||||
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 }
|
||||
'';
|
||||
}
|
9
modules/common/neovim/config/statusline.nix
Normal file
9
modules/common/neovim/config/statusline.nix
Normal file
@ -0,0 +1,9 @@
|
||||
{ pkgs, ... }: {
|
||||
plugins = [ pkgs.vimPlugins.lualine-nvim ];
|
||||
setup.lualine = {
|
||||
options = {
|
||||
theme = "gruvbox";
|
||||
icons_enabled = true;
|
||||
};
|
||||
};
|
||||
}
|
52
modules/common/neovim/config/syntax.nix
Normal file
52
modules/common/neovim/config/syntax.nix
Normal file
@ -0,0 +1,52 @@
|
||||
{ pkgs, ... }: {
|
||||
|
||||
plugins = [
|
||||
(pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins:
|
||||
with pkgs.tree-sitter-grammars; [
|
||||
tree-sitter-hcl
|
||||
tree-sitter-python
|
||||
tree-sitter-lua
|
||||
tree-sitter-nix
|
||||
tree-sitter-fish
|
||||
tree-sitter-toml
|
||||
tree-sitter-yaml
|
||||
tree-sitter-json
|
||||
]))
|
||||
pkgs.vimPlugins.vim-matchup # Better % jumping in languages
|
||||
pkgs.vimPlugins.nginx-vim
|
||||
pkgs.vimPlugins.vim-helm
|
||||
pkgs.vimPlugins.vim-puppet
|
||||
];
|
||||
|
||||
setup."nvim-treesitter.configs" = {
|
||||
highlight = { enable = true; };
|
||||
indent = { enable = true; };
|
||||
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true;
|
||||
lookahead = true; # Jump forward automatically
|
||||
|
||||
keymaps = {
|
||||
"['af']" = "@function.outer";
|
||||
"['if']" = "@function.inner";
|
||||
"['ac']" = "@class.outer";
|
||||
"['ic']" = "@class.inner";
|
||||
"['al']" = "@loop.outer";
|
||||
"['il']" = "@loop.inner";
|
||||
"['aa']" = "@call.outer";
|
||||
"['ia']" = "@call.inner";
|
||||
"['ar']" = "@parameter.outer";
|
||||
"['ir']" = "@parameter.inner";
|
||||
"['aC']" = "@comment.outer";
|
||||
"['iC']" = "@comment.outer";
|
||||
"['a/']" = "@comment.outer";
|
||||
"['i/']" = "@comment.outer";
|
||||
"['a;']" = "@statement.outer";
|
||||
"['i;']" = "@statement.outer";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
69
modules/common/neovim/config/telescope.lua
Normal file
69
modules/common/neovim/config/telescope.lua
Normal file
@ -0,0 +1,69 @@
|
||||
local telescope = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<Leader>k", telescope.keymaps)
|
||||
vim.keymap.set("n", "<Leader>/", telescope.live_grep)
|
||||
vim.keymap.set("n", "<Leader>ff", telescope.find_files)
|
||||
vim.keymap.set("n", "<Leader>fp", telescope.git_files)
|
||||
vim.keymap.set("n", "<Leader>fw", telescope.grep_string)
|
||||
vim.keymap.set("n", "<Leader>b", telescope.buffers)
|
||||
vim.keymap.set("n", "<Leader>hh", telescope.help_tags)
|
||||
vim.keymap.set("n", "<Leader>fr", telescope.oldfiles)
|
||||
vim.keymap.set("n", "<Leader>cc", telescope.commands)
|
||||
vim.keymap.set("n", "<Leader>gc", telescope.git_commits)
|
||||
vim.keymap.set("n", "<Leader>gf", telescope.git_bcommits)
|
||||
vim.keymap.set("n", "<Leader>gb", telescope.git_branches)
|
||||
vim.keymap.set("n", "<Leader>gs", telescope.git_status)
|
||||
vim.keymap.set("n", "<Leader>s", telescope.current_buffer_fuzzy_find)
|
||||
|
||||
vim.keymap.set("n", "<Leader>N", function()
|
||||
local opts = {
|
||||
prompt_title = "Search Notes",
|
||||
cwd = "$NOTES_PATH",
|
||||
}
|
||||
telescope.live_grep(opts)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<Leader>fN", function()
|
||||
local opts = {
|
||||
prompt_title = "Find Notes",
|
||||
cwd = "$NOTES_PATH",
|
||||
}
|
||||
telescope.find_files(opts)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<Leader>cr", function()
|
||||
local opts = require("telescope.themes").get_ivy({
|
||||
layout_config = {
|
||||
bottom_pane = {
|
||||
height = 15,
|
||||
},
|
||||
},
|
||||
})
|
||||
telescope.command_history(opts)
|
||||
end)
|
||||
|
||||
-- Zoxide
|
||||
vim.keymap.set("n", "<Leader>fz", require("telescope").extensions.zoxide.list)
|
||||
|
||||
-- Project
|
||||
require("telescope").load_extension("project")
|
||||
vim.keymap.set("n", "<C-p>", function()
|
||||
local opts = require("telescope.themes").get_ivy({
|
||||
layout_config = {
|
||||
bottom_pane = {
|
||||
height = 10,
|
||||
},
|
||||
},
|
||||
})
|
||||
require("telescope").extensions.project.project(opts)
|
||||
end)
|
||||
|
||||
-- File browser
|
||||
require("telescope").load_extension("file_browser")
|
||||
vim.keymap.set("n", "<Leader>fa", require("telescope").extensions.file_browser.file_browser)
|
||||
vim.keymap.set("n", "<Leader>fD", function()
|
||||
local opts = {
|
||||
prompt_title = "Find Downloads",
|
||||
cwd = "~/downloads",
|
||||
}
|
||||
require("telescope").extensions.file_browser.file_browser(opts)
|
||||
end)
|
34
modules/common/neovim/config/telescope.nix
Normal file
34
modules/common/neovim/config/telescope.nix
Normal file
@ -0,0 +1,34 @@
|
||||
{ pkgs, dsl, ... }: {
|
||||
|
||||
plugins = [
|
||||
pkgs.vimPlugins.telescope-nvim
|
||||
pkgs.vimPlugins.telescope-project-nvim
|
||||
pkgs.vimPlugins.telescope-fzy-native-nvim
|
||||
pkgs.vimPlugins.telescope-file-browser-nvim
|
||||
pkgs.vimPlugins.telescope-zoxide
|
||||
];
|
||||
|
||||
setup.telescope = {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
"['<esc>']" = dsl.rawLua "require('telescope.actions').close";
|
||||
"['<C-h>']" = "which_key";
|
||||
};
|
||||
};
|
||||
};
|
||||
pickers = {
|
||||
find_files = { theme = "ivy"; };
|
||||
oldfiles = { theme = "ivy"; };
|
||||
buffers = { theme = "dropdown"; };
|
||||
};
|
||||
extensions = {
|
||||
fzy_native = { };
|
||||
zoxide = { };
|
||||
project = { base_dirs = [ "~/dev" ]; };
|
||||
};
|
||||
};
|
||||
|
||||
lua = builtins.readFile ./telescope.lua;
|
||||
|
||||
}
|
40
modules/common/neovim/config/toggleterm.lua
Normal file
40
modules/common/neovim/config/toggleterm.lua
Normal file
@ -0,0 +1,40 @@
|
||||
vim.keymap.set("t", "<A-CR>", "<C-\\><C-n>") --- Exit terminal mode
|
||||
|
||||
-- Only set these keymaps for toggleterm
|
||||
vim.api.nvim_create_autocmd("TermOpen", {
|
||||
pattern = "term://*toggleterm#*",
|
||||
callback = function()
|
||||
-- vim.keymap.set("t", "<Esc>", "<C-\\><C-n>") --- Exit terminal mode
|
||||
vim.keymap.set("t", "<C-h>", "<C-\\><C-n><C-w>h")
|
||||
vim.keymap.set("t", "<C-j>", "<C-\\><C-n><C-w>j")
|
||||
vim.keymap.set("t", "<C-k>", "<C-\\><C-n><C-w>k")
|
||||
vim.keymap.set("t", "<C-l>", "<C-\\><C-n><C-w>l")
|
||||
end,
|
||||
})
|
||||
|
||||
local terminal = require("toggleterm.terminal").Terminal
|
||||
|
||||
local basicterminal = terminal:new()
|
||||
function TERM_TOGGLE()
|
||||
basicterminal:toggle()
|
||||
end
|
||||
|
||||
local nixpkgs = terminal:new({ cmd = "nix repl '<nixpkgs>'" })
|
||||
function NIXPKGS_TOGGLE()
|
||||
nixpkgs:toggle()
|
||||
end
|
||||
|
||||
local gitwatch = terminal:new({ cmd = "fish --interactive --init-command 'gh run watch'" })
|
||||
function GITWATCH_TOGGLE()
|
||||
gitwatch:toggle()
|
||||
end
|
||||
|
||||
local k9s = terminal:new({ cmd = "k9s" })
|
||||
function K9S_TOGGLE()
|
||||
k9s:toggle()
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<Leader>t", TERM_TOGGLE)
|
||||
vim.keymap.set("n", "<Leader>P", NIXPKGS_TOGGLE)
|
||||
vim.keymap.set("n", "<Leader>gw", GITWATCH_TOGGLE)
|
||||
vim.keymap.set("n", "<Leader>9", K9S_TOGGLE)
|
13
modules/common/neovim/config/toggleterm.nix
Normal file
13
modules/common/neovim/config/toggleterm.nix
Normal file
@ -0,0 +1,13 @@
|
||||
{ pkgs, dsl, ... }: {
|
||||
|
||||
plugins = [ pkgs.vimPlugins.toggleterm-nvim ];
|
||||
|
||||
use.toggleterm.setup = dsl.callWith {
|
||||
open_mapping = dsl.rawLua "[[<c-\\>]]";
|
||||
hide_numbers = true;
|
||||
direction = "float";
|
||||
};
|
||||
|
||||
lua = builtins.readFile ./toggleterm.lua;
|
||||
|
||||
}
|
77
modules/common/neovim/config/tree.nix
Normal file
77
modules/common/neovim/config/tree.nix
Normal file
@ -0,0 +1,77 @@
|
||||
{ pkgs, dsl, ... }: {
|
||||
|
||||
plugins = [ pkgs.vimPlugins.nvim-tree-lua pkgs.vimPlugins.nvim-web-devicons ];
|
||||
|
||||
# Disable netrw eagerly
|
||||
# https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129
|
||||
vim.g = {
|
||||
loaded = 1;
|
||||
loaded_netrwPlugin = 1;
|
||||
};
|
||||
|
||||
setup.nvim-tree = {
|
||||
disable_netrw = true;
|
||||
hijack_netrw = true;
|
||||
update_focused_file = {
|
||||
enable = true;
|
||||
update_cwd = true;
|
||||
ignore_list = { };
|
||||
};
|
||||
diagnostics = {
|
||||
enable = true;
|
||||
icons = {
|
||||
hint = "";
|
||||
info = "";
|
||||
warning = "";
|
||||
error = "";
|
||||
};
|
||||
};
|
||||
renderer = {
|
||||
icons = {
|
||||
glyphs = {
|
||||
git = {
|
||||
unstaged = "~";
|
||||
staged = "+";
|
||||
unmerged = "";
|
||||
renamed = "➜";
|
||||
deleted = "";
|
||||
untracked = "?";
|
||||
ignored = "◌";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
view = {
|
||||
width = 30;
|
||||
hide_root_folder = false;
|
||||
side = "left";
|
||||
mappings = {
|
||||
custom_only = false;
|
||||
list = [
|
||||
{
|
||||
key = [ "l" "<CR>" "o" ];
|
||||
cb = dsl.rawLua
|
||||
"require('nvim-tree.config').nvim_tree_callback('edit')";
|
||||
}
|
||||
{
|
||||
key = "h";
|
||||
cb = dsl.rawLua
|
||||
"require('nvim-tree.config').nvim_tree_callback('close_node')";
|
||||
}
|
||||
{
|
||||
key = "v";
|
||||
cb = dsl.rawLua
|
||||
"require('nvim-tree.config').nvim_tree_callback('vsplit')";
|
||||
}
|
||||
];
|
||||
};
|
||||
number = false;
|
||||
relativenumber = false;
|
||||
};
|
||||
};
|
||||
|
||||
lua = ''
|
||||
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
|
||||
'';
|
||||
|
||||
}
|
44
modules/common/neovim/default.nix
Normal file
44
modules/common/neovim/default.nix
Normal file
@ -0,0 +1,44 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
|
||||
neovim = import ./package {
|
||||
inherit pkgs;
|
||||
colors = import config.theme.colors.neovimConfig { inherit pkgs; };
|
||||
};
|
||||
|
||||
in {
|
||||
|
||||
options.neovim.enable = lib.mkEnableOption "Neovim.";
|
||||
|
||||
config = lib.mkIf config.neovim.enable {
|
||||
home-manager.users.${config.user} =
|
||||
|
||||
{
|
||||
|
||||
home.packages = [ neovim ];
|
||||
|
||||
programs.git.extraConfig.core.editor = "nvim";
|
||||
home.sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
MANPAGER = "nvim +Man!";
|
||||
};
|
||||
programs.fish = {
|
||||
shellAliases = { vim = "nvim"; };
|
||||
shellAbbrs = {
|
||||
v = lib.mkForce "nvim";
|
||||
vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'";
|
||||
vll = "nvim -c 'Telescope oldfiles'";
|
||||
};
|
||||
};
|
||||
programs.kitty.settings.scrollback_pager = lib.mkForce ''
|
||||
${neovim}/bin/nvim -c 'setlocal nonumber nolist showtabline=0 foldcolumn=0|Man!' -c "autocmd VimEnter * normal G" -'';
|
||||
|
||||
};
|
||||
|
||||
# # Used for icons in Vim
|
||||
# fonts.fonts = with pkgs; [ nerdfonts ];
|
||||
|
||||
};
|
||||
|
||||
}
|
4
modules/common/neovim/init.lua
Normal file
4
modules/common/neovim/init.lua
Normal file
@ -0,0 +1,4 @@
|
||||
require("packer_init")
|
||||
require("settings")
|
||||
require("keybinds")
|
||||
require("background")
|
78
modules/common/neovim/lua/keybinds.lua
Normal file
78
modules/common/neovim/lua/keybinds.lua
Normal file
@ -0,0 +1,78 @@
|
||||
-- ===========================================================================
|
||||
-- Key Mapping
|
||||
-- ===========================================================================
|
||||
|
||||
-- Function to cut down config boilerplate
|
||||
local key = function(mode, key_sequence, action, params)
|
||||
params = params or {}
|
||||
vim.keymap.set(mode, key_sequence, action, params)
|
||||
end
|
||||
|
||||
-- Remap space as leader key
|
||||
key("", "<Space>", "<Nop>", { silent = true })
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
-- Keep selection when changing indentation
|
||||
key("v", "<", "<gv")
|
||||
key("v", ">", ">gv")
|
||||
|
||||
-- Clear search register
|
||||
key("n", "<CR>", ":noh<CR><CR>", { silent = true })
|
||||
|
||||
-- Shuffle lines around
|
||||
key("n", "<A-j>", ":m .+1<CR>==")
|
||||
key("n", "<A-k>", ":m .-2<CR>==")
|
||||
key("v", "<A-j>", ":m '>+1<CR>gv=gv")
|
||||
key("v", "<A-k>", ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- Better window navigation
|
||||
key("n", "<C-h>", "<C-w>h")
|
||||
key("n", "<C-j>", "<C-w>j")
|
||||
key("n", "<C-k>", "<C-w>k")
|
||||
key("n", "<C-l>", "<C-w>l")
|
||||
|
||||
-- File commands
|
||||
key("n", "<Leader>q", ":quit<CR>")
|
||||
key("n", "<Leader>Q", ":quitall<CR>")
|
||||
key("n", "<Leader>fs", ":write<CR>")
|
||||
key("n", "<Leader>fd", ":lcd %:p:h<CR>", { silent = true })
|
||||
key("n", "<Leader>fu", ":lcd ..<CR>", { silent = true })
|
||||
key("n", "<Leader><Tab>", ":b#<CR>", { silent = true })
|
||||
key("n", "<Leader>gr", ":!gh repo view -w<CR><CR>", { silent = true })
|
||||
key("n", "<Leader>tt", [[<Cmd>exe 'edit $NOTES_PATH/journal/'.strftime("%Y-%m-%d_%a").'.md'<CR>]])
|
||||
key("n", "<Leader>jj", ":!journal<CR>:e<CR>")
|
||||
|
||||
-- Window commands
|
||||
key("n", "<Leader>wv", ":vsplit<CR>")
|
||||
key("n", "<Leader>wh", ":split<CR>")
|
||||
key("n", "<Leader>wm", ":only<CR>")
|
||||
|
||||
-- Vimrc editing
|
||||
key("n", "<Leader>rr", ":luafile $HOME/.config/nvim/init.lua<CR>")
|
||||
key("n", "<Leader>rp", ":luafile $HOME/.config/nvim/init.lua<CR>:PackerInstall<CR>:")
|
||||
key("n", "<Leader>rc", ":luafile $HOME/.config/nvim/init.lua<CR>:PackerCompile<CR>")
|
||||
|
||||
-- Keep cursor in place
|
||||
key("n", "n", "nzz")
|
||||
key("n", "N", "Nzz")
|
||||
key("n", "J", "mzJ`z") --- Mark and jump back to it
|
||||
|
||||
-- Add undo breakpoints
|
||||
key("i", ",", ",<C-g>u")
|
||||
key("i", ".", ".<C-g>u")
|
||||
key("i", "!", "!<C-g>u")
|
||||
key("i", "?", "?<C-g>u")
|
||||
|
||||
-- Resize with arrows
|
||||
key("n", "<C-Up>", ":resize +2<CR>", { silent = true })
|
||||
key("n", "<C-Down>", ":resize -2<CR>", { silent = true })
|
||||
key("n", "<C-Left>", ":vertical resize -2<CR>", { silent = true })
|
||||
key("n", "<C-Right>", ":vertical resize +2<CR>", { silent = true })
|
||||
|
||||
-- Other
|
||||
key("n", "<A-CR>", ":noh<CR>", { silent = true }) --- Clear search in VimWiki
|
||||
key("n", "Y", "y$") --- Copy to end of line
|
||||
key("v", "<C-r>", "y<Esc>:%s/<C-r>+//gc<left><left><left>") --- Substitute selected
|
||||
key("v", "D", "y'>gp") --- Duplicate selected
|
||||
key("x", "<Leader>p", '"_dP') --- Paste but keep register
|
164
modules/common/neovim/lua/packer/completion.lua
Normal file
164
modules/common/neovim/lua/packer/completion.lua
Normal file
@ -0,0 +1,164 @@
|
||||
-- =======================================================================
|
||||
-- Completion System
|
||||
-- =======================================================================
|
||||
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
-- Completion sources
|
||||
use("hrsh7th/cmp-nvim-lsp") --- Language server completion plugin
|
||||
use("hrsh7th/cmp-buffer") --- Generic text completion
|
||||
use("hrsh7th/cmp-path") --- Local file completion
|
||||
use("hrsh7th/cmp-cmdline") --- Command line completion
|
||||
use("hrsh7th/cmp-nvim-lua") --- Nvim lua api completion
|
||||
use("saadparwaiz1/cmp_luasnip") --- Luasnip completion
|
||||
use("lukas-reineke/cmp-rg") --- Ripgrep completion
|
||||
use("rafamadriz/friendly-snippets") -- Lots of pre-generated snippets
|
||||
|
||||
-- Completion engine
|
||||
use({
|
||||
"hrsh7th/nvim-cmp",
|
||||
requires = { "L3MON4D3/LuaSnip" },
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
|
||||
local kind_icons = {
|
||||
Text = "",
|
||||
Method = "m",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Class = "",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
}
|
||||
|
||||
cmp.setup({
|
||||
|
||||
-- Only enable on non-prompt buffers
|
||||
-- So don't use in telescope
|
||||
enabled = function()
|
||||
if vim.bo.buftype == "prompt" then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
|
||||
-- Setup snippet completion
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
-- Setup completion keybinds
|
||||
mapping = {
|
||||
["<C-n>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
|
||||
["<C-p>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
|
||||
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
|
||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
|
||||
["<C-e>"] = cmp.mapping(cmp.mapping.abort(), { "i", "c" }),
|
||||
["<Esc>"] = function(_)
|
||||
cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
})
|
||||
vim.cmd("stopinsert") --- Abort and leave insert mode
|
||||
end,
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
}),
|
||||
["<C-r>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
["<C-l>"] = cmp.mapping(function(_)
|
||||
if require("luasnip").expand_or_jumpable() then
|
||||
require("luasnip").expand_or_jump()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
|
||||
-- Setup completion engines
|
||||
sources = {
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
{ name = "buffer", keyword_length = 3, max_item_count = 10 },
|
||||
{
|
||||
name = "rg",
|
||||
keyword_length = 6,
|
||||
max_item_count = 10,
|
||||
option = { additional_arguments = "--ignore-case" },
|
||||
},
|
||||
},
|
||||
|
||||
-- Visual presentation
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
|
||||
vim_item.menu = ({
|
||||
luasnip = "[Snippet]",
|
||||
buffer = "[Buffer]",
|
||||
path = "[Path]",
|
||||
rg = "[Grep]",
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[Lua]",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
|
||||
-- Docs
|
||||
-- window = {
|
||||
-- completion = cmp.config.window.bordered(),
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
-- },
|
||||
|
||||
-- Extra features
|
||||
experimental = {
|
||||
native_menu = false, --- Use cmp menu instead of Vim menu
|
||||
ghost_text = true, --- Show preview auto-completion
|
||||
},
|
||||
})
|
||||
|
||||
-- Use buffer source for `/`
|
||||
cmp.setup.cmdline("/", {
|
||||
sources = {
|
||||
{ name = "buffer", keyword_length = 5 },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':'
|
||||
cmp.setup.cmdline(":", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
153
modules/common/neovim/lua/packer/lsp.lua
Normal file
153
modules/common/neovim/lua/packer/lsp.lua
Normal file
@ -0,0 +1,153 @@
|
||||
-- =======================================================================
|
||||
-- Language Server
|
||||
-- =======================================================================
|
||||
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
-- Language server engine
|
||||
use({
|
||||
"neovim/nvim-lspconfig",
|
||||
requires = { "hrsh7th/cmp-nvim-lsp" },
|
||||
config = function()
|
||||
local function on_path(program)
|
||||
return vim.fn.executable(program) == 1
|
||||
end
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
if on_path("lua-language-server") then
|
||||
require("lspconfig").sumneko_lua.setup({
|
||||
capabilities = capabilities,
|
||||
-- Turn off errors for vim global variable
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim", "hs" },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
if on_path("rust-analyzer") then
|
||||
require("lspconfig").rust_analyzer.setup({ capabilities = capabilities })
|
||||
end
|
||||
if on_path("tflint") then
|
||||
require("lspconfig").tflint.setup({ capabilities = capabilities })
|
||||
end
|
||||
if on_path("terraform-ls") then
|
||||
require("lspconfig").terraformls.setup({ capabilities = capabilities })
|
||||
end
|
||||
if on_path("pyright") then
|
||||
require("lspconfig").pyright.setup({
|
||||
on_attach = function()
|
||||
-- set keymaps (requires 0.7.0)
|
||||
-- vim.keymap.set("n", "", "", {buffer=0})
|
||||
end,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end
|
||||
if on_path("nil") then
|
||||
require("lspconfig").nil_ls.setup({ capabilities = capabilities })
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition)
|
||||
vim.keymap.set("n", "gT", vim.lsp.buf.type_definition)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation)
|
||||
vim.keymap.set("n", "gh", vim.lsp.buf.hover)
|
||||
-- vim.keymap.set("n", "gr", telescope.lsp_references)
|
||||
vim.keymap.set("n", "<Leader>R", vim.lsp.buf.rename)
|
||||
vim.keymap.set("n", "]e", vim.diagnostic.goto_next)
|
||||
vim.keymap.set("n", "[e", vim.diagnostic.goto_prev)
|
||||
vim.keymap.set("n", "<Leader>de", vim.diagnostic.open_float)
|
||||
vim.keymap.set("n", "<Leader>E", vim.lsp.buf.code_action)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Pretty highlights
|
||||
use("folke/lsp-colors.nvim")
|
||||
|
||||
-- Linting
|
||||
use({
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
branch = "main",
|
||||
requires = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
config = function()
|
||||
local function on_path(program)
|
||||
return vim.fn.executable(program) == 1
|
||||
end
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
require("null-ls").setup({
|
||||
sources = {
|
||||
require("null-ls").builtins.formatting.stylua.with({
|
||||
condition = function()
|
||||
return on_path("stylua")
|
||||
end,
|
||||
}),
|
||||
require("null-ls").builtins.formatting.black.with({
|
||||
condition = function()
|
||||
return on_path("black")
|
||||
end,
|
||||
}),
|
||||
require("null-ls").builtins.diagnostics.flake8.with({
|
||||
condition = function()
|
||||
return on_path("flake8")
|
||||
end,
|
||||
}),
|
||||
require("null-ls").builtins.formatting.fish_indent.with({
|
||||
condition = function()
|
||||
return on_path("fish_indent")
|
||||
end,
|
||||
}),
|
||||
require("null-ls").builtins.formatting.nixfmt.with({
|
||||
condition = function()
|
||||
return on_path("nixfmt")
|
||||
end,
|
||||
}),
|
||||
require("null-ls").builtins.formatting.rustfmt.with({
|
||||
condition = function()
|
||||
return on_path("rustfmt")
|
||||
end,
|
||||
}),
|
||||
require("null-ls").builtins.diagnostics.shellcheck.with({
|
||||
condition = function()
|
||||
return on_path("shellcheck")
|
||||
end,
|
||||
}),
|
||||
require("null-ls").builtins.formatting.shfmt.with({
|
||||
extra_args = { "-i", "4", "-ci" },
|
||||
condition = function()
|
||||
return on_path("shfmt")
|
||||
end,
|
||||
}),
|
||||
require("null-ls").builtins.formatting.terraform_fmt.with({
|
||||
condition = function()
|
||||
return on_path("terraform")
|
||||
end,
|
||||
}),
|
||||
-- require("null-ls").builtins.diagnostics.luacheck,
|
||||
-- require("null-ls").builtins.diagnostics.markdownlint,
|
||||
-- require("null-ls").builtins.diagnostics.pylint,
|
||||
},
|
||||
-- Format on save
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
67
modules/common/neovim/lua/packer/misc.lua
Normal file
67
modules/common/neovim/lua/packer/misc.lua
Normal file
@ -0,0 +1,67 @@
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
-- Important tweaks
|
||||
use("tpope/vim-surround") --- Manipulate parentheses
|
||||
|
||||
-- Convenience tweaks
|
||||
use("tpope/vim-eunuch") --- File manipulation in Vim
|
||||
use("tpope/vim-vinegar") --- Fixes netrw file explorer
|
||||
use("tpope/vim-fugitive") --- Git commands and syntax
|
||||
use("tpope/vim-repeat") --- Actually repeat using .
|
||||
|
||||
-- Use gc or gcc to add comments
|
||||
use({
|
||||
"numToStr/Comment.nvim",
|
||||
config = function()
|
||||
require("Comment").setup()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Alignment tool
|
||||
use({
|
||||
"godlygeek/tabular",
|
||||
config = function()
|
||||
vim.keymap.set("", "<Leader>ta", ":Tabularize /")
|
||||
vim.keymap.set("", "<Leader>t#", ":Tabularize /#<CR>")
|
||||
vim.keymap.set("", "<Leader>tl", ":Tabularize /---<CR>")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Markdown renderer / wiki notes
|
||||
-- use("vimwiki/vimwiki")
|
||||
use({
|
||||
"jakewvincent/mkdnflow.nvim",
|
||||
config = function()
|
||||
require("mkdnflow").setup({
|
||||
modules = {
|
||||
bib = false,
|
||||
conceal = true,
|
||||
folds = false,
|
||||
},
|
||||
perspective = {
|
||||
priority = "current",
|
||||
fallback = "first",
|
||||
nvim_wd_heel = false, -- Don't change working dir
|
||||
},
|
||||
links = {
|
||||
style = "markdown",
|
||||
conceal = true,
|
||||
},
|
||||
wrap = true,
|
||||
to_do = {
|
||||
symbols = { " ", "-", "x" },
|
||||
},
|
||||
})
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "markdown",
|
||||
callback = function()
|
||||
vim.o.autowriteall = true -- Save in new buffer
|
||||
vim.o.wrapmargin = 79 -- Wrap text automatically
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
13
modules/common/neovim/lua/packer/speed.lua
Normal file
13
modules/common/neovim/lua/packer/speed.lua
Normal file
@ -0,0 +1,13 @@
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
-- Startup speed hacks
|
||||
use({
|
||||
"lewis6991/impatient.nvim",
|
||||
config = function()
|
||||
require("impatient")
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
72
modules/common/neovim/lua/packer/syntax.lua
Normal file
72
modules/common/neovim/lua/packer/syntax.lua
Normal file
@ -0,0 +1,72 @@
|
||||
-- =======================================================================
|
||||
-- Syntax
|
||||
-- =======================================================================
|
||||
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
-- Syntax engine
|
||||
use({
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
commit = "9ada5f70f98d51e9e3e76018e783b39fd1cd28f7",
|
||||
run = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"hcl",
|
||||
"python",
|
||||
"lua",
|
||||
"nix",
|
||||
"fish",
|
||||
"toml",
|
||||
"yaml",
|
||||
"json",
|
||||
},
|
||||
auto_install = true,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Syntax-aware Textobjects
|
||||
use({
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
requires = { "nvim-treesitter/nvim-treesitter" },
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true, -- Jump forward automatically
|
||||
keymaps = {
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = "@class.inner",
|
||||
["al"] = "@loop.outer",
|
||||
["il"] = "@loop.inner",
|
||||
["aa"] = "@call.outer",
|
||||
["ia"] = "@call.inner",
|
||||
["ar"] = "@parameter.outer",
|
||||
["ir"] = "@parameter.inner",
|
||||
["aC"] = "@comment.outer",
|
||||
["iC"] = "@comment.outer",
|
||||
["a/"] = "@comment.outer",
|
||||
["i/"] = "@comment.outer",
|
||||
["a;"] = "@statement.outer",
|
||||
["i;"] = "@statement.outer",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Additional syntax sources
|
||||
use("chr4/nginx.vim") --- Nginx syntax
|
||||
use("towolf/vim-helm") --- Helm syntax
|
||||
use("rodjek/vim-puppet") --- Puppet syntax
|
||||
end
|
||||
|
||||
return M
|
139
modules/common/neovim/lua/packer/telescope.lua
Normal file
139
modules/common/neovim/lua/packer/telescope.lua
Normal file
@ -0,0 +1,139 @@
|
||||
-- =======================================================================
|
||||
-- Fuzzy Launcher
|
||||
-- =======================================================================
|
||||
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
use({
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "master",
|
||||
requires = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
-- Telescope: quit instantly with escape
|
||||
local actions = require("telescope.actions")
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<esc>"] = actions.close,
|
||||
["<C-h>"] = "which_key",
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
find_files = { theme = "ivy" },
|
||||
oldfiles = { theme = "ivy" },
|
||||
buffers = { theme = "dropdown" },
|
||||
},
|
||||
extensions = {
|
||||
fzy_native = {},
|
||||
zoxide = {},
|
||||
project = {
|
||||
base_dirs = { "~/dev" },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local telescope = require("telescope.builtin")
|
||||
|
||||
vim.keymap.set("n", "<Leader>k", telescope.keymaps)
|
||||
vim.keymap.set("n", "<Leader>/", telescope.live_grep)
|
||||
vim.keymap.set("n", "<Leader>ff", telescope.find_files)
|
||||
vim.keymap.set("n", "<Leader>fp", telescope.git_files)
|
||||
vim.keymap.set("n", "<Leader>fw", telescope.grep_string)
|
||||
vim.keymap.set("n", "<Leader>b", telescope.buffers)
|
||||
vim.keymap.set("n", "<Leader>hh", telescope.help_tags)
|
||||
vim.keymap.set("n", "<Leader>fr", telescope.oldfiles)
|
||||
vim.keymap.set("n", "<Leader>cc", telescope.commands)
|
||||
vim.keymap.set("n", "<Leader>gc", telescope.git_commits)
|
||||
vim.keymap.set("n", "<Leader>gf", telescope.git_bcommits)
|
||||
vim.keymap.set("n", "<Leader>gb", telescope.git_branches)
|
||||
vim.keymap.set("n", "<Leader>gs", telescope.git_status)
|
||||
vim.keymap.set("n", "<Leader>s", telescope.current_buffer_fuzzy_find)
|
||||
|
||||
vim.keymap.set("n", "<Leader>N", function()
|
||||
local opts = {
|
||||
prompt_title = "Search Notes",
|
||||
cwd = "$NOTES_PATH",
|
||||
}
|
||||
telescope.live_grep(opts)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<Leader>fN", function()
|
||||
local opts = {
|
||||
prompt_title = "Find Notes",
|
||||
cwd = "$NOTES_PATH",
|
||||
}
|
||||
telescope.find_files(opts)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<Leader>cr", function()
|
||||
local opts = require("telescope.themes").get_ivy({
|
||||
layout_config = {
|
||||
bottom_pane = {
|
||||
height = 15,
|
||||
},
|
||||
},
|
||||
})
|
||||
telescope.command_history(opts)
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Faster sorting
|
||||
use("nvim-telescope/telescope-fzy-native.nvim")
|
||||
|
||||
-- Jump around tmux sessions
|
||||
-- use("camgraff/telescope-tmux.nvim")
|
||||
|
||||
-- Jump directories
|
||||
use({
|
||||
"jvgrootveld/telescope-zoxide",
|
||||
requires = { "nvim-lua/popup.nvim", "nvim-telescope/telescope.nvim" },
|
||||
config = function()
|
||||
vim.keymap.set("n", "<Leader>fz", require("telescope").extensions.zoxide.list)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Jump projects
|
||||
use({
|
||||
"nvim-telescope/telescope-project.nvim",
|
||||
requires = { "nvim-telescope/telescope.nvim" },
|
||||
config = function()
|
||||
require("telescope").load_extension("project")
|
||||
|
||||
vim.keymap.set("n", "<C-p>", function()
|
||||
local opts = require("telescope.themes").get_ivy({
|
||||
layout_config = {
|
||||
bottom_pane = {
|
||||
height = 10,
|
||||
},
|
||||
},
|
||||
})
|
||||
require("telescope").extensions.project.project(opts)
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
-- File browser
|
||||
use({
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
requires = { "nvim-telescope/telescope.nvim" },
|
||||
config = function()
|
||||
require("telescope").load_extension("file_browser")
|
||||
|
||||
vim.keymap.set("n", "<Leader>fa", require("telescope").extensions.file_browser.file_browser)
|
||||
|
||||
vim.keymap.set("n", "<Leader>fD", function()
|
||||
local opts = {
|
||||
prompt_title = "Find Downloads",
|
||||
cwd = "~/downloads",
|
||||
}
|
||||
require("telescope").extensions.file_browser.file_browser(opts)
|
||||
end)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
79
modules/common/neovim/lua/packer/toggleterm.lua
Normal file
79
modules/common/neovim/lua/packer/toggleterm.lua
Normal file
@ -0,0 +1,79 @@
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
use({
|
||||
"akinsho/toggleterm.nvim",
|
||||
tag = "v2.1.0",
|
||||
config = function()
|
||||
require("toggleterm").setup({
|
||||
open_mapping = [[<c-\>]],
|
||||
hide_numbers = true,
|
||||
direction = "float",
|
||||
})
|
||||
|
||||
vim.keymap.set("t", "<A-CR>", "<C-\\><C-n>") --- Exit terminal mode
|
||||
|
||||
-- Only set these keymaps for toggleterm
|
||||
vim.api.nvim_create_autocmd("TermOpen", {
|
||||
pattern = "term://*toggleterm#*",
|
||||
callback = function()
|
||||
-- vim.keymap.set("t", "<Esc>", "<C-\\><C-n>") --- Exit terminal mode
|
||||
vim.keymap.set("t", "<C-h>", "<C-\\><C-n><C-w>h")
|
||||
vim.keymap.set("t", "<C-j>", "<C-\\><C-n><C-w>j")
|
||||
vim.keymap.set("t", "<C-k>", "<C-\\><C-n><C-w>k")
|
||||
vim.keymap.set("t", "<C-l>", "<C-\\><C-n><C-w>l")
|
||||
end,
|
||||
})
|
||||
|
||||
local terminal = require("toggleterm.terminal").Terminal
|
||||
|
||||
local basicterminal = terminal:new()
|
||||
function TERM_TOGGLE()
|
||||
basicterminal:toggle()
|
||||
end
|
||||
|
||||
local nixpkgs = terminal:new({ cmd = "nix repl '<nixpkgs>'" })
|
||||
function NIXPKGS_TOGGLE()
|
||||
nixpkgs:toggle()
|
||||
end
|
||||
|
||||
local gitwatch = terminal:new({ cmd = "fish --interactive --init-command 'gh run watch'" })
|
||||
function GITWATCH_TOGGLE()
|
||||
gitwatch:toggle()
|
||||
end
|
||||
|
||||
local k9s = terminal:new({ cmd = "k9s" })
|
||||
function K9S_TOGGLE()
|
||||
k9s:toggle()
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<Leader>t", TERM_TOGGLE)
|
||||
vim.keymap.set("n", "<Leader>P", NIXPKGS_TOGGLE)
|
||||
vim.keymap.set("n", "<Leader>gw", GITWATCH_TOGGLE)
|
||||
vim.keymap.set("n", "<Leader>9", K9S_TOGGLE)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Connect to telescope
|
||||
-- use({
|
||||
-- "https://git.sr.ht/~havi/telescope-toggleterm.nvim",
|
||||
-- event = "TermOpen",
|
||||
-- requires = {
|
||||
-- "akinsho/nvim-toggleterm.lua",
|
||||
-- "nvim-telescope/telescope.nvim",
|
||||
-- "nvim-lua/popup.nvim",
|
||||
-- "nvim-lua/plenary.nvim",
|
||||
-- },
|
||||
-- config = function()
|
||||
-- require("telescope").load_extension("toggleterm")
|
||||
-- require("telescope-toggleterm").setup({
|
||||
-- telescope_mappings = {
|
||||
-- -- <ctrl-c> : kill the terminal buffer (default) .
|
||||
-- ["<C-c>"] = require("telescope-toggleterm").actions.exit_terminal,
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
-- })
|
||||
end
|
||||
|
||||
return M
|
164
modules/common/neovim/lua/packer/visuals.lua
Normal file
164
modules/common/neovim/lua/packer/visuals.lua
Normal file
@ -0,0 +1,164 @@
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
-- Git next to line numbers
|
||||
use({
|
||||
"lewis6991/gitsigns.nvim",
|
||||
branch = "main",
|
||||
requires = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
local gitsigns = require("gitsigns")
|
||||
gitsigns.setup()
|
||||
vim.keymap.set("n", "<Leader>gB", gitsigns.blame_line)
|
||||
vim.keymap.set("n", "<Leader>gp", gitsigns.preview_hunk)
|
||||
vim.keymap.set("v", "<Leader>gp", gitsigns.preview_hunk)
|
||||
vim.keymap.set("n", "<Leader>gd", gitsigns.diffthis)
|
||||
vim.keymap.set("v", "<Leader>gd", gitsigns.diffthis)
|
||||
vim.keymap.set("n", "<Leader>rgf", gitsigns.reset_buffer)
|
||||
vim.keymap.set("v", "<Leader>hs", gitsigns.stage_hunk)
|
||||
vim.keymap.set("v", "<Leader>hr", gitsigns.reset_hunk)
|
||||
vim.keymap.set("v", "<Leader>hr", gitsigns.reset_hunk)
|
||||
|
||||
-- Navigation
|
||||
vim.keymap.set("n", "]g", function()
|
||||
if vim.wo.diff then
|
||||
return "]g"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gitsigns.next_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true })
|
||||
|
||||
vim.keymap.set("n", "[g", function()
|
||||
if vim.wo.diff then
|
||||
return "[g"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gitsigns.prev_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true })
|
||||
end,
|
||||
})
|
||||
|
||||
-- Status bar
|
||||
use({
|
||||
"hoob3rt/lualine.nvim",
|
||||
requires = { "kyazdani42/nvim-web-devicons", opt = true },
|
||||
config = function()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = "gruvbox",
|
||||
icons_enabled = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Buffer line ("tabs")
|
||||
use({
|
||||
"akinsho/bufferline.nvim",
|
||||
tag = "v2.4.0",
|
||||
requires = { "kyazdani42/nvim-web-devicons", "moll/vim-bbye" },
|
||||
config = function()
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
diagnostics = "nvim_lsp",
|
||||
always_show_bufferline = false,
|
||||
separator_style = "slant",
|
||||
offsets = { { filetype = "NvimTree" } },
|
||||
},
|
||||
})
|
||||
-- Move buffers
|
||||
vim.keymap.set("n", "L", ":BufferLineCycleNext<CR>", { silent = true })
|
||||
vim.keymap.set("n", "H", ":BufferLineCyclePrev<CR>", { silent = true })
|
||||
|
||||
-- Kill buffer
|
||||
vim.keymap.set("n", "<Leader>x", " :Bdelete<CR>", { silent = true })
|
||||
|
||||
-- Shift buffers
|
||||
-- vim.keymap.set("n", "<C-L>", ":BufferLineMoveNext<CR>")
|
||||
-- vim.keymap.set("i", "<C-L>", "<Esc>:BufferLineMoveNext<CR>i")
|
||||
-- vim.keymap.set("n", "<C-H>", ":BufferLineMovePrev<CR>")
|
||||
-- vim.keymap.set("i", "<C-H>", "<Esc>:BufferLineMovePrev<CR>i")
|
||||
end,
|
||||
})
|
||||
|
||||
-- File explorer
|
||||
use({
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
requires = { "kyazdani42/nvim-web-devicons" },
|
||||
config = function()
|
||||
require("nvim-tree").setup({
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true,
|
||||
ignore_list = {},
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
},
|
||||
},
|
||||
renderer = {
|
||||
icons = {
|
||||
glyphs = {
|
||||
git = {
|
||||
unstaged = "~",
|
||||
staged = "+",
|
||||
unmerged = "",
|
||||
renamed = "➜",
|
||||
deleted = "",
|
||||
untracked = "?",
|
||||
ignored = "◌",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
hide_root_folder = false,
|
||||
side = "left",
|
||||
mappings = {
|
||||
custom_only = false,
|
||||
list = {
|
||||
{
|
||||
key = { "l", "<CR>", "o" },
|
||||
cb = require("nvim-tree.config").nvim_tree_callback("edit"),
|
||||
},
|
||||
{ key = "h", cb = require("nvim-tree.config").nvim_tree_callback("close_node") },
|
||||
{ key = "v", cb = require("nvim-tree.config").nvim_tree_callback("vsplit") },
|
||||
},
|
||||
},
|
||||
number = false,
|
||||
relativenumber = false,
|
||||
},
|
||||
})
|
||||
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
|
||||
|
||||
-- https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129
|
||||
vim.g.loaded = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
end,
|
||||
})
|
||||
|
||||
-- Markdown pretty view
|
||||
use("ellisonleao/glow.nvim")
|
||||
|
||||
-- Hex color previews
|
||||
use({
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
config = function()
|
||||
require("colorizer").setup()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
34
modules/common/neovim/lua/packer_init.lua
Normal file
34
modules/common/neovim/lua/packer_init.lua
Normal file
@ -0,0 +1,34 @@
|
||||
-- Bootstrap the Packer plugin manager
|
||||
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
|
||||
PACKER_BOOTSTRAP = fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--depth",
|
||||
"1",
|
||||
"https://github.com/wbthomason/packer.nvim",
|
||||
install_path,
|
||||
})
|
||||
end
|
||||
|
||||
require("packer").startup(function(use)
|
||||
-- Maintain plugin manager
|
||||
use("wbthomason/packer.nvim")
|
||||
|
||||
-- Include other files initialized by packer
|
||||
require("packer.speed").packer(use)
|
||||
require("packer.misc").packer(use)
|
||||
require("packer.colors").packer(use)
|
||||
require("packer.visuals").packer(use)
|
||||
require("packer.lsp").packer(use)
|
||||
require("packer.completion").packer(use)
|
||||
require("packer.syntax").packer(use)
|
||||
require("packer.telescope").packer(use)
|
||||
require("packer.toggleterm").packer(use)
|
||||
|
||||
-- Auto-install after bootstrapping
|
||||
if PACKER_BOOTSTRAP then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
17
modules/common/neovim/lua/settings.lua
Normal file
17
modules/common/neovim/lua/settings.lua
Normal file
@ -0,0 +1,17 @@
|
||||
-- ===========================================================================
|
||||
-- Settings
|
||||
-- ===========================================================================
|
||||
|
||||
vim.filetype.add({
|
||||
pattern = {
|
||||
[".*%.tfvars"] = "hcl",
|
||||
[".*%.tf"] = "hcl",
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "*.eml",
|
||||
callback = function()
|
||||
vim.o.wrapmargin = 79 -- Wrap text automatically
|
||||
end,
|
||||
})
|
46
modules/common/neovim/package/default.nix
Normal file
46
modules/common/neovim/package/default.nix
Normal file
@ -0,0 +1,46 @@
|
||||
# { inputs, globals, extraConfig ? [ ], ... }:
|
||||
#
|
||||
# let
|
||||
#
|
||||
# pkgs = import inputs.nixpkgs {
|
||||
# system = inputs.system;
|
||||
# overlays = [
|
||||
# (import ./modules/neovim/plugins-overlay.nix inputs)
|
||||
# inputs.nix2vim.overlay
|
||||
# ];
|
||||
# };
|
||||
#
|
||||
# in pkgs.neovimBuilder {
|
||||
# package = pkgs.neovim-unwrapped;
|
||||
# imports = [
|
||||
# ./modules/common/neovim/plugins/bufferline.nix
|
||||
# ./modules/common/neovim/plugins/completion.nix
|
||||
# ./modules/common/neovim/plugins/gitsigns.nix
|
||||
# ./modules/common/neovim/plugins/lsp.nix
|
||||
# ./modules/common/neovim/plugins/misc.nix
|
||||
# ./modules/common/neovim/plugins/statusline.nix
|
||||
# ./modules/common/neovim/plugins/syntax.nix
|
||||
# ./modules/common/neovim/plugins/telescope.nix
|
||||
# ./modules/common/neovim/plugins/toggleterm.nix
|
||||
# ./modules/common/neovim/plugins/tree.nix
|
||||
# ] ++ extraConfig;
|
||||
# }
|
||||
|
||||
{ pkgs, colors ? { }, ... }:
|
||||
|
||||
pkgs.neovimBuilder {
|
||||
package = pkgs.neovim-unwrapped;
|
||||
imports = [
|
||||
../config/bufferline.nix
|
||||
../config/completion.nix
|
||||
../config/gitsigns.nix
|
||||
../config/lsp.nix
|
||||
../config/misc.nix
|
||||
../config/statusline.nix
|
||||
../config/syntax.nix
|
||||
../config/telescope.nix
|
||||
../config/toggleterm.nix
|
||||
../config/tree.nix
|
||||
colors
|
||||
];
|
||||
}
|
Reference in New Issue
Block a user