nvim: add separate config files for most plugins

This commit is contained in:
Moritz Böhme 2023-03-04 13:22:48 +01:00
parent 9db80c9673
commit 04dacde028
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9
25 changed files with 294 additions and 291 deletions

View 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")

View file

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

View 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",
})

View file

@ -0,0 +1,9 @@
require("dashboard").setup({
theme = "hyper",
config = {
packages = { enable = false },
week_header = {
enable = true,
},
},
})

View 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 })

View file

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

View 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 = {},
})

View 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
},
})

View file

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

View 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,
})

View file

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

View 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 })

View file

@ -0,0 +1,7 @@
require("nvim-treesitter.configs").setup({
textsubjects = {
enable = true,
prev_selection = ",", -- (Optional) keymap to select the previous selection
keymaps = { ["."] = "textsubjects-smart" },
},
})

View file

@ -0,0 +1,5 @@
require("nvim-treesitter.configs").setup({
context_commentstring = {
enable = true,
},
})

View 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",
})

View file

@ -0,0 +1,4 @@
require("smartcolumn").setup({
colorcolumn = 120,
disabled_filetypes = { "help", "text", "markdown", "dashboard" },
})

View file

@ -0,0 +1 @@
require("telescope").load_extension("fzf")

View 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>" })

View 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>" })

View file

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

View file

@ -0,0 +1,2 @@
vim.o.timeout = true
vim.o.timeoutlen = 500