1 " FILE: plugin/conque_term.vim {{{
2 " AUTHOR: Nico Raffo <nicoraffo@gmail.com>
3 " WEBSITE: http://conque.googlecode.com
5 " VERSION: 2.2, for Vim 7.0
7 " Conque - Vim terminal/console emulator
8 " Copyright (C) 2009-__YEAR__ Nico Raffo
12 " Permission is hereby granted, free of charge, to any person obtaining a copy
13 " of this software and associated documentation files (the "Software"), to deal
14 " in the Software without restriction, including without limitation the rights
15 " to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16 " copies of the Software, and to permit persons to whom the Software is
17 " furnished to do so, subject to the following conditions:
19 " The above copyright notice and this permission notice shall be included in
20 " all copies or substantial portions of the Software.
22 " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 " IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 " FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 " AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 " LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27 " OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
31 " See docs/conque_term.txt for help or type :help ConqueTerm
33 if exists('g:ConqueTerm_Loaded') || v:version < 700
37 " **********************************************************************************************************
38 " **** CONFIGURATION ***************************************************************************************
39 " **********************************************************************************************************
44 " Disables all features which could cause Conque to run slowly, including:
45 " * Disables terminal colors
46 " * Disables some multi-byte character handling
47 if !exists('g:ConqueTerm_FastMode')
48 let g:ConqueTerm_FastMode = 0
51 " automatically go into insert mode when entering buffer {{{
52 if !exists('g:ConqueTerm_InsertOnEnter')
53 let g:ConqueTerm_InsertOnEnter = 0
56 " Allow user to use <C-w> keys to switch window in insert mode. {{{
57 if !exists('g:ConqueTerm_CWInsert')
58 let g:ConqueTerm_CWInsert = 0
61 " Choose key mapping to leave insert mode {{{
62 " If you choose something other than '<Esc>', then <Esc> will be sent to terminal
63 " Using a different key will usually fix Alt/Meta key issues
64 if !exists('g:ConqueTerm_EscKey')
65 let g:ConqueTerm_EscKey = '<Esc>'
68 " Use this key to execute the current file in a split window. {{{
69 " THIS IS A GLOBAL KEY MAPPING
70 if !exists('g:ConqueTerm_ExecFileKey')
71 let g:ConqueTerm_ExecFileKey = '<F11>'
74 " Use this key to send the current file contents to conque. {{{
75 " THIS IS A GLOBAL KEY MAPPING
76 if !exists('g:ConqueTerm_SendFileKey')
77 let g:ConqueTerm_SendFileKey = '<F10>'
80 " Use this key to send selected text to conque. {{{
81 " THIS IS A GLOBAL KEY MAPPING
82 if !exists('g:ConqueTerm_SendVisKey')
83 let g:ConqueTerm_SendVisKey = '<F9>'
86 " Use this key to toggle terminal key mappings. {{{
87 " Only mapped inside of Conque buffers.
88 if !exists('g:ConqueTerm_ToggleKey')
89 let g:ConqueTerm_ToggleKey = '<F8>'
93 " If your apps use a lot of color it will slow down the shell.
94 " 0 - no terminal colors. You still will see Vim syntax highlighting.
95 " 1 - limited terminal colors (recommended). Past terminal color history cleared regularly.
96 " 2 - all terminal colors. Terminal color history never cleared.
97 if !exists('g:ConqueTerm_Color')
98 let g:ConqueTerm_Color = 1
101 " Color mode. Windows ONLY {{{
102 " Set this variable to 'conceal' to use Vim's conceal mode for terminal colors.
103 " This makes colors render much faster, but has some odd baggage.
104 if !exists('g:ConqueTerm_ColorMode')
105 let g:ConqueTerm_ColorMode = ''
108 " TERM environment setting {{{
109 if !exists('g:ConqueTerm_TERM')
110 let g:ConqueTerm_TERM = 'vt100'
113 " Syntax for your buffer {{{
114 if !exists('g:ConqueTerm_Syntax')
115 let g:ConqueTerm_Syntax = 'conque_term'
118 " Keep on updating the shell window after you've switched to another buffer {{{
119 if !exists('g:ConqueTerm_ReadUnfocused')
120 let g:ConqueTerm_ReadUnfocused = 0
123 " Use this regular expression to highlight prompt {{{
124 if !exists('g:ConqueTerm_PromptRegex')
125 let g:ConqueTerm_PromptRegex = '^\w\+@[0-9A-Za-z_.-]\+:[0-9A-Za-z_./\~,:-]\+\$'
128 " Choose which Python version to attempt to load first {{{
129 " Valid values are 2, 3 or 0 (no preference)
130 if !exists('g:ConqueTerm_PyVersion')
131 let g:ConqueTerm_PyVersion = 2
134 " Path to python.exe. (Windows only) {{{
135 " By default, Conque will check C:\PythonNN\python.exe then will search system path
136 " If you have installed Python in an unusual location and it's not in your path, fill in the full path below
137 " E.g. 'C:\Program Files\Python\Python27\python.exe'
138 if !exists('g:ConqueTerm_PyExe')
139 let g:ConqueTerm_PyExe = ''
142 " Automatically close buffer when program exits {{{
143 if !exists('g:ConqueTerm_CloseOnEnd')
144 let g:ConqueTerm_CloseOnEnd = 0
147 " Send function key presses to terminal {{{
148 if !exists('g:ConqueTerm_SendFunctionKeys')
149 let g:ConqueTerm_SendFunctionKeys = 0
152 " Session support {{{
153 if !exists('g:ConqueTerm_SessionSupport')
154 let g:ConqueTerm_SessionSupport = 0
157 " hide Conque startup messages {{{
158 " messages should only appear the first 3 times you start Vim with a new version of Conque
159 " and include important Conque feature and option descriptions
160 " TODO - disabled and unused for now
161 if !exists('g:ConqueTerm_StartMessages')
162 let g:ConqueTerm_StartMessages = 1
165 " Windows character code page {{{
166 " Leave at 0 to use current environment code page.
167 " Use 65001 for utf-8, although many console apps do not support it.
168 if !exists('g:ConqueTerm_CodePage')
169 let g:ConqueTerm_CodePage = 0
172 " InsertCharPre support {{{
173 " Disable this feature by default, still in Beta
174 if !exists('g:ConqueTerm_InsertCharPre')
175 let g:ConqueTerm_InsertCharPre = 0
180 " **********************************************************************************************************
181 " **** Startup *********************************************************************************************
182 " **********************************************************************************************************
186 let g:ConqueTerm_Loaded = 1
187 let g:ConqueTerm_Idx = 0
188 let g:ConqueTerm_Version = 210
190 command! -nargs=+ -complete=shellcmd ConqueTerm call conque_term#open(<q-args>)
191 command! -nargs=+ -complete=shellcmd ConqueTermSplit call conque_term#open(<q-args>, ['belowright split'])
192 command! -nargs=+ -complete=shellcmd ConqueTermVSplit call conque_term#open(<q-args>, ['belowright vsplit'])
193 command! -nargs=+ -complete=shellcmd ConqueTermTab call conque_term#open(<q-args>, ['tabnew'])
197 " **********************************************************************************************************
198 " **** Global Mappings & Autocommands **********************************************************************
199 " **********************************************************************************************************
203 if exists('g:ConqueTerm_SessionSupport') && g:ConqueTerm_SessionSupport == 1
204 autocmd SessionLoadPost * call conque_term#resume_session()
207 if maparg(g:ConqueTerm_ExecFileKey, 'n') == ''
208 exe 'nnoremap <silent> ' . g:ConqueTerm_ExecFileKey . ' :call conque_term#exec_file()<CR>'
213 " vim:foldmethod=marker