add autoinstall lsp and auto choose colortheme

This commit is contained in:
gameloader 2023-06-12 10:47:26 +08:00
parent 6aee450ef6
commit f299be3a65
13 changed files with 141 additions and 76 deletions

0
coc-settings.json Normal file
View File

View File

@ -19,9 +19,10 @@ require("plugin-config/table-mode")
require("plugin-config/mkdnflow") require("plugin-config/mkdnflow")
require("plugin-config/orgmode") require("plugin-config/orgmode")
require("plugin-config/project") require("plugin-config/project")
require("plugin-config/dashboard") -- require("plugin-config/dashboard")
require("plugin-config/neoscroll") -- require("plugin-config/neoscroll")
require("plugin-config/hop") require("plugin-config/hop")
require("plugin-config/neotree")
require("plugin-config/live_command") require("plugin-config/live_command")
require("plugin-config/jaq") require("plugin-config/jaq")
require("plugin-config/toggleterm") require("plugin-config/toggleterm")
@ -31,6 +32,7 @@ require("plugin-config/lazygit")
require("autocmd") require("autocmd")
require("lsp") require("lsp")
require("lsp.cmp") require("lsp.cmp")
-- require("lsp.coc")
require("lsp.null-ls") require("lsp.null-ls")
require("lsp.ui") require("lsp.ui")

View File

@ -15,11 +15,25 @@ function M.nvim_create_augroups(definitions)
end end
end end
function set_colorscheme()
local colorschemes = vim.fn.getcompletion("", "color")
local desired_colorscheme = "tokyonight-day"
if vim.tbl_contains(colorschemes, desired_colorscheme) then
vim.cmd("colorscheme " .. desired_colorscheme)
else
vim.cmd("colorscheme default")
end
end
local autoCommands = { local autoCommands = {
-- other autocommands -- other autocommands
open_folds = { open_folds = {
{ "FileReadPost", "*.md", "normal zx" }, { "FileReadPost", "*.md", "normal zx" },
}, },
set_colorscheme = {
{ "VimEnter", "*", "lua set_colorscheme()" },
},
} }
M.nvim_create_augroups(autoCommands) M.nvim_create_augroups(autoCommands)

View File

@ -8,6 +8,7 @@ M.load_default_options = function()
completeopt = { "menuone", "noselect" }, completeopt = { "menuone", "noselect" },
conceallevel = 0, -- so that `` is visible in markdown files conceallevel = 0, -- so that `` is visible in markdown files
fileencoding = "utf-8", -- the encoding written to a file fileencoding = "utf-8", -- the encoding written to a file
fileencodings = "utf-8,cp936,gb18030,big5",
guifont = "FiraCode Nerd Font:h20", -- the font used in graphical neovim applications guifont = "FiraCode Nerd Font:h20", -- the font used in graphical neovim applications
background = "light", -- set the background to light or dark background = "light", -- set the background to light or dark
hidden = true, -- required to keep multiple buffers and open multiple buffers hidden = true, -- required to keep multiple buffers and open multiple buffers
@ -71,8 +72,6 @@ M.load_default_options = function()
for k, v in pairs(let_options) do for k, v in pairs(let_options) do
vim.g[k] = v vim.g[k] = v
end end
vim.cmd("colorscheme onenord")
end end
return M return M

View File

@ -82,12 +82,6 @@ wk.register({
}, },
}) })
--一般映射方式
--map("n", "<Leader>wh", "<C-w>h", opt)
--map("n", "<Leader>wj", "<C-w>j", opt)
--map("n", "<Leader>wk", "<C-w>k", opt)
--map("n", "<Leader>wl", "<C-w>l", opt)
-- base operation for visual mode -- base operation for visual mode
-- 可视模式下基本操作 -- 可视模式下基本操作
map("v", "<", "<gv", opt) map("v", "<", "<gv", opt)
@ -124,6 +118,10 @@ wk.register({
["<Leader>j"] = { ":HopLineStart<CR>", "Quick jump line" }, ["<Leader>j"] = { ":HopLineStart<CR>", "Quick jump line" },
}) })
-- 快速切换主题
wk.register({
["<Leader>c"] = { ":Telescope colorscheme<CR>", "Quick change colortheme" },
})
map("n", "<Tab>", "za", opt) map("n", "<Tab>", "za", opt)
-- insert 模式下ctrl a e跳转开头结尾 -- insert 模式下ctrl a e跳转开头结尾
map("i", "<C-a>", "<C-o>I", opt) map("i", "<C-a>", "<C-o>I", opt)

View File

@ -0,0 +1 @@
return require("lsp.config.basic_config")

1
lua/lsp/config/r.lua Normal file
View File

@ -0,0 +1 @@
return require("lsp.config.basic_config")

View File

@ -9,6 +9,9 @@ local servers = {
clangd = require("lsp.config.clangd"), clangd = require("lsp.config.clangd"),
gopls = require("lsp.config.gopls"), gopls = require("lsp.config.gopls"),
eslint = require("lsp.config.eslint"), eslint = require("lsp.config.eslint"),
-- r_language_server = require("lsp.config.r"),
-- csharp_ls = require("lsp.config.csharp"),
omnisharp = require("lsp.config.csharp"),
-- bashls = require("lsp.config.bash"), -- bashls = require("lsp.config.bash"),
-- pyright = require("lsp.config.pyright"), -- pyright = require("lsp.config.pyright"),
pylsp = require("lsp.config.pylsp"), pylsp = require("lsp.config.pylsp"),

View File

@ -13,7 +13,11 @@ end
require("null-ls").setup({ require("null-ls").setup({
sources = { sources = {
require("null-ls").builtins.formatting.stylua, require("null-ls").builtins.formatting.stylua,
require("null-ls").builtins.formatting.clang_format, require("null-ls").builtins.formatting.styler,
require("null-ls").builtins.formatting.clang_format.with({
disabled_filetypes = { "cs" },
}),
require("null-ls").builtins.formatting.csharpier,
require("null-ls").builtins.formatting.gofmt, require("null-ls").builtins.formatting.gofmt,
require("null-ls").builtins.formatting.black, require("null-ls").builtins.formatting.black,
require("null-ls").builtins.formatting.eslint_d, require("null-ls").builtins.formatting.eslint_d,

View File

@ -1,5 +1,16 @@
local db = require("dashboard") -- local db = require("dashboard")
db.custom_header = { -- db.custom_header = {
-- "",
-- "┳┻| ",
-- "┻┳| ",
-- "┳┻|ヘ ∧ ",
-- "┻┳| ● w ● )",
-- "┳┻|⊂ノ ",
-- "┻┳| ",
-- "",
-- }
require("dashboard").setup{
custom_header = {
"", "",
"┳┻| ", "┳┻| ",
"┻┳| ", "┻┳| ",
@ -8,31 +19,63 @@ db.custom_header = {
"┳┻|⊂ノ ", "┳┻|⊂ノ ",
"┻┳| ", "┻┳| ",
"", "",
},
custom_section = {
a = {
description = { " Find File " },
command = "Telescope find_files find_command=rg,--hidden,--files",
},
b = {
description = { " Recently Used Files" },
command = "Telescope oldfiles",
},
c = {
description = { " Find Word " },
command = "Telescope live_grep",
},
d = {
description = { "洛 New File " },
command = "DashboardNewFile",
},
e = {
description = { " Bookmarks " },
command = "Telescope marks",
},
f = {
description = { " Load Last Session " },
command = "SessionLoad",
},
},
custom_footer = {
"Neovim",
},
} }
db.custom_center = {
{
icon = "", -- db.custom_center = {
desc = "Find File ", -- {
action = "Telescope find_files find_command=rg,--hidden,--files", -- icon = " ",
shortcut = "SPC f f", -- desc = "Find File ",
}, -- action = "Telescope find_files find_command=rg,--hidden,--files",
{ -- shortcut = "SPC f f",
icon = "", -- },
desc = "Recently opened files ", -- {
action = "Telescope oldfiles", -- icon = " ",
shortcut = "SPC f r", -- desc = "Recently opened files ",
}, -- action = "Telescope oldfiles",
{ -- shortcut = "SPC f r",
icon = "", -- },
desc = "Open Project ", -- {
action = "Telescope Project ", -- icon = " ",
shortcut = "SPC f p", -- desc = "Open Project ",
}, -- action = "Telescope Project ",
{ -- shortcut = "SPC f p",
icon = "", -- },
desc = "File Browser ", -- {
action = "Telescope file_browser", -- icon = " ",
shortcut = "SPC f b", -- desc = "File Browser ",
}, -- action = "Telescope file_browser",
} -- shortcut = "SPC f b",
-- },
-- }

View File

@ -9,4 +9,7 @@ require("mason").setup({
}, },
}) })
require("mason-lspconfig").setup() require("mason-lspconfig").setup({
automatic_installation = true,
ensure_installed = { "lua_ls", "clangd", "pyright" },
})

View File

@ -0,0 +1,5 @@
require("neo-tree").setup({
window = {
width = "30%", -- Width of the Neo-tree window
},
})

View File

@ -5,24 +5,12 @@ return require("packer").startup(function()
-- lua 调试 -- lua 调试
use("rafcamlet/nvim-luapad") use("rafcamlet/nvim-luapad")
------------------ themes -------------------------- ------------------ themes --------------------------
-- Nova theme for neovim light
-- use({
-- "zanglg/nova.nvim",
-- config = function()
-- -- support both dark and light style
-- require("nova").setup({ background = "light" })
-- -- load colorscheme
-- require("nova").load()
-- end,
-- })
use("rmehri01/onenord.nvim")
use({ use({
"navarasu/onedark.nvim", "navarasu/onedark.nvim",
}) })
use("savq/melange") use("folke/tokyonight.nvim")
----------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------
@ -45,14 +33,6 @@ return require("packer").startup(function()
"iamcco/markdown-preview.nvim", "iamcco/markdown-preview.nvim",
}) })
-- markdown table
-- 优化markdown添加表格
-- use("dhruvasagar/vim-table-mode")
-- nvim-markdown
-- markdown 增强
-- use("ixru/nvim-markdown")
-- markdown flow and enhance -- markdown flow and enhance
-- markdown 流程和增强 -- markdown 流程和增强
use({ "jakewvincent/mkdnflow.nvim" }) use({ "jakewvincent/mkdnflow.nvim" })
@ -79,15 +59,24 @@ return require("packer").startup(function()
-- vim dashboard -- vim dashboard
-- vim 开始界面 -- vim 开始界面
use({ "glepnir/dashboard-nvim" }) -- use({
-- "glepnir/dashboard-nvim",
-- event = "VimEnter",
-- -- config = function()
-- -- require("dashboard").setup({
-- -- -- config
-- -- })
-- -- end,
-- requires = { "nvim-tree/nvim-web-devicons" },
-- })
-- smooth neovim scroll -- smooth neovim scroll
-- 顺滑的neovim滚动 -- 顺滑的neovim滚动
use("karb94/neoscroll.nvim") -- use("karb94/neoscroll.nvim")
-- bufferline on the top -- bufferline on the top
-- 顶部状态栏 -- 顶部状态栏
use({ "akinsho/bufferline.nvim", requires = "kyazdani42/nvim-web-devicons" }) use({ "akinsho/bufferline.nvim", tag = "v3.*", requires = "nvim-tree/nvim-web-devicons" })
-- 更方便的切换buffer -- 更方便的切换buffer
-- use({ "matbme/JABS.nvim" }) -- use({ "matbme/JABS.nvim" })
@ -146,7 +135,7 @@ return require("packer").startup(function()
-- 底部状态栏 -- 底部状态栏
use({ use({
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
requires = { "kyazdani42/nvim-web-devicons", opt = true }, requires = { "nvim-tree/nvim-web-devicons", opt = true },
}) })
-- notify -- notify
@ -164,6 +153,7 @@ return require("packer").startup(function()
-- coderunner -- coderunner
-- 代码运行 -- 代码运行
use({ "is0n/jaq-nvim" }) use({ "is0n/jaq-nvim" })
-- cmake support -- cmake support
-- cmake 支持 -- cmake 支持
use("Civitasv/cmake-tools.nvim") use("Civitasv/cmake-tools.nvim")
@ -176,19 +166,21 @@ return require("packer").startup(function()
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
}) })
-- coc-nvim complete
-- use({ "neoclide/coc.nvim", branch = "release" })
-- null-ls for formatter and others -- null-ls for formatter and others
-- null-ls 用于格式化和其他 -- null-ls 用于格式化和其他
use({ use({
"jose-elias-alvarez/null-ls.nvim", "jose-elias-alvarez/null-ls.nvim",
}) })
-- 补全引擎 -- -- 补全引擎
use("hrsh7th/nvim-cmp") use("hrsh7th/nvim-cmp")
-- Snippet 引擎 -- Snippet 引擎
use({ "L3MON4D3/LuaSnip" }) use({ "L3MON4D3/LuaSnip" })
-- use("hrsh7th/vim-vsnip") use("hrsh7th/vim-vsnip")
-- 补全源 -- 补全源
-- use("hrsh7th/cmp-vsnip") use("hrsh7th/cmp-vsnip")
use({ "ray-x/lsp_signature.nvim" }) use({ "ray-x/lsp_signature.nvim" })
use({ "saadparwaiz1/cmp_luasnip" }) use({ "saadparwaiz1/cmp_luasnip" })
use("hrsh7th/cmp-nvim-lsp") -- { name = nvim_lsp } use("hrsh7th/cmp-nvim-lsp") -- { name = nvim_lsp }