Comments (6)
Then just do the dumb thing and create a script that does both:
#!/usr/bin/env bash
# get the selection
sel=$(vscode-recent | rofi -dmenu)
if [[ -n "$sel" ]]; then
# open in vscode (after expanding the tilde)
sh -c "code $sel"
# copy to clipboard
echo -n "$sel" | xclip -selection clipboard -in
fi
You save this in ~/.local/bin/my-rofi-vscode
and give it execution privileges.
Then call it from rofi-bangs.
from rofi-vscode-mode.
Sorry, just saw this! this works perfectly thank you!!! I just added a cd
to this line and it's perfect!!
echo -n "cd $sel" | xclip -selection clipboard -in
Many thanks!
from rofi-vscode-mode.
Hi there and thanks for the appreciation!
I've read your workflow and it's for sure a common case.
It's very easy to open an external terminal in your current VSCode Workspace:
- Open the command palette (Ctrl+Shift+P)
- Use the command "Open New External Terminal" (in my config it's also bound to Ctrl+Shift+C)
To control which terminal is opened, change the setting terminal.external.linuxExec
.
However, this still spawns a new terminal. Let's see what you can do to cd
into a recent workspace without leaving the terminal.
From the README you can see that this project also gives you a command line tool called vscode-recent
that provides the same entries as the Rofi plugin.
You can use it in combination with Rofi, fzf or dmenu to select a directory and cd
into it:
cd $(vscode-recent -F absolute-path | rofi -dmenu)
I'm sure you can also bind this command to a key combo in your shell if you put some time into it.
A lazier alternative, which is what I actually use, is to install fzf in your shell, use it to look through your history with Ctrl+R and bring up the command you're looking for.
Implementing a custom "copy" functionality into the Rofi plugin seems a little overkill to me, since you still need to paste the workspace path into the terminal.
I hope this is clear enough, as I've put it together after work 😆
If it's too cryptic, let me know.
from rofi-vscode-mode.
This seems like a potentially viable solution! However, I'm uncertain as to how to use with rofi-bangs which is what I'm currently using as the "meta" launcher
https://github.com/gotbletu/shownotes/blob/master/rofi-bangs.md
I'm a bit new to rofi and would be very grateful if you had some advice as to how I could integrate your suggestion with terminator and rofi-bangs
This is the entry in my current rofi-bangs script:
# vscode workspace selector
COMMANDS["{vsc"]="rofi -show vscode-recent -modi vscode-recent"
LABELS["{vsc"]=""
Thanks for your patience on this! :o)
from rofi-vscode-mode.
My suggestion was actually to set a keybinding inside your shell (I wrote terminal before, sorry) to launch that command. So you would manually open a new terminal panel in terminator, then press some key combination like Alt-C and the Rofi menu would come up. You select the entry you want and the cd /some/directory/you/selected
command is invoked. No need to pass through rofi-bangs
.
However, if you prefer to stick to rofi-bangs and the copy-paste workflow you described in the first post, you can do as follows. I'm assuming you're using X11, but this would be similar in Wayland.
- Install
xclip
- Add the following command to your rofi-bangs configuration
Basically, all that
vscode-recent | rofi -dmenu | xclip -selection clipboard -in
rofi -dmenu
does is getting the entries from thevscode-recent
command and showing them to you. Once you select an entry, it gets passed to thexclip
command, which puts the entry in your clipboard. Now you can just paste it into terminator as you originally suggested.
from rofi-vscode-mode.
hmmm. This seems good but it does not work as expected with rofi-bangs
Executing the following does not open the vscode window but successfully copies the workspace url:
vscode-recent | rofi -dmenu | xclip -selection clipboard -in
The following opens the dir in vscode, but fails to copy the directory
rofi -show vscode-recent -modi vscode-recent | rofi -demnu | xclip -selection clipboard -in
Is there a way to get both at once?
from rofi-vscode-mode.
Related Issues (2)
- Use VSCode's URL handler HOT 2
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 rofi-vscode-mode.