Skip to content

Commit 598aebc

Browse files
committed
- Improved open behaivior.
- Fixed completion column bug. - Implemented <Plug>(vimshell_move_end_argument). - Fixed environment variables parse bug.
1 parent f4e9d5b commit 598aebc

File tree

7 files changed

+30
-26
lines changed

7 files changed

+30
-26
lines changed

Rakefile

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
pwd = ENV["PWD"]
2+
$HOME = ENV["HOME"]
3+
14
VIMSHELL_TARGETS = %w[
25
autoload/proc.vim
36
autoload/vimshell

autoload/vimshell.vim

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" FILE: vimshell.vim
33
" AUTHOR: Janakiraman .S <[email protected]>(Original)
44
" Shougo Matsushita <[email protected]>(Modified)
5-
" Last Modified: 13 Sep 2009
5+
" Last Modified: 05 Oct 2009
66
" Usage: Just source this file.
77
" License: MIT license {{{
88
" Permission is hereby granted, free of charge, to any person obtaining
@@ -24,7 +24,7 @@
2424
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2525
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2626
" }}}
27-
" Version: 5.34, for Vim 7.0
27+
" Version: 5.35, for Vim 7.0
2828
"=============================================================================
2929

3030
if !exists('g:VimShell_UserPrompt')

autoload/vimshell/complete.vim

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"=============================================================================
22
" FILE: complete.vim
33
" AUTHOR: Shougo Matsushita <[email protected]>(Modified)
4-
" Last Modified: 13 Sep 2009
4+
" Last Modified: 19 Sep 2009
55
" Usage: Just source this file.
66
" License: MIT license {{{
77
" Permission is hereby granted, free of charge, to any person obtaining
@@ -64,10 +64,8 @@ function! vimshell#complete#insert_command_completion()"{{{
6464
let &iminsert = 0
6565
let &imsearch = 0
6666

67-
let l:save_ve = &l:virtualedit
68-
setlocal virtualedit=all
69-
let l:cur_text = substitute(getline('.')[: virtcol('.')-1], '^' . g:VimShell_Prompt . '\s*', '', '')
70-
let &l:virtualedit = l:save_ve
67+
let l:cur_text = (col('.') < 2)? '' : getline('.')[: col('.')-2]
68+
let l:cur_text = substitute(l:cur_text, '^' . g:VimShell_Prompt . '\s*', '', '')
7169
if l:cur_text =~ '^.\+/\|^[^\\]\+\s'
7270
" Filename completion.
7371
if exists(':NeoComplCacheDisable') && exists('*neocomplcache#manual_filename_complete')
@@ -91,10 +89,7 @@ endfunction"}}}
9189
function! vimshell#complete#smart_omni_completion(findstart, base)"{{{
9290
if a:findstart
9391
" Get cursor word.
94-
let l:save_ve = &l:virtualedit
95-
setlocal virtualedit=all
96-
let l:cur_text = getline('.')[: virtcol('.')-1]
97-
let &l:virtualedit = l:save_ve
92+
let l:cur_text = (col('.') < 2)? '' : getline('.')[: col('.')-2]
9893

9994
return match(l:cur_text, '\%([[:alnum:]_+~-]\|\\[ ]\)*$')
10095
endif

autoload/vimshell/internal/open.vim

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"=============================================================================
22
" FILE: open.vim
33
" AUTHOR: Shougo Matsushita <[email protected]>
4-
" Last Modified: 13 Sep 2009
4+
" Last Modified: 14 Sep 2009
55
" Usage: Just source this file.
66
" License: MIT license {{{
77
" Permission is hereby granted, free of charge, to any person obtaining
@@ -23,9 +23,11 @@
2323
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2424
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2525
" }}}
26-
" Version: 1.0, for Vim 7.0
26+
" Version: 1.1, for Vim 7.0
2727
"-----------------------------------------------------------------------------
2828
" ChangeLog: "{{{
29+
" 1.1: Improved behaivior.
30+
"
2931
" 1.0: Initial version.
3032
""}}}
3133
"-----------------------------------------------------------------------------
@@ -39,15 +41,10 @@
3941

4042
function! vimshell#internal#open#execute(program, args, fd, other_info)"{{{
4143
" Open file.
42-
if g:VimShell_EnableInteractive
43-
let l:command = 'exe'
44-
else
45-
let l:command = 'sexe'
46-
endif
4744

4845
if has('win32') || has('win64')
49-
let l:command = 'gexe'
50-
let l:args = a:args
46+
execute printf('silent ! start %s', join(a:args))
47+
return 0
5148
elseif has('mac')
5249
let l:args = ['open'] + a:args
5350
elseif executable(vimshell#getfilename('gnome-open'))
@@ -58,6 +55,6 @@ function! vimshell#internal#open#execute(program, args, fd, other_info)"{{{
5855
throw 'open: Not supported.'
5956
endif
6057

61-
return vimshell#execute_internal_command(l:command, l:args, a:fd, a:other_info)
58+
return vimshell#execute_internal_command('gexe', l:args, a:fd, a:other_info)
6259
endfunction"}}}
6360

autoload/vimshell/parser.vim

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"=============================================================================
22
" FILE: parser.vim
33
" AUTHOR: Shougo Matsushita <[email protected]>(Modified)
4-
" Last Modified: 12 Sep 2009
4+
" Last Modified: 08 Oct 2009
55
" Usage: Just source this file.
66
" License: MIT license {{{
77
" Permission is hereby granted, free of charge, to any person obtaining
@@ -342,9 +342,9 @@ function! s:parse_variables(script)"{{{
342342
while l:i < l:max
343343
if a:script[l:i] == '$'
344344
" Eval variables.
345-
if match(a:script, '^$\l', l:i)
345+
if match(a:script, '^$\l', l:i) >= 0
346346
let l:script .= string(eval(printf("b:vimshell_variables['%s']", matchstr(a:script, '^$\zs\l\w*', l:i))))
347-
elseif match(a:script, '^$$', l:i)
347+
elseif match(a:script, '^$$', l:i) >= 0
348348
let l:script .= string(eval(printf("b:vimshell_system_variables['%s']", matchstr(a:script, '^$$\zs\h\w*', l:i))))
349349
else
350350
let l:script .= string(eval(matchstr(a:script, '^$\h\w*', l:i)))

ftplugin/vimshell.vim

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ nmap <buffer> <C-n> <Plug>(vimshell_next_prompt)
1414
nmap <buffer> <C-d> <Plug>(vimshell_delete_previous_output)
1515
" Paste this prompt.
1616
nmap <buffer> <C-y> <Plug>(vimshell_paste_prompt)
17+
" Search end argument.
18+
nmap <buffer> E <Plug>(vimshell_move_end_argument)
1719
"}}}
1820

1921
" Insert mode key-mappings."{{{

plugin/vimshell.vim

+9-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" FILE: vimshell.vim
33
" AUTHOR: Janakiraman .S <[email protected]>(Original)
44
" Shougo Matsushita <[email protected]>(Modified)
5-
" Last Modified: 14 Sep 2009
5+
" Last Modified: 22 Sep 2009
66
" License: MIT license {{{
77
" Permission is hereby granted, free of charge, to any person obtaining
88
" a copy of this software and associated documentation files (the
@@ -23,13 +23,16 @@
2323
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2424
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2525
" }}}
26-
" Version: 5.34, for Vim 7.0
26+
" Version: 5.35, for Vim 7.0
2727
"=============================================================================
2828

2929
if exists('g:loaded_vimshell') || v:version < 700
3030
finish
3131
endif
3232

33+
let s:save_cpo = &cpo
34+
set cpo&vim
35+
3336
" Plugin keymapping"{{{
3437
nnoremap <silent> <Plug>(vimshell_split_switch) :<C-u>call vimshell#switch_shell(1)<CR>
3538
nnoremap <silent> <Plug>(vimshell_split_create) :<C-u>call vimshell#create_shell(1)<CR>
@@ -40,6 +43,7 @@ nnoremap <silent> <Plug>(vimshell_previous_prompt) :<C-u>call vimshell#previous
4043
nnoremap <silent> <Plug>(vimshell_next_prompt) :<C-u>call vimshell#next_prompt()<CR>
4144
nnoremap <silent> <Plug>(vimshell_delete_previous_output) :<C-u>call vimshell#delete_previous_output()<CR>
4245
nnoremap <silent> <Plug>(vimshell_paste_prompt) :<C-u>call vimshell#paste_prompt()<CR>
46+
nnoremap <silent> <Plug>(vimshell_move_end_argument) 0:<C-u>call search('\\\@<!\s\zs[^[:space:]]*$', '', line('.'))<CR>
4347
4448
inoremap <silent> <Plug>(vimshell_push_current_line) <ESC>:<C-u>call vimshell#push_current_line()<CR>
4549
inoremap <silent> <Plug>(vimshell_insert_last_word) <ESC>:<C-u>call vimshell#insert_last_word()<CR>
@@ -119,6 +123,9 @@ command! -nargs=0 VimShell call vimshell#switch_shell(0)
119123
command! -nargs=+ -complete=shellcmd VimShellExecute call vimshell#internal#bg#vimshell_bg(split(<q-args>))
120124
command! -nargs=+ -complete=shellcmd VimShellInteractive call vimshell#internal#iexe#vimshell_iexe(split(<q-args>))
121125

126+
let &cpo = s:save_cpo
127+
unlet s:save_cpo
128+
122129
let g:loaded_vimshell = 1
123130

124131
" vim: foldmethod=marker

0 commit comments

Comments
 (0)