-- vim.lsp.config['zk'] = { -- cmd = { 'zk', 'lsp'}, -- -- File types to automatically attach to. -- filetypes = { 'markdown'}, -- root_markers = { { '.zk' }, '.git' }, -- settings = { } -- } -- vim.lsp.enable('zk') -- -- require('zk').setup({ -- -- picker = 'fzf', -- -- lsp = { -- -- config = { -- -- cmd = { 'zk', 'lsp' }, -- -- filetypes = { 'markdown' }, -- -- root_markers = { { '.zk' }, '.git' }, -- -- }, -- -- auto_attach = { -- -- enabled = true, -- -- filetypes = { 'markdown' }, -- -- }, -- -- }, -- -- }) -- vim.api.nvim_create_autocmd('LspAttach', { -- callback = function(args) -- local client = assert(vim.lsp.get_client_by_id(args.data.client_id)) -- -- -- completion -- if client:supports_method('textDocument/completion') then -- if client.name == 'zk' then -- vim.opt.completeopt = "noinsert,menuone,fuzzy" -- vim.lsp.completion.enable(true, client.id, args.buf, { -- autotrigger = true, -- convert = function(item) -- local newText = "" -- local textEdit = item.textEdit -- if textEdit == nil then -- newText = item.insertText -- else -- newText = item.textEdit.newText -- end -- -- return { word = newText, info = item.detail } -- end, -- }) -- else -- vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true }) -- end -- -- -- get back the completion menu if lost -- vim.keymap.set('i', '', function() -- vim.lsp.completion.get() -- end) -- end -- end, -- }) -- -- vim.api.nvim_set_keymap('i', '-[', "- [ ] ", { noremap = true, expr = false }) -- vim.api.nvim_set_keymap('i', '-t', "TODO [ ] ", { noremap = true, expr = false }) -- vim.api.nvim_set_keymap('i', '-a', "TODO [#A] ", { noremap = true, expr = false }) -- vim.api.nvim_set_keymap('i', '-b', "TODO [#B] ", { noremap = true, expr = false }) -- vim.api.nvim_set_keymap('i', '-c', "TODO [#C] ", { noremap = true, expr = false }) -- -- function VimGrep(pattern, where) -- --- where -- --- ** recursively in all files -- --- % current buffer -- local ok, result = pcall( vim.cmd.lvimgrep, pattern, where) -- if ok then -- vim.cmd.lopen() -- else -- print(result) -- end -- end -- -- -- -- todos -- vim.api.nvim_create_user_command('Do', -- function() -- VimGrep('/TODO \\[/j', '**') -- end, -- {}) -- -- vim.api.nvim_create_user_command('Doa', -- function() -- VimGrep('/TODO \\[#A/j', '**') -- end, -- {}) -- -- vim.api.nvim_create_user_command('Dob', -- function() -- VimGrep('/TODO \\[#B/j', '**') -- end, -- {}) -- -- vim.api.nvim_create_user_command('Doc', -- function() -- VimGrep('/TODO \\[#C/j', '**') -- end, -- {}) -- -- vim.api.nvim_create_user_command('Donext', -- function() -- VimGrep('/TODO \\[#[ABC]/j', '**') -- end, -- {}) -- -- -- function insert_current_date() -- local time = string.format("%s ", os.date("%Y-%m-%d")) -- vim.cmd('normal! i' .. time) -- end -- -- vim.api.nvim_create_user_command('Date', ':lua insert_current_date()', {}) -- -- -- vimgrep for today's date -- vim.api.nvim_create_user_command('Today', -- function() -- local date = string.format("/%s/j", os.date("%Y-%m-%d")) -- VimGrep(date, '**') -- end, -- {}) -- -- -- vim.api.nvim_create_autocmd({'BufEnter', 'BufWinEnter'}, { -- group = augroup, -- callback = function() -- vim.fn.matchadd("mytodo", "TODO.*") -- vim.api.nvim_set_hl(0, 'mytodo', { bold = true }) -- vim.fn.matchadd("mytodoImp", "TODO \\[#[ABC]]") -- vim.api.nvim_set_hl(0, 'mytodoImp', { bold = true, fg = "#bee7a5" }) -- vim.fn.matchadd("mydone", "DONE") -- vim.api.nvim_set_hl(0, 'mydone', { bold = true, fg = "#788188" }) -- end, -- }) -- -- -- vim.api.nvim_create_user_command('Headings', -- function() -- VimGrep('/#\\s.\\+/j', '%') -- end, -- {}) -- -- -- vim.api.nvim_set_hl(0, 'markdownH1', { bold = true, underline=true, fg = "#f4cd6b" }) -- vim.api.nvim_set_hl(0, 'markdownH2', { bold = true, underline=true, fg = "#f4cd6b" }) -- vim.api.nvim_set_hl(0, 'markdownH3', { bold = true, underline=true, fg = "#f4cd6b" }) -- vim.api.nvim_set_hl(0, 'markdownH4', { bold = true, underline=true, fg = "#f4cd6b" }) -- vim.api.nvim_set_hl(0, 'markdownH5', { bold = true, underline=true, fg = "#f4cd6b" }) -- vim.api.nvim_set_hl(0, 'markdownH6', { bold = true, underline=true, fg = "#f4cd6b" }) -- -- -- vim.api.nvim_set_hl(0, '@markup.link.label', { underline=true, fg = "#b3cde0"})