Initialize branch wih configuration for NeoVim < 8.0
This commit is contained in:
parent
8b0d6f7c6b
commit
fc88420c44
94
init.lua
94
init.lua
@ -28,30 +28,26 @@ local config = {
|
||||
-- Set colorscheme to use
|
||||
colorscheme = "default_theme",
|
||||
|
||||
-- Add highlight groups in any theme
|
||||
-- Override highlight groups in any theme
|
||||
highlights = {
|
||||
-- duskfox = { -- a table of overrides/changes to the default
|
||||
-- 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)
|
||||
options = {
|
||||
opt = {
|
||||
-- set to true or false etc.
|
||||
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 = {
|
||||
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_assume_mapped = true,
|
||||
copilot_tab_fallback = "",
|
||||
@ -85,24 +81,13 @@ local config = {
|
||||
|
||||
-- Default theme configuration
|
||||
default_theme = {
|
||||
-- set the highlight style for diagnostic messages
|
||||
diagnostics_style = { italic = true },
|
||||
-- Modify the color palette for the default theme
|
||||
colors = {
|
||||
fg = "#abb2bf",
|
||||
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
|
||||
plugins = {
|
||||
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 = {
|
||||
virtual_text = true,
|
||||
underline = true,
|
||||
@ -133,23 +118,10 @@ local config = {
|
||||
|
||||
-- Extend LSP configuration
|
||||
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
|
||||
servers = {
|
||||
-- "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
|
||||
mappings = {
|
||||
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 = {
|
||||
-- second key is the lefthand side of the map
|
||||
-- mappings seen under group name "Buffer"
|
||||
["<leader>a"] = { "<cmd>Alpha<cr>", desc = "Alpha Dashboard" },
|
||||
["<leader>bb"] = { "<cmd>tabnew<cr>", desc = "New tab" },
|
||||
["<leader>bc"] = { "<cmd>BufferLinePickClose<cr>", desc = "Pick to close" },
|
||||
["<leader>bj"] = { "<cmd>BufferLinePick<cr>", desc = "Pick to jump" },
|
||||
@ -266,7 +248,9 @@ local config = {
|
||||
},
|
||||
i = {
|
||||
["<C-e>"] = { "copilot#Accept('<CR>')", silent = true, expr = true },
|
||||
}
|
||||
},
|
||||
v = {
|
||||
},
|
||||
},
|
||||
|
||||
-- Configure plugins
|
||||
@ -285,7 +269,6 @@ local config = {
|
||||
-- require("lsp_signature").setup()
|
||||
-- end,
|
||||
-- },
|
||||
--
|
||||
{"github/copilot.vim"},
|
||||
{"puremourning/vimspector"},
|
||||
{"lervag/vimtex"},
|
||||
@ -301,7 +284,6 @@ local config = {
|
||||
end,
|
||||
},
|
||||
|
||||
|
||||
-- We also support a key value style plugin definition similar to NvChad:
|
||||
-- ["ray-x/lsp_signature.nvim"] = {
|
||||
-- event = "BufRead",
|
||||
@ -323,7 +305,18 @@ local config = {
|
||||
-- null_ls.builtins.formatting.stylua,
|
||||
-- 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,
|
||||
treesitter = { -- overrides `require("treesitter").setup(...)`
|
||||
-- ensure_installed = { "lua" },
|
||||
@ -336,6 +329,9 @@ local config = {
|
||||
["mason-tool-installer"] = { -- overrides `require("mason-tool-installer").setup(...)`
|
||||
-- ensure_installed = { "prettier", "stylua" },
|
||||
},
|
||||
packer = { -- overrides `require("packer").setup(...)`
|
||||
compile_path = vim.fn.stdpath "data" .. "/packer_compiled.lua",
|
||||
},
|
||||
},
|
||||
|
||||
-- LuaSnip Options
|
||||
@ -344,7 +340,7 @@ local config = {
|
||||
vscode_snippet_paths = {},
|
||||
-- Extend filetypes
|
||||
filetype_extend = {
|
||||
-- javascript = { "javascriptreact" },
|
||||
javascript = { "javascriptreact" },
|
||||
},
|
||||
},
|
||||
|
||||
@ -366,7 +362,7 @@ local config = {
|
||||
-- Modify which-key registration (Use this with mappings table in the above.)
|
||||
["which-key"] = {
|
||||
-- Add bindings which show up as group name
|
||||
register = {
|
||||
register_mappings = {
|
||||
-- first key is the mode, n == normal mode
|
||||
n = {
|
||||
-- second key is the prefix, <leader> prefixes
|
||||
@ -390,6 +386,16 @@ local config = {
|
||||
-- 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
|
||||
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
|
||||
-- vim.filetype.add {
|
||||
-- extension = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user