Skip to content

Latest commit

 

History

36 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tuxedo.nvim

Open Tuxedo in a floating window.

Supports Neovim 0.11+

Table of Contents

Installation

Install through your favourite package manager.

vim.pack (0.12+)

vim.pack.add({
    -- Using `main` branch
    "https://github.com/RVxLab/tuxedo.nvim",

    -- If you wish to pin the version
    {
        src = "https://github.com/RVxLab/tuxedo.nvim",
        version = vim.version.range("^1.0.0"),
    },
    ...


})

require("tuxedo").setup()

-- Optional: set up a keymap
vim.keymap.set("n", "<leader>T", function ()
    require("tuxedo").tuxedo()
end, {
    desc = "Open Tuxedo",
})

ZPack (0.12+)

{
    "RVxLab/tuxedo.nvim",
    
    -- Optional: If you wish to pin the version
    sem_version = "^1.0.0",

    -- Set up lazy loading with the user command
    cmd = "Tuxedo",

    -- Set up lazy loading with a keymap
    keys = {
        {
            "<leader>T",
            function () require("tuxedo").tuxedo() end,
            mode = "n",
            desc = "Open Tuxedo",
        },
    },

    ---@module "tuxedo"
    ---@type Tuxedo.Config
    opts = {},
}

Lazy.nvim

{
    "RVxLab/tuxedo.nvim",
    
    -- Optional: If you wish to pin the version
    version = "^1.0.0",

    -- Set up lazy loading with the user command
    cmd = "Tuxedo",

    -- Set up lazy loading with a keymap
    keys = {
        {
            "<leader>T",
            function () require("tuxedo").tuxedo() end,
            mode = "n",
            desc = "Open Tuxedo",
        },
    },

    ---@module "tuxedo"
    ---@type Tuxedo.Config
    opts = {},
}

Using my mirror

If you wish to use my mirrored git repo you need to make a couple of small changes:

vim.pack.add({
    -- Using `main` branch
-   "https://github.com/RVxLab/tuxedo.nvim",
+   "https://code.rvx.works/RVxLab/tuxedo.nvim",

    -- If you wish to pin the version
    { 
-       src = "https://github.com/RVxLab/tuxedo.nvim",
+       src = "https://code.rvx.works/RVxLab/tuxedo.nvim",
        version = vim.version.range("^1.0.0"),
    },
    ...

    
})

ZPack

{
-   "RVxLab/tuxedo.nvim",
+   src = "https://code.rvx.works/RVxLab/tuxedo.nvim",
    
    -- Optional: If you wish to pin the version
    sem_version = "^1.0.0",

    -- Set up lazy loading with the user command
    cmd = "Tuxedo",

    -- Set up lazy loading with a keymap
    keys = {
        {
            "<leader>T",
            function () require("tuxedo").tuxedo() end,
            mode = "n",
            desc = "Open Tuxedo",
        },
    },

    ---@module "tuxedo"
    ---@type Tuxedo.Config
    opts = {},
}

Lazy.nvim

{
-   "RVxLab/tuxedo.nvim",
+   url = "https://code.rvx.works/RVxLab/tuxedo.nvim",
    
    -- Optional: If you wish to pin the version
    version = "^1.0.0",

    -- Set up lazy loading with the user command
    cmd = "Tuxedo",

    -- Set up lazy loading with a keymap
    keys = {
        {
            "<leader>T",
            function () require("tuxedo").tuxedo() end,
            mode = "n",
            desc = "Open Tuxedo",
        },
    },

    ---@module "tuxedo"
    ---@type Tuxedo.Config
    opts = {},
}

Configuration

This is the default configuration:

---@module "tuxedo"
---@type Tuxedo.Config
{
    -- The command to run Tuxedo, passed to `vim.jobstart`. May be a string, string[], a function returning one of either, or `nil`
    tuxedo_cmd = "tuxedo",

    -- The size ratios for the terminal between 0 and 1
    terminal = {
        width = 0.85,
        height = 0.7,
    },

    -- The user command by which to invoke Tuxedo. Set to `nil` to disable
    command = "Tuxedo",

    -- Configuration for the todo file itself
    todo_file = {
        -- Whether to create the todo file if it doesn't exist
        create_if_not_exists = true,

        -- The file to open. If it doesn't exist and `create_if_not_exists` is set to `true`, it will be created
        file_name = "todo.txt",
    },
}

Adjusting the tuxedo_cmd option

If you have more complex checks into determining which tuxedo binary to use, such as when you use Nix or Mise, you can pass a function to the tuxedo_cmd option.

This function must return a string, string[] or nil.

In the case of nil, no floating window will be created and an error will be shown.

For an example how this is used in a config, see tuxedo.lua in my config.

Changing the user command

You can change the user command by overriding the command option:

---@module "tuxedo"
---@type Tuxedo.Config
{
    command = "MyTuxedo",
}

Note: If you do this when using Zpack or Lazy, make sure you also set this command in cmd

Examples

Check the examples/ folder for some examples on how you can use this plugin.

Acknowledgements

License

This plugin is licensed under MIT.

About

Tuxedo in Neovim

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages