This commit is contained in:
Varris 2023-12-21 20:22:52 +01:00
parent 632d3111de
commit eb08fa76ec
14 changed files with 201 additions and 201 deletions

View File

@ -1,16 +1,16 @@
require("bufferline").setup({ require("bufferline").setup({
options = { options = {
show_tab_indicators = true, show_tab_indicators = true,
-- separator_style = { "", "" }, -- separator_style = { "", "" },
indicator = { style = "icon", icon = "" }, indicator = { style = "icon", icon = "" },
color_icons = true, color_icons = true,
offsets = { offsets = {
{ {
filetype = "neo-tree", filetype = "neo-tree",
text = "File Explorer", text = "File Explorer",
text_align = "center", text_align = "center",
separator = true, separator = true,
}, },
}, },
}, },
}) })

View File

@ -6,112 +6,112 @@ local luasnip = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load() require("luasnip.loaders.from_vscode").lazy_load()
local has_words_before = function() local has_words_before = function()
unpack = unpack or table.unpack unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0)) local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end end
cmp.setup({ cmp.setup({
preselect = cmp.PreselectMode.None, preselect = cmp.PreselectMode.None,
formatting = { formatting = {
format = lspkind.cmp_format({ format = lspkind.cmp_format({
mode = "symbol_text", mode = "symbol_text",
symbol_map = { symbol_map = {
Text = "󰉿", Text = "󰉿",
Method = "󰆧", Method = "󰆧",
Function = "󰊕", Function = "󰊕",
Constructor = "", Constructor = "",
Field = "", Field = "",
Variable = "󰀫", Variable = "󰀫",
Class = "", Class = "",
Interface = "", Interface = "",
Module = "", Module = "",
Property = "", Property = "",
Unit = "", Unit = "",
Value = "󰎠", Value = "󰎠",
Enum = "", Enum = "",
Keyword = "󰌋", Keyword = "󰌋",
Snippet = "", Snippet = "",
Color = "󰏘", Color = "󰏘",
File = "󰈙", File = "󰈙",
Reference = "󰈇", Reference = "󰈇",
Folder = "󰉋", Folder = "󰉋",
EnumMember = "", EnumMember = "",
Constant = "󰏿", Constant = "󰏿",
Struct = "", Struct = "",
Event = "", Event = "",
Operator = "󰆕", Operator = "󰆕",
TypeParameter = "", TypeParameter = "",
}, },
}), }),
}, },
snippet = { snippet = {
expand = function(args) expand = function(args)
require("luasnip").lsp_expand(args.body) require("luasnip").lsp_expand(args.body)
end, end,
}, },
window = { window = {
completion = cmp.config.window.bordered(), completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(),
}, },
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "buffer" }, { name = "buffer" },
{ name = "path" }, { name = "path" },
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
{ name = "luasnip" }, { name = "luasnip" },
}), }),
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4), ["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(), ["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = false }), ["<CR>"] = cmp.mapping.confirm({ select = false }),
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region -- they way you will only jump inside the snippet region
elseif luasnip.expand_or_locally_jumpable() then elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump() luasnip.expand_or_jump()
elseif has_words_before() then elseif has_words_before() then
cmp.complete() cmp.complete()
else else
fallback() fallback()
end end
end, { "i", "s" }), end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback) ["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()
elseif luasnip.jumpable(-1) then elseif luasnip.jumpable(-1) then
luasnip.jump(-1) luasnip.jump(-1)
else else
fallback() fallback()
end end
end, { "i", "s" }), end, { "i", "s" }),
}), }),
}) })
local cmp_autopairs = require("nvim-autopairs.completion.cmp") local cmp_autopairs = require("nvim-autopairs.completion.cmp")
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
cmp.setup.cmdline(":", { cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "path" }, { name = "path" },
{ name = "cmdline" }, { name = "cmdline" },
}), }),
}) })
cmp.setup.cmdline("/", { cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "buffer" }, { name = "buffer" },
}), }),
}) })

View File

@ -1,4 +1,4 @@
require("gruvbox").setup({ require("gruvbox").setup({
transparent_mode = true, transparent_mode = true,
}) })
vim.cmd("colorscheme gruvbox") vim.cmd("colorscheme gruvbox")

View File

@ -1,8 +1,8 @@
local capabilities = require("cmp_nvim_lsp").default_capabilities() local capabilities = require("cmp_nvim_lsp").default_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.foldingRange = { capabilities.textDocument.foldingRange = {
dynamicRegistration = false, dynamicRegistration = false,
lineFoldingOnly = true, lineFoldingOnly = true,
} }
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
@ -11,27 +11,27 @@ local null_ls = require("null-ls")
local null_ls_formatting = null_ls.builtins.formatting local null_ls_formatting = null_ls.builtins.formatting
null_ls.setup({ null_ls.setup({
sources = { sources = {
null_ls_formatting.prettier, null_ls_formatting.prettier,
null_ls_formatting.nixpkgs_fmt, null_ls_formatting.nixpkgs_fmt,
}, },
}) })
lspconfig.nixd.setup({ capabilities = capabilities }) lspconfig.nixd.setup({ capabilities = capabilities })
lspconfig.lua_ls.setup({ lspconfig.lua_ls.setup({
capabilities = capabilities, capabilities = capabilities,
settings = { settings = {
Lua = { Lua = {
runtime = { version = "LuaJIT" }, runtime = { version = "LuaJIT" },
diagnostics = { globals = { "vim" } }, diagnostics = { globals = { "vim" } },
workspace = { workspace = {
library = vim.api.nvim_get_runtime_file("", true), library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false, checkThirdParty = false,
}, },
telemetry = { enable = false }, telemetry = { enable = false },
}, },
}, },
}) })
lspconfig.clangd.setup({ capabilities = capabilities }) lspconfig.clangd.setup({ capabilities = capabilities })
@ -42,9 +42,9 @@ lspconfig.bashls.setup({ capabilities = capabilities })
lspconfig.tsserver.setup({ capabilities = capabilities }) lspconfig.tsserver.setup({ capabilities = capabilities })
lspconfig.cssls.setup({ lspconfig.cssls.setup({
capabilities = capabilities, capabilities = capabilities,
cmd = { "css-languageserver", "--stdio" }, cmd = { "css-languageserver", "--stdio" },
settings = { settings = {
css = { validate = false }, css = { validate = false },
}, },
}) })

View File

@ -1,5 +1,5 @@
require("lualine").setup({ require("lualine").setup({
options = { options = {
theme = "gruvbox_dark", theme = "gruvbox_dark",
}, },
}) })

View File

@ -1,35 +1,35 @@
require("neo-tree").setup({ require("neo-tree").setup({
default_component_configs = { default_component_configs = {
icon = { icon = {
folder_empty = "󰜌", folder_empty = "󰜌",
folder_empty_open = "󰜌", folder_empty_open = "󰜌",
}, },
git_status = { git_status = {
symbols = { symbols = {
renamed = "󰁕", renamed = "󰁕",
unstaged = "󰄱", unstaged = "󰄱",
}, },
}, },
}, },
document_symbols = { document_symbols = {
kinds = { kinds = {
File = { icon = "󰈙", hl = "Tag" }, File = { icon = "󰈙", hl = "Tag" },
Namespace = { icon = "󰌗", hl = "Include" }, Namespace = { icon = "󰌗", hl = "Include" },
Package = { icon = "󰏖", hl = "Label" }, Package = { icon = "󰏖", hl = "Label" },
Class = { icon = "󰌗", hl = "Include" }, Class = { icon = "󰌗", hl = "Include" },
Property = { icon = "󰆧", hl = "@property" }, Property = { icon = "󰆧", hl = "@property" },
Enum = { icon = "󰒻", hl = "@number" }, Enum = { icon = "󰒻", hl = "@number" },
Function = { icon = "󰊕", hl = "Function" }, Function = { icon = "󰊕", hl = "Function" },
String = { icon = "󰀬", hl = "String" }, String = { icon = "󰀬", hl = "String" },
Number = { icon = "󰎠", hl = "Number" }, Number = { icon = "󰎠", hl = "Number" },
Array = { icon = "󰅪", hl = "Type" }, Array = { icon = "󰅪", hl = "Type" },
Object = { icon = "󰅩", hl = "Type" }, Object = { icon = "󰅩", hl = "Type" },
Key = { icon = "󰌋", hl = "" }, Key = { icon = "󰌋", hl = "" },
Struct = { icon = "󰌗", hl = "Type" }, Struct = { icon = "󰌗", hl = "Type" },
Operator = { icon = "󰆕", hl = "Operator" }, Operator = { icon = "󰆕", hl = "Operator" },
TypeParameter = { icon = "󰊄", hl = "Type" }, TypeParameter = { icon = "󰊄", hl = "Type" },
StaticMethod = { icon = "󰠄 ", hl = "Function" }, StaticMethod = { icon = "󰠄 ", hl = "Function" },
}, },
}, },
}) })

View File

@ -1,18 +1,18 @@
require("noice").setup({ require("noice").setup({
lsp = { lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter** -- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = { override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true, ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true, ["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true, ["cmp.entry.get_documentation"] = true,
}, },
}, },
-- you can enable a preset for easier configuration -- you can enable a preset for easier configuration
presets = { presets = {
bottom_search = false, -- use a classic bottom cmdline for search bottom_search = false, -- use a classic bottom cmdline for search
command_palette = false, -- position the cmdline and popupmenu together command_palette = false, -- position the cmdline and popupmenu together
long_message_to_split = false, -- long messages will be sent to a split long_message_to_split = false, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help lsp_doc_border = false, -- add a border to hover docs and signature help
}, },
}) })

View File

@ -1,3 +1,3 @@
require("notify").setup({ require("notify").setup({
background_colour = "#282828", background_colour = "#282828",
}) })

View File

@ -1,8 +1,8 @@
require("smart-splits").setup({ require("smart-splits").setup({
ignored_filetypes = { ignored_filetypes = {
"neo-tree", "neo-tree",
"nofile", "nofile",
"quickfix", "quickfix",
"prompt", "prompt",
}, },
}) })

View File

@ -1,10 +1,10 @@
local telescope = require("telescope") local telescope = require("telescope")
telescope.setup({ telescope.setup({
extensions = { extensions = {
["ui-select"] = { ["ui-select"] = {
require("telescope.themes").get_dropdown({}), require("telescope.themes").get_dropdown({}),
}, },
}, },
}) })
telescope.load_extension("fzf") telescope.load_extension("fzf")

View File

@ -1,4 +1,4 @@
require("nvim-treesitter.configs").setup({ require("nvim-treesitter.configs").setup({
highlight = { enable = true }, highlight = { enable = true },
indent = { enable = true }, indent = { enable = true },
}) })

View File

@ -1,7 +1,7 @@
vim.o.timeoutlen = 100 vim.o.timeoutlen = 100
require("which-key").setup({ require("which-key").setup({
window = { window = {
padding = { 1, 5, 1, 5 }, padding = { 1, 5, 1, 5 },
}, },
}) })

View File

@ -10,7 +10,7 @@ map("n", "<Leader>fb", telescope_builtin.buffers, { desc = "List Buffers" })
map("n", "<Leader>fh", telescope_builtin.help_tags, { desc = "Help Tags" }) map("n", "<Leader>fh", telescope_builtin.help_tags, { desc = "Help Tags" })
map("n", "<Leader>fp", telescope_builtin.git_files, { desc = "Find Files (Git)" }) map("n", "<Leader>fp", telescope_builtin.git_files, { desc = "Find Files (Git)" })
map("n", "<Leader>fc", function() map("n", "<Leader>fc", function()
telescope_builtin.git_files({ cwd = "~/.dotfiles" }) telescope_builtin.git_files({ cwd = "~/.dotfiles" })
end, { desc = "Edit Dotfiles" }) end, { desc = "Edit Dotfiles" })
map("n", "<C-n>", "<cmd>Neotree toggle<CR>", { desc = "Open NeoTree" }) map("n", "<C-n>", "<cmd>Neotree toggle<CR>", { desc = "Open NeoTree" })
map({ "n", "x" }, "ga", ":EasyAlign", { desc = "Align text" }) map({ "n", "x" }, "ga", ":EasyAlign", { desc = "Align text" })

View File

@ -26,9 +26,9 @@ vim.wo.number = true
vim.wo.relativenumber = true vim.wo.relativenumber = true
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = "nix", pattern = "nix",
callback = function() callback = function()
vim.opt_local.shiftwidth = 2 vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2 vim.opt_local.tabstop = 2
end, end,
}) })