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/orgmode")
require("plugin-config/project")
require("plugin-config/dashboard")
require("plugin-config/neoscroll")
-- require("plugin-config/dashboard")
-- require("plugin-config/neoscroll")
require("plugin-config/hop")
require("plugin-config/neotree")
require("plugin-config/live_command")
require("plugin-config/jaq")
require("plugin-config/toggleterm")
@ -31,6 +32,7 @@ require("plugin-config/lazygit")
require("autocmd")
require("lsp")
require("lsp.cmp")
-- require("lsp.coc")
require("lsp.null-ls")
require("lsp.ui")

View File

@ -15,11 +15,25 @@ function M.nvim_create_augroups(definitions)
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 = {
-- other autocommands
open_folds = {
{ "FileReadPost", "*.md", "normal zx" },
},
set_colorscheme = {
{ "VimEnter", "*", "lua set_colorscheme()" },
},
}
M.nvim_create_augroups(autoCommands)

View File

@ -8,6 +8,7 @@ M.load_default_options = function()
completeopt = { "menuone", "noselect" },
conceallevel = 0, -- so that `` is visible in markdown files
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
background = "light", -- set the background to light or dark
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
vim.g[k] = v
end
vim.cmd("colorscheme onenord")
end
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
-- 可视模式下基本操作
map("v", "<", "<gv", opt)
@ -124,6 +118,10 @@ wk.register({
["<Leader>j"] = { ":HopLineStart<CR>", "Quick jump line" },
})
-- 快速切换主题
wk.register({
["<Leader>c"] = { ":Telescope colorscheme<CR>", "Quick change colortheme" },
})
map("n", "<Tab>", "za", opt)
-- insert 模式下ctrl a e跳转开头结尾
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"),
gopls = require("lsp.config.gopls"),
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"),
-- pyright = require("lsp.config.pyright"),
pylsp = require("lsp.config.pylsp"),

View File

@ -13,7 +13,11 @@ end
require("null-ls").setup({
sources = {
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.black,
require("null-ls").builtins.formatting.eslint_d,

View File

@ -1,38 +1,81 @@
local db = require("dashboard")
db.custom_header = {
"",
"┳┻| ",
"┻┳| ",
"┳┻|ヘ ∧ ",
"┻┳| ● w ● )",
"┳┻|⊂ノ ",
"┻┳| ",
"",
-- local db = require("dashboard")
-- db.custom_header = {
-- "",
-- "┳┻| ",
-- "┻┳| ",
-- "┳┻|ヘ ∧ ",
-- "┻┳| ● w ● )",
-- "┳┻|⊂ノ ",
-- "┻┳| ",
-- "",
-- }
require("dashboard").setup{
custom_header = {
"",
"┳┻| ",
"┻┳| ",
"┳┻|ヘ ∧ ",
"┻┳| ● w ● )",
"┳┻|⊂ノ ",
"┻┳| ",
"",
},
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 = "",
desc = "Find File ",
action = "Telescope find_files find_command=rg,--hidden,--files",
shortcut = "SPC f f",
},
{
icon = "",
desc = "Recently opened files ",
action = "Telescope oldfiles",
shortcut = "SPC f r",
},
{
icon = "",
desc = "Open Project ",
action = "Telescope Project ",
shortcut = "SPC f p",
},
{
icon = "",
desc = "File Browser ",
action = "Telescope file_browser",
shortcut = "SPC f b",
},
}
-- db.custom_center = {
-- {
-- icon = " ",
-- desc = "Find File ",
-- action = "Telescope find_files find_command=rg,--hidden,--files",
-- shortcut = "SPC f f",
-- },
-- {
-- icon = " ",
-- desc = "Recently opened files ",
-- action = "Telescope oldfiles",
-- shortcut = "SPC f r",
-- },
-- {
-- icon = " ",
-- desc = "Open Project ",
-- action = "Telescope Project ",
-- shortcut = "SPC f p",
-- },
-- {
-- icon = " ",
-- 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 调试
use("rafcamlet/nvim-luapad")
------------------ 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({
"navarasu/onedark.nvim",
})
use("savq/melange")
use("folke/tokyonight.nvim")
-----------------------------------------------------------------------------------------
@ -45,14 +33,6 @@ return require("packer").startup(function()
"iamcco/markdown-preview.nvim",
})
-- markdown table
-- 优化markdown添加表格
-- use("dhruvasagar/vim-table-mode")
-- nvim-markdown
-- markdown 增强
-- use("ixru/nvim-markdown")
-- markdown flow and enhance
-- markdown 流程和增强
use({ "jakewvincent/mkdnflow.nvim" })
@ -79,15 +59,24 @@ return require("packer").startup(function()
-- vim dashboard
-- 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
-- 顺滑的neovim滚动
use("karb94/neoscroll.nvim")
-- use("karb94/neoscroll.nvim")
-- 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
-- use({ "matbme/JABS.nvim" })
@ -146,7 +135,7 @@ return require("packer").startup(function()
-- 底部状态栏
use({
"nvim-lualine/lualine.nvim",
requires = { "kyazdani42/nvim-web-devicons", opt = true },
requires = { "nvim-tree/nvim-web-devicons", opt = true },
})
-- notify
@ -164,6 +153,7 @@ return require("packer").startup(function()
-- coderunner
-- 代码运行
use({ "is0n/jaq-nvim" })
-- cmake support
-- cmake 支持
use("Civitasv/cmake-tools.nvim")
@ -176,19 +166,21 @@ return require("packer").startup(function()
"neovim/nvim-lspconfig",
})
-- coc-nvim complete
-- use({ "neoclide/coc.nvim", branch = "release" })
-- null-ls for formatter and others
-- null-ls 用于格式化和其他
use({
"jose-elias-alvarez/null-ls.nvim",
})
-- 补全引擎
-- -- 补全引擎
use("hrsh7th/nvim-cmp")
-- Snippet 引擎
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({ "saadparwaiz1/cmp_luasnip" })
use("hrsh7th/cmp-nvim-lsp") -- { name = nvim_lsp }