本文主要是介绍FloatRun 在浮动窗口中运行你的代码,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
FloatRun(https://github.com/StubbornVegeta/FloatRun)是一个极其精简的浮动窗口的插件,没有其他多余的功能,他只会做两件事:
- 在浮动窗口中运行你的代码
- 在浮动窗口中打开你的终端
安装与配置
- 对于Packer.nvim
use {'StubbornVegeta/FloatRun',config = function()require 'module.floatrun'end,cmd = {'FloatRunToggle', 'FloatTermToggle'}}
在文件~/.config/nvim/lua/module/floatrun.lua
中写入以下配置
require("FloatRun").setup{ui = {border = "single",float_hl = "Normal",border_hl = "FloatBorder",blend = 0,height = 0.8,width = 0.8,x = 0.5,y = 0.5},run_command = {['cpp'] = 'g++ -std=c++11 %s -Wall -o {} && {}',['python'] = "python %s",['lua'] = "lua %s",['sh'] = "sh %s",[''] = "",}
}
- 对于lazy.nvim
{"StubbornVegeta/FloatRun",cmd = { "FloatRunToggle", "FloatTermToggle" },opts = function()return {ui = {border = "single",float_hl = "Normal",border_hl = "FloatBorder",blend = 0,height = 0.5,width = 0.9,x = 0.5,y = 0.5,},run_command = {cpp = "g++ -std=c++11 %s -Wall -o {} && {}",python = "python %s",lua = "lua %s",sh = "sh %s",[""] = "",},}end,keys = {{ "<F5>", "<cmd>FloatRunToggle<cr>" },{ "<F2>", mode = { "n", "t" }, "<cmd>FloatTermToggle<cr>" },},
}
用法:
:FloatRunToggle
:FloatTermToggle
参考
- fm-nvim
这篇关于FloatRun 在浮动窗口中运行你的代码的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!