Skip to content

a neovim plugin to search through a julia project's source files from nvim

Notifications You must be signed in to change notification settings

ArbitRandomUser/projectsearchjl.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

A plugin to search through dependency source files of the current julia project in nvim. Looks up the file's project folder for its Project.toml and Manifest.toml, resolves where the dependencies are and caches them

Use telescope or fzf-lua to search through julia source files in these directories.

Requires:

Installation:

Use your neovim plugin manager ex for Plug:

Plug 'ArbitRandomUser/projectsearchjl.nvim'

Setup:

require("projectsearchjl").setup(
    {juliabin="/home/<user>/.juliaup/bin/julia",
    picker = "fzflua"} -- or "telescope" whichever you use
    )

-- with telescope 
vim.keymap.set('n','<your keybind here>',require"projectsearchjl".telescope_grep_jl()) 
vim.keymap.set('n','<your keybind here>',require"projectsearchjl".telescope_live_grep_jl())


-- fzf-lua bindings
vim.keymap.set('n','<your keybind here',require"projectsearchjl".fzflua_live_grep_jl())
vim.keymap.set('n','<your keybind here>',require"projectsearchjl".fzflua_grep_jl())

-- i also like to pass the visual selection to fzflua 

vim.keymap.set('v', '<your keybind here>', function ()
    query = getVisualSelection()
    require "projectsearchjl".fzflua_grep_jl(query)
end)

vim.keymap.set('v', '<leader>jl', function ()
    query = getVisualSelection()
    require "projectsearchjl".fzflua_live_grep_jl(query)
end)

--where VisualSelection is defined as.
-- get selection for visual selection 
function getVisualSelection()
    vim.cmd('noau normal! "vy"')
    local text = vim.fn.getreg('v')
    vim.fn.setreg('v', {})
    text = string.gsub(text, "\n", "")
    if #text > 0 then
        return text
    else
        return ''
    end
end

-- 

grep: prompts you for a string first search for? in the nvim command line. That string is then searched for in the project source folders using rg and triggers telescope/fzf floating window. Furthur filtering can be done by typing floating window.

live_grep: Pops up telescope/fzflua first, as you start typing neovim will search for the typed string using rg in the source folders that the project resolves to. You can switch to grep-mode and filter furthur by alt-g (only if using fzflua) .

About

a neovim plugin to search through a julia project's source files from nvim

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published