Skip to content

devkvlt/floaty.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Floaty.nvim

Install

For example, with packer.nvim:

use('devkvlt/floaty.nvim')

Setup

require('floaty').setup()

This sets up Floaty with the following defaults:

config = {
  width = 0.5, -- Number between 0 and 1 representing a percentage of the editor's width
  height = 0.5, -- Same as above
  border = { '', '', '', '', '', '', '', '' }, -- Chars for the window borders
  winhl = 'Normal:Normal,FloatBorder:Normal', -- Highlight group for the window and the borders, see `h: winhl`
  runners = {}, -- Commands to execute code per (filetype,) see below
}

Code runners

Example:

require('floaty').setup({
  runners = {
    c = 'gcc {} && ./a.out',
    go = 'go run {}',
    html = 'open {}',
    javascript = 'node {}',
    lua = 'lua {}',
    python = 'python3 {}',
    rust = 'rustc {} -o a.out && ./a.out',
    sh = 'bash {}',
    typescript = 'deno run {}',
  },
})

{} expands to the full path to the file to run.

Keymaps

Floaty exposes 3 functions which can be used to create keymaps, for example:

local floaty = require('floaty')

vim.keymap.set({ 'n', 't' }, '<A-\\>', floaty.toggle, { silent = true })
vim.keymap.set('t', '<Esc>', floaty.kill, { silent = true })
vim.keymap.set('n', ' r', floaty.run, { silent = true })

About

Simple floating terminal and code runner for Neovim.

Topics

Resources

Stars

Watchers

Forks

Languages