netrwSettings.vim 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. " netrwSettings.vim: makes netrw settings simpler
  2. " Date: Aug 12, 2021
  3. " Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
  4. " Version: 17 ASTRO-ONLY
  5. " Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1
  6. " Permission is hereby granted to use and distribute this code,
  7. " with or without modifications, provided that this copyright
  8. " notice is copied with it. Like anything else that's free,
  9. " netrwSettings.vim is provided *as is* and comes with no
  10. " warranty of any kind, either expressed or implied. By using
  11. " this plugin, you agree that in no event will the copyright
  12. " holder be liable for any damages resulting from the use
  13. " of this software.
  14. "
  15. " Mat 4:23 (WEB) Jesus went about in all Galilee, teaching in their {{{1
  16. " synagogues, preaching the gospel of the kingdom, and healing
  17. " every disease and every sickness among the people.
  18. " Load Once: {{{1
  19. if exists("g:loaded_netrwSettings") || &cp
  20. finish
  21. endif
  22. let g:loaded_netrwSettings = "v17"
  23. if v:version < 700
  24. echohl WarningMsg
  25. echo "***warning*** this version of netrwSettings needs vim 7.0"
  26. echohl Normal
  27. finish
  28. endif
  29. " ---------------------------------------------------------------------
  30. " NetrwSettings: {{{1
  31. fun! netrwSettings#NetrwSettings()
  32. " this call is here largely just to insure that netrw has been loaded
  33. call netrw#WinPath("")
  34. if !exists("g:loaded_netrw")
  35. echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None
  36. return
  37. endif
  38. above wincmd s
  39. enew
  40. setlocal noswapfile bh=wipe
  41. set ft=vim
  42. file Netrw\ Settings
  43. " these variables have the following default effects when they don't
  44. " exist (ie. have not been set by the user in his/her .vimrc)
  45. if !exists("g:netrw_liststyle")
  46. let g:netrw_liststyle= 0
  47. let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
  48. endif
  49. if !exists("g:netrw_silent")
  50. let g:netrw_silent= 0
  51. endif
  52. if !exists("g:netrw_use_nt_rcp")
  53. let g:netrw_use_nt_rcp= 0
  54. endif
  55. if !exists("g:netrw_ftp")
  56. let g:netrw_ftp= 0
  57. endif
  58. if !exists("g:netrw_ignorenetrc")
  59. let g:netrw_ignorenetrc= 0
  60. endif
  61. put ='+ ---------------------------------------------'
  62. put ='+ NetrwSettings: by Charles E. Campbell'
  63. put ='+ Press <F1> with cursor atop any line for help'
  64. put ='+ ---------------------------------------------'
  65. let s:netrw_settings_stop= line(".")
  66. put =''
  67. put ='+ Netrw Protocol Commands'
  68. put = 'let g:netrw_dav_cmd = '.g:netrw_dav_cmd
  69. put = 'let g:netrw_fetch_cmd = '.g:netrw_fetch_cmd
  70. put = 'let g:netrw_ftp_cmd = '.g:netrw_ftp_cmd
  71. put = 'let g:netrw_http_cmd = '.g:netrw_http_cmd
  72. put = 'let g:netrw_rcp_cmd = '.g:netrw_rcp_cmd
  73. put = 'let g:netrw_rsync_cmd = '.g:netrw_rsync_cmd
  74. put = 'let g:netrw_scp_cmd = '.g:netrw_scp_cmd
  75. put = 'let g:netrw_sftp_cmd = '.g:netrw_sftp_cmd
  76. put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd
  77. let s:netrw_protocol_stop= line(".")
  78. put = ''
  79. put ='+Netrw Transfer Control'
  80. put = 'let g:netrw_cygwin = '.g:netrw_cygwin
  81. put = 'let g:netrw_ftp = '.g:netrw_ftp
  82. put = 'let g:netrw_ftpmode = '.g:netrw_ftpmode
  83. put = 'let g:netrw_ignorenetrc = '.g:netrw_ignorenetrc
  84. put = 'let g:netrw_sshport = '.g:netrw_sshport
  85. put = 'let g:netrw_silent = '.g:netrw_silent
  86. put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp
  87. put = 'let g:netrw_win95ftp = '.g:netrw_win95ftp
  88. let s:netrw_xfer_stop= line(".")
  89. put =''
  90. put ='+ Netrw Messages'
  91. put ='let g:netrw_use_errorwindow = '.g:netrw_use_errorwindow
  92. put = ''
  93. put ='+ Netrw Browser Control'
  94. if exists("g:netrw_altfile")
  95. put = 'let g:netrw_altfile = '.g:netrw_altfile
  96. else
  97. put = 'let g:netrw_altfile = 0'
  98. endif
  99. put = 'let g:netrw_alto = '.g:netrw_alto
  100. put = 'let g:netrw_altv = '.g:netrw_altv
  101. put = 'let g:netrw_banner = '.g:netrw_banner
  102. if exists("g:netrw_bannerbackslash")
  103. put = 'let g:netrw_bannerbackslash = '.g:netrw_bannerbackslash
  104. else
  105. put = '\" let g:netrw_bannerbackslash = (not defined)'
  106. endif
  107. put = 'let g:netrw_browse_split = '.g:netrw_browse_split
  108. if exists("g:netrw_browsex_viewer")
  109. put = 'let g:netrw_browsex_viewer = '.g:netrw_browsex_viewer
  110. else
  111. put = '\" let g:netrw_browsex_viewer = (not defined)'
  112. endif
  113. put = 'let g:netrw_compress = '.g:netrw_compress
  114. if exists("g:Netrw_corehandler")
  115. put = 'let g:Netrw_corehandler = '.g:Netrw_corehandler
  116. else
  117. put = '\" let g:Netrw_corehandler = (not defined)'
  118. endif
  119. put = 'let g:netrw_ctags = '.g:netrw_ctags
  120. put = 'let g:netrw_cursor = '.g:netrw_cursor
  121. let decompressline= line("$")
  122. put = 'let g:netrw_decompress = '.string(g:netrw_decompress)
  123. if exists("g:netrw_dynamic_maxfilenamelen")
  124. put = 'let g:netrw_dynamic_maxfilenamelen='.g:netrw_dynamic_maxfilenamelen
  125. else
  126. put = '\" let g:netrw_dynamic_maxfilenamelen= (not defined)'
  127. endif
  128. put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax
  129. put = 'let g:netrw_errorlvl = '.g:netrw_errorlvl
  130. put = 'let g:netrw_fastbrowse = '.g:netrw_fastbrowse
  131. let fnameescline= line("$")
  132. put = 'let g:netrw_fname_escape = '.string(g:netrw_fname_escape)
  133. put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject
  134. put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd
  135. put = 'let g:netrw_ftp_sizelist_cmd = '.g:netrw_ftp_sizelist_cmd
  136. put = 'let g:netrw_ftp_timelist_cmd = '.g:netrw_ftp_timelist_cmd
  137. let globescline= line("$")
  138. put = 'let g:netrw_glob_escape = '.string(g:netrw_glob_escape)
  139. put = 'let g:netrw_hide = '.g:netrw_hide
  140. if exists("g:netrw_home")
  141. put = 'let g:netrw_home = '.g:netrw_home
  142. else
  143. put = '\" let g:netrw_home = (not defined)'
  144. endif
  145. put = 'let g:netrw_keepdir = '.g:netrw_keepdir
  146. put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd
  147. put = 'let g:netrw_list_hide = '.g:netrw_list_hide
  148. put = 'let g:netrw_liststyle = '.g:netrw_liststyle
  149. put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd
  150. put = 'let g:netrw_localcopycmdopt = '.g:netrw_localcopycmdopt
  151. put = 'let g:netrw_localmkdir = '.g:netrw_localmkdir
  152. put = 'let g:netrw_localmkdiropt = '.g:netrw_localmkdiropt
  153. put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd
  154. put = 'let g:netrw_localmovecmdopt = '.g:netrw_localmovecmdopt
  155. put = 'let g:netrw_localrmdir = '.g:netrw_localrmdir
  156. put = 'let g:netrw_localrmdiropt = '.g:netrw_localrmdiropt
  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