Karsten Hopp cf9f5a
" netrwSettings.vim: makes netrw settings simpler
Karsten Hopp cf9f5a
" Date:		Sep 03, 2008
Karsten Hopp cf9f5a
" Maintainer:	Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
Karsten Hopp cf9f5a
" Version:	13
Karsten Hopp cf9f5a
" Copyright:    Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1
Karsten Hopp cf9f5a
"               Permission is hereby granted to use and distribute this code,
Karsten Hopp cf9f5a
"               with or without modifications, provided that this copyright
Karsten Hopp cf9f5a
"               notice is copied with it. Like anything else that's free,
Karsten Hopp cf9f5a
"               netrwSettings.vim is provided *as is* and comes with no
Karsten Hopp cf9f5a
"               warranty of any kind, either expressed or implied. By using
Karsten Hopp cf9f5a
"               this plugin, you agree that in no event will the copyright
Karsten Hopp cf9f5a
"               holder be liable for any damages resulting from the use
Karsten Hopp cf9f5a
"               of this software.
Karsten Hopp cf9f5a
"
Karsten Hopp cf9f5a
" Mat 4:23 (WEB) Jesus went about in all Galilee, teaching in their {{{1
Karsten Hopp cf9f5a
"                synagogues, preaching the gospel of the kingdom, and healing
Karsten Hopp cf9f5a
"                every disease and every sickness among the people.
Karsten Hopp cf9f5a
" Load Once: {{{1
Karsten Hopp cf9f5a
if exists("g:loaded_netrwSettings") || &cp
Karsten Hopp cf9f5a
  finish
Karsten Hopp cf9f5a
endif
Karsten Hopp cf9f5a
let g:loaded_netrwSettings = "v13"
Karsten Hopp cf9f5a
if v:version < 700
Karsten Hopp cf9f5a
 echohl WarningMsg
Karsten Hopp cf9f5a
 echo "***warning*** this version of netrwSettings needs vim 7.0"
Karsten Hopp cf9f5a
 echohl Normal
Karsten Hopp cf9f5a
 finish
Karsten Hopp cf9f5a
endif
Karsten Hopp cf9f5a
Karsten Hopp cf9f5a
" ---------------------------------------------------------------------
Karsten Hopp cf9f5a
" NetrwSettings: {{{1
Karsten Hopp cf9f5a
fun! netrwSettings#NetrwSettings()
Karsten Hopp cf9f5a
  " this call is here largely just to insure that netrw has been loaded
Karsten Hopp cf9f5a
  call netrw#NetrwSavePosn()
Karsten Hopp cf9f5a
  if !exists("g:loaded_netrw")
Karsten Hopp cf9f5a
   echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None
Karsten Hopp cf9f5a
   return
Karsten Hopp cf9f5a
  endif
Karsten Hopp cf9f5a
Karsten Hopp cf9f5a
  above wincmd s
Karsten Hopp cf9f5a
  enew
Karsten Hopp cf9f5a
  setlocal noswapfile bh=wipe
Karsten Hopp cf9f5a
  set ft=vim
Karsten Hopp cf9f5a
  file Netrw\ Settings
Karsten Hopp cf9f5a
Karsten Hopp cf9f5a
  " these variables have the following default effects when they don't
Karsten Hopp cf9f5a
  " exist (ie. have not been set by the user in his/her .vimrc)
Karsten Hopp cf9f5a
  if !exists("g:netrw_liststyle")
Karsten Hopp cf9f5a
   let g:netrw_liststyle= 0
Karsten Hopp cf9f5a
   let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
Karsten Hopp cf9f5a
  endif
Karsten Hopp cf9f5a
  if !exists("g:netrw_silent")
Karsten Hopp cf9f5a
   let g:netrw_silent= 0
Karsten Hopp cf9f5a
  endif
Karsten Hopp cf9f5a
  if !exists("g:netrw_use_nt_rcp")
Karsten Hopp cf9f5a
   let g:netrw_use_nt_rcp= 0
Karsten Hopp cf9f5a
  endif
Karsten Hopp cf9f5a
  if !exists("g:netrw_ftp")
Karsten Hopp cf9f5a
   let g:netrw_ftp= 0
Karsten Hopp cf9f5a
  endif
Karsten Hopp cf9f5a
  if !exists("g:netrw_ignorenetrc")
Karsten Hopp cf9f5a
   let g:netrw_ignorenetrc= 0
Karsten Hopp cf9f5a
  endif
Karsten Hopp cf9f5a
Karsten Hopp cf9f5a
  put ='+ ---------------------------------------------'
Karsten Hopp cf9f5a
  put ='+  NetrwSettings:  by Charles E. Campbell, Jr.'
Karsten Hopp cf9f5a
  put ='+ Press <F1> with cursor atop any line for help'
Karsten Hopp cf9f5a
  put ='+ ---------------------------------------------'
Karsten Hopp cf9f5a
  let s:netrw_settings_stop= line(".")
Karsten Hopp cf9f5a
Karsten Hopp cf9f5a
  put =''
Karsten Hopp cf9f5a
  put ='+ Netrw Protocol Commands'
Karsten Hopp cf9f5a
  put = 'let g:netrw_dav_cmd           = '.g:netrw_dav_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_fetch_cmd         = '.g:netrw_fetch_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_ftp_cmd           = '.g:netrw_ftp_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_http_cmd          = '.g:netrw_http_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_rcp_cmd           = '.g:netrw_rcp_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_rsync_cmd         = '.g:netrw_rsync_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_scp_cmd           = '.g:netrw_scp_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_sftp_cmd          = '.g:netrw_sftp_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_ssh_cmd           = '.g:netrw_ssh_cmd
Karsten Hopp cf9f5a
  let s:netrw_protocol_stop= line(".")
Karsten Hopp cf9f5a
  put = ''
Karsten Hopp cf9f5a
Karsten Hopp cf9f5a
  put ='+Netrw Transfer Control'
Karsten Hopp cf9f5a
  put = 'let g:netrw_cygwin            = '.g:netrw_cygwin
Karsten Hopp cf9f5a
  put = 'let g:netrw_ftp               = '.g:netrw_ftp
Karsten Hopp cf9f5a
  put = 'let g:netrw_ftpmode           = '.g:netrw_ftpmode
Karsten Hopp cf9f5a
  put = 'let g:netrw_ignorenetrc       = '.g:netrw_ignorenetrc
Karsten Hopp cf9f5a
  put = 'let g:netrw_sshport           = '.g:netrw_sshport
Karsten Hopp cf9f5a
  put = 'let g:netrw_use_nt_rcp        = '.g:netrw_use_nt_rcp
Karsten Hopp cf9f5a
  put = 'let g:netrw_win95ftp          = '.g:netrw_win95ftp
Karsten Hopp cf9f5a
  let s:netrw_xfer_stop= line(".")
Karsten Hopp cf9f5a
  put =''
Karsten Hopp cf9f5a
  put ='+ Netrw Messages'
Karsten Hopp cf9f5a
  put ='let g:netrw_use_errorwindow    = '.g:netrw_use_errorwindow
Karsten Hopp cf9f5a
Karsten Hopp cf9f5a
  put = ''
Karsten Hopp cf9f5a
  put ='+ Netrw Browser Control'
Karsten Hopp cf9f5a
  put = 'let g:netrw_alto              = '.g:netrw_alto
Karsten Hopp cf9f5a
  put = 'let g:netrw_altv              = '.g:netrw_altv
Karsten Hopp cf9f5a
  put = 'let g:netrw_browse_split      = '.g:netrw_browse_split
Karsten Hopp cf9f5a
  if exists("g:netrw_browsex_viewer")
Karsten Hopp cf9f5a
   put = 'let g:netrw_browsex_viewer    = '.g:netrw_browsex_viewer
Karsten Hopp cf9f5a
  else
Karsten Hopp cf9f5a
   put = 'let g:netrw_browsex_viewer    = (not defined)'
Karsten Hopp cf9f5a
  endif
Karsten Hopp cf9f5a
  put = 'let g:netrw_compress          = '.g:netrw_compress
Karsten Hopp cf9f5a
  put = 'let g:netrw_cursorline        = '.g:netrw_cursorline
Karsten Hopp cf9f5a
  let decompressline= line("$")
Karsten Hopp cf9f5a
  put ='let g:netrw_decompress...'
Karsten Hopp cf9f5a
  put = 'let g:netrw_dirhistmax        = '.g:netrw_dirhistmax
Karsten Hopp cf9f5a
  put = 'let g:netrw_fastbrowse        = '.g:netrw_fastbrowse
Karsten Hopp cf9f5a
  let fnameescline= line("$")
Karsten Hopp cf9f5a
  put = 'let g:netrw_fname_escape...'
Karsten Hopp cf9f5a
  put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject
Karsten Hopp cf9f5a
  put = 'let g:netrw_ftp_list_cmd      = '.g:netrw_ftp_list_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_ftp_sizelist_cmd  = '.g:netrw_ftp_sizelist_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_ftp_timelist_cmd  = '.g:netrw_ftp_timelist_cmd
Karsten Hopp cf9f5a
  let globescline= line("$")
Karsten Hopp cf9f5a
  put ='let g:netrw_glob_escape...'
Karsten Hopp cf9f5a
  put = 'let g:netrw_hide              = '.g:netrw_hide
Karsten Hopp cf9f5a
  put = 'let g:netrw_keepdir           = '.g:netrw_keepdir
Karsten Hopp cf9f5a
  put = 'let g:netrw_list_cmd          = '.g:netrw_list_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_list_hide         = '.g:netrw_list_hide
Karsten Hopp cf9f5a
  put = 'let g:netrw_liststyle         = '.g:netrw_liststyle
Karsten Hopp cf9f5a
  put = 'let g:netrw_localcopycmd      = '.g:netrw_localcopycmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_local_mkdir       = '.g:netrw_local_mkdir
Karsten Hopp cf9f5a
  put = 'let g:netrw_localmovecmd      = '.g:netrw_localmovecmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_local_rmdir       = '.g:netrw_local_rmdir
Karsten Hopp cf9f5a
  put = 'let g:netrw_maxfilenamelen    = '.g:netrw_maxfilenamelen
Karsten Hopp cf9f5a
  put = 'let g:netrw_menu              = '.g:netrw_menu
Karsten Hopp cf9f5a
  put = 'let g:netrw_mkdir_cmd         = '.g:netrw_mkdir_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_preview           = '.g:netrw_preview
Karsten Hopp cf9f5a
  put = 'let g:netrw_rename_cmd        = '.g:netrw_rename_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_retmap            = '.g:netrw_retmap
Karsten Hopp cf9f5a
  put = 'let g:netrw_rm_cmd            = '.g:netrw_rm_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_rmdir_cmd         = '.g:netrw_rmdir_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_rmf_cmd           = '.g:netrw_rmf_cmd
Karsten Hopp cf9f5a
  put = 'let g:netrw_silent            = '.g:netrw_silent
Karsten Hopp cf9f5a
  put = 'let g:netrw_sort_by           = '.g:netrw_sort_by
Karsten Hopp cf9f5a
  put = 'let g:netrw_sort_direction    = '.g:netrw_sort_direction
Karsten Hopp cf9f5a
  put = 'let g:netrw_sort_options      = '.g:netrw_sort_options
Karsten Hopp cf9f5a
  put = 'let g:netrw_sort_sequence     = '.g:netrw_sort_sequence
Karsten Hopp cf9f5a
  put = 'let g:netrw_special_syntax    = '.g:netrw_special_syntax
Karsten Hopp cf9f5a
  put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject
Karsten Hopp cf9f5a
  put = 'let g:netrw_scpport           = '.g:netrw_scpport
Karsten Hopp cf9f5a
  put = 'let g:netrw_sshport           = '.g:netrw_sshport
Karsten Hopp cf9f5a
  put = 'let g:netrw_timefmt           = '.g:netrw_timefmt
Karsten Hopp cf9f5a
  let tmpfileescline= line("$")
Karsten Hopp cf9f5a
  put ='let g:netrw_tmpfile_escape...'
Karsten Hopp cf9f5a
  put = 'let g:netrw_use_noswf         = '.g:netrw_use_noswf
Karsten Hopp cf9f5a
  put = 'let g:netrw_xstrlen           = '.g:netrw_xstrlen
Karsten Hopp cf9f5a
  put = 'let g:netrw_winsize           = '.g:netrw_winsize
Karsten Hopp cf9f5a
Karsten Hopp cf9f5a
  put =''
Karsten Hopp cf9f5a
  put ='+ For help, place cursor on line and press <F1>'
Karsten Hopp cf9f5a
Karsten Hopp cf9f5a
  1d
Karsten Hopp cf9f5a
  silent %s/^+/"/e
Karsten Hopp cf9f5a
  res 99
Karsten Hopp cf9f5a
  silent %s/= \([^0-9].*\)$/= '\1'/e
Karsten Hopp cf9f5a
  silent %s/= $/= ''/e
Karsten Hopp cf9f5a
  1
Karsten Hopp cf9f5a
Karsten Hopp cf9f5a
  call setline(decompressline,"let g:netrw_decompress        = ".substitute(string(g:netrw_decompress),"^'\\(.*\\)'$",'\1',''))
Karsten Hopp cf9f5a
  call setline(fnameescline,  "let g:netrw_fname_escape      = '".escape(g:netrw_fname_escape,"'")."'")
Karsten Hopp cf9f5a
  call setline(globescline,   "let g:netrw_glob_escape       = '".escape(g:netrw_glob_escape,"'")."'")
Karsten Hopp cf9f5a
  call setline(tmpfileescline,"let g:netrw_tmpfile_escape    = '".escape(g:netrw_tmpfile_escape,"'")."'")
Karsten Hopp cf9f5a
Karsten Hopp cf9f5a
  set nomod
Karsten Hopp cf9f5a
Karsten Hopp cf9f5a
  nmap <buffer> <silent> <F1>                       :call NetrwSettingHelp()<cr>
Karsten Hopp cf9f5a
  nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call NetrwSettingHelp()<cr>
Karsten Hopp cf9f5a
  let tmpfile= tempname()
Karsten Hopp cf9f5a
  exe 'au BufWriteCmd	Netrw\ Settings	silent w! '.tmpfile.'|so '.tmpfile.'|call delete("'.tmpfile.'")|set nomod'
Karsten Hopp cf9f5a
endfun
Karsten Hopp cf9f5a
Karsten Hopp cf9f5a
" ---------------------------------------------------------------------
Karsten Hopp cf9f5a
" NetrwSettingHelp: {{{2
Karsten Hopp cf9f5a
fun! NetrwSettingHelp()
Karsten Hopp cf9f5a
"  call Dfunc("NetrwSettingHelp()")
Karsten Hopp cf9f5a
  let curline = getline(".")
Karsten Hopp cf9f5a
  if curline =~ '='
Karsten Hopp cf9f5a
   let varhelp = substitute(curline,'^\s*let ','','e')
Karsten Hopp cf9f5a
   let varhelp = substitute(varhelp,'\s*=.*$','','e')
Karsten Hopp cf9f5a
"   call Decho("trying help ".varhelp)
Karsten Hopp cf9f5a
   try
Karsten Hopp cf9f5a
    exe "he ".varhelp
Karsten Hopp cf9f5a
   catch /^Vim\%((\a\+)\)\=:E149/
Karsten Hopp cf9f5a
   	echo "***sorry*** no help available for <".varhelp.">"
Karsten Hopp cf9f5a
   endtry
Karsten Hopp cf9f5a
  elseif line(".") < s:netrw_settings_stop
Karsten Hopp cf9f5a
   he netrw-settings
Karsten Hopp cf9f5a
  elseif line(".") < s:netrw_protocol_stop
Karsten Hopp cf9f5a
   he netrw-externapp
Karsten Hopp cf9f5a
  elseif line(".") < s:netrw_xfer_stop
Karsten Hopp cf9f5a
   he netrw-variables
Karsten Hopp cf9f5a
  else
Karsten Hopp cf9f5a
   he netrw-browse-var
Karsten Hopp cf9f5a
  endif
Karsten Hopp cf9f5a
"  call Dret("NetrwSettingHelp")
Karsten Hopp cf9f5a
endfun
Karsten Hopp cf9f5a
Karsten Hopp cf9f5a
" ---------------------------------------------------------------------
Karsten Hopp cf9f5a
" Modelines: {{{1
Karsten Hopp cf9f5a
" vim:ts=8 fdm=marker