Comments (14)
Perhaps a new variable such as diffviewfile that acts this way ?
But its fine as is. You are so good about fixing bugs and adding features so I keep suggesting things.
from grv.
Thanks for reporting this issue. For commands that are non-interactive (they don't expect any input) it should be possible to close the popup using q
. There is an easy to miss message in the bottom left hand corner that provides the key to press (highlighted in the image below):
So when running :!ls
it should be possible to close the window using by pressing q
.
Interactive commands like :!vim {$file}
won't work at the moment as they need to be run in the controlling terminal. But I agree that it's a nice idea and GRV should support that functionality. I think the best approach would be to make running a shell command :!...
behave the same way as vim does. Then running :!vim ${file}
will hide GRV, pass over control of the terminal to vim until it's finished and then GRV can resume. I will have a look at implementing this.
from grv.
Ah ha! Then the culprit must be this configuration line of mine:
# Hotkey to quit
map All q ":q<Enter>"
…because as it is, I have the "Loaded XXX commits" line, but the following one is empty. If I remove that configuration line, then I see "Press q to close command output". I now get the intended behavior by using these explicit maps instead:
# Hotkey to quit
# (Don't map "All" because that would break pop-up dismissal.)
map CommitView q ":q<Enter>"
map DiffView q ":q<Enter>"
map GitStatusView q ":q<Enter>"
map GitSummaryView q ":q<Enter>"
map RefView q ":q<Enter>"
map RemoteView q ":q<Enter>"
Thank you for the hint. :)
As for Vim-style !
, since GRV already launches an external editor for commit messages, it seems like the bulk of the mechanism would already be in place for launching one on the currently selected file. That said, since I'm using Tmux I devised a very friendly work-around with @
:
# Hotkey to edit current file
map CommitView e ":@tmux new-window vi ${repo-workdir}/${file}<Enter>"
map DiffView e ":@tmux new-window vi ${repo-workdir}/${file}<Enter>"
map StatusView e ":@tmux new-window vi ${repo-workdir}/${file}<Enter>"
…the trick here is that when a new Tmux tab is launched with a command, it'll take focus but also close automatically when the command exits. The result is almost identical vs having Vim in the GRV tab itself.
from grv.
Master has been updated so that !
behaves in the same way as vim. Although I think your solution using tmux is a lot nicer!
from grv.
Thanks for this. Both the :!vi and the :@tmux new-window vi are great features.
But I found the file it wants to edit is sometimes not the right one ?
Not sure the steps I took to get there but it happened often. It seemed to keep editting a previous file and not the one in the commit.
from grv.
@mckellyln Currently the file variable is set when a file from the diff stats part of the DiffView is selected or when a file in the StatusView is selected.
There is a GRVVariableView
which can be useful to see what GRV thinks the current value of all variables are. In the gif below we switch to the CommitView
, run :addview GRVVariableView
and change the orientation with <C-w>t
. This allows us to see how the variables change as different rows in each view are selected:
Let me know if you think GRV is missing a case where it should set the file variable.
from grv.
@rgburke thanks. I did this and it shows the problem.
Initially when selecting commits the file variable is blank and the repo-workdir is correct. But when I go to diffs window and then to the line where the file is specified - the file variable is updated to be correct. But then if I go back to the commit view the file variable remains what it was - and is now no longer correct.
Perhaps with each <Tab>/<Shift><Tab>(changing windows/views) the file variable should be cleared ?
I'm using:
GRV - Git Repository Viewer v0.3.1-21-gf53e3d1 (compiled with go1.11.4 at 2019-02-27 21:00:55 EST)
from grv.
Just curious, is there a way to not have the
Press any key to continue
prompt when exiting vi after editting a file ?
(using the map of e to :!vi
from grv.
And thank you for awesome grv.
from grv.
A new config variable has been added which controls whether the Press any key to continue
message is displayed. Add set input-prompt-after-command false
to your grvrc
and it will no longer appear.
For the shell variable behaviour, at the moment a variable will keep a value until a new one is set. So until another filepath is selected the file
variable will retain the value of the previously selected filepath. The variables represent the most recently selected values, rather than the currently selected row.
The thinking was that as long as a row is selected with the file path you're interested in, then the file
variable should be the value you expect. We could clear the variable when a different view is selected, although it could also be useful to still be able to use the file
variable later on in a different view. I'm not sure if there's a big advantage for clearing the variables over the current behaviour.
from grv.
@rgburke thank you so much.
I understand the file variable will remain unchanged until it is updated with a new one, and I can see that might be useful.
I think its my view that upon entering a new diff view, if the file(s) in the current diff view are not the same as the previous file variable then it should be cleared, as I'd rather get a "no file selected yet" type message than editing the wrong file.
I really appreciate your code and effort, thanks again.
from grv.
@mckellyln It is great to see @rgburke caring about this project as much as he does. Not to go further off-topic, but I'd gladly make a one-time donation if there were an easy way to do so. hint
from grv.
@mckellyln Sorry for the delay, last week was very busy. A diff-view-file
variable has been added which should behave the way you want.
Thanks for the kind words guys. Knowing that people find GRV useful is payment enough for me.
from grv.
Thanks, its awesome.
from grv.
Related Issues (20)
- No ignore in Status View?
- How can you use an url for the repoFilePath (or equivalent)
- How to open a bare repository?
- New feature: blame view
- FATAL: Unable to initialise grv Permission denied
- loading diff error buffer too long
- Error compiling - Invalid flag in pkg-config
- can not build grv on Mojave
- Cannot leave command prompt without typing anything HOT 3
- Mouse misbehavior in v0.3.1 HOT 7
- initial layout HOT 2
- Problem in diff for lines starting with ```%``` HOT 4
- Freeze with 'git push' HOT 2
- Show mappings of commands in menu HOT 2
- Scrolling and highlight display not functioning correctly
- How to bind Escape to q (<grv-remove-view>)?
- <S-Tab>key (<grv-prev-view>) doesn't work
- grv's Status View shows untracked file which is not in `git status`
- Is it able to set the auto focused view when gvr starts?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grv.