mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: in vim dev you can focus on spec line in autospec
instructions in bin/notify_file_change
This commit is contained in:
37
bin/notify_file_change
Executable file
37
bin/notify_file_change
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../tmp && pwd )"
|
||||
|
||||
SOCKET="$DIR"/file_change.sock
|
||||
|
||||
if [[ -e "$SOCKET" ]]; then
|
||||
echo "$1 $2" | socat - UNIX-CONNECT:$SOCKET >/dev/null 2>/dev/null
|
||||
if [ $? != 0 ]; then
|
||||
rm $SOCKET
|
||||
fi
|
||||
fi
|
||||
|
||||
# To enable:
|
||||
#
|
||||
# 1. Install socat
|
||||
# 2. Add VIM_AUTOSPEC=1 to your environment
|
||||
# 3. Add the following to your .vimrc
|
||||
#
|
||||
# function s:notify_file_change()
|
||||
# let git_root = fugitive#extract_git_dir(expand("%:p"))
|
||||
# let root = substitute(git_root, '.git', '', 'g')
|
||||
# let notify = root . "bin/notify_file_change"
|
||||
# if executable(notify)
|
||||
# if executable('socat')
|
||||
# execute "!" . notify . ' ' . expand("%:p") . " " . line(".")
|
||||
# end
|
||||
# end
|
||||
# " redraw!
|
||||
# endfunction
|
||||
|
||||
# autocmd BufWritePost * silent! call s:notify_file_change()
|
||||
|
||||
# What this does?
|
||||
#
|
||||
# bin/rake autospec will now automatically try running specs where the actual cursor is located first, then fall back to running spec file
|
||||
Reference in New Issue
Block a user