OneTerm.nvim icon indicating copy to clipboard operation
OneTerm.nvim copied to clipboard

New command ideas

Open LoricAndre opened this issue 4 years ago • 63 comments

I need ideas for new commands, so comment here anything you might want !

LoricAndre avatar Apr 14 '21 15:04 LoricAndre

What you think about a command that opens just a terminal in the current workspace to run some quick code while editing. But the terminal is persistent, so that you can execute your program or whatever, esc out, edit some, use some other one term commands, come back to the terminal, and you still have the output etc. I just like the floating thing more than the standard neovim term.

aMOPel avatar Apr 15 '21 09:04 aMOPel

This should be feasible, I'll look into it EDIT : done with 25b41e17a61ce35a929199f5a1b5c01c0752c16e to 886d951 EDIT2: I'll document shortly, I forgot

LoricAndre avatar Apr 15 '21 09:04 LoricAndre

so how do you exit it again? since it captures all the keyinput, because by typing exit of course you kill the instance.

aMOPel avatar Apr 15 '21 11:04 aMOPel

You can use <C-\><C-n> to get back to normal mode

LoricAndre avatar Apr 15 '21 11:04 LoricAndre

alright, but it doesnt stop rendering the floating window, i can jump outside but the floating window is still in front and if i close it with "c-w c" my vim crashes. free(): invalid size zsh: abort (core dumped) nvim -S ./Session.vim

aMOPel avatar Apr 15 '21 12:04 aMOPel

I'm looking into this, a stable version should be up shortly.

LoricAndre avatar Apr 15 '21 12:04 LoricAndre

Well it should be working now

LoricAndre avatar Apr 15 '21 12:04 LoricAndre

And btw you still need to close the window when you're down (if you delete the buffer it will open a new shell instance).

LoricAndre avatar Apr 15 '21 12:04 LoricAndre

first i got this error when closing the window Error executing vim.schedule lua callback: vim.lua:492: Vim(source):E484: Can't open file /tmp/o neterm

then i manually created the file and had no error when closing the windows, but still calling ":OneTerm term" again opens a new instance, old output is gone

aMOPel avatar Apr 15 '21 20:04 aMOPel

The first issue is easy to fix and I'll work on it tomorrow (meaning in ~16h) How do you close the window ? The file should be created anyway unless you exit the shell early

LoricAndre avatar Apr 15 '21 20:04 LoricAndre

so i exit terminal mode with <c-\><c-n> and then use <c-w>c which i didnt remap which executes :close

aMOPel avatar Apr 15 '21 20:04 aMOPel

All right, it's weird cause I tested it by closing it this way. Can you check if g:oneterm_term_buf changes every time you open a new window?

LoricAndre avatar Apr 15 '21 20:04 LoricAndre

it does indeed, went from 9 to 10

aMOPel avatar Apr 15 '21 20:04 aMOPel

All right, thanks, I'll look into it tomorrow. The other commands are working for you (apart for #3)?

LoricAndre avatar Apr 15 '21 20:04 LoricAndre

well files isnt working since it depends on rg and i only have ag currently (and fd-find ) but thats to be expected.

now that i tested :OneTerm buffers i saw that the terms are actually there

the :OneTerm make listed some makefiles but it didnt compile on enter, also without the path of the makefile im missing the context which is which, also im getting no targets, only makefiles. but im using <leader>m for compiling and have a dedicated .exrc file in the project root to set makeprg because i also specify a -C flag for the command

symbols works for me, i have nvim-lspconfig, but ws_symbols doesnt give me anything

also what i noticed is that its a little annoying that for every match with fzf there is the full absolute path, usually there is little space left for the actual match, so maybe an omision or a compression of parts of the path would be nice.

also another idea would be to add snippet search

aMOPel avatar Apr 15 '21 21:04 aMOPel

references is giving me results but opens nonsense ~/learncpp/src/main.cpp 27 Mystring string{ this is the buffer name and the buffer is empty when i jump to a reference

aMOPel avatar Apr 15 '21 21:04 aMOPel

and yank isnt working for me i have let g:var_oneterm_yank = 1 in my vimrc and i get

Error detected while processing function Oneterm_cmd: line 2: E5108: Error executing lua [string "luaeval()"]:1: attempt to call field 'yank' (a nil value)

is there some dependency or smth?

aMOPel avatar Apr 15 '21 21:04 aMOPel

It would be great if OneTerm commits were colorful. It's almost useless without syntax because it's hard to see the diffs. And would be useful OneTerm bcommits to see diffs for current buffer only. For OneTerm rg it would be useful if the results had line numbers. Thanks for your work.

basilgood avatar Apr 16 '21 00:04 basilgood

also what i noticed is that its a little annoying that for every match with fzf there is the full absolute path, usually there is little space left for the actual match, so maybe an omision or a compression of parts of the path would be nice.

Could you please open an issue for this please ? It will take some time & work but I'll try

LoricAndre avatar Apr 16 '21 09:04 LoricAndre

and yank isnt working for me i have let g:var_oneterm_yank = 1 in my vimrc and i get

Error detected while processing function Oneterm_cmd: line 2: E5108: Error executing lua [string "luaeval()"]:1: attempt to call field 'yank' (a nil value)

is there some dependency or smth?

The actual command is yanks, The s is missing from the completion function and doc. I'll push this soon

LoricAndre avatar Apr 16 '21 09:04 LoricAndre

I see, also the last time I looked term wasn't in the completions

aMOPel avatar Apr 16 '21 09:04 aMOPel

Neovim has now native floating border. It could be easy to put in function getopts() local opt: border = 'single'

basilgood avatar Apr 16 '21 09:04 basilgood

Neovim has now native floating border. It could be easy to put in function getopts() local opt: border = 'single'

I saw this, that's why I created g:oneterm_options, you can simply put it in there !

LoricAndre avatar Apr 16 '21 09:04 LoricAndre

I fixed most of the issues above, apart from @aMOPel 's term issue, ws_symbols and make. I've also added bcommits.

LoricAndre avatar Apr 16 '21 10:04 LoricAndre

The paths on the lsp matching are now relative btw

LoricAndre avatar Apr 16 '21 10:04 LoricAndre

@aMOPel could you also please open an issue for the problem you have with term please ? I can't reproduce it...

LoricAndre avatar Apr 16 '21 10:04 LoricAndre

the :OneTerm make listed some makefiles but it didnt compile on enter, also without the path of the makefile im missing the context which is which, also im getting no targets, only makefiles. but im using <leader>m for compiling and have a dedicated .exrc file in the project root to set makeprg because i also specify a -C flag for the command>

Did you run the command with a Makefile in neovim's working directory ?

LoricAndre avatar Apr 16 '21 10:04 LoricAndre

the :OneTerm make listed some makefiles but it didnt compile on enter, also without the path of the makefile im missing the context which is which, also im getting no targets, only makefiles. but im using <leader>m for compiling and have a dedicated .exrc file in the project root to set makeprg because i also specify a -C flag for the command>

Did you run the command with a Makefile in neovim's working directory ?

not in the root of the working directory but in a folder 1 below

aMOPel avatar Apr 16 '21 10:04 aMOPel

About ws_symbols, not many language servers support it, so in those cases it will be empty. I tested it in python with jedi and it works.

LoricAndre avatar Apr 16 '21 10:04 LoricAndre

the :OneTerm make listed some makefiles but it didnt compile on enter, also without the path of the makefile im missing the context which is which, also im getting no targets, only makefiles. but im using <leader>m for compiling and have a dedicated .exrc file in the project root to set makeprg because i also specify a -C flag for the command>

Did you run the command with a Makefile in neovim's working directory ?

not in the root of the working directory but in a folder 1 below

Ok that's why it isn't working, I'm only detecting targets for neovim's pwd. I'll try making the plugin walk a few directories up

LoricAndre avatar Apr 16 '21 10:04 LoricAndre