[Vim-latex-cvs] vimfiles/plugin explorer.vim,1.2,1.3
Brought to you by:
srinathava,
tmaas
|
From: <mi...@us...> - 2003-05-02 20:00:50
|
Update of /cvsroot/vim-latex/vimfiles/plugin
In directory sc8-pr-cvs1:/tmp/cvs-serv6165
Modified Files:
explorer.vim
Log Message:
Merging x action from main explorer.vim
Index: explorer.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/plugin/explorer.vim,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** explorer.vim 23 Apr 2003 17:28:32 -0000 1.2
--- explorer.vim 2 May 2003 20:00:45 -0000 1.3
***************
*** 2,8 ****
" File: explorer.vim
" Author: M A Aziz Ahmed (az...@ac...)
! " Last Change: 2002 Jun 12
" Version: 2.5 + changes
" Additions by Mark Waggoner (wag...@ar...) et al.
"-----------------------------------------------------------------------------
" This file implements a file explorer. Latest version available at:
--- 2,9 ----
" File: explorer.vim
" Author: M A Aziz Ahmed (az...@ac...)
! " Last Change: 2002 May 02
" Version: 2.5 + changes
" Additions by Mark Waggoner (wag...@ar...) et al.
+ " Additions for latexSuite by Mikolaj Machowski (mi...@wp...)
"-----------------------------------------------------------------------------
" This file implements a file explorer. Latest version available at:
***************
*** 127,130 ****
--- 128,155 ----
endif
+ " Execute file handler
+ if !exists("g:explFileHandler")
+ if has("win32")
+ " for Win32 use rundll32
+ function! s:explFileHandlerWin32(fn)
+ exec 'silent !start rundll32 url.dll,FileProtocolHandler "'
+ \ . escape(a:fn, '%#') . '"'
+ endfunction
+ let g:explFileHandler = "<SID>explFileHandlerWin32"
+ elseif has("unix") && executable("kfmclient")
+ " for KDE use kfmclient
+ function! s:explFileHandlerKDE(fn)
+ if &shellredir =~ "%s"
+ let redir = substitute(&shellredir, "%s", "/dev/null", "")
+ else
+ let redir = &shellredir . "/dev/null"
+ endif
+ " Need to escape % and # but not spaces.
+ exec "silent !kfmclient exec '" . escape(a:fn, '%#') . "'" . redir
+ endfunction
+ let g:explFileHandler = "<SID>explFileHandlerKDE"
+ endif
+ endif
+
"---
" script variables - these are the same across all
***************
*** 138,142 ****
let s:escfilename = ' %#'
else
! let s:escfilename = ' \%#'
endif
--- 163,167 ----
let s:escfilename = ' %#'
else
! let s:escfilename = ' \%#[]'
endif
***************
*** 206,210 ****
" Turn off the swapfile, set the buffer type so that it won't get
" written, and so that it will get deleted when it gets hidden.
! setlocal modifiable
setlocal noswapfile
setlocal buftype=nowrite
--- 231,235 ----
" Turn off the swapfile, set the buffer type so that it won't get
" written, and so that it will get deleted when it gets hidden.
! setlocal noreadonly modifiable
setlocal noswapfile
setlocal buftype=nowrite
***************
*** 259,263 ****
" If directory is already loaded, don't open it again!
if line('$') > 1
! setlocal nomodifiable
return
endif
--- 284,288 ----
" If directory is already loaded, don't open it again!
if line('$') > 1
! setlocal readonly nomodifiable
return
endif
***************
*** 271,277 ****
" eliminating things like ".."
let origdir= s:Path(getcwd())
! exe "chdir" escape(b:completePath,s:escfilename)
let b:completePath = s:Path(getcwd())
! exe "chdir" escape(origdir,s:escfilename)
" Add a slash at the end
--- 296,302 ----
" eliminating things like ".."
let origdir= s:Path(getcwd())
! exe "chdir" escape(b:completePath, s:escfilename)
let b:completePath = s:Path(getcwd())
! exe "chdir" escape(origdir, s:escfilename)
" Add a slash at the end
***************
*** 281,286 ****
" escape special characters for exec commands
! let b:completePathEsc=escape(b:completePath,s:escfilename)
! let b:parentDirEsc=substitute(b:completePathEsc, '/[^/]*/$', '/', 'g')
" Set up syntax highlighting
--- 306,311 ----
" escape special characters for exec commands
! let b:completePathEsc = escape(b:completePath, s:escfilename)
! let b:parentDirEsc = substitute(b:completePathEsc, '/[^/]*/$', '/', 'g')
" Set up syntax highlighting
***************
*** 333,336 ****
--- 358,364 ----
nnoremap <buffer> <cr> :call EditEntry("","edit")<cr>
nnoremap <buffer> - :exec ("silent e " . b:parentDirEsc)<cr>
+ if exists("g:explFileHandler")
+ nnoremap <buffer> x :call <SID>ExecuteEntry()<cr>
+ endif
nnoremap <buffer> o :call <SID>OpenEntry()<cr>
nnoremap <buffer> O :call <SID>OpenEntryPrevWindow()<cr>
***************
*** 346,353 ****
nnoremap <buffer> c :exec "cd ".b:completePathEsc<cr>
nnoremap <buffer> <2-leftmouse> :call <SID>DoubleClick()<cr>
let &cpo = cpo_save
" prevent the buffer from being modified
! setlocal nomodifiable
endfunction
--- 374,384 ----
nnoremap <buffer> c :exec "cd ".b:completePathEsc<cr>
nnoremap <buffer> <2-leftmouse> :call <SID>DoubleClick()<cr>
+ if exists("*ExplorerCustomMap")
+ call ExplorerCustomMap()
+ endif
let &cpo = cpo_save
" prevent the buffer from being modified
! setlocal readonly nomodifiable
endfunction
***************
*** 526,529 ****
--- 557,575 ----
endfunction
+ function! s:ExecuteEntry()
+ " Are we on a line with a file name?
+ let l = getline(".")
+ if l =~ '^"'
+ return
+ endif
+
+ " Get the file name
+ let fn = s:GetFullFileName()
+ if has("win32") && fn =~ '^//'
+ let fn = substitute(fn, '/', '\\', 'g')
+ endif
+ exec "call " . g:explFileHandler . "(fn)"
+ endfunction
+
"---
" Double click with the mouse
***************
*** 611,622 ****
" Get a list of all the files
! let files = s:Path(glob(b:completePath."*"))
! if files != "" && files !~ '\n$'
let files = files . "\n"
endif
" Add the dot files now, making sure "." is not included!
! let files = files . substitute(s:Path(glob(b:completePath.".*")), "[^\n]*/./\\=\n", '' , '')
! if files != "" && files !~ '\n$'
let files = files . "\n"
endif
--- 657,668 ----
" Get a list of all the files
! let files = s:Path(glob(b:completePathEsc . "*"))
! if files != "" && files !~ "\n$"
let files = files . "\n"
endif
" Add the dot files now, making sure "." is not included!
! let files = files . substitute(s:Path(glob(b:completePathEsc . ".*")), "[^\n]*/./\\=\n", '' , '')
! if files != "" && files !~ "\n$"
let files = files . "\n"
endif
***************
*** 767,778 ****
if w:longhelp==1
let @f="\" <enter> : open file or directory\n"
! \."\" o : open new window for file/directory\n"
! \."\" O : open file in previously visited window\n"
! \."\" p : preview the file\n"
! \."\" i : toggle size/date listing\n"
! \."\" s : select sort field r : reverse sort\n"
! \."\" - : go up one level c : cd to this dir\n"
! \."\" R : rename file D : delete file\n"
! \."\" :help file-explorer for detailed help\n"
else
let @f="\" Press ? for keyboard shortcuts\n"
--- 813,828 ----
if w:longhelp==1
let @f="\" <enter> : open file or directory\n"
! \."\" o : open new window for file/directory\n"
! \."\" O : open file in previously visited window\n"
! \."\" p : preview the file\n"
! if exists("g:explFileHandler")
! let @f=@f."\" x : execute file or directory\n"
! endif
! let @f=@f
! \."\" i : toggle size/date listing\n"
! \."\" s : select sort field r : reverse sort\n"
! \."\" - : go up one level c : cd to this dir\n"
! \."\" R : rename file D : delete file\n"
! \."\" :help file-explorer for detailed help\n"
else
let @f="\" Press ? for keyboard shortcuts\n"
***************
*** 857,861 ****
let currLine = a:firstline
let lastLine = a:lastline
! setlocal modifiable
while ((currLine <= lastLine) && (stopDel==0))
--- 907,911 ----
let currLine = a:firstline
let lastLine = a:lastline
! setlocal noreadonly modifiable
while ((currLine <= lastLine) && (stopDel==0))
***************
*** 893,897 ****
let &report = oldRep
setlocal nomodified
! setlocal nomodifiable
endfunction
--- 943,947 ----
let &report = oldRep
setlocal nomodified
! setlocal readonly nomodifiable
endfunction
***************
*** 901,905 ****
function! s:RenameFile()
let fileName=s:GetFullFileName()
! setlocal modifiable
if isdirectory(fileName)
echo "Directory renaming not supported yet"
--- 951,955 ----
function! s:RenameFile()
let fileName=s:GetFullFileName()
! setlocal noreadonly modifiable
if isdirectory(fileName)
echo "Directory renaming not supported yet"
***************
*** 908,912 ****
echo " "
if altName==""
! setlocal nomodifiable
return
endif
--- 958,962 ----
echo " "
if altName==""
! setlocal readonly nomodifiable
return
endif
***************
*** 923,927 ****
endif
setlocal nomodified
! setlocal nomodifiable
endfunction
--- 973,977 ----
endif
setlocal nomodified
! setlocal readonly nomodifiable
endfunction
***************
*** 938,945 ****
endif
" Allow modification
! setlocal modifiable
call s:UpdateHeader()
" Disallow modification
! setlocal nomodifiable
endfunction
--- 988,995 ----
endif
" Allow modification
! setlocal noreadonly modifiable
call s:UpdateHeader()
" Disallow modification
! setlocal readonly nomodifiable
endfunction
***************
*** 971,975 ****
"
function! s:ToggleLongList()
! setlocal modifiable
if exists("w:longlist") && w:longlist==1
let w:longlist=0
--- 1021,1025 ----
"
function! s:ToggleLongList()
! setlocal noreadonly modifiable
if exists("w:longlist") && w:longlist==1
let w:longlist=0
***************
*** 980,984 ****
endif
call s:AddFileInfo()
! setlocal nomodifiable
endfunction
--- 1030,1034 ----
endif
call s:AddFileInfo()
! setlocal readonly nomodifiable
endfunction
***************
*** 987,995 ****
"
function! s:ShowAllFiles()
! setlocal modifiable
let b:filterFormula=""
let b:filtering=""
call s:ShowDirectory()
! setlocal nomodifiable
endfunction
--- 1037,1045 ----
"
function! s:ShowAllFiles()
! setlocal noreadonly modifiable
let b:filterFormula=""
let b:filtering=""
call s:ShowDirectory()
! setlocal readonly nomodifiable
endfunction
***************
*** 1233,1237 ****
" Allow modification
! setlocal modifiable
" Send a message about what we're doing
--- 1283,1287 ----
" Allow modification
! setlocal noreadonly modifiable
" Send a message about what we're doing
***************
*** 1271,1275 ****
" Disallow modification
setlocal nomodified
! setlocal nomodifiable
endfunction
--- 1321,1325 ----
" Disallow modification
setlocal nomodified
! setlocal readonly nomodifiable
endfunction
|