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
# make it possible to pass file names from gcc errors, e.g. “foo.c:3:14:”, | |
# directly to vim and have vim jump to line 3, column 14. | |
vim() | |
{ | |
if [[ $# -eq 1 && $1 =~ (.*):([[:digit:]]+):([[:digit:]]+): ]]; then | |
FILE="${BASH_REMATCH[1]}" | |
LINE="${BASH_REMATCH[2]}" | |
COL="${BASH_REMATCH[3]}" | |
$(which vim) -c "call cursor($LINE,$COL)" $FILE |