Open LoricAndre opened 3 years ago
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.
This should be feasible, I'll look into it EDIT : done with 25b41e17a61ce35a929199f5a1b5c01c0752c16e to 886d951 EDIT2: I'll document shortly, I forgot
so how do you exit it again? since it captures all the keyinput, because by typing exit of course you kill the instance.
You can use <C-\><C-n>
to get back to normal mode
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
I'm looking into this, a stable version should be up shortly.
Well it should be working now
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).
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
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
so i exit terminal mode with <c-\><c-n>
and then use <c-w>c
which i didnt remap which executes :close
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?
it does indeed, went from 9 to 10
All right, thanks, I'll look into it tomorrow. The other commands are working for you (apart for #3)?
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
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
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?
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.
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
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
I see, also the last time I looked term
wasn't in the completions
Neovim has now native floating border.
It could be easy to put in function getopts()
local opt
: border = 'single'
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 !
I fixed most of the issues above, apart from @aMOPel 's term issue, ws_symbols
and make
. I've also added bcommits
.
The paths on the lsp matching are now relative btw
@aMOPel could you also please open an issue for the problem you have with term
please ? I can't reproduce it...
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 toset makeprg
because i also specify a-C
flag for the command>
Did you run the command with a Makefile in neovim's working directory ?
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 toset 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
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.
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 toset 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
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 toset 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
About
ws_symbols
, not many language servers support it, so in those cases it will be empty. I tested it in python withjedi
and it works.
i see, that makes sense
will you add a snippet search?
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 toset 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 upi 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 2938f81b34d9466ea8523ca6a634c19f57dd5853
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
Oldfiles or History it would be useful.
Do you mean command history ?
Oldfiles is done !
Oldfiles is done !
for recent files you could use the .fasd file if fasd is installed
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 toset 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 upi 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/makefileI'll try using makeprg then ! EDIT : done with 2938f81
works for me
History done (it lists command history) !
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
Wow you're awesome. Oldfiles it's what I wanted. Thank you very much. It works perfectly.
An awesome feature would be term to be toggle and keep the session.
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
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?
<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
Yes, I tested it and it works perfectly. Thank you.
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
I have this:
vimp.nmap([[<C-\>]], ":OneTerm term<cr>")
vimp.tnoremap([[<C-\>]], '<C-\\><C-n>:q<cr>')
Thank you.
I need ideas for new commands, so comment here anything you might want !