iterm2 cmd-click to open file in vim in terminal
This will enable you to cmd-click on a filename in iTerm2 and have it launch vim within the same iterm2 window:
Click on: Preferences -> Profiles -> Advanced
Under "Semantic History", choose "Run coprocess..". In the text field, put:
echo vim \1 +\2
Written by Lorin Hochstein
Related protips
1 Response
Thank you so much for the tip, I was finally looking at a way of doing that today after many years of frustration having xcode open when clicking on a .py file.
I made a little improvement to add the line number only if it's present (otherwise a single + takes you to the end of the file):
echo vim \1 $(if [[ "\2" =~ ^[0-9]+$ ]]; then echo "+\2";fi)
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#