Initialize branch wih configuration for NeoVim < 8.0

This commit is contained in:
Jiří Štefka 2022-10-03 03:57:04 +02:00
parent 8b0d6f7c6b
commit fc88420c44

@ -28,30 +28,26 @@ local config = {
-- Set colorscheme to use -- Set colorscheme to use
colorscheme = "default_theme", colorscheme = "default_theme",
-- Add highlight groups in any theme -- Override highlight groups in any theme
highlights = { highlights = {
-- duskfox = { -- a table of overrides/changes to the default -- duskfox = { -- a table of overrides/changes to the default
-- Normal = { bg = "#000000" }, -- Normal = { bg = "#000000" },
-- }, -- },
default_theme = function(highlights) -- or a function that returns a new table of colors to set
local C = require "default_theme.colors"
highlights.Normal = { fg = C.fg, bg = C.bg }
return highlights
end,
}, },
-- set vim options here (vim.<first_key>.<second_key> = value) -- set vim options here (vim.<first_key>.<second_key> = value)
options = { options = {
opt = { opt = {
-- set to true or false etc.
relativenumber = true, -- sets vim.opt.relativenumber relativenumber = true, -- sets vim.opt.relativenumber
number = true, -- sets vim.opt.number
spell = true, -- sets vim.opt.spell
signcolumn = "auto", -- sets vim.opt.signcolumn to auto
wrap = false, -- sets vim.opt.wrap
}, },
g = { g = {
mapleader = " ", -- sets vim.g.mapleader mapleader = " ", -- sets vim.g.mapleader
cmp_enabled = true, -- enable completion at start
autopairs_enabled = true, -- enable autopairs at start
diagnostics_enabled = true, -- enable diagnostics at start
status_diagnostics_enabled = true, -- enable diagnostics in statusline
copilot_no_tab_map = true, copilot_no_tab_map = true,
copilot_assume_mapped = true, copilot_assume_mapped = true,
copilot_tab_fallback = "", copilot_tab_fallback = "",
@ -85,24 +81,13 @@ local config = {
-- Default theme configuration -- Default theme configuration
default_theme = { default_theme = {
-- set the highlight style for diagnostic messages
diagnostics_style = { italic = true },
-- Modify the color palette for the default theme -- Modify the color palette for the default theme
colors = { colors = {
fg = "#abb2bf", fg = "#abb2bf",
bg = "#1e222a", bg = "#1e222a",
}, },
highlights = function(hl) -- or a function that returns a new table of colors to set
local C = require "default_theme.colors"
hl.Normal = { fg = C.fg, bg = C.bg }
-- New approach instead of diagnostic_style
hl.DiagnosticError.italic = true
hl.DiagnosticHint.italic = true
hl.DiagnosticInfo.italic = true
hl.DiagnosticWarn.italic = true
return hl
end,
-- enable or disable highlighting for extra plugins -- enable or disable highlighting for extra plugins
plugins = { plugins = {
aerial = true, aerial = true,
@ -125,7 +110,7 @@ local config = {
}, },
}, },
-- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on -- Diagnostics configuration (for vim.diagnostics.config({...}))
diagnostics = { diagnostics = {
virtual_text = true, virtual_text = true,
underline = true, underline = true,
@ -133,23 +118,10 @@ local config = {
-- Extend LSP configuration -- Extend LSP configuration
lsp = { lsp = {
on_attach = function(client, bufnr)
if client.server_capabilities.documentFormattingProvider then
vim.api.nvim_del_augroup_by_name "auto_format"
end
end,
-- enable servers that you already have installed without mason -- enable servers that you already have installed without mason
servers = { servers = {
-- "pyright" -- "pyright"
}, },
formatting = {
disabled = { -- disable formatting capabilities for the listed clients
-- "sumneko_lua",
},
-- filter = function(client) -- fully override the default formatting function
-- return true
-- end
},
-- easily add or disable built in mappings added during LSP attaching -- easily add or disable built in mappings added during LSP attaching
mappings = { mappings = {
n = { n = {
@ -179,6 +151,15 @@ local config = {
-- }, -- },
-- }, -- },
-- }, -- },
-- Example disabling formatting for a specific language server
-- gopls = { -- override table for require("lspconfig").gopls.setup({...})
-- on_attach = function(client, bufnr)
-- client.resolved_capabilities.document_formatting = false
-- end
-- }
clangd = {
capabilities = { offsetEncoding = "utf-8" },
},
}, },
}, },
@ -192,6 +173,7 @@ local config = {
n = { n = {
-- second key is the lefthand side of the map -- second key is the lefthand side of the map
-- mappings seen under group name "Buffer" -- mappings seen under group name "Buffer"
["<leader>a"] = { "<cmd>Alpha<cr>", desc = "Alpha Dashboard" },
["<leader>bb"] = { "<cmd>tabnew<cr>", desc = "New tab" }, ["<leader>bb"] = { "<cmd>tabnew<cr>", desc = "New tab" },
["<leader>bc"] = { "<cmd>BufferLinePickClose<cr>", desc = "Pick to close" }, ["<leader>bc"] = { "<cmd>BufferLinePickClose<cr>", desc = "Pick to close" },
["<leader>bj"] = { "<cmd>BufferLinePick<cr>", desc = "Pick to jump" }, ["<leader>bj"] = { "<cmd>BufferLinePick<cr>", desc = "Pick to jump" },
@ -266,7 +248,9 @@ local config = {
}, },
i = { i = {
["<C-e>"] = { "copilot#Accept('<CR>')", silent = true, expr = true }, ["<C-e>"] = { "copilot#Accept('<CR>')", silent = true, expr = true },
} },
v = {
},
}, },
-- Configure plugins -- Configure plugins
@ -285,7 +269,6 @@ local config = {
-- require("lsp_signature").setup() -- require("lsp_signature").setup()
-- end, -- end,
-- }, -- },
--
{"github/copilot.vim"}, {"github/copilot.vim"},
{"puremourning/vimspector"}, {"puremourning/vimspector"},
{"lervag/vimtex"}, {"lervag/vimtex"},
@ -301,7 +284,6 @@ local config = {
end, end,
}, },
-- We also support a key value style plugin definition similar to NvChad: -- We also support a key value style plugin definition similar to NvChad:
-- ["ray-x/lsp_signature.nvim"] = { -- ["ray-x/lsp_signature.nvim"] = {
-- event = "BufRead", -- event = "BufRead",
@ -323,7 +305,18 @@ local config = {
-- null_ls.builtins.formatting.stylua, -- null_ls.builtins.formatting.stylua,
-- null_ls.builtins.formatting.prettier, -- null_ls.builtins.formatting.prettier,
} }
return config -- return final config table -- set up null-ls's on_attach function
-- NOTE: You can uncomment this on attach function to enable format on save
-- config.on_attach = function(client)
-- if client.resolved_capabilities.document_formatting then
-- vim.api.nvim_create_autocmd("BufWritePre", {
-- desc = "Auto format before save",
-- pattern = "<buffer>",
-- callback = vim.lsp.buf.formatting_sync,
-- })
-- end
-- end
return config -- return final config table to use in require("null-ls").setup(config)
end, end,
treesitter = { -- overrides `require("treesitter").setup(...)` treesitter = { -- overrides `require("treesitter").setup(...)`
-- ensure_installed = { "lua" }, -- ensure_installed = { "lua" },
@ -336,6 +329,9 @@ local config = {
["mason-tool-installer"] = { -- overrides `require("mason-tool-installer").setup(...)` ["mason-tool-installer"] = { -- overrides `require("mason-tool-installer").setup(...)`
-- ensure_installed = { "prettier", "stylua" }, -- ensure_installed = { "prettier", "stylua" },
}, },
packer = { -- overrides `require("packer").setup(...)`
compile_path = vim.fn.stdpath "data" .. "/packer_compiled.lua",
},
}, },
-- LuaSnip Options -- LuaSnip Options
@ -344,7 +340,7 @@ local config = {
vscode_snippet_paths = {}, vscode_snippet_paths = {},
-- Extend filetypes -- Extend filetypes
filetype_extend = { filetype_extend = {
-- javascript = { "javascriptreact" }, javascript = { "javascriptreact" },
}, },
}, },
@ -366,7 +362,7 @@ local config = {
-- Modify which-key registration (Use this with mappings table in the above.) -- Modify which-key registration (Use this with mappings table in the above.)
["which-key"] = { ["which-key"] = {
-- Add bindings which show up as group name -- Add bindings which show up as group name
register = { register_mappings = {
-- first key is the mode, n == normal mode -- first key is the mode, n == normal mode
n = { n = {
-- second key is the prefix, <leader> prefixes -- second key is the prefix, <leader> prefixes
@ -390,6 +386,16 @@ local config = {
-- augroups/autocommands and custom filetypes also this just pure lua so -- augroups/autocommands and custom filetypes also this just pure lua so
-- anything that doesn't fit in the normal config locations above can go here -- anything that doesn't fit in the normal config locations above can go here
polish = function() polish = function()
-- Set key binding
-- Set autocommands
-- vim.api.nvim_create_augroup("packer_conf", { clear = true })
-- vim.api.nvim_create_autocmd("BufWritePost", {
-- desc = "Sync packer after modifying plugins.lua",
-- group = "packer_conf",
-- pattern = "plugins.lua",
-- command = "source <afile> | PackerSync",
-- })
-- Set up custom filetypes -- Set up custom filetypes
-- vim.filetype.add { -- vim.filetype.add {
-- extension = { -- extension = {