From 69123b9bf02ed792595a3e0f1c3938da6c559557 Mon Sep 17 00:00:00 2001 From: servostar Date: Fri, 1 Mar 2024 18:57:06 +0100 Subject: [PATCH] updated files --- init.lua | 8 ++++-- lua/keymap.lua | 57 ++++++++++++++++++++++++++++++++++++++++ lua/options.lua | 13 +++++++-- lua/plugins/cmp.lua | 50 ++++++++++++++++++++++++++--------- lua/plugins/cokeline.lua | 28 ++++++++++++++------ lua/plugins/lsp.lua | 2 ++ lua/plugins/lualine.lua | 50 ++++++++++++++++++++++++----------- lua/plugins/noice.lua | 5 +--- lua/plugins/trouble.lua | 19 ++++++++++++++ 9 files changed, 189 insertions(+), 43 deletions(-) create mode 100644 lua/keymap.lua create mode 100644 lua/plugins/trouble.lua diff --git a/init.lua b/init.lua index 86c62a8..c5b7da2 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,4 @@ require('bootstrap') --- custom key maps -require('keymaps') -- load options local options = require('options') @@ -16,3 +14,9 @@ if not status then print("Colorscheme not found: " .. options.ui.theme) -- Print an error message if the colorscheme is not installed return end + +-- apply keymap +local keymap = require('keymap') +for _, v in pairs(keymap) do + vim.keymap.set(v[1], v[2], v[3], v[4]) +end diff --git a/lua/keymap.lua b/lua/keymap.lua new file mode 100644 index 0000000..cb45f59 --- /dev/null +++ b/lua/keymap.lua @@ -0,0 +1,57 @@ +return { + { + { 'i', 'x', 'n', 's' }, "", "w", { desc = "Save file" } + }, + { + { 'n' }, "", "enew", { desc = "New File" } + }, + { + { 'n', 'i' }, '', 'u', { desc = "Undo" } + }, + { + { 'n', 'i' }, '', 'redo', { desc = "Undo" } + }, + { + { 'n', 'i' }, '', '<', { desc = "Remove Tab" } + }, + { + { 'n', 'i' }, '', 'Telescope', { desc = "Open Telescope" } + }, + { + { 'n', 'i' }, '', '', { desc = "Scroll sideways" } + }, + { + { 'n', 'i' }, '', '', { desc = "Scroll sideways" } + }, + { + { 'n' }, "", "(cokeline-focus-prev)", { desc = "Next Tab", silent = false } + }, + { + { 'n' }, "", "(cokeline-focus-next)", { desc = "Previous Tab", silent = false } + }, + { + { 'n' }, '', '', { desc = "Disable STRG+w" } + }, + { + { 'n' }, 'v', 'vsplit', { desc = "Split Vertical", noremap = true } + }, + { + { 'n' }, 'h', 'split', { desc = "Split Horizontal", noremap = true } + }, + { + { 'n' }, 'q', 'q', { desc = "Quit Window" } + }, + { + { 'n' }, '', 'wincmd h', { desc = "Window Left" } + }, + { + { 'n' }, '', 'wincmd j', { desc = "Window Down" } + }, + { + { 'n' }, '', 'wincmd k', { desc = "Window Up" } + }, + { + { 'n' }, '', 'wincmd l', { desc = "Window Right" } + } +} + diff --git a/lua/options.lua b/lua/options.lua index 229e10b..d2caa27 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -9,10 +9,10 @@ return { confirm = true, -- Confirm to save changes before exiting modified buffer cursorline = true, -- Enable highlighting of the current line ignorecase = true, -- Ignore case - laststatus = 3, -- global statusline mouse = "a", -- Enable mouse mode number = true, -- Print line number pumblend = 0, -- Popup pseudo transparency + pumheight = 12, -- Popup height showmode = false, -- Dont show mode since we have a statusline smartindent = true, -- Insert indents automatically termguicolors = true, -- True color support @@ -29,7 +29,16 @@ return { foldsep = " ", diff = "╱", eob = " ", - } + horiz = '─', + horizup = '─', + horizdown = '─', + vert = '▎', + vertleft = '▎', + vertright = '▎', + verthoriz = '▎', + }, + mousemoveevent = true, + laststatus = 3, -- global statusline }, ui = { theme = "vscode", diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index c8466b5..9b0a6e4 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -15,24 +15,39 @@ return { 'hrsh7th/vim-vsnip', 'onsails/lspkind.nvim' }, - config = function(_, opts) + config = function(_, _) local cmp = require("cmp"); cmp.setup({ + window = { + completion = { + border = "single", + scrollbar = false, + winhighlight = "Normal:CmpPmenu,FloatBorder:FloatBorder,Search:None" + }, + documentation = { + border = "single", + scrollbar = false, + winhighlight = "Normal:CmpPmenu,FloatBorder:FloatBorder,Search:None" + }, + }, snippet = { expand = function(args) vim.fn["vsnip#anonymous"](args.body) end, }, completion = { - completeopt = "menu,menuone,noinsert", + preselect = 'none', + completeopt = "menu,menuone,noinser,noselectt", }, sources = cmp.config.sources({ { name = 'nvim_lsp' }, + { name = 'nvim_lsp_signature_help' }, { name = 'vsnip' }, { name = 'buffer' }, - { name = 'calc' }, - { name = 'emoji' }, { name = "path" }, + { name = 'calc' }, + }, { + { name = 'emoji' }, { name = "cmdline" }, { name = "latex_symbols" } }), @@ -41,18 +56,29 @@ return { [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping({ + i = function(fallback) + if cmp.visible() and cmp.get_active_entry() then + cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }) + else + fallback() + end + end, + s = cmp.mapping.confirm({ select = true }), + c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), + }), }), formatting = { - fields = { "kind", "abbr", "menu" }, + fields = { "abbr", "kind", "menu" }, format = function(entry, item) - local kind = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, item) - local strings = vim.split(kind.kind, "%s", { trimempty = true }) - kind.kind = " " .. (strings[1] or "") .. " " - kind.menu = " (" .. (strings[2] or "") .. ")" - return kind + return require("lspkind").cmp_format()(entry, item) end - } + }, + experimental = { + ghost_text = { + hl_group = "NonText", + }, + }, }) end } diff --git a/lua/plugins/cokeline.lua b/lua/plugins/cokeline.lua index 274bc12..8232c1d 100644 --- a/lua/plugins/cokeline.lua +++ b/lua/plugins/cokeline.lua @@ -1,13 +1,18 @@ return { - { + { "willothy/nvim-cokeline", config = true, + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons" + }, opts = { fill_hl = "NeoTreeTabInactive", show_if_buffers_are_at_least = 1, buffers = { focus_on_delete = "next", new_buffers_position = 'last', + delete_on_right_click = false }, mappings = { disable_mouse = false, @@ -38,7 +43,7 @@ return { fg = function(buffer) return buffer.devicon.color end }, { - text = function(buffer) return buffer.devicon.icon end, + text = function(buffer) return ' ' .. buffer.devicon.icon end, fg = function(buffer) return buffer.devicon.color end, }, { @@ -173,16 +178,23 @@ return { } }, }, + rhs = { + { + text = "󰓩 2 tabs" + } + }, sidebar = { - filetype = { "NvimTree", "neo-tree", "SidebarNvim" }, + filetype = { + 'neo-tree' + }, components = { { - text = "", - bg = "NeoTreeTabInactive", - fg = "NeoTreeTabInactive" + text = '', + fg = "NeoTreeTabInactive", + bg = "NeoTreeTabInactive" } - }, - }, + } + } } } } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index f21e291..7d41007 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -48,6 +48,8 @@ return { end vim.diagnostic.config(vim.deepcopy(opts.diagnostics)) + + require'lspconfig'.gdscript.setup{} end } } diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index 598756f..72671a8 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -7,14 +7,44 @@ return { options = { theme = "vscode", component_separators = { left = '', right = '' }, + section_separators = { left = '', right = '' }, + globalstatus = true }, sections = { lualine_a = { - 'mode', + { + function () + return ' ' + end, + separator = { left = '', right = '' }, + padding = 1, + fmt = function (text) + return string.gsub(text, "%s+", "") + end + }, + { + 'mode', + padding = 0, + fmt = function (text) + return string.gsub(text, "%s+", "") .. ' ' + end + } }, lualine_b = { + { + 'filename', + symbols = { + modified = '', -- Text to show when the file is modified. + readonly = '', -- Text to show when the file is non-modifiable or readonly. + unnamed = '', -- Text to show for unnamed buffers. + newfile = '[New]', -- Text to show for newly created file before first write + } + } + }, + lualine_c = { { 'branch', + icon = '󰊤 ' }, { 'diff', @@ -23,9 +53,9 @@ return { modified = '~', removed = '-', } - } + }, }, - lualine_c = { + lualine_x = { { 'diagnostics', symbols = { @@ -39,21 +69,10 @@ return { }, update_in_insert = true }, - { - 'filename', - symbols = { - modified = '', -- Text to show when the file is modified. - readonly = '', -- Text to show when the file is non-modifiable or readonly. - unnamed = '', -- Text to show for unnamed buffers. - newfile = '[New]', -- Text to show for newly created file before first write - } - } - }, - lualine_x = { { function () local client_id = vim.lsp.get_client_by_id(1) - return ' ' .. client_id.name + return ' LSP - ' .. client_id.name end, on_click = function () vim.defer_fn(function() @@ -98,3 +117,4 @@ return { end } } + diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua index e875dad..8898549 100644 --- a/lua/plugins/noice.lua +++ b/lua/plugins/noice.lua @@ -1,5 +1,5 @@ return { - { + { "folke/noice.nvim", event = "VeryLazy", dependencies = { @@ -29,9 +29,6 @@ return { col = "50%", }, } - }, - views = { - } } end diff --git a/lua/plugins/trouble.lua b/lua/plugins/trouble.lua new file mode 100644 index 0000000..c1ed9e9 --- /dev/null +++ b/lua/plugins/trouble.lua @@ -0,0 +1,19 @@ +return { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = function (_) + local options = require('options') + return { + padding = false, + indent_lines = false, + auto_jump = { }, + signs = { + error = options.lsp.icons.Error, + warning = options.lsp.icons.Warn, + hint = options.lsp.icons.Hint, + information = options.lsp.icons.Info, + other = options.lsp.icons.Info, + }, + } + end +}