Update readme

This commit is contained in:
hedy
2023-11-01 17:25:38 +08:00
parent 2df9662290
commit 8c42667fd0

View File

@@ -186,7 +186,7 @@ Lazy:
{ {
"simrat39/symbols-outline.nvim", "simrat39/symbols-outline.nvim",
config = function() config = function()
-- Example mapping to toggle symbols-outline -- Example mapping to toggle outline
vim.keymap.set("n", "<leader>tt", "<cmd>SymbolsOutline<CR>", vim.keymap.set("n", "<leader>tt", "<cmd>SymbolsOutline<CR>",
{ desc = "SymbolsOutline" }) { desc = "SymbolsOutline" })
@@ -201,19 +201,21 @@ Lazy with lazy-loading:
```lua ```lua
{ {
"simrat39/symbols-outline.nvim", "simrat39/symbols-outline.nvim",
cmd = { "SymbolsOutline", "SymbolsOutlineOpen", "SymbolsOutlineClose" }, cmd = { "SymbolsOutline", "SymbolsOutlineOpen" },
keys = { "<leader>tt" }, keys = {
config = function() -- Example mapping to toggle outline
-- Example mapping to toggle symbols-outline { "<leader>tt", "<cmd>SymbolsOutline<CR>", desc = "Toggle outline window" },
vim.keymap.set("n", "<leader>tt", "<cmd>SymbolsOutline<CR>", },
{ desc = "SymbolsOutline" }) opts = {
require("symbols-outline").setup { -- Your setup opts here
-- Your setup opts here (leave empty to use defaults) },
}
end,
}, },
``` ```
This allows Lazy.nvim to lazy load the plugin on commands `SymbolsOutline`,
`SymbolsOutlineOpen`, and your keybindings.
## Setup ## Setup
Call the setup function with your configuration options. Call the setup function with your configuration options.
@@ -245,6 +247,7 @@ local opts = {
show_relative_numbers = false, show_relative_numbers = false,
show_cursorline = true, show_cursorline = true,
show_symbol_details = true, show_symbol_details = true,
-- Highlight group for the preview background
preview_bg_highlight = 'Pmenu', preview_bg_highlight = 'Pmenu',
autofold_depth = nil, autofold_depth = nil,
auto_unfold_hover = true, auto_unfold_hover = true,
@@ -257,12 +260,16 @@ local opts = {
focus_on_open = true, focus_on_open = true,
keymaps = { -- These keymaps can be a string or a table for multiple keys keymaps = { -- These keymaps can be a string or a table for multiple keys
close = {"<Esc>", "q"}, close = {"<Esc>", "q"},
-- Jump to symbol under cursor
goto_location = "<Cr>", goto_location = "<Cr>",
-- Jump to symbol under cursor but keep focus on outline window
focus_location = "o", focus_location = "o",
hover_symbol = "<C-space>", hover_symbol = "<C-space>",
-- Preview symbol under cursor
toggle_preview = "K", toggle_preview = "K",
rename_symbol = "r", rename_symbol = "r",
code_actions = "a", code_actions = "a",
-- These fold actions are collapsing tree items, not code folding
fold = "h", fold = "h",
fold_toggle = '<tab>', -- Only in this fork fold_toggle = '<tab>', -- Only in this fork
fold_toggle_all = '<S-tab>', -- Only in this fork fold_toggle_all = '<S-tab>', -- Only in this fork
@@ -347,16 +354,18 @@ local opts = {
| `:SymbolsOutlineFocusOutline` | Focus on symbols outline | | `:SymbolsOutlineFocusOutline` | Focus on symbols outline |
| `:SymbolsOutlineFocusCode` | Focus on source window | | `:SymbolsOutlineFocusCode` | Focus on source window |
### Lua ### Lua API
```lua ```lua
require'symbols-outline'.toggle_outline() require'symbols-outline'
require'symbols-outline'.open_outline()
require'symbols-outline'.close_outline()
require'symbols-outline'.focus_toggle()
require'symbols-outline'.focus_outline()
require'symbols-outline'.focus_code()
``` ```
- setup(opts)
- toggle_outline()
- open_outline()
- close_outline()
- focus_toggle()
- focus_outline()
- focus_code()
## Default keymaps ## Default keymaps