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

Option to open file in terminal editor #103

Merged
merged 2 commits into from
Apr 13, 2020
Merged

Option to open file in terminal editor #103

merged 2 commits into from
Apr 13, 2020

Conversation

mg979
Copy link
Contributor

@mg979 mg979 commented Feb 1, 2020

Add suffix @, that causes the file to be opened in the default terminal
editor (set to vim), using the default terminal.

I made these modification because I find it difficult to open files in a terminal in some other way. The alternative is the one you described here, but while it works for the file manager (where the app is called directly), somehow it doesn't work for in dmenu_extended for me (xdg_open insists in opening a terminal with less). It may be caused by some issues with concatenation of commands xdg_open -> terminal emulator -> terminal app -> file.

No idea, but this is a direct way to solve the problem and it doesn't need a system-wide change (like changing the default application for a filetype).

There is also the non small benefit that the method open_in_terminal_editor(path) can be called directly by plugins.

Add suffix @, that causes the file to be opened in the default terminal
editor (set to vim), using the default terminal.
@MarkHedleyJones MarkHedleyJones self-requested a review April 12, 2020 11:15
Copy link
Owner

@MarkHedleyJones MarkHedleyJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. I think this is a great idea!
I'd love to merge it, but as it is, the description in the README.md is a bit hard to understand. I had assumed that the @ should come at the start of the command, e.g., @/home/dog/cat.txt, and I had trouble getting it to work. If you could attend to the two comments I made then I'd be happy to merge it.
I know the instructions for the usage of the other operators isn't very clear either, this is something I should improve on.

Thanks!

@@ -195,7 +196,8 @@ Dmenu-extended understands the following modifier characters when entering a spe
1. **+** (plus) - Manually add an entry to the cache
2. **-** (minus) - Remove a manually added entry from the cache
3. **:** (colon) - Open with
4. **;** (semi-colon) - Execute in terminal
4. **@** (at) - Open in default terminal editor
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a note that the @ symbol must come at the end of the command?

README.md Outdated
@@ -228,6 +230,10 @@ There are a few different ways to use the colon operator, summarised by example
* `/home/me/Documents/writing.txt:gedit` - Open this file with gedit.
* `gedit:/home/me/Documents/writing.txt` - Open this file with gedit.

### **@** (at) - Open in terminal editor

Default editor is set to `vim`, but it can be changed in the preferences (`"terminal_editor"`). The terminal window is closed as soon as the application is exited.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you could put an example in here for the way to use the operator like the : operator (above) I think that would help people understand how to use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added an example, since also : and ; are suffixes, I thought it was not necessary. How does it look now?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! Thank you :)

@MarkHedleyJones MarkHedleyJones merged commit 16bde81 into MarkHedleyJones:master Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants