Changed init.lua line ending format
This commit is contained in:
@@ -1,152 +1,155 @@
|
|||||||
if vim.fn.expand("$XDG_CONFIG_HOME") == "$XDG_CONFIG_HOME" then
|
if vim.fn.expand("$XDG_CONFIG_HOME") == "$XDG_CONFIG_HOME" then
|
||||||
print("[XDG_CONFIG_HOME] environment variable not set, please set this environment variable for configuration to work")
|
print("[XDG_CONFIG_HOME] environment variable not set, please set this environment variable for configuration to work")
|
||||||
print("press any key to close neovim")
|
print("press any key to close neovim")
|
||||||
vim.fn.getchar()
|
vim.fn.getchar()
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
end
|
end
|
||||||
package.path = vim.fn.expand("$XDG_CONFIG_HOME") .. "/nvim/?.lua;" .. package.path
|
package.path = vim.fn.expand("$XDG_CONFIG_HOME") .. "/nvim/?.lua;" .. package.path
|
||||||
|
|
||||||
pcall(vim.api.nvim_exec2, "language en_US", true)
|
pcall(vim.api.nvim_exec2, "language en_US", true)
|
||||||
|
|
||||||
local lazypath = vim.fn.expand("$XDG_CONFIG_HOME") .. "/nvim/lazy/lazy.nvim"
|
local lazypath = vim.fn.expand("$XDG_CONFIG_HOME") .. "/nvim/lazy/lazy.nvim"
|
||||||
|
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
vim.g.maplocalleader = " "
|
vim.g.maplocalleader = " "
|
||||||
|
|
||||||
--Insure lazy.nvim is installed
|
--Insure lazy.nvim is installed
|
||||||
if not vim.uv.fs_stat(lazypath) then
|
if not vim.uv.fs_stat(lazypath) then
|
||||||
vim.fn.system({
|
vim.fn.system({
|
||||||
"git",
|
"git",
|
||||||
"clone",
|
"clone",
|
||||||
"--filter=blob:none",
|
"--filter=blob:none",
|
||||||
"https://github.com/folke/lazy.nvim.git",
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
"--branch=stable",
|
"--branch=stable",
|
||||||
lazypath
|
lazypath
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
local lazy_options = {
|
local lazy_options = {
|
||||||
root = vim.fn.expand("$XDG_CONFIG_HOME") .. "/nvim/plugins/lazy/",
|
root = vim.fn.expand("$XDG_CONFIG_HOME") .. "/nvim/plugins/lazy/",
|
||||||
install = {
|
install = {
|
||||||
missing = true,
|
missing = true,
|
||||||
-- colorscheme = { "habamax" }
|
-- colorscheme = { "habamax" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require("lazy").setup("plugins", lazy_options)
|
require("lazy").setup("plugins", lazy_options)
|
||||||
require("options")
|
require("options")
|
||||||
require("remap")
|
require("remap")
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
-- local lsp_servers = require("mason-lspconfig").get_installed_servers()
|
-- local lsp_servers = require("mason-lspconfig").get_installed_servers()
|
||||||
-- local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
-- local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
-- capabilities.textDocument.foldingRange = {
|
-- capabilities.textDocument.foldingRange = {
|
||||||
-- dynamicRegistration = false,
|
-- dynamicRegistration = false,
|
||||||
-- lineFoldingOnly = true
|
-- lineFoldingOnly = true
|
||||||
-- }
|
-- }
|
||||||
--
|
--
|
||||||
-- require("lspconfig").glsl_analyzer.setup({})
|
-- require("lspconfig").glsl_analyzer.setup({})
|
||||||
-- for _, server in pairs(lsp_servers) do
|
-- for _, server in pairs(lsp_servers) do
|
||||||
-- if server == "lua_ls" then
|
-- if server == "lua_ls" then
|
||||||
-- require("lspconfig")[server].setup({
|
-- require("lspconfig")[server].setup({
|
||||||
-- capabilities = capabilities,
|
-- capabilities = capabilities,
|
||||||
-- settings = {
|
-- settings = {
|
||||||
-- Lua = {
|
-- Lua = {
|
||||||
-- runtime = {
|
-- runtime = {
|
||||||
-- version = "LuaJIT",
|
-- version = "LuaJIT",
|
||||||
-- },
|
-- },
|
||||||
-- diagnostics = {
|
-- diagnostics = {
|
||||||
-- globals = { "vim" }
|
-- globals = { "vim" }
|
||||||
-- }
|
-- }
|
||||||
-- }
|
-- }
|
||||||
-- }
|
-- }
|
||||||
-- })
|
-- })
|
||||||
-- vim.lsp.enable("lua_ls")
|
-- vim.lsp.enable("lua_ls")
|
||||||
-- elseif server == "svelte" then
|
-- elseif server == "svelte" then
|
||||||
-- local dyn_cap = vim.lsp.protocol.make_client_capabilities()
|
-- local dyn_cap = vim.lsp.protocol.make_client_capabilities()
|
||||||
-- dyn_cap.workspace.didChangeWatchedFiles.dynamicRegistration = true
|
-- dyn_cap.workspace.didChangeWatchedFiles.dynamicRegistration = true
|
||||||
-- dyn_cap.textDocument.foldingRange = {
|
-- dyn_cap.textDocument.foldingRange = {
|
||||||
-- dynamicRegistration = false,
|
-- dynamicRegistration = false,
|
||||||
-- lineFoldingOnly = true
|
-- lineFoldingOnly = true
|
||||||
-- }
|
-- }
|
||||||
--
|
--
|
||||||
-- require("lspconfig")[server].setup({
|
-- require("lspconfig")[server].setup({
|
||||||
-- capabilities = dyn_cap,
|
-- capabilities = dyn_cap,
|
||||||
-- on_attach = function(client)
|
-- on_attach = function(client)
|
||||||
-- vim.api.nvim_create_autocmd("BufWritePost", {
|
-- vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
-- pattern = { "*.js", "*.ts" },
|
-- pattern = { "*.js", "*.ts" },
|
||||||
-- callback = function(ctx)
|
-- callback = function(ctx)
|
||||||
-- client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
|
-- client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
|
||||||
-- end
|
-- end
|
||||||
-- })
|
-- })
|
||||||
-- end,
|
-- end,
|
||||||
-- settings = {
|
-- settings = {
|
||||||
-- svelte = {
|
-- svelte = {
|
||||||
-- plugin = {
|
-- plugin = {
|
||||||
-- svelte = {
|
-- svelte = {
|
||||||
-- compilerWarnings = {
|
-- compilerWarnings = {
|
||||||
-- ["a11y-no-onchange"] = "ignore",
|
-- ["a11y-no-onchange"] = "ignore",
|
||||||
-- ["a11y-aria-attributes"] = "ignore",
|
-- ["a11y-aria-attributes"] = "ignore",
|
||||||
-- ["a11y-no-static-element-interactions"] = "ignore",
|
-- ["a11y-no-static-element-interactions"] = "ignore",
|
||||||
-- ["a11y-click-events-have-key-events"] = "ignore",
|
-- ["a11y-click-events-have-key-events"] = "ignore",
|
||||||
-- }
|
-- }
|
||||||
-- }
|
-- }
|
||||||
-- }
|
-- }
|
||||||
-- }
|
-- }
|
||||||
-- }
|
-- }
|
||||||
-- })
|
-- })
|
||||||
-- else
|
-- else
|
||||||
-- require("lspconfig")[server].setup({ capabilities = capabilities })
|
-- require("lspconfig")[server].setup({ capabilities = capabilities })
|
||||||
-- end
|
-- end
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
group = vim.api.nvim_create_augroup("LspConfig", {}),
|
group = vim.api.nvim_create_augroup("LspConfig", {}),
|
||||||
callback = function(ev)
|
callback = function(ev)
|
||||||
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||||
|
|
||||||
local opts = { buffer = ev.buf }
|
local opts = { buffer = ev.buf }
|
||||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
|
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
|
||||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
|
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
|
||||||
vim.keymap.set("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, opts)
|
vim.keymap.set("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, opts)
|
||||||
vim.keymap.set("n", "<leader>wi", vim.lsp.buf.remove_workspace_folder, opts)
|
vim.keymap.set("n", "<leader>wi", vim.lsp.buf.remove_workspace_folder, opts)
|
||||||
vim.keymap.set("n", "<leader>wl", function()
|
vim.keymap.set("n", "<leader>wl", function()
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
end, opts)
|
end, opts)
|
||||||
vim.keymap.set("n", "<leader>D", vim.lsp.buf.type_definition, opts)
|
vim.keymap.set("n", "<leader>D", vim.lsp.buf.type_definition, opts)
|
||||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||||
vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts)
|
vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts)
|
||||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
||||||
vim.keymap.set("n", "<leader>f", function()
|
vim.keymap.set("n", "<leader>f", function()
|
||||||
vim.lsp.buf.format { async = true }
|
vim.lsp.buf.format { async = true }
|
||||||
end, opts)
|
end, opts)
|
||||||
|
|
||||||
-- require("lsp_signature").on_attach({
|
-- require("lsp_signature").on_attach({
|
||||||
--
|
--
|
||||||
-- }, ev.buf)
|
-- }, ev.buf)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
--Color
|
--Color
|
||||||
-- local color = nil
|
-- local color = nil
|
||||||
-- vim.cmd.colorscheme(color or "rose-pine")
|
-- vim.cmd.colorscheme(color or "rose-pine")
|
||||||
-- vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
-- vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||||
-- vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
-- vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||||
--
|
--
|
||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
float = {
|
float = {
|
||||||
source = true,
|
source = true,
|
||||||
border = "rounded",
|
border = "rounded",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local highlight = require("highlight")
|
local highlight = require("highlight")
|
||||||
highlight.setup()
|
highlight.setup()
|
||||||
|
|
||||||
|
local quickCommand = require("quick-command")
|
||||||
|
quickCommand.setup()
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'VimLeavePre' }, {
|
vim.api.nvim_create_autocmd({ 'VimLeavePre' }, {
|
||||||
group = vim.api.nvim_create_augroup('fuck_shada_temp', { clear = true }),
|
group = vim.api.nvim_create_augroup('fuck_shada_temp', { clear = true }),
|
||||||
|
|||||||
Reference in New Issue
Block a user