Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Merged.

  • Loading branch information...
commit dc1c21836f5cdcd5ebf33386c22adad47965ce0a 2 parents 65e869e + 7328714
@Shougo Shougo authored
View
16 autoload/vimshell.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: vimshell.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 14 Jun 2011.
+" Last Modified: 06 Jul 2011.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -609,6 +609,20 @@ function! vimshell#execute_current_line(is_insert)"{{{
\ vimshell#mappings#execute_line(a:is_insert) :
\ vimshell#int_mappings#execute_line(a:is_insert)
endfunction"}}}
+function! vimshell#get_cursor_filename()"{{{
+ let l:filename_pattern = (b:interactive.type ==# 'vimshell') ?
+ \ '\%([[:alnum:];/?:@&=+$,_.!~*''|()-]\+[ ]\)*[[:alnum:];/?:@&=+$,_.!~*''|()-]\+' :
+ \ '[[:alnum:];/?:@&=+$,_.!~*''|()-]\+'
+ let l:filename = matchstr(getline('.')[: col('.')-1], l:filename_pattern . '$')
+ \ . matchstr(getline('.')[col('.') :], '^'.l:filename_pattern)
+
+ if has('conceal') && b:interactive.type ==# 'vimshell' && l:filename =~ '\[\%[%\]]\|^%$'
+ " Skip user prompt.
+ let l:filename = matchstr(getline('.'), l:filename_pattern, 3)
+ endif
+
+ return expand(l:filename)
+endfunction"}}}
"}}}
" User helper functions.
View
6 autoload/vimshell/int_mappings.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: int_mappings.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 01 Jul 2011.
+" Last Modified: 05 Jul 2011.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -173,8 +173,8 @@ function! s:delete_backward_line()"{{{
endfunction"}}}
function! vimshell#int_mappings#execute_line(is_insert)"{{{
if !a:is_insert
- " Search cursor file.
- let l:filename = matchstr(substitute(substitute(expand('<cfile>'), '\\', '/', 'g'), ' ', '\\ ', 'g'), '\h\w*://\f\+')
+ " Search cursor filename.
+ let l:filename = vimshell#get_cursor_filename()
if &termencoding != '' && &encoding != &termencoding
" Convert encoding.
View
9 autoload/vimshell/mappings.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: mappings.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 04 Jul 2011.
+" Last Modified: 05 Jul 2011.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -201,12 +201,7 @@ function! vimshell#mappings#execute_line(is_insert)"{{{
let l:pattern = l:line[1]
else
" Search cursor file.
- " let l:filename = expand('<cfile>')
- let l:filename = matchstr(getline('.')[: col('.')-1], '\%(\f\+[ ]\)*\f\+$')
- \ . matchstr(getline('.')[col('.') :], '^\%(\f\+[ ]\)*\f\+')
- if has('conceal') && l:filename =~ '\[\%[%\]]\|^%$'
- let l:filename = matchstr(getline('.'), '\%(\f\+[ ]\)*\f\+', 3)
- endif
+ let l:filename = vimshell#get_cursor_filename()
let l:pattern = ''
endif
View
6 doc/vimshell.txt
@@ -220,6 +220,12 @@ CHANGELOG *vimshell-changelog*
2011-07-10
- Fixed cd internal command.
+2011-07-06
+- Improved open cursor file.
+
+2011-07-05
+- Improved open cursor file.
+
2011-07-04
- Added <Plug>(vimshell_move_head) mapping.
- Improved <Plug>(vimshell_previous_prompt) and <Plug>(vimshell_next_prompt)
Please sign in to comment.
Something went wrong with that request. Please try again.