Skip to content

Instantly share code, notes, and snippets.

@Baekalfen
Created April 9, 2016 16:10
Show Gist options
  • Save Baekalfen/487b07570502332182091bc8c5d9235c to your computer and use it in GitHub Desktop.
Save Baekalfen/487b07570502332182091bc8c5d9235c to your computer and use it in GitHub Desktop.
iTerm 2 beta 3.0 find exact line and column of error in Rust and go to error in Vim
iTerm:
Trigger regex: ^([a-zA-Z0-9+/.-]+):([0-9]+):([0-9]+): ([0-9]+):[0-9]+ (?:error):
Trigger action: Capture Output
Trigger parameter: echo ":call GetTabOrOpenFile(\"\1\")"; echo "$[\2 - 1]G\3|"
For .vimrc:
set swb=usetab
function! GetTabOrOpenFile(file)
try
execute "tab sb ".a:file
catch /^Vim\%((\a\+)\)\=:E94/
execute "tabnew"
execute "e ".a:file
" execute "tabe ".a:file
endtry
1
endfunction
Put this in .zshrc to make suspending Vim easier, but it's not required:
fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
BUFFER="fg"
zle accept-line
else
zle push-input
zle clear-screen
fi
}
zle -N fancy-ctrl-z
bindkey '^Z' fancy-ctrl-z
How to use it:
Press shift+cmd+b to show toolbox
Build a Rust project
See the errors come up in Capture Output in toolbox
Open Vim
Double-click error
@Baekalfen
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment