Skip to content

How to create a new note using current selection? #100

Discussion options

You must be logged in to vote

Yes this is actually implemented using LSP code actions. You need to bind a key to vim.lsp.buf.range_code_action as follows:

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:

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@lokesh-krishna
Comment options

@mickael-menu
Comment options

Answer selected by lokesh-krishna
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants