This commit is contained in:
hedy
2023-11-19 17:45:41 +08:00
parent fa219c33af
commit 9b90379c7a
4 changed files with 3 additions and 23 deletions

View File

@@ -18,7 +18,8 @@ to rename and detach the fork, starting to work on this as a new plugin.
## Migrating from symbols-outline.nvim ## Migrating from symbols-outline.nvim
If you have existing setup opts for symbols-outline.nvim, you can convert it to If you have existing setup opts for symbols-outline.nvim, you can convert it to
be usable for outline.nvim using this script: [scripts/convert-symbols-outline-opts.lua](scripts/convert-symbols-outline-opts.lua). be usable for outline.nvim using this script:
[scripts/convert-symbols-outline-opts.lua](scripts/convert-symbols-outline-opts.lua).
--- ---

View File

@@ -368,61 +368,42 @@ local function setup_keymaps(bufnr)
local map = function(...) local map = function(...)
utils.nmap(bufnr, ...) utils.nmap(bufnr, ...)
end end
-- goto_location of symbol and focus that window
map(cfg.o.keymaps.goto_location, function() map(cfg.o.keymaps.goto_location, function()
M._goto_location(true) M._goto_location(true)
end) end)
-- goto_location of symbol but stay in outline
map(cfg.o.keymaps.peek_location, function() map(cfg.o.keymaps.peek_location, function()
M._goto_location(false) M._goto_location(false)
end) end)
-- Navigate to corresponding outline location for current code location
map(cfg.o.keymaps.restore_location, M._map_follow_cursor) map(cfg.o.keymaps.restore_location, M._map_follow_cursor)
-- Navigate to corresponding outline location for current code location
map(cfg.o.keymaps.goto_and_close, M._goto_and_close) map(cfg.o.keymaps.goto_and_close, M._goto_and_close)
-- Move down/up in outline and peek that location in code
map(cfg.o.keymaps.down_and_jump, function() map(cfg.o.keymaps.down_and_jump, function()
M._move_and_jump('down') M._move_and_jump('down')
end) end)
-- Move down/up in outline and peek that location in code
map(cfg.o.keymaps.up_and_jump, function() map(cfg.o.keymaps.up_and_jump, function()
M._move_and_jump('up') M._move_and_jump('up')
end) end)
-- hover symbol
map(cfg.o.keymaps.hover_symbol, require('outline.hover').show_hover) map(cfg.o.keymaps.hover_symbol, require('outline.hover').show_hover)
-- preview symbol
map(cfg.o.keymaps.toggle_preview, require('outline.preview').toggle) map(cfg.o.keymaps.toggle_preview, require('outline.preview').toggle)
-- rename symbol
map(cfg.o.keymaps.rename_symbol, require('outline.rename').rename) map(cfg.o.keymaps.rename_symbol, require('outline.rename').rename)
-- code actions
map(cfg.o.keymaps.code_actions, require('outline.code_action').show_code_actions) map(cfg.o.keymaps.code_actions, require('outline.code_action').show_code_actions)
-- show help
map(cfg.o.keymaps.show_help, require('outline.docs').show_help) map(cfg.o.keymaps.show_help, require('outline.docs').show_help)
-- close outline
map(cfg.o.keymaps.close, function() map(cfg.o.keymaps.close, function()
M.view:close() M.view:close()
end) end)
-- toggle fold selection
map(cfg.o.keymaps.fold_toggle, M._toggle_fold) map(cfg.o.keymaps.fold_toggle, M._toggle_fold)
-- fold selection
map(cfg.o.keymaps.fold, function() map(cfg.o.keymaps.fold, function()
M._set_folded(true) M._set_folded(true)
end) end)
-- unfold selection
map(cfg.o.keymaps.unfold, function() map(cfg.o.keymaps.unfold, function()
M._set_folded(false) M._set_folded(false)
end) end)
-- toggle fold all
map(cfg.o.keymaps.fold_toggle_all, M._toggle_all_fold) map(cfg.o.keymaps.fold_toggle_all, M._toggle_all_fold)
-- fold all
map(cfg.o.keymaps.fold_all, function() map(cfg.o.keymaps.fold_all, function()
M._set_all_folded(true) M._set_all_folded(true)
end) end)
-- unfold all
map(cfg.o.keymaps.unfold_all, function() map(cfg.o.keymaps.unfold_all, function()
M._set_all_folded(false) M._set_all_folded(false)
end) end)
-- fold reset
map(cfg.o.keymaps.fold_reset, function() map(cfg.o.keymaps.fold_reset, function()
M._set_all_folded(nil) M._set_all_folded(nil)
end) end)

View File

@@ -3,7 +3,6 @@ local folding = require('outline.folding')
local lsp_utils = require('outline.utils.lsp_utils') local lsp_utils = require('outline.utils.lsp_utils')
local symbols = require('outline.symbols') local symbols = require('outline.symbols')
local t_utils = require('outline.utils.table') local t_utils = require('outline.utils.table')
local ui = require('outline.ui')
local M = {} local M = {}

View File

@@ -1,10 +1,9 @@
local config = require('outline.config') local config = require('outline.config')
local tbl_utils = require('outline.utils.table')
local M = {} local M = {}
function M.is_buf_attached_to_lsp(bufnr) function M.is_buf_attached_to_lsp(bufnr)
local clients = vim.lsp.buf_get_clients(bufnr or 0) local clients = vim.lsp.get_active_clients({ bufnr = bufnr or 0 })
return clients ~= nil and #clients > 0 return clients ~= nil and #clients > 0
end end