From f1ad37b19c7e3ae58e9064210b8bb43a5c34e358 Mon Sep 17 00:00:00 2001 From: gameloader Date: Mon, 31 Oct 2022 11:44:48 +0800 Subject: [PATCH] add nvim-qt config and lsp config --- ginit.vim | 29 +++++++++++++++++++++++++++++ lua/basic.lua | 2 +- lua/plugin-config/lua_line.lua | 19 ++++++++++++++++++- lua/plugins.lua | 5 ++--- 4 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 ginit.vim diff --git a/ginit.vim b/ginit.vim new file mode 100644 index 0000000..9624b20 --- /dev/null +++ b/ginit.vim @@ -0,0 +1,29 @@ +" Enable Mouse +set mouse=a + +" Set Editor Font +if exists(':GuiFont') + " Use GuiFont! to ignore font errors + GuiFont FiraCode Nerd Font:h20 +endif + +" Disable GUI Tabline +if exists(':GuiTabline') + GuiTabline 0 +endif + +" Disable GUI Popupmenu +if exists(':GuiPopupmenu') + GuiPopupmenu 0 +endif + +" Enable GUI ScrollBar +if exists(':GuiScrollBar') + GuiScrollBar 1 +endif + +" Right Click Context Menu (Copy-Cut-Paste) +nnoremap :call GuiShowContextMenu() +inoremap :call GuiShowContextMenu() +xnoremap :call GuiShowContextMenu()gv +snoremap :call GuiShowContextMenu()gv diff --git a/lua/basic.lua b/lua/basic.lua index 4943272..f9eac8c 100644 --- a/lua/basic.lua +++ b/lua/basic.lua @@ -10,7 +10,7 @@ M.load_default_options = function() fileencoding = "utf-8", -- the encoding written to a file foldmethod = "manual", -- folding, set to "expr" for treesitter based folding foldexpr = "", -- set to "nvim_treesitter#foldexpr()" for treesitter based folding - guifont = "Menlo: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 hidden = true, -- required to keep multiple buffers and open multiple buffers hlsearch = true, -- highlight all matches on previous search pattern diff --git a/lua/plugin-config/lua_line.lua b/lua/plugin-config/lua_line.lua index ab267c6..caba7b4 100644 --- a/lua/plugin-config/lua_line.lua +++ b/lua/plugin-config/lua_line.lua @@ -1,3 +1,20 @@ +-- 显示lsp_name +local function lsp_name() + local msg = "No Active Lsp" + local buf_ft = vim.api.nvim_buf_get_option(0, "filetype") + local clients = vim.lsp.get_active_clients() + if next(clients) == nil then + return msg + end + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + return client.name + end + end + return msg +end + require("lualine").setup({ options = { icons_enabled = true, @@ -20,7 +37,7 @@ require("lualine").setup({ sections = { lualine_a = { "mode" }, lualine_b = { "branch", "diff", "diagnostics" }, - lualine_c = { "require'lsp-status'.status()" }, + lualine_c = { { lsp_name, icon = " LSP:", color = { fg = "#9933ff", gui = "bold" } } }, lualine_x = { "encoding", "fileformat", "filetype" }, lualine_y = { "progress" }, lualine_z = { "location" }, diff --git a/lua/plugins.lua b/lua/plugins.lua index 796b824..d82db94 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -2,6 +2,8 @@ return require("packer").startup(function() -- Packer can manage itself use("wbthomason/packer.nvim") + -- lua 调试 + use("rafcamlet/nvim-luapad") ------------------ themes -------------------------- -- Nova theme for neovim light -- use({ @@ -166,9 +168,6 @@ return require("packer").startup(function() "jose-elias-alvarez/null-ls.nvim", }) - -- lsp-status - use("nvim-lua/lsp-status.nvim") - -- 补全引擎 use("hrsh7th/nvim-cmp") -- Snippet 引擎