+ :ZkOrphans :ZkGrep bracket & html matching
parent
e7f3facc2c
commit
fbbc1dea98
|
@ -74,6 +74,8 @@ Plug('hrsh7th/cmp-buffer')
|
||||||
Plug('hrsh7th/nvim-cmp')
|
Plug('hrsh7th/nvim-cmp')
|
||||||
Plug('onsails/lspkind-nvim')
|
Plug('onsails/lspkind-nvim')
|
||||||
-- DevExp
|
-- DevExp
|
||||||
|
Plug('windwp/nvim-autopairs') -- matches pairs like [] (),...
|
||||||
|
Plug('windwp/nvim-ts-autotag') -- matches tags <body>hello</body>
|
||||||
Plug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines
|
Plug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines
|
||||||
Plug('lewis6991/gitsigns.nvim') -- add git info to sign columns
|
Plug('lewis6991/gitsigns.nvim') -- add git info to sign columns
|
||||||
Plug('tpope/vim-fugitive') -- git commands in nvim
|
Plug('tpope/vim-fugitive') -- git commands in nvim
|
||||||
|
@ -201,6 +203,7 @@ end, { desc = '[F]ind [D]iagnostics' })
|
||||||
-- treesitter
|
-- treesitter
|
||||||
require('nvim-treesitter.configs').setup {
|
require('nvim-treesitter.configs').setup {
|
||||||
ensure_installed = { 'lua', 'typescript', 'rust', 'go', 'python', 'prisma' },
|
ensure_installed = { 'lua', 'typescript', 'rust', 'go', 'python', 'prisma' },
|
||||||
|
sync_install = false,
|
||||||
highlight = { enable = true },
|
highlight = { enable = true },
|
||||||
indent = { enable = true },
|
indent = { enable = true },
|
||||||
incremental_selection = {
|
incremental_selection = {
|
||||||
|
@ -224,7 +227,16 @@ require('nvim-treesitter.configs').setup {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
-- automatically close and modify HTML and TSX tags
|
||||||
|
autotag = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require('nvim-autopairs').setup {
|
||||||
|
check_ts = true,
|
||||||
|
}
|
||||||
|
|
||||||
-- harpoon: mark significant files & switch between them
|
-- harpoon: mark significant files & switch between them
|
||||||
remap('n', '<leader>m', function() require('harpoon.mark').add_file() end)
|
remap('n', '<leader>m', function() require('harpoon.mark').add_file() end)
|
||||||
local function harpoon_nav(key, nav_file_index, lead_keybind)
|
local function harpoon_nav(key, nav_file_index, lead_keybind)
|
||||||
|
@ -233,6 +245,7 @@ local function harpoon_nav(key, nav_file_index, lead_keybind)
|
||||||
assert(type(nav_file_index) == "number" and nav_file_index >= 1, "expect 1-indexed number for file index")
|
assert(type(nav_file_index) == "number" and nav_file_index >= 1, "expect 1-indexed number for file index")
|
||||||
return remap('n', lead_keybind .. key, function() require('harpoon.ui').nav_file(nav_file_index) end)
|
return remap('n', lead_keybind .. key, function() require('harpoon.ui').nav_file(nav_file_index) end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- remap letters to index. Inspired by alternating number of Dvorak programmer
|
-- remap letters to index. Inspired by alternating number of Dvorak programmer
|
||||||
-- best practices: try to keep marked files to be around 4
|
-- best practices: try to keep marked files to be around 4
|
||||||
harpoon_nav('f', 1)
|
harpoon_nav('f', 1)
|
||||||
|
@ -241,16 +254,16 @@ harpoon_nav('d', 3)
|
||||||
harpoon_nav('k', 4)
|
harpoon_nav('k', 4)
|
||||||
remap('n', '<leader>hh', function() require('harpoon.ui').toggle_quick_menu() end)
|
remap('n', '<leader>hh', function() require('harpoon.ui').toggle_quick_menu() end)
|
||||||
-- harpoon: navigate by numbers
|
-- harpoon: navigate by numbers
|
||||||
harpoon_nav('1',1)
|
harpoon_nav('1', 1)
|
||||||
harpoon_nav('2',2)
|
harpoon_nav('2', 2)
|
||||||
harpoon_nav('3',3)
|
harpoon_nav('3', 3)
|
||||||
harpoon_nav('4',4)
|
harpoon_nav('4', 4)
|
||||||
harpoon_nav('5',5)
|
harpoon_nav('5', 5)
|
||||||
harpoon_nav('6',6)
|
harpoon_nav('6', 6)
|
||||||
harpoon_nav('7',7)
|
harpoon_nav('7', 7)
|
||||||
harpoon_nav('8',8)
|
harpoon_nav('8', 8)
|
||||||
harpoon_nav('9',9)
|
harpoon_nav('9', 9)
|
||||||
harpoon_nav('0',10)
|
harpoon_nav('0', 10)
|
||||||
|
|
||||||
-- LSP settings
|
-- LSP settings
|
||||||
-- This function gets run when an LSP connects to a particular buffer.
|
-- This function gets run when an LSP connects to a particular buffer.
|
||||||
|
@ -347,17 +360,43 @@ require('zk').setup({
|
||||||
picker = "telescope",
|
picker = "telescope",
|
||||||
lsp = {
|
lsp = {
|
||||||
config = {
|
config = {
|
||||||
cmd = {"zk", "lsp"},
|
cmd = { "zk", "lsp" },
|
||||||
name = "zk",
|
name = "zk",
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
},
|
},
|
||||||
auto_attach = {
|
auto_attach = {
|
||||||
enable = true,
|
enable = true,
|
||||||
filetypes = {"markdown"}
|
filetypes = { "markdown" }
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Custom ZkOrphans that determines unlinked notes
|
||||||
|
-- `:ZkOrphans {tags = {"work"}}`
|
||||||
|
require('zk.commands').add("ZkOrphans", function(options)
|
||||||
|
options = vim.tbl_extend("force", { orphan = true }, options or {})
|
||||||
|
-- zk.edit opens notes picker
|
||||||
|
require('zk').edit(options, { title = "Zk Orphans (unlinked notes)" })
|
||||||
|
end)
|
||||||
|
-- ZkGrep: opens file picker
|
||||||
|
-- In the case where `match_ctor` is falsy, create a prompt.
|
||||||
|
-- This is so that we distinguish between ZkGrep and ZkNotes
|
||||||
|
-- Params:
|
||||||
|
-- match_ctor: string | {match= :string,...} | "" | nil
|
||||||
|
require('zk.commands').add("ZkGrep", function(match_ctor)
|
||||||
|
-- handle polymorphic `match_ctor`
|
||||||
|
local grep_str = ""
|
||||||
|
local match
|
||||||
|
if match_ctor == nil or match_ctor == '' then
|
||||||
|
vim.fn.inputsave()
|
||||||
|
grep_str = vim.fn.input('Grep string: >')
|
||||||
|
vim.fn.inputrestore()
|
||||||
|
|
||||||
|
match = { match = grep_str }
|
||||||
|
end
|
||||||
|
require('zk').edit(match, { title = "Grep: '" .. grep_str .. "'" })
|
||||||
|
end)
|
||||||
|
|
||||||
-- nvim-cmp
|
-- nvim-cmp
|
||||||
local cmp = require 'cmp'
|
local cmp = require 'cmp'
|
||||||
local luasnip = require 'luasnip'
|
local luasnip = require 'luasnip'
|
||||||
|
@ -416,4 +455,3 @@ require('lualine').setup {
|
||||||
icons_enabled = true,
|
icons_enabled = true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue