Use lua to create commands
This commit is contained in:
@@ -301,6 +301,14 @@ local opts = {
|
|||||||
| `:SymbolsOutlineOpen` | Open symbols outline |
|
| `:SymbolsOutlineOpen` | Open symbols outline |
|
||||||
| `:SymbolsOutlineClose` | Close symbols outline |
|
| `:SymbolsOutlineClose` | Close symbols outline |
|
||||||
|
|
||||||
|
### Lua
|
||||||
|
|
||||||
|
```
|
||||||
|
require'symbols-outline'.toggle_outline()
|
||||||
|
require'symbols-outline'.open_outline()
|
||||||
|
require'symbols-outline'.close_outline()
|
||||||
|
```
|
||||||
|
|
||||||
## Default keymaps
|
## Default keymaps
|
||||||
|
|
||||||
| Key | Action |
|
| Key | Action |
|
||||||
|
|||||||
@@ -53,6 +53,12 @@ local function setup_buffer_autocmd()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function setup_commands()
|
||||||
|
vim.api.nvim_create_user_command('SymbolsOutline', M.toggle_outline, { nargs = 0 })
|
||||||
|
vim.api.nvim_create_user_command('SymbolsOutlineOpen', M.open_outline, { nargs = 0 })
|
||||||
|
vim.api.nvim_create_user_command('SymbolsOutlineClose', M.close_outline, { nargs = 0 })
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------
|
-------------------------
|
||||||
-- STATE
|
-- STATE
|
||||||
-------------------------
|
-------------------------
|
||||||
@@ -357,6 +363,7 @@ function M.setup(opts)
|
|||||||
|
|
||||||
M.view = View:new()
|
M.view = View:new()
|
||||||
setup_global_autocmd()
|
setup_global_autocmd()
|
||||||
|
setup_commands()
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
command! SymbolsOutline :lua require'symbols-outline'.toggle_outline()
|
|
||||||
command! SymbolsOutlineOpen :lua require'symbols-outline'.open_outline()
|
|
||||||
command! SymbolsOutlineClose :lua require'symbols-outline'.close_outline()
|
|
||||||
Reference in New Issue
Block a user