remove some stuff I don't use
This commit is contained in:
@@ -106,42 +106,6 @@ end)
|
||||
vim.keymap.set('n', ',ct', function()
|
||||
vim.fn.system('ctags -R .')
|
||||
end)
|
||||
do
|
||||
local function escaped(text)
|
||||
local _escaped = vim.fn.escape(text, "\\/.*$^~[]")
|
||||
local pattern = "\\V" .. _escaped
|
||||
return pattern
|
||||
end
|
||||
---@param pattern string
|
||||
local function recursive_literal_vimgrep(pattern)
|
||||
vim.cmd("vimgrep /" .. pattern .. "/ **/*")
|
||||
end
|
||||
---@param keymap string
|
||||
---@param search_for fun(): string
|
||||
local function search_for_in_same_filetype(keymap, search_for)
|
||||
vim.keymap.set('n', keymap, function()
|
||||
recursive_literal_vimgrep(search_for())
|
||||
end, { desc = "Search for word under cursor in same filetype" })
|
||||
end
|
||||
|
||||
search_for_in_same_filetype(',vs', function() return escaped(vim.fn.expand("<cword>")) end)
|
||||
search_for_in_same_filetype(',vS', function() return escaped(vim.fn.expand("<cWORD>")) end)
|
||||
local file_specific = {
|
||||
odin=function()
|
||||
search_for_in_same_filetype(',vd', function()
|
||||
local word = vim.fn.expand("<cword>")
|
||||
local pattern = "\\v"..word.." *: *[:=]"
|
||||
return pattern
|
||||
end)
|
||||
end
|
||||
}
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
callback=function()
|
||||
local conf = file_specific[vim.bo.filetype]
|
||||
if conf then conf() end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({
|
||||
'BufRead',
|
||||
|
||||
Reference in New Issue
Block a user