Vim Tips Wiki
(Change <tt> to <code>, perhaps also minor tweak.)
(Link to working git repo)
Tag: sourceedit
 
(2 intermediate revisions by one other user not shown)
Line 61: Line 61:
   
 
----
 
----
A small improvement suggestion, after leaving buffer via ctrl-w and returning back, I wanted conque term window to remember insert/normal mode the window had before. I didn't get response from the author, so I'm just posting here so that it's available to others.
+
A small improvement suggestion, after leaving buffer via ctrl-w and returning back, I wanted conque term window to remember insert/normal mode the window had before. I didn't get response from the author, so I have made fork at https://github.com/vlmarek/ConqueVlad which mainly orients at increasing usability.
  +
--[[User:Vlmarek|Vlmarek]] ([[User talk:Vlmarek|talk]]) 21:19, December 21, 2013 (UTC)
   
  +
The main git repo is broken, but I forked and reverted the breaking commit. Enjoy! https://github.com/mcandre/Conque-Shell
<pre>
 
  +
Index: bundle/conque/doc/conque_term.txt
 
  +
--[[User:Mcandre|Mcandre]]
===================================================================
 
--- bundle/conque/doc/conque_term.txt (revision 4181)
 
+++ bundle/conque/doc/conque_term.txt (revision 4183)
 
@@ -262,8 +262,9 @@
 
3.1.6 Insert mode when entering buffer *ConqueTerm_InsertOnEnter*
 
 
If set to 1 then you will automatically go into insert mode when you enter the
 
-buffer. This diverges from normal Vim behavior. If 0 you will still be in
 
-normal mode.
 
+buffer. This diverges from normal Vim behavior. If set to 2, vim will remember
 
+whether you left in insert mode or not, and restore the mode on return. If 0
 
+you will still be in normal mode.
 
>
 
let g:ConqueTerm_InsertOnEnter = 0
 
<
 
Index: bundle/conque/autoload/conque_term.vim
 
===================================================================
 
--- bundle/conque/autoload/conque_term.vim (revision 4181)
 
+++ bundle/conque/autoload/conque_term.vim (revision 4183)
 
@@ -689,7 +689,7 @@
 
 
" Map <C-w> in insert mode
 
if exists('g:ConqueTerm_CWInsert') && g:ConqueTerm_CWInsert == 1
 
- inoremap <silent> <buffer> <C-w> <Esc><C-w>
 
+ inoremap <silent> <buffer> <C-w> <Esc>:let b:ConqueTerm_LeavedInsert=1<cr><C-w>
 
endif
 
" }}}
 
 
@@ -992,6 +992,10 @@
 
if g:ConqueTerm_InsertOnEnter == 1
 
startinsert!
 
endif
 
+ if exists("b:ConqueTerm_LeavedInsert") && b:ConqueTerm_LeavedInsert == 1 && g:ConqueTerm_InsertOnEnter == 2
 
+ startinsert!
 
+ endif
 
+ let b:ConqueTerm_LeavedInsert = 0
 
 
endfunction " }}}
 
</pre>
 

Latest revision as of 00:56, 17 February 2015

Use this page to discuss script 2771 Conque shell: run interactive commands inside a Vim buffer

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

Comments[]

Let's say running 'ksh -o vi' in a normal shell, <Esc> k will recall the last command. But in conqueshell, since buffer shell is in Vim's insert mode and <Esc> is always captured by Vim and change the Vim to command mode. It disables -o vi's command line editing capability. Anyway, you can fix this? thanks!

You can configure Conque to use a key of your choice for exiting insert mode, in which case <Esc> will be sent to the terminal. Put this in your .vimrc
let g:ConqueTerm_EscKey = '<C-k>'
Now you can use vi line editing mode, but will need to press <C-k> to leave insert mode in the terminal buffer. You can choose a different key other than <C-k> of course. Although keys which are internally coded with an <Esc> won't work (the F- keys for example)
You can see all the Conque options here: http://code.google.com/p/conque/wiki/Usage

Cool! It works. Thanks!

Awesome script. Great job!


How to reference current file (e.g. %) when mapping ConqueTerm command? Let's I'm editing a python code and want to hit F3 to open a conqueterm in a new buffer, then run a program against my code.

nmap <F3> :ConqueTermSplit ipython my_current_file<CR>
nmap <F4> :ConqueTermSplit pychecker my_current_file<CR>

Vim replaces % (file name) and %:p (full path) in the command line when a file name is expected. At other places, you need to execute expand('%:p') perhaps like this (not tested):

nmap <F3> :execute 'ConqueTermSplit ipython '.expand('%:p')<CR>

JohnBeckett 05:09, June 26, 2010 (UTC)

Works like charm. Thanks John!

I recently upgrade our python to 2.6.5 (installed on a NFS share) while still keepinp local python 2.4 in /usr/bin/python. I'm getting the following error the first time when I tried to start conqueTerm and getting "Unable to open command: bash" later. Is it possible that somewhere in your code, python was referred to /usr/bin/python instead of /usr/bin/env python ? Thanks!

-ERROR-
Error detected while processing /home/sjing/.vim/autoload/conque_term.vim:
line 1587:
Traceback (most recent call last):
  File "<string>", line 908, in ?
  File "/appl/pm/vendor/python/lx-x86/python-2.6.5/lib/python2.6/os.py", line 758
    bs = b""
           ^
SyntaxError: invalid syntax
Unable to open command: bash

It looks like Vim is loading python 2.4, but importing libraries for 2.6. I use the Vim command :python to run all python code, so I'm not instructing Vim to use one version/installation or another. In order for Vim to work with 2.6 you'll probably need to recompile Vim with the new 2.6 headers. Or maybe you could fix the import paths for 2.4 so it doesn't attempt to use the 2.6 libs.


I'd like to point out that you can always open the output of a shell command in a window with the following:

:r !<command>

That may be a good enough workaround if you can't get your sysadmin to install this custom Vim plugin.


I just installed this script and connected to powershell. It works well except the text is messed up in my windows as this (some words are not correct (D:\lcs), and the lines are messed up):

WindPowrShell                                                                                                Copyt
 () 2009 Microsoft Corporation. All rights reserverd.



A small improvement suggestion, after leaving buffer via ctrl-w and returning back, I wanted conque term window to remember insert/normal mode the window had before. I didn't get response from the author, so I have made fork at https://github.com/vlmarek/ConqueVlad which mainly orients at increasing usability. --Vlmarek (talk) 21:19, December 21, 2013 (UTC)

The main git repo is broken, but I forked and reverted the breaking commit. Enjoy! https://github.com/mcandre/Conque-Shell

--Mcandre