Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

run-in-iterm can run in a named session

  • Loading branch information...
commit 49e79da6c440992039a003cc61489003a7abe1df 1 parent 5fb7c0c
@jyurek authored
View
12 bin/exclusively-name-session
@@ -0,0 +1,12 @@
+#!/usr/bin/osascript
+
+on run argv
+ tell application "iTerm"
+ tell current terminal
+ repeat with s in sessions
+ set name of s to "terminal"
+ end repeat
+ set name of current session to (item 1 of argv)
+ end tell
+ end tell
+end run
View
17 bin/name-terminal-session
@@ -0,0 +1,17 @@
+#!/usr/bin/osascript
+
+on run argv
+ set new_name to (item 1 of argv)
+ tell application "iTerm"
+ tell current terminal
+ repeat with s in sessions
+ set current_name to name of s
+ if (current_name = new_name) then
+ set name of s to ""
+ end if
+ end repeat
+ set name of current session to new_name
+ end tell
+ end tell
+end run
+
View
17 bin/run-in-iterm
@@ -2,9 +2,22 @@
on run argv
tell application "iTerm"
+ if ((count of argv) > 1) then
+ set command to (item 2 of argv)
+ tell current terminal
+ set our_session to (the first session whose name contains (item 1 of argv))
+ end tell
+ else
+ set command to (item 1 of argv)
+ set our_session to the current session of the current terminal
+ end if
+
+ tell our_session to write text command
+
activate
- tell the current session of the current terminal
- write text (item 1 of argv)
+ tell current terminal
+ tell current terminal to select our_session
end tell
end tell
end run
+
View
0  bin/s3put.rb 100644 → 100755
File mode changed
View
7 bin/session-name
@@ -0,0 +1,7 @@
+#!/usr/bin/osascript
+
+tell application "iTerm"
+ tell current terminal
+ get name of current session
+ end tell
+end tell
View
10 bin/terminal-session-name
@@ -0,0 +1,10 @@
+#!/usr/bin/osascript
+
+on run argv
+ tell application "iTerm"
+ tell current terminal
+ set n to get name of current session
+ return n
+ end tell
+ end tell
+end run
View
13 vim/vimrc
@@ -160,20 +160,15 @@ let g:Powerline_symbols = 'fancy'
set exrc
set secure
-" Testing an RSpec thing
-function! RSpec(args)
- execute ":silent !run-in-terminal 'rspec -fd " . a:args . " %'"
-endfunction
-
-" nmap <CR> :call RSpec("-l " . <C-r>=line('.')<CR>)<CR>
-" nmap <Leader>ta :call RSpec("")<CR>
-
" Actually do searching with the silver searcher if available
" https://github.com/ggreer/the_silver_searcher
if executable("ag")
set grepprg=ag\ --nogroup\ --nocolor\ --column
endif
+" I type this enough on the command line. Might as well type it the same here.
+cnoreabbrev ag grep
+
" Search the project for the word under the cursor.
nmap K :grep "<C-R><C-W>"<CR>
autocmd QuickFixCmdPost *grep* cwindow
@@ -226,5 +221,5 @@ function! SetLastSpecCommand(command)
endfunction
function! RunSpecs(command)
- execute ":w\|:silent !run-in-iterm '" . a:command . "'"
+ execute ":w\|:silent !run-in-iterm rspec '" . a:command . "'"
endfunction
Please sign in to comment.
Something went wrong with that request. Please try again.