netrwSettings.vim 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. " netrwSettings.vim: makes netrw settings simpler
  2. " Date: Nov 15, 2021
  3. " Maintainer: This runtime file is looking for a new maintainer.
  4. " Former Maintainer: Charles E Campbell
  5. " Version: 18
  6. " Last Change:
  7. " 2024 May 08 by Vim Project: cleanup legacy Win9X checks
  8. " Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1
  9. " Permission is hereby granted to use and distribute this code,
  10. " with or without modifications, provided that this copyright
  11. " notice is copied with it. Like anything else that's free,
  12. " netrwSettings.vim is provided *as is* and comes with no
  13. " warranty of any kind, either expressed or implied. By using
  14. " this plugin, you agree that in no event will the copyright
  15. " holder be liable for any damages resulting from the use
  16. " of this software.
  17. "
  18. " Mat 4:23 (WEB) Jesus went about in all Galilee, teaching in their {{{1
  19. " synagogues, preaching the gospel of the kingdom, and healing
  20. " every disease and every sickness among the people.
  21. " Load Once: {{{1
  22. if exists("g:loaded_netrwSettings") || &cp
  23. finish
  24. endif
  25. let g:loaded_netrwSettings = "v18"
  26. if v:version < 700
  27. echohl WarningMsg
  28. echo "***warning*** this version of netrwSettings needs vim 7.0"
  29. echohl Normal
  30. finish
  31. endif
  32. " ---------------------------------------------------------------------
  33. " NetrwSettings: {{{1
  34. fun! netrwSettings#NetrwSettings()
  35. " this call is here largely just to insure that netrw has been loaded
  36. call netrw#WinPath("")
  37. if !exists("g:loaded_netrw")
  38. echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None
  39. return
  40. endif
  41. above wincmd s
  42. enew
  43. setlocal noswapfile bh=wipe
  44. set ft=vim
  45. file Netrw\ Settings
  46. " these variables have the following default effects when they don't
  47. " exist (ie. have not been set by the user in his/her .vimrc)
  48. if !exists("g:netrw_liststyle")
  49. let g:netrw_liststyle= 0
  50. let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
  51. endif
  52. if !exists("g:netrw_silent")
  53. let g:netrw_silent= 0
  54. endif
  55. if !exists("g:netrw_use_nt_rcp")
  56. let g:netrw_use_nt_rcp= 0
  57. endif
  58. if !exists("g:netrw_ftp")
  59. let g:netrw_ftp= 0
  60. endif
  61. if !exists("g:netrw_ignorenetrc")
  62. let g:netrw_ignorenetrc= 0
  63. endif
  64. put ='+ ---------------------------------------------'
  65. put ='+ NetrwSettings: by Charles E. Campbell'
  66. put ='+ Press <F1> with cursor atop any line for help'
  67. put ='+ ---------------------------------------------'
  68. let s:netrw_settings_stop= line(".")
  69. put =''
  70. put ='+ Netrw Protocol Commands'
  71. put = 'let g:netrw_dav_cmd = '.g:netrw_dav_cmd
  72. put = 'let g:netrw_fetch_cmd = '.g:netrw_fetch_cmd
  73. put = 'let g:netrw_ftp_cmd = '.g:netrw_ftp_cmd
  74. put = 'let g:netrw_http_cmd = '.g:netrw_http_cmd
  75. put = 'let g:netrw_rcp_cmd = '.g:netrw_rcp_cmd
  76. put = 'let g:netrw_rsync_cmd = '.g:netrw_rsync_cmd
  77. put = 'let g:netrw_scp_cmd = '.g:netrw_scp_cmd
  78. put = 'let g:netrw_sftp_cmd = '.g:netrw_sftp_cmd
  79. put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd
  80. let s:netrw_protocol_stop= line(".")
  81. put = ''
  82. put ='+Netrw Transfer Control'
  83. put = 'let g:netrw_cygwin = '.g:netrw_cygwin
  84. put = 'let g:netrw_ftp = '.g:netrw_ftp
  85. put = 'let g:netrw_ftpmode = '.g:netrw_ftpmode
  86. put = 'let g:netrw_ignorenetrc = '.g:netrw_ignorenetrc
  87. put = 'let g:netrw_sshport = '.g:netrw_sshport
  88. put = 'let g:netrw_silent = '.g:netrw_silent
  89. put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp
  90. let s:netrw_xfer_stop= line(".")
  91. put =''
  92. put ='+ Netrw Messages'
  93. put ='let g:netrw_use_errorwindow = '.g:netrw_use_errorwindow
  94. put = ''
  95. put ='+ Netrw Browser Control'
  96. if exists("g:netrw_altfile")
  97. put = 'let g:netrw_altfile = '.g:netrw_altfile
  98. else
  99. put = 'let g:netrw_altfile = 0'
  100. endif
  101. put = 'let g:netrw_alto = '.g:netrw_alto
  102. put = 'let g:netrw_altv = '.g:netrw_altv
  103. put = 'let g:netrw_banner = '.g:netrw_banner
  104. if exists("g:netrw_bannerbackslash")
  105. put = 'let g:netrw_bannerbackslash = '.g:netrw_bannerbackslash
  106. else
  107. put = '\" let g:netrw_bannerbackslash = (not defined)'
  108. endif
  109. put = 'let g:netrw_browse_split = '.g:netrw_browse_split
  110. if exists("g:netrw_browsex_viewer")
  111. put = 'let g:netrw_browsex_viewer = '.g:netrw_browsex_viewer
  112. else
  113. put = '\" let g:netrw_browsex_viewer = (not defined)'
  114. endif
  115. put = 'let g:netrw_compress = '.g:netrw_compress
  116. if exists("g:Netrw_corehandler")
  117. put = 'let g:Netrw_corehandler = '.g:Netrw_corehandler
  118. else
  119. put = '\" let g:Netrw_corehandler = (not defined)'
  120. endif
  121. put = 'let g:netrw_ctags = '.g:netrw_ctags
  122. put = 'let g:netrw_cursor = '.g:netrw_cursor
  123. let decompressline= line("$")
  124. put = 'let g:netrw_decompress = '.string(g:netrw_decompress)
  125. if exists("g:netrw_dynamic_maxfilenamelen")
  126. put = 'let g:netrw_dynamic_maxfilenamelen='.g:netrw_dynamic_maxfilenamelen
  127. else
  128. put = '\" let g:netrw_dynamic_maxfilenamelen= (not defined)'
  129. endif
  130. put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax
  131. put = 'let g:netrw_errorlvl = '.g:netrw_errorlvl
  132. put = 'let g:netrw_fastbrowse = '.g:netrw_fastbrowse
  133. let fnameescline= line("$")
  134. put = 'let g:netrw_fname_escape = '.string(g:netrw_fname_escape)
  135. put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject
  136. put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd
  137. put = 'let g:netrw_ftp_sizelist_cmd = '.g:netrw_ftp_sizelist_cmd
  138. put = 'let g:netrw_ftp_timelist_cmd = '.g:netrw_ftp_timelist_cmd
  139. let globescline= line("$")
  140. put = 'let g:netrw_glob_escape = '.string(g:netrw_glob_escape)
  141. put = 'let g:netrw_hide = '.g:netrw_hide
  142. if exists("g:netrw_home")
  143. put = 'let g:netrw_home = '.g:netrw_home
  144. else
  145. put = '\" let g:netrw_home = (not defined)'
  146. endif
  147. put = 'let g:netrw_keepdir = '.g:netrw_keepdir
  148. put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd
  149. put = 'let g:netrw_list_hide = '.g:netrw_list_hide
  150. put = 'let g:netrw_liststyle = '.g:netrw_liststyle
  151. put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd
  152. put = 'let g:netrw_localcopycmdopt = '.g:netrw_localcopycmdopt
  153. put = 'let g:netrw_localmkdir = '.g:netrw_localmkdir
  154. put = 'let g:netrw_localmkdiropt = '.g:netrw_localmkdiropt
  155. put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd
  156. put = 'let g:netrw_localmovecmdopt = '.g:netrw_localmovecmdopt
  157. put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen
  158. put = 'let g:netrw_menu = '.g:netrw_menu
  159. put = 'let g:netrw_mousemaps = '.g:netrw_mousemaps
  160. put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd
  161. if exists("g:netrw_nobeval")
  162. put = 'let g:netrw_nobeval = '.g:netrw_nobeval
  163. else
  164. put = '\" let g:netrw_nobeval = (not defined)'
  165. endif
  166. put = 'let g:netrw_remote_mkdir = '.g:netrw_remote_mkdir
  167. put = 'let g:netrw_preview = '.g:netrw_preview
  168. put = 'let g:netrw_rename_cmd = '.g:netrw_rename_cmd
  169. put = 'let g:netrw_retmap = '.g:netrw_retmap
  170. put = 'let g:netrw_rm_cmd = '.g:netrw_rm_cmd
  171. put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd
  172. put = 'let g:netrw_rmf_cmd = '.g:netrw_rmf_cmd
  173. put = 'let g:netrw_sort_by = '.g:netrw_sort_by
  174. put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction
  175. put = 'let g:netrw_sort_options = '.g:netrw_sort_options
  176. put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence
  177. put = 'let g:netrw_servername = '.g:netrw_servername
  178. put = 'let g:netrw_special_syntax = '.g:netrw_special_syntax
  179. put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject
  180. put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd
  181. put = 'let g:netrw_scpport = '.g:netrw_scpport
  182. put = 'let g:netrw_sepchr = '.g:netrw_sepchr
  183. put = 'let g:netrw_sshport = '.g:netrw_sshport
  184. put = 'let g:netrw_timefmt = '.g:netrw_timefmt
  185. let tmpfileescline= line("$")
  186. put ='let g:netrw_tmpfile_escape...'
  187. put = 'let g:netrw_use_noswf = '.g:netrw_use_noswf
  188. put = 'let g:netrw_xstrlen = '.g:netrw_xstrlen
  189. put = 'let g:netrw_winsize = '.g:netrw_winsize
  190. put =''
  191. put ='+ For help, place cursor on line and press <F1>'
  192. 1d
  193. silent %s/^+/"/e
  194. res 99
  195. silent %s/= \([^0-9].*\)$/= '\1'/e
  196. silent %s/= $/= ''/e
  197. 1
  198. call setline(decompressline,"let g:netrw_decompress = ".substitute(string(g:netrw_decompress),"^'\\(.*\\)'$",'\1',''))
  199. call setline(fnameescline, "let g:netrw_fname_escape = '".escape(g:netrw_fname_escape,"'")."'")
  200. call setline(globescline, "let g:netrw_glob_escape = '".escape(g:netrw_glob_escape,"'")."'")
  201. call setline(tmpfileescline,"let g:netrw_tmpfile_escape = '".escape(g:netrw_tmpfile_escape,"'")."'")
  202. set nomod
  203. nmap <buffer> <silent> <F1> :call NetrwSettingHelp()<cr>
  204. nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call NetrwSettingHelp()<cr>
  205. let tmpfile= tempname()
  206. exe 'au BufWriteCmd Netrw\ Settings silent w! '.tmpfile.'|so '.tmpfile.'|call delete("'.tmpfile.'")|set nomod'
  207. endfun
  208. " ---------------------------------------------------------------------
  209. " NetrwSettingHelp: {{{2
  210. fun! NetrwSettingHelp()
  211. " call Dfunc("NetrwSettingHelp()")
  212. let curline = getline(".")
  213. if curline =~ '='
  214. let varhelp = substitute(curline,'^\s*let ','','e')
  215. let varhelp = substitute(varhelp,'\s*=.*$','','e')
  216. " call Decho("trying help ".varhelp)
  217. try
  218. exe "he ".varhelp
  219. catch /^Vim\%((\a\+)\)\=:E149/
  220. echo "***sorry*** no help available for <".varhelp.">"
  221. endtry
  222. elseif line(".") < s:netrw_settings_stop
  223. he netrw-settings
  224. elseif line(".") < s:netrw_protocol_stop
  225. he netrw-externapp
  226. elseif line(".") < s:netrw_xfer_stop
  227. he netrw-variables
  228. else
  229. he netrw-browse-var
  230. endif
  231. " call Dret("NetrwSettingHelp")
  232. endfun
  233. " ---------------------------------------------------------------------
  234. " Modelines: {{{1
  235. " vim:ts=8 fdm=marker