Last active
August 29, 2015 14:26
-
-
Save ggarza/1fd9404a1aa918f2843a to your computer and use it in GitHub Desktop.
This file contains 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
" Vim filetype plugin file | |
" Language: julia | |
autocmd! BufLeave,FocusLost * nested silent! update | |
nmap <buffer> <silent> <space> <esc>:call Send_to_iterm()<cr>j | |
noremap <leader>ae <esc>:w<cr>:call Send_input_file_to_iterm()<cr> | |
noremap <leader>rf <esc>:w<cr>:call New_julia_repl()<cr> | |
noremap <leader>pd <esc>:w<cr>:call Get_paragraph()<cr> | |
function! Send_to_iterm() | |
let current_line= getline('.') | |
silent exec "!osascript ~/.vim/scripts/sendtoiterm.applescript " . shellescape(current_line, 1) | |
endfunction | |
function! Send_input_file_to_iterm() | |
let current_file = '"' . "%:p" . '"' | |
let include_file = "include\(" . current_file . "\)" | |
let include_file = "'" . include_file . "'" | |
silent exec "!osascript ~/.vim/scripts/sendtoiterm.applescript " . include_file | |
endfunction | |
function! New_julia_repl() | |
let current_directory = "%:p:h" | |
silent exec "!open -a iTerm %:p:h" | |
silent exec "!osascript ~/.vim/scripts/sendtoiterm.applescript julia" | |
endfunction | |
function! Get_paragraph() | |
let start = line('.') | |
let end = search("^$") | |
let lines = getline(start, end) | |
for line in lines | |
silent exec "!osascript ~/.vim/scripts/sendtoiterm.applescript " . shellescape(line, 1) | |
endfor | |
endfunction |
This file contains 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
on run argv | |
set command to item 1 of argv | |
tell application "iTerm" | |
--make new terminal | |
tell the current terminal | |
--activate current session | |
--launch session "Default Session" | |
tell the last session | |
write text command | |
end tell | |
end tell | |
end tell | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment