Last active
December 15, 2015 18:43
-
-
Save JoshuaGross/ad146e15c80ba7424ede to your computer and use it in GitHub Desktop.
Open vim to a certain file, line, and (optionally) column
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://gist.github.com/JoshuaGross/ad146e15c80ba7424ede | |
# Open vim to a certain file, line, and (optionally) column | |
function vimline { | |
col=$(echo $1 | awk '{split($0,a,":"); print a[3]}') | |
line=$(echo $1 | awk '{split($0,a,":"); print a[2]}') | |
file=$(echo $1 | awk '{split($0,a,":"); print a[1]}') | |
if [ -z "$col" ]; then | |
linecol="+$line" | |
else | |
linecol="+call cursor($line, $col)" | |
fi | |
vim "$linecol" "$file" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment