added zk and markdown
This commit is contained in:
parent
cdb768ec25
commit
1a3a965f41
6
after/syntax/markdown.vim
Normal file
6
after/syntax/markdown.vim
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
" markdownWikiLink is a new region
|
||||||
|
syn region markdownWikiLink matchgroup=markdownLinkDelimiter start="\[\[" end="\]\]" contains=markdownUrl keepend oneline concealends
|
||||||
|
" markdownLinkText is copied from runtime files with 'concealends' appended
|
||||||
|
syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\%(\_[^][]\|\[\_[^][]*\]\)*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart concealends
|
||||||
|
" markdownLink is copied from runtime files with 'conceal' appended
|
||||||
|
syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" contains=markdownUrl keepend contained conceal
|
28
ftplugin/markdown.lua
Normal file
28
ftplugin/markdown.lua
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
-- Add the key mappings only for Markdown files in a zk notebook.
|
||||||
|
if require('zk.util').notebook_root(vim.fn.expand('%:p')) ~= nil then
|
||||||
|
local function map(...) vim.api.nvim_buf_set_keymap(0, ...) end
|
||||||
|
local opts = { noremap = true, silent = false }
|
||||||
|
|
||||||
|
-- Create a new note after asking for its title.
|
||||||
|
-- This overrides the global `<leader>zn` mapping to create the note in the same directory as the current buffer.
|
||||||
|
vim.keymap.set('n', '<leader>zn', "<Cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>",
|
||||||
|
{ noremap = true, silent = false, desc = 'Create a new note' })
|
||||||
|
-- Create a new note in the same directory as the current buffer, using the current selection for title.
|
||||||
|
vim.keymap.set('v', '<leader>znt', ":'<,'>ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') }<CR>",
|
||||||
|
{ noremap = true, silent = false, desc = 'Create a new note' })
|
||||||
|
-- Create a new note in the same directory as the current buffer, using the current selection for note content and asking for its title.
|
||||||
|
map('v', '<leader>znc',
|
||||||
|
":'<,'>ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
|
||||||
|
|
||||||
|
-- Open notes linking to the current buffer.
|
||||||
|
map('n', '<leader>zb', '<Cmd>ZkBacklinks<CR>', opts)
|
||||||
|
-- Alternative for backlinks using pure LSP and showing the source context.
|
||||||
|
--map('n', '<leader>zb', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||||
|
-- Open notes linked by the current buffer.
|
||||||
|
map('n', '<leader>zl', '<Cmd>ZkLinks<CR>', opts)
|
||||||
|
|
||||||
|
-- Preview a linked note.
|
||||||
|
map('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||||
|
-- Open the code actions for a visual selection.
|
||||||
|
map('v', '<leader>za', ":'<,'>lua vim.lsp.buf.range_code_action()<CR>", opts)
|
||||||
|
end
|
@ -7,7 +7,7 @@ return {
|
|||||||
ensure_installed = 'all',
|
ensure_installed = 'all',
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
additional_vim_regex_highlighting = false
|
additional_vim_regex_highlighting = {'markdown'}
|
||||||
},
|
},
|
||||||
rainbow = {
|
rainbow = {
|
||||||
enable = true,
|
enable = true,
|
||||||
|
11
lua/plugins/zk.lua
Normal file
11
lua/plugins/zk.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
return {
|
||||||
|
'mickael-menu/zk-nvim',
|
||||||
|
config = function()
|
||||||
|
require('zk').setup({
|
||||||
|
picker = 'telescope',
|
||||||
|
config = {
|
||||||
|
on_attach = require('plugins.lspconfig').on_attach
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user