From 27a7c25f0727b373b5d0e4693d5bb2cb4c9c3a88 Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 19 Oct 2022 23:55:51 +0200 Subject: Made Sourcing lua config easier --- lua/user/lspsaga.lua | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 lua/user/lspsaga.lua (limited to 'lua/user/lspsaga.lua') diff --git a/lua/user/lspsaga.lua b/lua/user/lspsaga.lua new file mode 100644 index 0000000..0bf1ec7 --- /dev/null +++ b/lua/user/lspsaga.lua @@ -0,0 +1,145 @@ +require "lspsaga".init_lsp_saga { + -- "single" | "double" | "rounded" | "bold" | "plus" + border_style = "rounded", + --border_style = "single", + saga_winblend = 30, + move_in_saga = { next = '', prev = '' }, + --move_in_saga = { prev = "k", next = "j" }, + scroll_in_preview = { + scroll_down = "", + scroll_up = "", + }, + diagnostic_header = { " ", " ", " ", " " }, + -- add bracket or something with diagnostic source, just have 2 elements + -- use emoji lightbulb in default + code_action_icon = "", + --code_action_icon = "ﯦ ", + -- if true can press number to execute the codeaction in codeaction window + code_action_num_shortcut = true, + -- same as nvim-lightbulb but async + code_action_lightbulb = { + enable = false, + sign = false, + sign_priority = 20, -- + virtual_text = false, + }, + finder_icons = { + def = " ", + ref = " ", + link = " ", + }, + -- preview lines of lsp_finder and definition preview + max_preview_lines = 5, + definition_action_keys = { + edit = '', + vsplit = '', + split = '', + tabe = '', + quit = '', + }, + -- definition_preview_quit = '', + -- finder_preview_hl_ns = 8, + finder_action_keys = { + open = { 'o', '' }, + vsplit = "v", + split = "s", + tabe = "t", + quit = "", + scroll_down = "", + scroll_up = "", -- quit can be a table + }, + code_action_keys = { + quit = "", + exec = "", + }, + rename_action_quit = "", + rename_in_select = true, + symbol_in_winbar = { + enable = true, + --in_custom = false, + in_custom = true, + separator = '  ', + --show_file = false, + show_file = true, + click_support = false, + --click_support = false, + }, + --show_outline = { + -- win_position = 'right', + -- --set special filetype win that outline window split.like NvimTree neotree + -- -- defx, db_ui + -- min_with = '', + -- win_width = 40, + -- auto_enter = false, + -- auto_preview = true, + -- virt_text = 'x', + -- jump_key = 'l', + -- -- auto refresh when change buffer + -- auto_refresh = true, + --}, + custom_kind = { + File = { " " }, + Module = { " " }, + Namespace = { "ﱕ " }, + Package = { " " }, + Class = { "ﴯ " }, + Method = { "" }, + Property = { "ﰠ " }, + Field = { "ﰠ " }, + Constructor = { " " }, + Enum = { " " }, + Interface = { " " }, + Function = { " " }, + Variable = { " " }, + Constant = { " " }, + String = { " " }, + Number = { " " }, + Boolean = { " " }, + Array = { " " }, + Object = { " " }, + Key = { "- " }, + Null = { " " }, + EnumMember = { " " }, + Struct = { " " }, + Event = { " " }, + Operator = { " " }, + TypeParameter = { " " }, + TypeAlias = { " " }, + Parameter = { " " }, + StaticMethod = { " " }, + Macro = { "廓" }, + }, +} + + -- Mappings. +local map = vim.api.nvim_set_keymap +local opts = { noremap = true, silent = true } + +map("n", "gd", "Lspsaga peek_definition", opts) +--map("n", "gp", "Lspsaga peek_definition", opts) +map("n", "gi", "Lspsaga lsp_finder", opts) +map("n", "gh", "Lspsaga hover_doc", opts) +map("n", "gs", "Lspsaga signature_help", opts) +map("n", "ga", "Lspsaga code_action", opts) +map("v", "ga", "Lspsaga range_code_action", opts) +map("n", "gl", "Lspsaga show_line_diagnostics", opts) +--map("n", "go", "Lspsaga open_floaterm zsh", opts) +map("n", ";D", "Lspsaga show_cursor_diagnostics", opts) +map("n", "", "Lspsaga rename", opts) +map("n", "gk", "Lspsaga diagnostic_jump_prev", opts) +map("n", "gj", "Lspsaga diagnostic_jump_next", opts) +map("n", "[d", "lua vim.lsp.diagnostic.goto_prev()", opts) +map("n", "]d", "lua vim.lsp.diagnostic.goto_next()", opts) +map("t", "", "Lspsaga close_floaterm", opts) + +--vim.api.nvim_command("highlight LspFloatWinNormal guibg=none ") +--hi LspFloatWinNormal guibg=none + + +-- vim.api.nvim_create_autocmd("BufEnter", { +-- callback = function () +-- if #vim.api.nvim_list_wins() == 1 and vim.bo.filetype == "lspsagaoutline" then +-- vim.cmd "quit" +-- end +-- end +-- }) -- cgit v1.2.3