nvim: add separate config files for most plugins
This commit is contained in:
parent
9db80c9673
commit
8b80d68409
23 changed files with 290 additions and 282 deletions
|
@ -8,6 +8,13 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.my.programs.vim;
|
cfg = config.my.programs.vim;
|
||||||
|
|
||||||
|
mkPlugin = name: {
|
||||||
|
plugin = pkgs.vimPlugins.${name};
|
||||||
|
type = "lua";
|
||||||
|
config = builtins.readFile "./plugins/${name}.lua";
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.my.programs.vim = {
|
options.my.programs.vim = {
|
||||||
|
@ -50,46 +57,49 @@ in
|
||||||
taplo
|
taplo
|
||||||
yamlfmt
|
yamlfmt
|
||||||
];
|
];
|
||||||
plugins = with pkgs.vimPlugins; [
|
plugins = builtins.map mkPlugin [
|
||||||
catppuccin-nvim
|
"catppuccin-nvim"
|
||||||
|
"comment-nvim"
|
||||||
|
"copilot-lua"
|
||||||
|
"dashboard-nvim"
|
||||||
|
"formatter-nvim"
|
||||||
|
"gitsigns-nvim"
|
||||||
|
"lualine-nvim"
|
||||||
|
"noice-nvim"
|
||||||
|
"nvim-autopairs"
|
||||||
|
"nvim-lastplace"
|
||||||
|
"nvim-surround"
|
||||||
|
"nvim-tree-lua"
|
||||||
|
"nvim-treesitter-textsubjects"
|
||||||
|
"nvim-ts-context-commentstring"
|
||||||
|
"orgmode"
|
||||||
|
"smartcolumn-nvim"
|
||||||
|
"telescope-fzf-native-nvim"
|
||||||
|
"telescope-nvim"
|
||||||
|
"telescope-zoxide"
|
||||||
|
"which-key-nvim"
|
||||||
|
"todo-comments-nvim"
|
||||||
|
] ++ (with pkgs.vimPlugins; [
|
||||||
cmp-nvim-lsp
|
cmp-nvim-lsp
|
||||||
cmp_luasnip
|
cmp_luasnip
|
||||||
comment-nvim
|
|
||||||
copilot-cmp
|
copilot-cmp
|
||||||
copilot-lua
|
|
||||||
dashboard-nvim
|
|
||||||
direnv-vim
|
direnv-vim
|
||||||
formatter-nvim
|
|
||||||
gitsigns-nvim
|
|
||||||
lsp_lines-nvim
|
lsp_lines-nvim
|
||||||
lspkind-nvim
|
lspkind-nvim
|
||||||
lspsaga-nvim-original
|
lspsaga-nvim-original
|
||||||
lualine-lsp-progress
|
lualine-lsp-progress
|
||||||
lualine-nvim
|
|
||||||
luasnip
|
luasnip
|
||||||
neogit
|
|
||||||
noice-nvim
|
|
||||||
nui-nvim # for noice-nvim
|
nui-nvim # for noice-nvim
|
||||||
nvim-autopairs
|
|
||||||
nvim-cmp
|
nvim-cmp
|
||||||
nvim-lastplace
|
|
||||||
nvim-lspconfig
|
nvim-lspconfig
|
||||||
nvim-surround
|
|
||||||
nvim-tree-lua
|
|
||||||
nvim-treesitter-textsubjects
|
|
||||||
nvim-treesitter.withAllGrammars
|
nvim-treesitter.withAllGrammars
|
||||||
nvim-ts-context-commentstring
|
nvim-ufo
|
||||||
nvim-web-devicons # for dashboard-nvim
|
nvim-web-devicons # for dashboard-nvim
|
||||||
orgmode
|
|
||||||
plenary-nvim # for telescope, neogit
|
plenary-nvim # for telescope, neogit
|
||||||
popup-nvim
|
popup-nvim
|
||||||
smartcolumn-nvim
|
promise-async
|
||||||
telescope-fzf-native-nvim
|
|
||||||
telescope-nvim
|
|
||||||
telescope-zoxide
|
|
||||||
vim-lion
|
vim-lion
|
||||||
which-key-nvim
|
]);
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,7 +8,7 @@ if not vim.loop.fs_stat(spelldir) then
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.opt.autoindent = true
|
vim.opt.autoindent = true
|
||||||
vim.opt.backupdir = { vim.fn.stdpath("state") .. "/nvim/backup//" } -- don't store backup in files dir
|
vim.opt.backupdir = { vim.fn.stdpath("state") .. "/nvim/backup/" } -- don't store backup in files dir
|
||||||
vim.opt.clipboard = "unnamedplus" -- sync with system clipboard
|
vim.opt.clipboard = "unnamedplus" -- sync with system clipboard
|
||||||
vim.opt.conceallevel = 2
|
vim.opt.conceallevel = 2
|
||||||
vim.opt.expandtab = true -- spaces instead of tabs
|
vim.opt.expandtab = true -- spaces instead of tabs
|
||||||
|
@ -37,78 +37,24 @@ if vim.g.neovide then
|
||||||
vim.g.neovide_scale_factor = 0.7
|
vim.g.neovide_scale_factor = 0.7
|
||||||
end
|
end
|
||||||
|
|
||||||
require("catppuccin").setup({
|
|
||||||
compile_path = vim.fn.stdpath("cache") .. "/catppuccin", -- fix issue of writing to nix store
|
|
||||||
integrations = {
|
|
||||||
which_key = true,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
vim.cmd.colorscheme("catppuccin-macchiato")
|
|
||||||
|
|
||||||
vim.o.timeout = true
|
|
||||||
vim.o.timeoutlen = 500
|
|
||||||
local wk = require("which-key")
|
local wk = require("which-key")
|
||||||
|
|
||||||
require("noice").setup({
|
|
||||||
lsp = {
|
|
||||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
|
||||||
override = {
|
|
||||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
|
||||||
["vim.lsp.util.stylize_markdown"] = true,
|
|
||||||
["cmp.entry.get_documentation"] = true,
|
|
||||||
},
|
|
||||||
progress = {
|
|
||||||
enabled = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- you can enable a preset for easier configuration
|
|
||||||
presets = {
|
|
||||||
bottom_search = true, -- use a classic bottom cmdline for search
|
|
||||||
command_palette = true, -- position the cmdline and popupmenu together
|
|
||||||
long_message_to_split = true, -- long messages will be sent to a split
|
|
||||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
|
||||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
require("telescope").load_extension("zoxide")
|
|
||||||
wk.register({
|
|
||||||
f = {
|
|
||||||
name = "find",
|
|
||||||
f = { "<cmd>Telescope find_files<cr>", "find file" },
|
|
||||||
z = { "<cmd>Telescope zoxide list<cr>", "find location" },
|
|
||||||
l = { "<cmd>Telescope current_buffer_fuzzy_find<cr>", "find line" },
|
|
||||||
g = { "<cmd>Telescope live_grep<cr>", "live grep" },
|
|
||||||
b = { "<cmd>Telescope buffers<cr>", "find buffer" },
|
|
||||||
},
|
|
||||||
}, { prefix = "<leader>" })
|
|
||||||
-- To get fzf loaded and working with telescope, you need to call
|
|
||||||
-- load_extension, somewhere after setup function:
|
|
||||||
require("telescope").load_extension("fzf")
|
|
||||||
|
|
||||||
require("neogit").setup({
|
|
||||||
disable_commit_confirmation = true,
|
|
||||||
})
|
|
||||||
wk.register({
|
|
||||||
g = { "<cmd>Neogit<cr>", "git" },
|
|
||||||
}, { prefix = "<leader>" })
|
|
||||||
|
|
||||||
require("nvim-treesitter.configs").setup({
|
require("nvim-treesitter.configs").setup({
|
||||||
sync_install = false,
|
sync_install = false,
|
||||||
auto_install = false,
|
auto_install = false,
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
additional_vim_regex_highlighting = true,
|
additional_vim_regex_highlighting = false,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local lspkind = require("lspkind")
|
|
||||||
|
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
local luasnip = require("luasnip")
|
local luasnip = require("luasnip")
|
||||||
|
require("copilot_cmp").setup()
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
formatting = {
|
formatting = {
|
||||||
format = lspkind.cmp_format({
|
format = require("lspkind").cmp_format({
|
||||||
mode = "symbol", -- show only symbol annotations
|
mode = "symbol", -- show only symbol annotations
|
||||||
maxwidth = 50, -- prevent the popup from showing more than provided characters
|
maxwidth = 50, -- prevent the popup from showing more than provided characters
|
||||||
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead
|
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead
|
||||||
|
@ -185,76 +131,6 @@ local function table_merge(...)
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
|
|
||||||
require("formatter").setup({
|
|
||||||
-- Enable or disable logging
|
|
||||||
logging = true,
|
|
||||||
-- Set the log level
|
|
||||||
log_level = vim.log.levels.WARN,
|
|
||||||
-- All formatter configurations are opt-in
|
|
||||||
filetype = {
|
|
||||||
json = {
|
|
||||||
require("formatter.filetypes.json").jq,
|
|
||||||
},
|
|
||||||
lua = {
|
|
||||||
require("formatter.filetypes.lua").stylua,
|
|
||||||
},
|
|
||||||
nix = {
|
|
||||||
require("formatter.filetypes.nix").nixpkgs_fmt,
|
|
||||||
},
|
|
||||||
python = {
|
|
||||||
require("formatter.filetypes.python").black,
|
|
||||||
},
|
|
||||||
rust = {
|
|
||||||
require("formatter.filetypes.rust").rustfmt,
|
|
||||||
},
|
|
||||||
sh = {
|
|
||||||
require("formatter.filetypes.sh").shfmt,
|
|
||||||
},
|
|
||||||
toml = {
|
|
||||||
require("formatter.filetypes.toml").taplo,
|
|
||||||
},
|
|
||||||
yaml = {
|
|
||||||
require("formatter.filetypes.yaml").yamlfmt,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- HACK to use specific formatters only when specified
|
|
||||||
alejandra = {
|
|
||||||
require("formatter.filetypes.nix").alejandra,
|
|
||||||
},
|
|
||||||
isort = {
|
|
||||||
require("formatter.filetypes.python").isort,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Use the special "*" filetype for defining formatter configurations on
|
|
||||||
-- any filetype
|
|
||||||
["*"] = {
|
|
||||||
-- "formatter.filetypes.any" defines default configurations for any
|
|
||||||
-- filetype
|
|
||||||
require("formatter.filetypes.any").remove_trailing_whitespace,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
vim.api.nvim_create_user_command("Fmt", function(opts)
|
|
||||||
local params = vim.split(opts.args, "%s+", { trimempty = true })
|
|
||||||
local filetype = vim.bo.filetype
|
|
||||||
vim.cmd("set filetype=" .. params[1]) -- fake filetype
|
|
||||||
vim.cmd(":Format")
|
|
||||||
vim.cmd("set filetype=" .. filetype) -- restore original filetype
|
|
||||||
end, {
|
|
||||||
nargs = 1,
|
|
||||||
complete = function()
|
|
||||||
local languages = {
|
|
||||||
nix = { "alejandra" },
|
|
||||||
python = { "isort" },
|
|
||||||
}
|
|
||||||
return languages[vim.bo.filetype] or {}
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
wk.register({
|
|
||||||
["="] = { "<cmd>Format<cr>", "format (formatter)" },
|
|
||||||
}, { noremap = true, silent = true })
|
|
||||||
|
|
||||||
local lsp_lines = require("lsp_lines")
|
local lsp_lines = require("lsp_lines")
|
||||||
lsp_lines.setup()
|
lsp_lines.setup()
|
||||||
-- Disable virtual_text since it's redundant due to lsp_lines.
|
-- Disable virtual_text since it's redundant due to lsp_lines.
|
||||||
|
@ -265,6 +141,25 @@ vim.diagnostic.config({
|
||||||
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
|
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
|
||||||
|
vim.o.foldcolumn = "1" -- '0' is not bad
|
||||||
|
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
||||||
|
vim.o.foldlevelstart = 99
|
||||||
|
vim.o.foldenable = true
|
||||||
|
-- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself
|
||||||
|
wk.register({
|
||||||
|
z = {
|
||||||
|
R = { require("ufo").openAllFolds, "Open all folds" },
|
||||||
|
M = { require("ufo").closeAllFolds, "Close all folds" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
-- Tell the server the capability of foldingRange,
|
||||||
|
-- Neovim hasn't added foldingRange to default capabilities, users must add it manually
|
||||||
|
capabilities.textDocument.foldingRange = {
|
||||||
|
dynamicRegistration = false,
|
||||||
|
lineFoldingOnly = true,
|
||||||
|
}
|
||||||
|
require("ufo").setup()
|
||||||
|
|
||||||
require("lspsaga").setup({
|
require("lspsaga").setup({
|
||||||
symbol_in_winbar = {
|
symbol_in_winbar = {
|
||||||
enable = false,
|
enable = false,
|
||||||
|
@ -340,8 +235,6 @@ for _, lsp in ipairs(servers) do
|
||||||
end
|
end
|
||||||
|
|
||||||
lspconfig_setup("lua_ls", {
|
lspconfig_setup("lua_ls", {
|
||||||
on_attach = on_attach_def,
|
|
||||||
capabilities = capabilities,
|
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = {
|
runtime = {
|
||||||
|
@ -367,131 +260,3 @@ lspconfig_setup("lua_ls", {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
require("dashboard").setup({
|
|
||||||
theme = "hyper",
|
|
||||||
config = {
|
|
||||||
packages = { enable = false },
|
|
||||||
week_header = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
require("lualine").setup({
|
|
||||||
options = {
|
|
||||||
icons_enabled = true,
|
|
||||||
theme = "auto",
|
|
||||||
component_separators = "|",
|
|
||||||
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", separator = { left = "" }, right_padding = 2 },
|
|
||||||
},
|
|
||||||
lualine_b = { "branch", "diff", "diagnostics" },
|
|
||||||
lualine_c = { "filename", "lsp_progress" },
|
|
||||||
lualine_x = { "encoding", "fileformat", "filetype" },
|
|
||||||
lualine_y = { "progress" },
|
|
||||||
lualine_z = {
|
|
||||||
{ "location", separator = { right = "" }, left_padding = 2 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
inactive_sections = {
|
|
||||||
lualine_a = {},
|
|
||||||
lualine_b = {},
|
|
||||||
lualine_c = { "filename" },
|
|
||||||
lualine_x = { "location" },
|
|
||||||
lualine_y = {},
|
|
||||||
lualine_z = {},
|
|
||||||
},
|
|
||||||
tabline = {},
|
|
||||||
winbar = {},
|
|
||||||
inactive_winbar = {},
|
|
||||||
extensions = {},
|
|
||||||
})
|
|
||||||
|
|
||||||
require("Comment").setup()
|
|
||||||
|
|
||||||
require("nvim-treesitter.configs").setup({
|
|
||||||
context_commentstring = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
require("nvim-surround").setup({})
|
|
||||||
|
|
||||||
require("nvim-treesitter.configs").setup({
|
|
||||||
textsubjects = {
|
|
||||||
enable = true,
|
|
||||||
prev_selection = ",", -- (Optional) keymap to select the previous selection
|
|
||||||
keymaps = { ["."] = "textsubjects-smart" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
require("copilot").setup({
|
|
||||||
suggestion = { enabled = false },
|
|
||||||
panel = { enabled = false },
|
|
||||||
})
|
|
||||||
vim.api.nvim_create_autocmd("VimEnter", {
|
|
||||||
desc = "Disable Copilot by default on startup",
|
|
||||||
command = "Copilot disable",
|
|
||||||
})
|
|
||||||
require("copilot_cmp").setup()
|
|
||||||
|
|
||||||
local orgmode = require("orgmode")
|
|
||||||
-- Load custom treesitter grammar for org filetype
|
|
||||||
orgmode.setup_ts_grammar()
|
|
||||||
-- Treesitter configuration
|
|
||||||
require("nvim-treesitter.configs").setup({
|
|
||||||
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
|
|
||||||
-- highlighting will fallback to default Vim syntax highlighting
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
-- Required for spellcheck, some LaTex highlights and
|
|
||||||
-- code block highlights that do not have ts grammar
|
|
||||||
additional_vim_regex_highlighting = { "org" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
orgmode.setup({
|
|
||||||
org_agenda_files = { "~/Notes/org" },
|
|
||||||
org_default_notes_file = "~/Notes/org/refile.org",
|
|
||||||
})
|
|
||||||
|
|
||||||
require("gitsigns").setup()
|
|
||||||
|
|
||||||
require("nvim-lastplace").setup({
|
|
||||||
lastplace_ignore_buftype = { "quickfix", "nofile", "help" },
|
|
||||||
lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit" },
|
|
||||||
lastplace_open_folds = true,
|
|
||||||
})
|
|
||||||
|
|
||||||
require("nvim-autopairs").setup()
|
|
||||||
|
|
||||||
-- disable netrw at the very start of your init.lua (strongly advised)
|
|
||||||
vim.g.loaded_netrw = 1
|
|
||||||
vim.g.loaded_netrwPlugin = 1
|
|
||||||
-- set termguicolors to enable highlight groups
|
|
||||||
vim.opt.termguicolors = true
|
|
||||||
-- empty setup using defaults
|
|
||||||
require("nvim-tree").setup()
|
|
||||||
wk.register({
|
|
||||||
t = { "<cmd>NvimTreeFindFileToggle<cr>", "nvim tree" },
|
|
||||||
}, { prefix = "<leader>t", silent = true })
|
|
||||||
|
|
||||||
require("smartcolumn").setup({
|
|
||||||
colorcolumn = 120,
|
|
||||||
disabled_filetypes = { "help", "text", "markdown", "dashboard" },
|
|
||||||
})
|
|
||||||
|
|
7
modules/programs/nvim/plugins/catppuccin-nvim.lua
Normal file
7
modules/programs/nvim/plugins/catppuccin-nvim.lua
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
require("catppuccin").setup({
|
||||||
|
compile_path = vim.fn.stdpath("cache") .. "/catppuccin", -- fix issue of writing to nix store
|
||||||
|
integrations = {
|
||||||
|
which_key = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
vim.cmd.colorscheme("catppuccin-macchiato")
|
1
modules/programs/nvim/plugins/comment-nvim.lua
Normal file
1
modules/programs/nvim/plugins/comment-nvim.lua
Normal file
|
@ -0,0 +1 @@
|
||||||
|
require("Comment").setup()
|
8
modules/programs/nvim/plugins/copilot-lua.lua
Normal file
8
modules/programs/nvim/plugins/copilot-lua.lua
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
require("copilot").setup({
|
||||||
|
suggestion = { enabled = false },
|
||||||
|
panel = { enabled = false },
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_autocmd("VimEnter", {
|
||||||
|
desc = "Disable Copilot by default on startup",
|
||||||
|
command = "Copilot disable",
|
||||||
|
})
|
9
modules/programs/nvim/plugins/dashboard-nvim.lua
Normal file
9
modules/programs/nvim/plugins/dashboard-nvim.lua
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
require("dashboard").setup({
|
||||||
|
theme = "hyper",
|
||||||
|
config = {
|
||||||
|
packages = { enable = false },
|
||||||
|
week_header = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
71
modules/programs/nvim/plugins/formatter-nvim.lua
Normal file
71
modules/programs/nvim/plugins/formatter-nvim.lua
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
|
||||||
|
require("formatter").setup({
|
||||||
|
-- Enable or disable logging
|
||||||
|
logging = true,
|
||||||
|
-- Set the log level
|
||||||
|
log_level = vim.log.levels.WARN,
|
||||||
|
-- All formatter configurations are opt-in
|
||||||
|
filetype = {
|
||||||
|
json = {
|
||||||
|
require("formatter.filetypes.json").jq,
|
||||||
|
},
|
||||||
|
lua = {
|
||||||
|
require("formatter.filetypes.lua").stylua,
|
||||||
|
},
|
||||||
|
nix = {
|
||||||
|
require("formatter.filetypes.nix").nixpkgs_fmt,
|
||||||
|
},
|
||||||
|
python = {
|
||||||
|
require("formatter.filetypes.python").black,
|
||||||
|
},
|
||||||
|
rust = {
|
||||||
|
require("formatter.filetypes.rust").rustfmt,
|
||||||
|
},
|
||||||
|
sh = {
|
||||||
|
require("formatter.filetypes.sh").shfmt,
|
||||||
|
},
|
||||||
|
toml = {
|
||||||
|
require("formatter.filetypes.toml").taplo,
|
||||||
|
},
|
||||||
|
yaml = {
|
||||||
|
require("formatter.filetypes.yaml").yamlfmt,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- HACK to use specific formatters only when specified
|
||||||
|
alejandra = {
|
||||||
|
require("formatter.filetypes.nix").alejandra,
|
||||||
|
},
|
||||||
|
isort = {
|
||||||
|
require("formatter.filetypes.python").isort,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Use the special "*" filetype for defining formatter configurations on
|
||||||
|
-- any filetype
|
||||||
|
["*"] = {
|
||||||
|
-- "formatter.filetypes.any" defines default configurations for any
|
||||||
|
-- filetype
|
||||||
|
require("formatter.filetypes.any").remove_trailing_whitespace,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command("Fmt", function(opts)
|
||||||
|
local params = vim.split(opts.args, "%s+", { trimempty = true })
|
||||||
|
local filetype = vim.bo.filetype
|
||||||
|
vim.cmd("set filetype=" .. params[1]) -- fake filetype
|
||||||
|
vim.cmd(":Format")
|
||||||
|
vim.cmd("set filetype=" .. filetype) -- restore original filetype
|
||||||
|
end, {
|
||||||
|
nargs = 1,
|
||||||
|
complete = function()
|
||||||
|
local languages = {
|
||||||
|
nix = { "alejandra" },
|
||||||
|
python = { "isort" },
|
||||||
|
}
|
||||||
|
return languages[vim.bo.filetype] or {}
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
require("which-key").register({
|
||||||
|
["="] = { "<cmd>Format<cr>", "format (formatter)" },
|
||||||
|
}, { noremap = true, silent = true })
|
1
modules/programs/nvim/plugins/gitsigns-nvim.lua
Normal file
1
modules/programs/nvim/plugins/gitsigns-nvim.lua
Normal file
|
@ -0,0 +1 @@
|
||||||
|
require("gitsigns").setup()
|
44
modules/programs/nvim/plugins/lualine-nvim.lua
Normal file
44
modules/programs/nvim/plugins/lualine-nvim.lua
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
require("lualine").setup({
|
||||||
|
options = {
|
||||||
|
icons_enabled = true,
|
||||||
|
theme = "auto",
|
||||||
|
component_separators = "|",
|
||||||
|
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", separator = { left = "" }, right_padding = 2 },
|
||||||
|
},
|
||||||
|
lualine_b = { "branch", "diff", "diagnostics" },
|
||||||
|
lualine_c = { "filename", "lsp_progress" },
|
||||||
|
lualine_x = { "encoding", "fileformat", "filetype" },
|
||||||
|
lualine_y = { "progress" },
|
||||||
|
lualine_z = {
|
||||||
|
{ "location", separator = { right = "" }, left_padding = 2 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = { "filename" },
|
||||||
|
lualine_x = { "location" },
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
},
|
||||||
|
tabline = {},
|
||||||
|
winbar = {},
|
||||||
|
inactive_winbar = {},
|
||||||
|
extensions = {},
|
||||||
|
})
|
21
modules/programs/nvim/plugins/noice-nvim.lua
Normal file
21
modules/programs/nvim/plugins/noice-nvim.lua
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
require("noice").setup({
|
||||||
|
lsp = {
|
||||||
|
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||||
|
override = {
|
||||||
|
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||||
|
["vim.lsp.util.stylize_markdown"] = true,
|
||||||
|
["cmp.entry.get_documentation"] = true,
|
||||||
|
},
|
||||||
|
progress = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- you can enable a preset for easier configuration
|
||||||
|
presets = {
|
||||||
|
bottom_search = true, -- use a classic bottom cmdline for search
|
||||||
|
command_palette = true, -- position the cmdline and popupmenu together
|
||||||
|
long_message_to_split = true, -- long messages will be sent to a split
|
||||||
|
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||||
|
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||||
|
},
|
||||||
|
})
|
1
modules/programs/nvim/plugins/nvim-autopairs.lua
Normal file
1
modules/programs/nvim/plugins/nvim-autopairs.lua
Normal file
|
@ -0,0 +1 @@
|
||||||
|
require("nvim-autopairs").setup()
|
5
modules/programs/nvim/plugins/nvim-lastplace.lua
Normal file
5
modules/programs/nvim/plugins/nvim-lastplace.lua
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
require("nvim-lastplace").setup({
|
||||||
|
lastplace_ignore_buftype = { "quickfix", "nofile", "help" },
|
||||||
|
lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit" },
|
||||||
|
lastplace_open_folds = true,
|
||||||
|
})
|
1
modules/programs/nvim/plugins/nvim-surround.lua
Normal file
1
modules/programs/nvim/plugins/nvim-surround.lua
Normal file
|
@ -0,0 +1 @@
|
||||||
|
require("nvim-surround").setup({})
|
10
modules/programs/nvim/plugins/nvim-tree-lua.lua
Normal file
10
modules/programs/nvim/plugins/nvim-tree-lua.lua
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
-- disable netrw at the very start of your init.lua (strongly advised)
|
||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
-- set termguicolors to enable highlight groups
|
||||||
|
vim.opt.termguicolors = true
|
||||||
|
-- empty setup using defaults
|
||||||
|
require("nvim-tree").setup()
|
||||||
|
require("which-key").register({
|
||||||
|
t = { "<cmd>NvimTreeFindFileToggle<cr>", "nvim tree" },
|
||||||
|
}, { prefix = "<leader>t", silent = true })
|
|
@ -0,0 +1,7 @@
|
||||||
|
require("nvim-treesitter.configs").setup({
|
||||||
|
textsubjects = {
|
||||||
|
enable = true,
|
||||||
|
prev_selection = ",", -- (Optional) keymap to select the previous selection
|
||||||
|
keymaps = { ["."] = "textsubjects-smart" },
|
||||||
|
},
|
||||||
|
})
|
|
@ -0,0 +1,5 @@
|
||||||
|
require("nvim-treesitter.configs").setup({
|
||||||
|
context_commentstring = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
})
|
18
modules/programs/nvim/plugins/orgmode.lua
Normal file
18
modules/programs/nvim/plugins/orgmode.lua
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
local orgmode = require("orgmode")
|
||||||
|
-- Load custom treesitter grammar for org filetype
|
||||||
|
orgmode.setup_ts_grammar()
|
||||||
|
-- Treesitter configuration
|
||||||
|
require("nvim-treesitter.configs").setup({
|
||||||
|
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
|
||||||
|
-- highlighting will fallback to default Vim syntax highlighting
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
-- Required for spellcheck, some LaTex highlights and
|
||||||
|
-- code block highlights that do not have ts grammar
|
||||||
|
additional_vim_regex_highlighting = { "org" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
orgmode.setup({
|
||||||
|
org_agenda_files = { "~/Notes/org" },
|
||||||
|
org_default_notes_file = "~/Notes/org/refile.org",
|
||||||
|
})
|
4
modules/programs/nvim/plugins/smartcolumn-nvim.lua
Normal file
4
modules/programs/nvim/plugins/smartcolumn-nvim.lua
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
require("smartcolumn").setup({
|
||||||
|
colorcolumn = 120,
|
||||||
|
disabled_filetypes = { "help", "text", "markdown", "dashboard" },
|
||||||
|
})
|
|
@ -0,0 +1 @@
|
||||||
|
require("telescope").load_extension("fzf")
|
9
modules/programs/nvim/plugins/telescope-nvim.lua
Normal file
9
modules/programs/nvim/plugins/telescope-nvim.lua
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
require("which-key").register({
|
||||||
|
f = {
|
||||||
|
name = "find",
|
||||||
|
f = { "<cmd>Telescope find_files<cr>", "find file" },
|
||||||
|
l = { "<cmd>Telescope current_buffer_fuzzy_find<cr>", "find line" },
|
||||||
|
g = { "<cmd>Telescope live_grep<cr>", "live grep" },
|
||||||
|
b = { "<cmd>Telescope buffers<cr>", "find buffer" },
|
||||||
|
},
|
||||||
|
}, { prefix = "<leader>" })
|
7
modules/programs/nvim/plugins/telescope-zoxide.lua
Normal file
7
modules/programs/nvim/plugins/telescope-zoxide.lua
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
require("telescope").load_extension("zoxide")
|
||||||
|
require("which-key").register({
|
||||||
|
f = {
|
||||||
|
name = "find",
|
||||||
|
z = { "<cmd>Telescope zoxide list<cr>", "find location" },
|
||||||
|
},
|
||||||
|
}, { prefix = "<leader>" })
|
1
modules/programs/nvim/plugins/todo-comments-nvim.lua
Normal file
1
modules/programs/nvim/plugins/todo-comments-nvim.lua
Normal file
|
@ -0,0 +1 @@
|
||||||
|
require("todo-comments").setup({})
|
2
modules/programs/nvim/plugins/which-key-nvim.lua
Normal file
2
modules/programs/nvim/plugins/which-key-nvim.lua
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
vim.o.timeout = true
|
||||||
|
vim.o.timeoutlen = 500
|
Loading…
Reference in a new issue