8000 GitHub - Sinedka/trunner.nvim: nvim plugin for running programs
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Sinedka/trunner.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trunner.nvim

A simple Neovim plugin that simplifies running source code directly from the editor. Only works with NvChad to display results in the terminal.

Features

  • Run the current file with the :RunProgram command
  • Support for different programming languages (C and C++ pre-configured)
  • Easy configuration of commands for each file type
  • Use variables in run commands

Installation

Using packer.nvim:

use {
  'sinedka/trunner.nvim',
  cmd = { "RunProgram" }
}

Using lazy.nvim:

{
  'Sinedka/trunner.nvim',
  cmd = { "RunProgram" }
}

Configuration

require('trunner').setup({
  commands = {
    -- Configuration commands for different file types
    cpp = "cd $dir && g++ $fileName -o $fileNameWithoutExt && ./$fileNameWithoutExt",
    c = "cd $dir && g++ $fileName -o $fileNameWithoutExt && ./$fileNameWithoutExt",
    python = "python3 $file",
    -- Add your settings for other languages
  },
  term = {
    pos = "sp", -- Terminal position: sp(split), vs(vsplit), float
    id = "htoggleTerm", -- Terminal ID for NvChad
  },
})

Available Variables

When configuring run commands, you can use the following variables:

  • $fileNameWithoutExt - filename without extension
  • $fileName - full filename with extension
  • $file - full path to the file
  • $dir - directory containing the file

Usage

After installing and configuring the plugin, simply open a file of the desired type and run:

:RunProgram

The plugin will automatically select the correct command to run based on the file type and display the result in the terminal.

License

MIT

About

nvim plugin for running programs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0