Skip to content

Execute the current file / project at the speed of thought

Notifications You must be signed in to change notification settings

shawnyu5/executor.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 

Repository files navigation

executor.nvim

Compiles / executes the current file(s) based on file type in a new terminal tab and exits when commands completes.

Requires neovim >= 5.0

Set up

Vim-plug

Plug 'shawnyu5/executor.nvim'

lua << EOF
require("executor").setup({
    -- where you define your own commands, or leave it empty to use default
    -- configuration
})

EOF

configuration

Executor comes with the following defaults:

{
    commands = {
        -- file type
        cpp = {
            -- command(s) to excute
            "make",
            "g++ % && ./a.out" -- `%` represent the current file name
        },
        python = {
            "python3 %"
        },
        javascript = {
            "nodemon %"
        },
        sh = {
            "bash %"
        },
        vim = {
            "source %",
            extern = false  -- run command in pop terminal instead of terminal
                            -- in new tab
        },
        lua = {
            "luafile %",
            extern = false
        },
        markdown = {
            "MarkdownPreview",
            extern = false
        }

    },
     default_mappings = true, -- use default mapping
    always_exit = true, -- always exit terminal no matter status of previous
    command

     dependency_commands = {
         -- the command make requires the presents of a makefile in cwd, if
         -- makefile is not found, try next command in table
         make = "makefile"
     }
}

Set always_exit to true will run exit after the command no matter the status of the previous command. When set to false, it will only exit when previous command succeeds.

Key mappings

Executor comes with the following key mappings:

nnoremap <leader>m :lua require('executor').executor()<CR> - executes the current file

nnoremap <leader>ct :lua require('executor').term_closer()<CR> - close all terminal windows. Effectively running :bd! on all terminal tabs

About

Execute the current file / project at the speed of thought

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages