1
- *pi_netrw.txt* For Vim version 9.1. Last change: 2024 Oct 27
1
+ *pi_netrw.txt* For Vim version 9.1. Last change: 2024 Nov 01
2
2
3
3
------------------------------------------------
4
4
NETRW REFERENCE MANUAL by Charles E. Campbell
@@ -54,9 +54,10 @@ Copyright: Copyright (C) 2017 Charles E Campbell *netrw-copyright*
54
54
Browsing With A Horizontally Split Window...........| netrw-o |
55
55
Browsing With A New Tab.............................| netrw-t |
56
56
Browsing With A Vertically Split Window.............| netrw-v |
57
- Change File Permission..............................| netrw-gp |
58
- Change Listing Style.(thin wide long tree)..........| netrw-i |
57
+ Change Listing Style (thin wide long tree)..........| netrw-i |
59
58
Changing To A Bookmarked Directory..................| netrw-gb |
59
+ Quick hide/unhide of dot-files......................| netrw-gh |
60
+ Changing local-only File Permission.................| netrw-gp |
60
61
Changing To A Predecessor Directory.................| netrw-u |
61
62
Changing To A Successor Directory...................| netrw-U |
62
63
Customizing Browsing With A Special Handler.........| netrw-x |
@@ -1469,7 +1470,6 @@ With either form of the command, netrw will first ask for confirmation
1469
1470
that the removal is in fact what you want to do. If netrw doesn't have
1470
1471
permission to remove a file, it will issue an error message.
1471
1472
1472
- *netrw-gx* *Open* *Launch*
1473
1473
CUSTOMIZING BROWSING WITH A SPECIAL HANDLER *netrw-x* *netrw-handler* {{{2
1474
1474
1475
1475
Certain files, such as html, gif, jpeg, (word/office) doc, etc, files, are
@@ -1479,7 +1479,7 @@ operating system). Netrw allows one to invoke such special handlers by:
1479
1479
* hitting gx with the cursor atop the file path or alternatively x
1480
1480
in a netrw buffer; the former can be disabled by defining the
1481
1481
| g:netrw_nogx | variable
1482
- * when in command line, typing :Open <path>
1482
+ * when in command line, typing :Open <path> , see | :Open | below.
1483
1483
1484
1484
One may also use visual mode (see | visual-start | ) to select the text that the
1485
1485
special handler will use. Normally gx checks for a close-by URL or file name
@@ -1490,47 +1490,54 @@ select the text to be used by gx by making a visual selection (see
1490
1490
| visual-block | ) and then pressing gx.
1491
1491
1492
1492
The selection function can be adapted for each filetype by adding a function
1493
- Netrw_get_URL_<filetype> , where <filetype> is given by & filetype.
1493
+ ` Netrw_get_URL_<filetype> ` , where <filetype> is given by the ' filetype' .
1494
1494
The function should return the URL or file name to be used by gx, and will
1495
1495
fall back to the default behavior if it returns an empty string.
1496
1496
For example, special handlers for links Markdown and HTML are
1497
- >
1498
- " make gx work on concealed links regardless of exact cursor position
1499
- function Netrw_get_URL_markdown()
1500
- " markdown URL such as [link text](http://ya.ru 'yandex search')
1501
- try
1502
- let save_view = winsaveview()
1503
- if searchpair('\[.\{-} \](', '', ')\zs', 'cbW', '', line('.')) > 0
1504
- return matchstr(getline('.')[col('.')-1:], '\[.\{-} \](\zs' .. g:netrw_regex_url .. '\ze\(\s\+.\{-} \)\?)')
1505
- endif
1506
- finally
1507
- call winrestview(save_view)
1508
- return ''
1509
- endtry
1510
- endfunction
1511
-
1512
- function Netrw_get_URL_html()
1513
- " HTML URL such as <a href='http://www.python.org '>Python is here</a>
1514
- " <a href="http://www.python.org "/>
1515
- try
1516
- let save_view = winsaveview()
1517
- if searchpair('<a\s\+href=', '', '\%(</a>\|/>\)\zs', 'cbW', '', line('.')) > 0
1518
- return matchstr(getline('.')[col('.') - 1 : ],
1519
- \ 'href=["'.."'"..']\?\zs\S\{-} \ze["'.."'"..']\?/\?>')
1520
- endif
1521
- finally
1522
- call winrestview(save_view)
1523
- return ''
1524
- endtry
1525
- endfunction
1526
- <
1527
1497
1498
+ " make gx work on concealed links regardless of exact cursor position: >
1499
+
1500
+ function Netrw_get_URL_markdown()
1501
+ " markdown URL such as [link text](http://ya.ru 'yandex search')
1502
+ try
1503
+ let save_view = winsaveview()
1504
+ if searchpair('\[.\{-}\](', '', ')\zs', 'cbW', '', line('.')) > 0
1505
+ return matchstr(getline('.')[col('.')-1:],
1506
+ \ '\[.\{-}\](\zs' .. g:netrw_regex_url .. '\ze\(\s\+.\{-}\)\?)')
1507
+ endif
1508
+ finally
1509
+ call winrestview(save_view)
1510
+ return ''
1511
+ endtry
1512
+ endfunction
1513
+
1514
+ function Netrw_get_URL_html()
1515
+ " HTML URL such as <a href='http://www.python.org'>Python is here</a>
1516
+ " <a href="http://www.python.org"/>
1517
+ try
1518
+ let save_view = winsaveview()
1519
+ if searchpair('<a\s\+href=', '', '\%(</a>\|/>\)\zs', 'cbW', '', line('.')) > 0
1520
+ return matchstr(getline('.')[col('.') - 1 : ],
1521
+ \ 'href=["'.."'"..']\?\zs\S\{-}\ze["'.."'"..']\?/\?>')
1522
+ endif
1523
+ finally
1524
+ call winrestview(save_view)
1525
+ return ''
1526
+ endtry
1527
+ endfunction
1528
+ <
1528
1529
Other than a file path, the text under the cursor may be a URL. Netrw uses
1529
1530
by default the following regular expression to determine if the text under the
1530
1531
cursor is a URL:
1531
1532
>
1532
- g:netrw_regex_url = '\%(\%(http\|ftp\|irc\)s\?\|file\)://\S\{-}'
1533
+ :let g:netrw_regex_url = '\%(\%(http\|ftp\|irc\)s\?\|file\)://\S\{-}'
1533
1534
<
1535
+ Associated setting variables:
1536
+ | g:netrw_gx | control how gx picks up the text under the cursor
1537
+ | g:netrw_nogx | prevent gx map while editing
1538
+ | g:netrw_suppress_gx_mesg | controls gx's suppression of browser messages
1539
+
1540
+ OPENING FILES AND LAUNCHING APPS *netrw-gx* *:Open* *:Launch* {{{2
1534
1541
1535
1542
Netrw determines which special handler by the following method:
1536
1543
@@ -1544,24 +1551,25 @@ Netrw determines which special handler by the following method:
1544
1551
* for Mac OS X : open is used.
1545
1552
* for Linux : xdg-open is used.
1546
1553
1547
- To open a file <filepath> by the appropriate handler, type
1548
-
1549
- :Open <filepath>
1554
+ To open a path (or URL) <path> by the appropriate handler, type >
1550
1555
1551
- No escaping, neither for the shell, nor for Vim's command-line is needed.
1556
+ :Open <path>
1557
+ <
1558
+ No escaping, neither for the shell nor for Vim's command-line, is needed.
1552
1559
1553
- To launch a specific application <app> <args> , often <args> being <filepath> ,
1560
+ To launch a specific application <app> <args> , often <args> being <path> >
1554
1561
1555
- :Launch <app> <args> .
1562
+ :Launch <app> <args>.
1556
1563
1557
1564
Since <args> can be arbitrarily complex, in particular contain many file
1558
1565
paths, the escaping is left to the user.
1559
1566
1560
- Associated setting variables:
1561
- | g:netrw_gx | control how gx picks up the text under the cursor
1562
- | g:netrw_nogx | prevent gx map while editing
1563
- | g:netrw_suppress_gx_mesg | controls gx's suppression of browser messages
1567
+ If you disabled the netrw plugin by setting g:loaded_netrwPlugin (see
1568
+ | netrw-noload | ), then you can use >
1564
1569
1570
+ :call netrw#Launch('<app> <args>')
1571
+ :call netrw#Open('<path>')
1572
+ <
1565
1573
*netrw-curdir*
1566
1574
DELETING BOOKMARKS *netrw-mB* {{{2
1567
1575
0 commit comments