Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New command ideas #2

Open
LoricAndre opened this issue Apr 14, 2021 · 63 comments
Open

New command ideas #2

LoricAndre opened this issue Apr 14, 2021 · 63 comments
Assignees
Labels
enhancement New feature or request

Comments

@LoricAndre
Copy link
Owner

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

@LoricAndre LoricAndre self-assigned this Apr 14, 2021
@LoricAndre LoricAndre added the enhancement New feature or request label Apr 14, 2021
@aMOPel
Copy link

aMOPel commented Apr 15, 2021

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.

@LoricAndre
Copy link
Owner Author

LoricAndre commented Apr 15, 2021

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

@aMOPel
Copy link

aMOPel commented Apr 15, 2021

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

@LoricAndre
Copy link
Owner Author

LoricAndre commented Apr 15, 2021

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

@aMOPel
Copy link

aMOPel commented Apr 15, 2021

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

@LoricAndre
Copy link
Owner Author

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

@LoricAndre
Copy link
Owner Author

Well it should be working now

@LoricAndre
Copy link
Owner Author

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).

@aMOPel
Copy link

aMOPel commented Apr 15, 2021

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

@LoricAndre
Copy link
Owner Author

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

@aMOPel
Copy link

aMOPel commented Apr 15, 2021

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

@LoricAndre
Copy link
Owner Author

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?

@aMOPel
Copy link

aMOPel commented Apr 15, 2021

it does indeed, went from 9 to 10

@LoricAndre
Copy link
Owner Author

LoricAndre commented Apr 15, 2021

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

@aMOPel
Copy link

aMOPel commented Apr 15, 2021

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
Copy link

aMOPel commented Apr 15, 2021

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
Copy link

aMOPel commented Apr 15, 2021

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?

@basilgood
Copy link

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.

@LoricAndre
Copy link
Owner Author

LoricAndre commented Apr 16, 2021

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
Copy link
Owner Author

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

@aMOPel
Copy link

aMOPel commented Apr 16, 2021

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

@basilgood
Copy link

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

@LoricAndre
Copy link
Owner Author

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
Copy link
Owner Author

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

@LoricAndre
Copy link
Owner Author

The paths on the lsp matching are now relative btw

@LoricAndre
Copy link
Owner Author

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

@LoricAndre
Copy link
Owner Author

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 ?

@aMOPel
Copy link

aMOPel commented Apr 16, 2021

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

@LoricAndre
Copy link
Owner Author

will you add a snippet search?

I'll try to, at least with UltiSnips there has to be a way since fzf.vim did it

@basilgood
Copy link

Oldfiles or History it would be useful.

@LoricAndre
Copy link
Owner Author

Do you mean command history ?

@LoricAndre
Copy link
Owner Author

Oldfiles is done !

@aMOPel
Copy link

aMOPel commented Apr 16, 2021

Oldfiles is done !

for recent files you could use the .fasd file if fasd is installed

@aMOPel
Copy link

aMOPel commented Apr 16, 2021

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

i mean i work with cmake and it makes a folder for debug for example and in there is the makefile generated. however i make the project root vims working dir and have a session file there from which i continue working. and then i have a .exrc set makeprg=make\ -C\ ./debug so i can call :make in vim, but i guess i could also symlink the makefile in the root.
but then what about different builds like release..
ex:
vim working dir is just project/
project/src/main.cpp etc.
project/debug/makefile

I'll try using makeprg then !
EDIT : done with 2938f81

works for me

@LoricAndre
Copy link
Owner Author

History done (it lists command history) !

@LoricAndre
Copy link
Owner Author

LoricAndre commented Apr 16, 2021

Oldfiles is done !

for recent files you could use the .fasd file if fasd is installed

I'm not using that but it seems interesting !
EDIT : For files you've edited in neovim, it keeps a list in v:oldfiles so I don't really need it

@basilgood
Copy link

Wow you're awesome. Oldfiles it's what I wanted.
Thank you very much.
It works perfectly.

@basilgood
Copy link

An awesome feature would be term to be toggle and keep the session.

@LoricAndre
Copy link
Owner Author

LoricAndre commented Apr 16, 2021

This is how it's supposed to work, see #5 for progress and the issue and to help me debug it !
EDIT : you need set hidden for it to work since I have to keep the buffer alive

@basilgood
Copy link

I watched the debugging on the #5 but it doesn't work for me.
set hidden? hidden
OneTerm term open terminal
<C-\><C-n> and OneTerm term
and nothing happens.
maybe I'm doing something wrong?

@LoricAndre
Copy link
Owner Author

LoricAndre commented Apr 16, 2021

<C-\><C-n> will put you in normal mode, you have to close the window afterwards. Then, invoking the command again should open the same terminal instance

@basilgood
Copy link

Yes, I tested it and it works perfectly.
Thank you.

@aMOPel
Copy link

aMOPel commented Apr 16, 2021

Yes, I tested it and it works perfectly.
Thank you.

you can use this mapping to easily close it
tnoremap <c-w> <c-\><c-n><c-w>c

@basilgood
Copy link

I have this:

vimp.nmap([[<C-\>]], ":OneTerm term<cr>")
vimp.tnoremap([[<C-\>]], '<C-\\><C-n>:q<cr>')

Thank you.

@basilgood
Copy link

basilgood commented Apr 16, 2021

I wonder if we could not use the framework to not clutter the plugin ?
If I want to change gitui with lazygit or if I want to change the default
cmd from OneTerm files,
Or if I want to add something new: open ~/.config/nvim or open current dir...
Or if I want OpenTerm to follow my colorscheme...
A few examples would make this easier.

@LoricAndre
Copy link
Owner Author

LoricAndre commented Apr 16, 2021

You can check init.lua for examples, don't hesitate to open an issue for any questions you might have !

@LoricAndre
Copy link
Owner Author

Snippets are added, I'd love some feedback

@basilgood
Copy link

Snippets are added, I'd love some feedback

on nvim start:
image

@LoricAndre
Copy link
Owner Author

Oh yeah I'm an idiot this is linked to #7 which I've reopened. Everything should work otherwise

@basilgood
Copy link

Yes everything works

@dcordb
Copy link

dcordb commented Apr 18, 2021

@LoricAndre what about integrating the functionality of this plugin https://github.com/dominickng/fzf-session.vim ? I use this to have a quick access to my sessions.

@LoricAndre
Copy link
Owner Author

This seems easy enough, I'll start working on it

@LoricAndre
Copy link
Owner Author

Sorry for the delay, with the end of term, plus I was moving and starting an internship, so I didn't have much time in the past weeks

@LoricAndre
Copy link
Owner Author

Sessions should be done with dcbeec6 !

@qvieth
Copy link

qvieth commented Jul 28, 2021

@LoricAndre can you make using "ranger in OneTerm term" same as "OneTerm ranger", also the same for fzf,rg,... this plugin is so cool btw

@LoricAndre LoricAndre pinned this issue Jul 28, 2021
@LoricAndre
Copy link
Owner Author

LoricAndre commented Jul 28, 2021

Hi, do you mean that when you use ranger in the neovim terminal opened by OneTerm term you'd want it to open the file into a new buffer in the main neovim instance ? This sounds interesting, I'll try to think about it but I'm not sure it's doable from the plugin, this might be doable through scripting and neovim-remote

@qvieth
Copy link

qvieth commented Jul 28, 2021

Yes! Thank you, @LoricAndre ! Love the idea of 1 terminal rules them all!! This plugin is so convenient!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants