The difference to the original is, that fork as a dirty implementation for local compiler-explorer instances and compile_commands.json parsing.
Compile your code and explore assembly from Neovim using the
compiler-explorer REST API. Supercharged by vim.ui,
vim.notify and vim.diagnostic.
Install • Features • Commands • Configuration
- dressing.nvim or another plugin that overrides
vim.ui
- nvim-notify or another plugin that overrides
vim.notify
require('packer').startup(function()
use {'krady21/compiler-explorer.nvim'}
endrequire("paq") {
{'krady21/compiler-explorer.nvim'};
}Plug 'krady21/compiler-explorer.nvim'- Compile code asynchronously using
vim.loop. - Select compiler interactively using
vim.ui.selector pass it as a vim command parameter. - Compile visual selections.
- Send compiler warnings and errors to the quickfix list.
- Highlight matching lines between source code and assembly.
- Show binary output (opcodes and address) using virtual text.
- Format code.
- Add libraries.
- Show tooltips about specific instructions.
- Jump to label definitions.
- Load example code.
- Open the website with the local state (source code and compilers).
:h compiler-explorer-commands
- CECompile
- CECompileLive
- CEFormat
- CEAddLibrary
- CELoadExample
- CEOpenWebsite
- CEDeleteCache
- CEShowTooltip (local to assembly buffer)
- CEGotoLabel (local to assembly buffer)
:CECompilewill prompt the user to select the compiler and flags interactively usingvim.ui.selectandvim.ui.input.:CECompile compiler=g121 flags=-O2 flags=-Wallspecify the compiler and flags as command arguments.':<,'>CECompilewill compile a visual selection.:CECompile!will open the assembly output in a new window. Not adding bang (!) will reuse the last assembly window.:CECompile inferLang=falsedo not infer possible language (based on file extension). Will prompt user to select the language before selecting the compiler.:CECompile binary=trueshow binary opcodes and address using virtual text.:CECompile intel=falseuse AT&T syntax instead of intel.:CECompileLivecreates an autcommand that runs:CECompileevery time the buffer is saved (BufWritePost).
compiler-explorer.nvim
works out of the box without configuration. If you want to change some of its
options (like using a local instance of compiler-explorer), you can do so
through the setup() function. You can find all the options
here.
require("compiler-explorer").setup({
url = "http://localhost:10240",
open_qflist = false, -- Open qflist after compile.
infer_lang = true, -- Try to infer possible language based on file extension.
binary_hl = "Comment", -- Highlight group for binary extmarks/virtual text.
autocmd = {
enable = false, -- Enable assembly to source and source to assembly highlighting.
hl = "Cursor", -- Highlight group used for line match highlighting.
},
diagnostics = { -- vim.diagnostic.config() options for the ce-diagnostics namespace.
underline = false,
virtual_text = false,
signs = false,
},
split = "split", -- How to split the window after the second compile (split/vsplit).
spinner_frames = { "⣼", "⣹", "⢻", "⠿", "⡟", "⣏", "⣧", "⣶" }, -- Compiling... spinner settings.
spinner_interval = 100,
compiler_flags = "", -- Default flags passed to the compiler.
use_compile_commands = true,
compile_commands_folder = "build",
job_timeout = 25000, -- Timeout for libuv job in milliseconds.
})-
GET /api/languages -
GET /api/compilers/<lang-id> -
GET /api/libraries/<lang-id> -
GET /api/shortlinkinfo/<link-id> -
POST /api/compiler/<compiler-id>/compile -
GET /api/formats -
POST /api/format/<formatter> -
GET /api/asm/<instruction-set>/<instruction> -
GET /source/builtin/list -
GET /source/builtin/load/<lang-id>/<example-id> -
GET /clientstate/<base64>
- The async.lua and alert.lua modules are inspired from gitsigns.nvim .
- The base64.lua module is taken from lbase64
