Skip to content

perryrh0dan/nx.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

nx.nvim

NX workspace plugin for neovim

Installation & Usage

require('lazy').setup({
   "perryrh0dan/nx.nvim'
})

Usage

Copy the project name of the current open file

vim.api.nvim_create_user_command('NxProjectName', function()
    local filepath = vim.fn.expand('%')
    local name = require('custom.utils.nx').project_name(filepath)
    vim.fn.setreg('+', name) -- write to clippoard
    vim.print(name)
end, { desc = 'Copy NX project name' })

Select and copy a target for the current project to paste it directly into the terminal

vim.api.nvim_create_user_command('NxProjectTarget', function()
    local filepath = vim.fn.expand('%')
    local target = require('nx').project_target(filepath)
    if target ~= nil then
        local command = 'npx nx run ' .. target
        vim.fn.setreg('+', command) -- write to clippoard
        -- Without vim.schedule the select will not be properly "closed" and is still visible on the screen
        vim.schedule(function()
            vim.notify(command)
        end)
    end
end, { desc = 'Select and copy NX project target' })

Dependencies

This plugin requires jq to parse the project.json

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages