ervandew / screen Goto Github PK
View Code? Open in Web Editor NEWSimulate a split shell in vim using gnu screen or tmux
Simulate a split shell in vim using gnu screen or tmux
Hi,
Till yesterday everything was fine..But when i opened terminal today morning and tyoed coomands they are teeling like
-bash: java: command not found
-bash: sudo: command not found etc
I dont know what happened. Yesterday i changed envt variable..i dnt knw it is because of that..now i dnt know how to reset that because when i type
open -e.bash_profile
it shows,
-bash: open: command not found
pls help
Oftentimes, a program that you are working on contains relative references to files, and will not work unless the ScreenShell program is launched in the same working directory as the script.
If you launch :ScreenShell when you are not in a screen session, the bootstrapped screen session's CWD is the same as that of vim's, happily coinciding.
If you are in a screen session, the new ScreenShell's CWD is that of the screen session, which is likely not the same as Vim's CWD. :(
Right now I have a mapping that clumsily sends ScreenShellSend('cd '.getcwd())
, but it would be nice if Screen.vim could do this (better) on init.
I'm using tmux 1.6 and vim 7.3 on OSX lion.
First of all, thank you for awesome tool!
My issue is this. When I run vim, and then :ScreenShell, it opens a panel well, but it doesn't if I close a shell by pressing ^D(i.e., logout).
Here's how to reproduce it.
The issue is that I can't re-run ScreenShell at stage 4. It works only if I type in ScreenQuit which is nuisance. I tried to write a script to automate quit, but it's not working.
function! ScreenShellStartOrRestart()
if g:ScreenShellActive
ScreenQuit
ScreenShellVertical <- ScreenQuit makes this line unreachable.
else
ScreenShellVertical
endif
endfunction
How can I fix this?
Thanks
Minkoo
I noticed the screen.vim does not work when using 'vimx'. I'm using tmux.
When executing :ScreenShell the terminal just 'blinks' and does not execute any tmux session.
I use vimx because I benefit from the +clipboard built option.
Just as additional info, vimx runs on the terminal and belongs to the vim-X11 package.
Is it possible to open two terminal on screen? How to do it? And how can I navigate through it?
I tried with CTRL + W, but it doesn't work...
In other words, how should the 'shell' option be set up in gvim?
Also, are the commands run via ScreenShell cygwin commands or regular windows commands? In other words, in your example, is 'python' c:\cygwin\bin\python or c:\Python26\python.exe?
Thanks.
Hi,
Just pulled your latest commit. When I attempted to open a vertical split shell, vim came back with "E477: No ! allowed".
Any ideas?
Thanks,
John
The code from lines 570 to 577 in autoload/screen.vim fails with the following terminals: x-terminal-emulator, Terminator, xfce4-terminal.
" gnome-terminal needs quotes around the screen call, but konsole and
" rxvt based terms (urxvt, aterm, mrxvt, etc.) don't work properly with
" quotes. xterm seems content either way, so we'll treat gnome-terminal
" as the odd ball here.
elseif terminal == 'gnome-terminal'
let result = system(terminal . ' -e "' . a:command . '" &')
else
let result = system(terminal . ' -e ' . a:command . ' &')
endif
I use Gnu Bash v4.1.5 on Linux Mint 11.
The standard behaviour is to quote arguments passed to an option.
If you type: someterm -e foo -S bar
without quotes, the shell will always interpret -S as an option of someterm, not as an option of foo.
I think this is the standard behaviour and it works for me on all terminals I tested, even urxvt. And without quotes,they all fail...
Maybe it's related to Bash, but I'd really be surprised.
IMHO the default should be to quote the command and then handle special cases.
I'm using screen.vim 1.1 and screen 4.00.03jw4. When I do a :ScreenSend, I get this message from the screen session:
"slurped X characters into buffer", with X being the number of characters sent to the screen session.
After searching the documentation for screen, I found out how to hide this message. The function screenGnuScreen.sendTempBuffer needs to have a "msgwait 0" line, as well as the existing "msgminwait 0":
function s:screenGnuScreen.sendTempBuffer(tmp) dict " {{{
if exists('g:ScreenShellWindow')
let result = self.exec(
\ '-p ' . g:ScreenShellWindow . ' -X eval ' .
\ '"msgminwait 0" ' .
\ '"msgwait 0" ' .
\ '"readbuf ' . a:tmp . '" ' .
\ '"at ' . g:ScreenShellWindow . ' paste ." ' .
\ '"msgwait 5" ' .
\ '"msgminwait 1"')
else
let result = self.exec(
\ '-X eval ' .
\ '"msgminwait 0" ' .
\ '"msgwait 0" ' .
\ '"readbuf ' . a:tmp . '" ' .
\ '"paste ." ' .
\ '"msgwait 5" ' .
\ '"msgminwait 1"')
endif
return result
endfunction " }}}
After inserting the msgwait 0 lines, the problem was solved for me.
I use :call g:ScreenShellFocus()
to bring focus to the new pane that :ScreenShell
created, but then I can't get back to vim.
Some searching indicates that C-a C-a
should switch to the latest window (and (maybe?) back to vim) but this just places the string: ^A^A
at the shell. I remapped C-a
to C-b
in .screenrc
, which allows me to invoke the gnu-screen control options, but it still doesn't work.
C-b C-a
does nothing
C-b w
brings up a list of screens, but it only contains one item, so there's nothing to switch to.
I tried switching to tmux, and found similar behavior. Sorry if I'm missing something obvious, but is there a way to switch back to vim once I've sent focus to screen or tmux?
The behavior is similar whether or not I'm already in a screen session.
Hi,
ScreenShell is a nice plugin. It is very fast, compared to ConqueTerm. Thanks for your work!!
Normally I use gvim and tmux for my work.
ScreenShell works very well if one uses vim+tmux or screen, and one can set g:ScreenShellExternal
for internal shell or external shell. However external shell is always set for gvim users.
If external shell is forced, there is no difference if gvim users use some special terminals like yakuake, which I am using with vim...
I wonder if it is possible and easy to make gvim users can use internal shell.
If screen can support this feature, I definitely will use ScreenShell instead of yakuake for my daily work.
Thank you again for your working on such a wonderful plugin.
Best,
Jian Cheng
I have GNU Screen ( no tmux ) , but ScreenSend just doesnt works for me!
ScreenShell works just fine.
Is this due to my custom screen config? How do i debug this?
Thanks
Debian Wheezy, I am new in vim. I try run Rspec tests in vim with Screen, Tmux.
F5
open screeshell<leader>-r
runs test well first time"spec/features/authentication_pages_spec.rb" 49L, 1428C "spec/features/authentication_pages_spec.rb" 49L, 1428C written "spec/features/authentication_pages_spec.rb" 49L, 1428C written E776: No location list
Here Screen configs
let g:ScreenImpl = 'Tmux' let g:ScreenShellTmuxInitArgs = '-2' let g:ScreenShellQuitOnVimExit = 0 let g:ScreenShellHeight = 10 map <F5> :ScreenShell<CR> command -nargs=? -complete=shellcmd W :w | :call ScreenShellSend("load '".@%."';") map <Leader>c :ScreenShell bundle exec rails c<CR> map <Leader>r :w<CR> :call ScreenShellSend("rspec ".@% . ':' . line('.'))<CR> map <Leader>R :w<CR> :call ScreenShellSend("rspec ".@%)<CR> map <Leader>e :w<CR> :call ScreenShellSend("cucumber --format=pretty ".@% . ':' . line('.'))<CR> map <Leader>b :w<CR> :call ScreenShellSend("break ".@% . ':' . line('.'))<CR>
Full .vimrc
tmux.conf
How I can solve this?
Could you please add an explicit LICENSE
file to the repo so that it's clear under what terms the content is provided, and under what terms user contributions are licensed?
[...] without a license, the default copyright laws apply, meaning that you retain all rights to your source code and no one may reproduce, distribute, or create derivative works from your work. If you're creating an open source project, we strongly encourage you to include an open source license.
Thanks!
ConqueTerm is a terminal emulator written as a python vim plugin that displays in a vim buffer. It has some quirks (display doesn't always update until insert mode entered on the buffer), but is able to host ncurses apps rather well, allowing one to run even console vim inside of gvim (Esc-Esc to send Esc to the hosted vim).
For GVim users, I'd like to see screen.vim automatically call ':ConqueTermSplit screen ...args...' if it's available instead of opening a new window. For console vim users, I'd like to see this as an optional alternative to bootstrapping into a screen session (definitely bootstrap should remain default; it's superior in many ways, but some users might still want to use Conque).
ConqueTerm is script 2771 on vim.org and hosted on google code here: http://code.google.com/p/conque/
The code from lines 570 to 577 in autoload/screen.vim fails with the following terminals: Terminator, LKTerminal, xfce4-terminal, xterm, urxvt.
" gnome-terminal needs quotes around the screen call, but konsole and
" rxvt based terms (urxvt, aterm, mrxvt, etc.) don't work properly with
" quotes. xterm seems content either way, so we'll treat gnome-terminal
" as the odd ball here.
elseif terminal == 'gnome-terminal'
let result = system(terminal . ' -e "' . a:command . '" &')
else
let result = system(terminal . ' -e ' . a:command . ' &')
endif
I use Gnu Bash v4.1.5 on Linux Mint 11.
The standard behaviour is to quote arguments passed to an option.
If you type:
someterm -e foo -S bar
Without quotes, the shell will always interpret -S as an option of someterm, not as an option of foo.
I think this is the standard behaviour and it works for me on all terminals I tested, even urxvt. And without quotes,they all fail...
Maybe it's related to Bash, iI would be surprised.
IMHO the default should be to quote the command and then handle special cases.
How can i send a block of code? I'm using vim and ipython on tmux. Send a line of code is working fine, but when i use visual mode to select a block of code and use ScreenSend, just the first line is being sended.
I have my window-status-format to be '#I#F:#T-#W'. The rename-window command only sets the #W part and the search for the screenshell command fails.
Ideally, the pane should be stored using the session:window.pane address, but panes can be moved and even this isn't fool-proof. However the current solution can find the wrong pane if there is more than one window named 'screenshell'.
I've been poking it trying to get it to work without success so far.
With people using virtualenv or homebrew installed python OS X it would be advisable to look for ipython in the PATH instead of hardcoding it to /usr/bin (especially on OS X, where that limits you to whichever old python version comes with the system).
If I have taglist.vim installed, the :ScreenShell command always opens a taglist window, even if one was not open before running :ScreenShell. I believe the problem is caused by line 181 in autoload/screen.vim (in version 1.5). The line is part of an if statement that checks to see whether a taglist window is open or not in s:ScreenBootstrap(). currently, its check is:
if exists(':TlistSessionSave') &&
\ exists('g:TagList_title') &&
\ bufwinnr(g:TagList_title)
with the problem being the bufwinnr(g:TagList_title). bufwinnr() returns -1 if the specified window name does not exist, which evaluates to true by vim (0 evaluates to false). To fix, check the return value for -1:
\ bufwinnr(g:TagList_title) != -1
Hello, I've been using this awesome plugin in Vim for a long time. Now I'm trying to move to NeoVim and it just doesn't work: no split screen is created when I try to use :ScreenShell
.
A friend of mine was having a problem with ScreenShell. It would fail with the error message:
Error detected while processing function screen#ScreenShell..18_ScreenInit:
line 85:
failed to connect to server^@
Turns out that it was because he had TERM set to screen-256color without actually being in a screen or tmux session. I was able to reproduce this error by setting my TERM to screen-256color or screen.
tmux actually requires that TERM be set to screen-256color for 256 color terminals, so it might be better to try starting a new session if it cannot connect instead of failing.
I'm using screen.vim 1.1, with screen version 4.00.03jw4.
when I try to use :ScreenShellAttach and use tab to autocomplete the list of existing shells, I'm not able to attach to the autocompleted shell. I tracked down the problem to the GetScreenSessions function. The regular expression doesn't work with the output of screen -wipe:
$ screen -wipe
There is a screen on:
6567.slime (09/23/2010 09:05:33 AM) (Attached)
1 Socket in /var/run/screen/S-bbooth.
I loosened up the regular expressions to be this:
function! s:GetScreenSessions()
let results = split(system('screen -wipe'), "\n")
call filter(results, 'v:val =~ "(\\w\\+)"')
call map(results, '[' .
\ 'substitute(v:val, "^\\s*\\(\\S*\\).*", "\\1", ""), ' .
\ 'tolower(substitute(v:val, "(\\(\\w\\+\\))$", "\\1", ""))]')
return results
endfunction " }}}
This fixes the problem.
Instead of Terminal.app make iTerm2 or make settings to allow override
I do :ScreenShell user@remotehost
but subsequent :ScreenSend
doesn't send anything.
Normal :ScreenShell
or :ScreenShell ipython
works fine.
Should this be workable, or is it impossible?
When I'm using the plugin with irb and I try to send the file over any text with multiple tabs in causes problems. Irb interprets the double tab as a queue to try and autocomplete a file name in the current directory and this mangles the input.
It would be nice if there was a way to get the plugin to replace tabs for spaces or something similar before it sends text. Currently I am getting around this by having some hoary looking aliases in my ./vimrc to do a substitute before sending then undoing after.
So for example, sending the text:
class Foo
def bar()
puts "Hello World!"
end
end
results in the output from irb:
220:0> class Foo
221:1> def bar()
222:2>
Display all 329 possibilities? (y or n)
[...]
222:2> d
223:2> end
Thanks.
I think there is a problem when sending code using Tmux and IPython>=5.0.0
print('hello')
Then run the following commands
:IPython
:ScreenSend
ipython
[12:57:35 maikel:sensors_action_recognition]$ ipython
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
Type "copyright", "credits" or "license" for more information.
IPython 4.2.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:print('hello')
:--
hello
In [2]:
ipython
[12:59:48 maikel:sensors_action_recognition]$ ipython
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
Type "copyright", "credits" or "license" for more information.
IPython 5.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:
How can I navigate without using mouse on screen?
After issue :ScreenShell in vim the new vim buffer containing the file are without syntax highligtning.
The screen shell pane have colors.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.