From c64fb3f85a4b5a4936edf471e5239a358f048650 Mon Sep 17 00:00:00 2001 From: Leslie Kerman Date: Thu, 25 Aug 2022 18:22:36 +0800 Subject: [PATCH] Bring back symbols outline --- lua/configs/symbols_outline.lua | 94 +++++++++++++++++++++++++++++++++ lua/configs/terminal.lua | 2 +- lua/core/init.lua | 1 + lua/core/keymaps.lua | 2 +- lua/core/plugins.lua | 2 + lua/core/theme.lua | 2 +- 6 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 lua/configs/symbols_outline.lua diff --git a/lua/configs/symbols_outline.lua b/lua/configs/symbols_outline.lua new file mode 100644 index 0000000..b2c8974 --- /dev/null +++ b/lua/configs/symbols_outline.lua @@ -0,0 +1,94 @@ +local M = {} +function M.config() + require("symbols-outline").setup { + highlight_hovered_item = true, + show_guides = true, + auto_preview = true, + position = 'right', + relative_width = true, + width = 20, + auto_close = false, + show_numbers = false, + show_relative_numbers = false, + show_symbol_details = true, + preview_bg_highlight = 'Pmenu', + autofold_depth = nil, + auto_unfold_hover = true, + fold_markers = { '', '' }, + keymaps = { -- These keymaps can be a string or a table for multiple keys + close = { "", "q" }, + goto_location = "", + focus_location = "o", + hover_symbol = "", + toggle_preview = "K", + rename_symbol = "r", + code_actions = { "", "a" }, + fold = "h", + unfold = "l", + fold_all = "H", + unfold_all = "L", + fold_reset = "R", + }, + lsp_blacklist = {}, + symbol_blacklist = {}, + --String xxx ctermfg=107 guifg=#a0c980 + --Constant xxx ctermfg=179 guifg=#deb974 + --Character xxx ctermfg=107 guifg=#a0c980 + --Number xxx ctermfg=107 guifg=#a0c980 + --Boolean xxx ctermfg=107 guifg=#a0c980 + --Float xxx ctermfg=107 guifg=#a0c980 + --Function xxx ctermfg=110 guifg=#6cb6eb + --Identifier xxx ctermfg=72 guifg=#5dbbc1 + --Conditional xxx ctermfg=176 guifg=#d38aea + --Statement xxx ctermfg=176 guifg=#d38aea + --Repeat xxx ctermfg=176 guifg=#d38aea + --Label xxx ctermfg=179 guifg=#deb974 + --Operator xxx ctermfg=176 guifg=#d38aea + --Keyword xxx ctermfg=176 guifg=#d38aea + --Exception xxx ctermfg=176 guifg=#d38aea + --Include xxx ctermfg=176 guifg=#d38aea + --PreProc xxx ctermfg=176 guifg=#d38aea + --Define xxx ctermfg=176 guifg=#d38aea + --Macro xxx ctermfg=179 guifg=#deb974 + --PreCondit xxx ctermfg=176 guifg=#d38aea + --StorageClass xxx ctermfg=203 guifg=#ec7279 + --Type xxx ctermfg=203 guifg=#ec7279 + --Structure xxx ctermfg=203 guifg=#ec7279 + --Typedef xxx ctermfg=176 guifg=#d38aea + --Tag xxx ctermfg=179 guifg=#deb974 + --Special xxx ctermfg=179 guifg=#deb974 + --SpecialChar xxx ctermfg=179 guifg=#deb974 + --Delimiter xxx ctermfg=250 guifg=#c5cdd9 + --SpecialComment xxx cterm=italic ctermfg=246 gui=italic guifg=#758094 + symbols = { + File = { icon = "", hl = "Special" }, + Module = { icon = "", hl = "Special" }, + Namespace = { icon = "", hl = "Special" }, + Package = { icon = "", hl = "Special" }, + Class = { icon = "𝓒", hl = "Structure" }, + Method = { icon = "ƒ", hl = "Function" }, + Property = { icon = "", hl = "Identifier" }, + Field = { icon = "", hl = "Identifier" }, + Constructor = { icon = "", hl = "Function" }, + Enum = { icon = "ℰ", hl = "Structure" }, + Interface = { icon = "ﰮ", hl = "Structure" }, + Function = { icon = "", hl = "Function" }, + Variable = { icon = "", hl = "Identifier" }, + Constant = { icon = "", hl = "Identifier" }, + String = { icon = "𝓐", hl = "String" }, + Number = { icon = "#", hl = "Number" }, + Boolean = { icon = "⊨", hl = "Boolean" }, + Array = { icon = "", hl = "Structure" }, + Object = { icon = "⦿", hl = "Structure" }, + Key = { icon = "", hl = "Keyword" }, + Null = { icon = "NULL", hl = "Normal" }, + EnumMember = { icon = "", hl = "Variable" }, + Struct = { icon = "𝓢", hl = "Structure" }, + Event = { icon = "", hl = "Special" }, + Operator = { icon = "+", hl = "Operator" }, + TypeParameter = { icon = "𝙏", hl = "Type" } + } + } +end + +return M diff --git a/lua/configs/terminal.lua b/lua/configs/terminal.lua index 9bdee5b..b03ff85 100644 --- a/lua/configs/terminal.lua +++ b/lua/configs/terminal.lua @@ -32,7 +32,7 @@ function M.config() -- see :h nvim_open_win for details on borders however -- the 'curved' border is a custom border type -- not natively supported but implemented in this plugin. - border = 'shadow', + border = 'single', -- like `size`, width and height can be a number or function which is passed the current terminal width = 140, height = 50, diff --git a/lua/core/init.lua b/lua/core/init.lua index 0f2c307..2b98064 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -50,6 +50,7 @@ require('image').setup { require("impatient") require("configs.autocomplete").config() +require("configs.symbols_outline").config() require("configs.statusline").config() require("configs.filetree").config() require("configs.treesitter").config() diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua index ae10aa1..db4ce02 100644 --- a/lua/core/keymaps.lua +++ b/lua/core/keymaps.lua @@ -67,7 +67,7 @@ vim.keymap.set('n', 'lr', ':Lspsaga rename') vim.keymap.set('n', 'lh', vim.lsp.buf.signature_help) vim.keymap.set('n', 'la', vim.lsp.buf.code_action) vim.keymap.set('n', 'lf', vim.lsp.buf.formatting) -vim.keymap.set('n', 'lb', ':LSoutlineToggle') +vim.keymap.set('n', 'lb', ':SymbolsOutline') vim.keymap.set('n', 'la', ':Lspsaga code_action') vim.keymap.set('n', 'lu', ':Lspsaga lsp_finder') vim.keymap.set('n', '', ':Lspsaga code_action') diff --git a/lua/core/plugins.lua b/lua/core/plugins.lua index 3f8d023..481d4ee 100644 --- a/lua/core/plugins.lua +++ b/lua/core/plugins.lua @@ -29,6 +29,7 @@ return require('packer').startup(function() use 'liuchengxu/space-vim-dark' use 'sainnhe/edge' use 'B4mbus/oxocarbon-lua.nvim' + use 'Th3Whit3Wolf/one-nvim' -- file tree use { @@ -47,6 +48,7 @@ return require('packer').startup(function() use 'L3MON4D3/LuaSnip' use 'nvim-treesitter/nvim-treesitter' use 'simrat39/rust-tools.nvim' + use 'simrat39/symbols-outline.nvim' -- git use { diff --git a/lua/core/theme.lua b/lua/core/theme.lua index 0d994bf..6b9cac6 100644 --- a/lua/core/theme.lua +++ b/lua/core/theme.lua @@ -53,4 +53,4 @@ vim.cmd("colorscheme edge") -- github -- vim.cmd("colorscheme github_dark") -vim.cmd("set background=light") +vim.cmd("set background=dark")