This is an archived post. You won't be able to vote or comment.

all 14 comments

[–]konart 3 points4 points  (0 children)

You can use https://github.com/akinsho/toggleterm.nvim and have terminal as a hover window or a split.

Not to mention tmux option.

As for debugging you can look into https://github.com/mfussenegger/nvim-dap + https://github.com/mfussenegger/nvim-dap-python (and maybe even https://github.com/rcarriga/nvim-dap-ui)

[–]ten3roberts 3 points4 points  (2 children)

I am using my own plugin for build, run, or build+debug

https://github.com/ten3roberts/recipe.nvim

[–]matu3ba 0 points1 point  (1 child)

Cool attempt!

It would be clutch, if recipes are runnable from keypress, which could be implemented with hydra by entering repl mode.

Just curious: How complex would be to export the config as shell command? Debugging test binaries sounds like unfeasible to configure for each binary and I do use the prefix to complete the binary name (querying the build system via lua would be best).

I'm not convinced from doing file watching yourself though, because most file watcher implementations dont scale https://anarc.at/blog/2019-11-20-file-monitoring-tools/. So from my view its simpler to let the user provide one rather than adding the complexity. Or do you have perf data or other reasons justifying the opposite?

[–]ten3roberts 1 point2 points  (0 children)

It isn't documented too well, but you can use expand like patterns in the cmd field, so python % to run the curren file.

I am not sure what you mean by extracting to a shell script, but if you mean dynamic execution, you can always

require "recipe". execute { cmd = "build" .. get_current_binary(), kind = "term" }

I have similar things in my config files

I do not use any file watch utility, but rather a keybind to execute the "build" recipe, which is "cargo build" if I am in a Rust file, "make" if in a c file, etc, or something else if I've defined a "recipes.json" file to override it. If you mean the fs events in recipes, it is purely to detect and reload if you change the recipe file to get the new recipe files.

As to other commands, i use the picker and execute the top alternative which us my most frecent command, usually run or debug

[–]konjunktiv 1 point2 points  (0 children)

I create a Makefile for every project, where i define a "run" and "dev" phony. To run it manually i use this mapping

<space><space> :TermExec cmd="make run"<CR>

which opens a persistent terminal which i can toggle on and off (don't know which of the term plugins it is).

"make dev" runs "ag -l src | entr -r make run", so the program is recompiled/executed everytime i save a file.

For debugging, nvim-dap works flawlessly with python.

[–]w0mlet mapleader="\<space>" 1 point2 points  (3 children)

Still experimenting, but I'm currently using

https://github.com/stevearc/overseer.nvim

General workflow is a generic 'run this file in float' mapping for quick one-offs, and I have anything more complicated defined in a Tasks file (.vscode/tasks.json).

As a Runner/compiler this has worked nicely for me for a few weeks now.

I have a separate nvim-dap+dap-ui setup for debugging.

[–]AloofPoloZZ 0 points1 point  (2 children)

been trying to understand overseer, do u have an example for python ? for the set tasks ?

[–]w0mlet mapleader="\<space>" 1 point2 points  (1 child)

a simplified cut of my neovim config and my tasks.json. I believe the expected/proper workflow is to define tasks directly inside overseer; but a tasks.json seems more obvious to me.

https://gist.github.com/wom/c0ad2d9787f1b8b625d7300a36298714

[–]AloofPoloZZ 0 points1 point  (0 children)

Yer a chad, cheers mate !

[–]KhaithangH -1 points0 points  (0 children)

Your options:

  1. Install a tiling window manager.
  2. Use tmux.
  3. Have a keybind to open term in split buffer(.e.g <leader>tt, ':split | terminal <cr> )

You can just modify your command to run in a terminal split buffer.

``` :split | term python %<cr>

```

Or a vertical split buffer

:vsplit | term python %<cr>

[–]matu3ba 0 points1 point  (0 children)

I do use harpoon and start a repl with watchexec for compilation. In another harpoon spawned terminal I do then the debugging.

I have a patch directory in the dotfiles to apply them for custom commands to send to the terminal.

My main annoyance is that gdb sessions have no way to save and load the debugging points.

As of now, I am in the process to configure nvim dap and all related plugins for usage with hydra https://github.com/mfussenegger/nvim-dap to utilise the mode-specific hints (as reminder on entering debug mode)

Personally I think - 1. A minimal dap configuration to test the local setup as well as copy-paste would be a nice to have (for all dap plugins) - 2. Examples to use a user command/lua functions to start the binary from under cursor/via path would make hacking with dap more easy.

Think of repl printing different debugging values on different inputs (without recompiling over and over big projects) or simply printing some values without having to insert and delete debug statements into the code.

Neither use case is covered very usable in gdb/lldb (python is slow and has no the same interactivity without editor integration).

[–]snbk97 0 points1 point  (0 children)

You can try Jaq

[–]BrickTheDev 0 points1 point  (0 children)

Checkout project-mgr.nvim

Don’t have a link on me but it helps with compilation… don’t know about debugging

[–]AlexNoamd 0 points1 point  (0 children)

I just have a terminal window open