How to create a new note using current selection? #100
Answered
by
mickael-menu
lokesh-krishna
asked this question in
Help
-
I'm using Neovim 0.5 and native LSP. While I'm able to use all other functions, such as go to definition and auto-completion, I don't know how to go about creating a new note using the current selection, a feature that's mentioned in the editor integrations. Does this require any further setting up beyond just the basic lspconfig one? |
Beta Was this translation helpful? Give feedback.
Answered by
mickael-menu
Nov 11, 2021
Replies: 1 comment 2 replies
-
Yes this is actually implemented using LSP code actions. You need to bind a key to lspconfig.zk.setup({
on_attach = function(client, bufnr)
-- Key mappings
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local opts = { noremap=true, silent=false }
buf_set_keymap("v", "<CR>", ":'<,'>lua vim.lsp.buf.range_code_action()<CR>", opts)
end
}) Then, select a portion of text and hit Enter. You should see this: |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
lokesh-krishna
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes this is actually implemented using LSP code actions. You need to bind a key to
vim.lsp.buf.range_code_action
as follows:Then, select a portion of text and hit Enter. You should see this: