Compare commits
No commits in common. "8c2ab48ed51b4115c475476d2731014e647bfcb7" and "0cc17c0b2678193539e0f070ca86623d8ceb912c" have entirely different histories.
8c2ab48ed5
...
0cc17c0b26
7 changed files with 80 additions and 141 deletions
83
init.lua
83
init.lua
|
@ -1,4 +1,11 @@
|
||||||
require("vim-options")
|
vim.opt.number = true
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.softtabstop = 2
|
||||||
|
vim.opt.shiftwidth = 2
|
||||||
|
vim.opt.title = true
|
||||||
|
vim.opt.whichwrap = "<,>,[,]"
|
||||||
|
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
@ -11,9 +18,77 @@ if not vim.loop.fs_stat(lazypath) then
|
||||||
lazypath,
|
lazypath,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
require("lazy").setup({
|
|
||||||
spec = "plugins"
|
local plugins = {
|
||||||
|
{ "rebelot/kanagawa.nvim", name = "kanagawa", priority = 1000 },
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim", tag = "0.1.8",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" }
|
||||||
|
},
|
||||||
|
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
|
||||||
|
{ "williamboman/mason.nvim" },
|
||||||
|
{ "williamboman/mason-lspconfig.nvim" },
|
||||||
|
{ "neovim/nvim-lspconfig" },
|
||||||
|
{ "hrsh7th/nvim-cmp" },
|
||||||
|
{ "hrsh7th/cmp-nvim-lsp" },
|
||||||
|
}
|
||||||
|
|
||||||
|
require("lazy").setup(plugins, {})
|
||||||
|
|
||||||
|
vim.cmd.colorscheme "kanagawa-dragon"
|
||||||
|
local builtin = require("telescope.builtin")
|
||||||
|
|
||||||
|
local configs = require("nvim-treesitter.configs")
|
||||||
|
|
||||||
|
configs.setup({
|
||||||
|
ensure_installed = { "asm", "c", "javascript", "latex", "lua", "matlab", "meson", "sql", "toml", "typescript", "verilog", "vue" },
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
require("mason").setup()
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
ensure_installed = { "clangd", "texlab", "lua_ls", "matlab_ls", "mesonlsp", "sqlls", "svlangserver", "ts_ls", "volar" }
|
||||||
|
})
|
||||||
|
|
||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
|
lspconfig.clangd.setup({
|
||||||
|
cmd = { "clangd", "-header-insertion=never" },
|
||||||
|
})
|
||||||
|
lspconfig.lua_ls.setup({})
|
||||||
|
lspconfig.matlab_ls.setup({})
|
||||||
|
lspconfig.mesonlsp.setup({})
|
||||||
|
lspconfig.sqlls.setup({})
|
||||||
|
lspconfig.svlangserver.setup({})
|
||||||
|
lspconfig.texlab.setup({})
|
||||||
|
lspconfig.ts_ls.setup({})
|
||||||
|
lspconfig.volar.setup({})
|
||||||
|
|
||||||
|
local cmp = require("cmp")
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "T", function() vim.lsp.buf.definition() end, {})
|
||||||
|
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, {})
|
||||||
|
vim.keymap.set("n", "J", function() vim.lsp.buf.type_definition() end, {})
|
||||||
|
vim.keymap.set("n", "C", function() vim.lsp.buf.code_action() end, {})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<C-p>", builtin.find_files, {})
|
||||||
|
vim.keymap.set("n", "<C-f>", builtin.live_grep, {})
|
||||||
|
|
|
@ -4,12 +4,6 @@ return {
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
|
|
||||||
config = function ()
|
config = function ()
|
||||||
local conf = require("kanagawa")
|
vim.cmd("colorscheme kanagawa-dragon")
|
||||||
|
|
||||||
conf.setup({
|
|
||||||
theme = "dragon"
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.cmd("colorscheme kanagawa")
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
return {
|
|
||||||
{
|
|
||||||
"hrsh7th/cmp-nvim-lsp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"hrsh7th/nvim-cmp",
|
|
||||||
|
|
||||||
config = function()
|
|
||||||
local cmp = require("cmp")
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
window = {
|
|
||||||
completion = cmp.config.window.bordered(),
|
|
||||||
documentation = cmp.config.window.bordered()
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
|
||||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
|
||||||
["<C-e>"] = cmp.mapping.abort(),
|
|
||||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
|
||||||
}),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = "nvim_lsp" }
|
|
||||||
})
|
|
||||||
})
|
|
||||||
end
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
return {
|
|
||||||
{
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
|
|
||||||
config = function()
|
|
||||||
require("mason").setup()
|
|
||||||
end
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"williamboman/mason-lspconfig.nvim",
|
|
||||||
|
|
||||||
config = function()
|
|
||||||
local mason_lspconfig = require("mason")
|
|
||||||
|
|
||||||
mason_lspconfig.setup({
|
|
||||||
ensure_installed = { "clangd", "texlab", "lua_ls", "matlab_ls", "mesonlsp", "sqlls", "svlangserver", "ts_ls", "volar" }
|
|
||||||
})
|
|
||||||
end
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
return {
|
|
||||||
"neovim/nvim-lspconfig",
|
|
||||||
|
|
||||||
config = function()
|
|
||||||
local lspconfig = require("lspconfig")
|
|
||||||
local mason_registry = require("mason-registry")
|
|
||||||
local volar_path = mason_registry.get_package("vue-language-server"):get_install_path() .. "/node_modules/@vue/language-server"
|
|
||||||
|
|
||||||
lspconfig.clangd.setup({
|
|
||||||
cmd = { "clangd", "-header-insertion=never" },
|
|
||||||
})
|
|
||||||
lspconfig.lua_ls.setup({})
|
|
||||||
lspconfig.matlab_ls.setup({})
|
|
||||||
lspconfig.mesonlsp.setup({})
|
|
||||||
lspconfig.sqlls.setup({})
|
|
||||||
lspconfig.svlangserver.setup({})
|
|
||||||
lspconfig.texlab.setup({})
|
|
||||||
|
|
||||||
lspconfig.ts_ls.setup({
|
|
||||||
init_options = {
|
|
||||||
plugins = {
|
|
||||||
{
|
|
||||||
name = "@vue/typescript-plugin",
|
|
||||||
location = volar_path,
|
|
||||||
languages = { "vue" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" },
|
|
||||||
})
|
|
||||||
lspconfig.volar.setup({})
|
|
||||||
end
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
return {
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
build = ":TSUpdate",
|
|
||||||
|
|
||||||
config = function()
|
|
||||||
local config = require("nvim-treesitter.configs")
|
|
||||||
|
|
||||||
config.setup({
|
|
||||||
ensure_installed = { "asm", "c", "css", "javascript", "latex", "lua", "matlab", "meson", "sql", "toml", "typescript", "verilog", "vue" },
|
|
||||||
highlight = { enable = true },
|
|
||||||
indent = { enable = true }
|
|
||||||
})
|
|
||||||
end
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
vim.o.background = ""
|
|
||||||
vim.cmd("set number")
|
|
||||||
vim.cmd("set expandtab")
|
|
||||||
vim.cmd("set tabstop=2")
|
|
||||||
vim.cmd("set scrolloff=4")
|
|
||||||
vim.cmd("set softtabstop=2")
|
|
||||||
vim.cmd("set shiftwidth=2")
|
|
||||||
vim.cmd("set title")
|
|
||||||
|
|
||||||
vim.keymap.set("n", "T", function() vim.lsp.buf.definition() end, {})
|
|
||||||
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, {})
|
|
||||||
vim.keymap.set("n", "J", function() vim.lsp.buf.type_definition() end, {})
|
|
||||||
vim.keymap.set("n", "C", function() vim.lsp.buf.code_action() end, {})
|
|
||||||
|
|
||||||
|
|
||||||
local prettier = function()
|
|
||||||
local clients = vim.lsp.get_active_clients()
|
|
||||||
for _, client in pairs(clients) do
|
|
||||||
if (client.name == "svelte") then
|
|
||||||
local path = vim.api.nvim_buf_get_name(0):gsub("%(", "\\("):gsub("%)", "\\)")
|
|
||||||
local command = "npx prettier --write " .. path
|
|
||||||
vim.system(vim.split(command, " ")):wait()
|
|
||||||
vim.cmd("e")
|
|
||||||
end
|
|
||||||
if (client.name == "texlab") then
|
|
||||||
local path = vim.api.nvim_buf_get_name(0):gsub("%(", "\\("):gsub("%)", "\\)")
|
|
||||||
local command = "pdflatex " .. path
|
|
||||||
vim.system(vim.split(command, " ")):wait()
|
|
||||||
print("Done")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<C-T>", function() prettier() end, {})
|
|
Loading…
Add table
Add a link
Reference in a new issue