Compare commits
10 commits
0cc17c0b26
...
8c2ab48ed5
Author | SHA1 | Date | |
---|---|---|---|
8c2ab48ed5 | |||
db54c6be3a | |||
e02b5d9e03 | |||
49015143c5 | |||
40fa8c3ade | |||
8197dd257d | |||
f141c8937a | |||
afdc9169ae | |||
60c9579bab | |||
a6e02d4c04 |
7 changed files with 141 additions and 80 deletions
83
init.lua
83
init.lua
|
@ -1,11 +1,4 @@
|
|||
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 = "<,>,[,]"
|
||||
require("vim-options")
|
||||
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
|
@ -18,77 +11,9 @@ if not vim.loop.fs_stat(lazypath) then
|
|||
lazypath,
|
||||
})
|
||||
end
|
||||
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
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("lazy").setup({
|
||||
spec = "plugins"
|
||||
})
|
||||
|
||||
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,6 +4,12 @@ return {
|
|||
priority = 1000,
|
||||
|
||||
config = function ()
|
||||
vim.cmd("colorscheme kanagawa-dragon")
|
||||
local conf = require("kanagawa")
|
||||
|
||||
conf.setup({
|
||||
theme = "dragon"
|
||||
})
|
||||
|
||||
vim.cmd("colorscheme kanagawa")
|
||||
end
|
||||
}
|
||||
|
|
29
lua/plugins/completion.lua
Normal file
29
lua/plugins/completion.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
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
|
||||
}
|
||||
}
|
20
lua/plugins/lsp.lua
Normal file
20
lua/plugins/lsp.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
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
|
||||
}
|
||||
}
|
33
lua/plugins/lspconfig.lua
Normal file
33
lua/plugins/lspconfig.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
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
|
||||
}
|
14
lua/plugins/treesitter.lua
Normal file
14
lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
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
|
||||
}
|
34
lua/vim-options.lua
Normal file
34
lua/vim-options.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
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