w3m MANUAL

Akinori Ito
aito@ei5sun.yz.yamagata-u.ac.jp

Index

  • Introduction
  • Options
  • Document color
  • Key binding
  • Lynx-like key binding
  • Mouse operation
  • Key customization
  • Local CGI

  • Introduction

    w3m is a pager/text-based WWW browser. You can browse local documents and/or documents on the WWW using a terminal emulator.

    Options

    Command line usage is

        w3m [options] [file|URL]
    

    If you specify filenames/URLs on command line, these documents are displayed. If you specify nothing, w3m reads a document from standard input and display it. If no filename and/or URLs are specified and standard input is tty, w3m terminates without displaying anything.

    Options are as follows:

    +<line number>
    Move to the specified line.
    -t width
    Specify tab width. Default is 8.
    -r
    When displaying text/plain document, prohibit emphasis using backspace. If you don't specify this option, ``A^H_'' is interpreted as underlined character and ``A^HA'' as a bold character.
    -S
    When displaying text/plain document, squeeze blank lines.
    -l number
    Specify line number preserved internally when reading text/plain document fron standard input. Default is 10000.
    -s
    Display documents with Shift_JIS code.
    -e
    Display documents with EUC_JP code.
    -j
    Display documents with ISO-2022-JP code.
    -T type
    Specify document type. Without this option, document type is determined from extension of a file. If the determination fails, the document is regarded as text/plain.

    Example:
    Read HTML document from standard input and display it

       cat hoge.html | w3m -T text/html
    

    Display HTML source

       w3m -T text/plain hoge.html
    
    -m
    Display document with Internet message mode. With this option, w3m determines document type from header infomation. It is useful when reading E-mail or NetNews messages.
    -B
    Show the bookmark.
    -bookmark file
    Specify bookmark file.
    -M
    Monochrome display mode.
    -F
    Automatically render frame.
    -S
    Sqeeze blank lines.
    -X
    Upon exit, do not display preserved screen.
    -W
    Toggle wrap search mode.
    -o option=value
    Specify option. The option names and values are same as that appears in ~/.w3m/config.
    -cookie
    Process cookies.
    -no-cookie
    Don't process cookies.
    -pauth username:password
    Set username and password for (basic) proxy authentication.
    -num
    Show linenumber.
    -dump
    Read document specified by URL and dump formatted text into standard output. The width of the document become 80. This width can be overridden with -cols option.
    -cols width
    Specify document width. Used with -dump option.
    -ppc count
    Specify the number of pixels per character (default 8.0). Larger values will make tables narrower.
    -dump_source
    Read document specified by URL and dump the source.
    -dump_head
    Read document specified by URL and dump headers.
    -no-proxy
    Don't use proxy server.
    -no-graph
    Don't use graphic character to draw frames.
    -no-mouse
    Don't activate mouse.

    Document color

    Links and images are displayed as follows.
     Color modeMonochrome mode
    linksblueunderline
    inline imagesgreenreverse
    form inputredreverse
    These colors can be customized using option setting command "o".

    Key binding

    After invocation, you can operate w3m by one-character commands from the keyboard.

    Here's the original key-binding table. If you are using Lynx-like key bindings, see the Lynx-like key binding.

    Page/Cursor motion

    SPC,C-vForward page
    b,ESC vBackward page
    l,C-fCursor right
    h,C-bCursor left
    j,C-nCursor down
    k,C-pCursor up
    JRoll up one line
    KRoll down one line
    wGo to next word
    WGo to previous word
    >Shift screen right
    <Shift screen left
    .Shift screen one column right
    ,Shift screen one column left
    gGo to the first line
    GGo to the last line
    ESC gGo to specified line
    TABMove to next hyperlink
    ESC TABMove to previous hyperlink
    [Move to the first hyperlink
    ]Move to the last hyperlink

    Hyperlink operation

    RETFollow hyperlink
    a, ESC RETSave link to file
    uPeek link URL
    IView inline image
    ESC ISave inline image to file
    :Mark URL-like strings as anchors
    ESC :Mark Message-ID-like strings as news anchors
    cPeek current URL
    =Display infomation about current document
    FRender frame
    MBrowse current document using external browser (use 2M and 3M to invoke second and third browser)
    ESC MBrowse link using external browser (use 2ESC M and 3ESC M to invoke second and third browser)

    File/Stream operation

    UOpen URL
    VView new file
    @Execute shell command and load
    #Execute shell command and browse

    Buffer operation

    BBack to the previous buffer
    vView HTML source
    sSelect buffer
    EEdit buffer source
    RReload buffer
    SSave buffer
    ESC sSave source
    ESC eEdit buffer image

    Buffer selection mode

    k, C-pSelect previous buffer
    j, C-nSelect next buffer
    DDelect current buffer
    RETGo to the selected buffer

    Bookmark operation

    ESC bLoad bookmark
    ESC aAdd current to bookmark

    Search

    /,C-sSearch forward
    ?,C-rSearch backward
    nSearch next
    NSearch previous

    Mark operation

    C-SPCSet/unset mark
    ESC pGo to previous mark
    ESC nGo to next mark
    "Mark by regular expression

    Miscellany

    !Execute shell command
    HHelp (load this file)
    oSet option
    C-cStop
    C-zSuspend
    qQuit (with confirmation, if you like)
    QQuit without confirmation

    Line-edit mode

    C-fMove cursor forward
    C-bMove cursor backward
    C-hDelete previous character
    C-dDelete current character
    C-kKill everything after cursor
    C-uKill everything before cursor
    C-aMove to the top of line
    C-eMove to the bottom of line
    C-pFetch the previous string from the history list
    C-nFetch the next string from the history list
    TAB,SPCComplete filename
    RETURNAccept

    Lynx-like key binding

    If you have chosen `Lynx-like key binding' at the compile time, you can use the following key binding.

    Page/Cursor motion

    SPC,C-vForward page
    b,ESC vPrevious page
    lCursor right
    hCursor left
    jCursor down
    kCursor up
    JRoll up one line
    KRoll down one line
    >Shift screen right
    <Shift screen left
    .Shift screen one column right
    ,Shift screen one column left
    GGo to the specified line
    TAB,C-n,Down arrowMove to next hyperlink
    ESC TAB,C-p,Up arrowMove to previous link

    Hyperlink operation

    RET, C-f, Right arrowFollow hyperlink
    d, ESC RETSave link to file
    uPeek link URL
    IView inline image
    ESC ISave inline image to file
    :Mark URL-like strings as anchors
    ESC :Mark Message-ID-like strings as news anchors
    cPeek current URL
    =Display infomation about current document
    FRender frame
    MBrowse current document using external browser (use 2M and 3M to invoke second and third browser)
    ESC MBrowse link using external browser (use 2ESC M and 3ESC M to invoke second and third browser)

    File/Stream operation

    g,UOpen URL
    VView new file
    @Execute shell command and load
    #Execute shell command and browse

    Buffer operation

    B, C-b, Left arrowBack to the previous buffer
    \View HTML source
    s, C-hSelect buffer
    EEdit buffer source
    R, C-rReload buffer
    S, pSave buffer
    ESC sSave source
    ESC eEdit buffer image

    Buffer selection mode

    k, C-pSelect previous buffer
    j, C-nSelect next buffer
    DDelect current buffer
    RETGo to the selected buffer

    Bookmark operation

    v, ESC bLoad bookmark
    a, ESC aAdd current to bookmark

    Search

    /Search forward
    ?Search backward
    nSearch next

    Mark operation

    C-SPCSet/unset mark
    ESC pGo to previous mark
    ESC nGo to next mark
    "Mark by regular expression

    Miscellany

    !Execute shell command
    HHelp (load this file)
    oSet option
    C-cStop
    C-zSuspend
    qQuit (with confirmation, if you like)
    QQuit without confirmation

    Line-edit mode

    C-fMove cursor forward
    C-bMove cursor backward
    C-hDelete previous character
    C-dDelete current character
    C-kKill everything after cursor
    C-uKill everything before cursor
    C-aMove to the top of line
    C-eMove to the bottom of line
    C-pFetch the previous string from the history list
    C-nFetch the next string from the history list
    TAB,SPCComplete filename
    RETURNAccept

    Mouse operation

    If w3m is compiled with mouse option and you are using xterm/kterm/rxvt (in this case, you have to set the TERM environment variable to `xterm' or `kterm'.) or GPM environment, you can use mouse for the navigation.

    left click Move the cursor to the place pointed by the mouse cursor. If you click the cursor and it is on an anchor, follow the anchor.
    middle click Back to the previous buffer.
    right click Open pop-up menu. You can choose an item by clicking it.
    left drag Scroll document. The default behavior is to grab the document and drag it. You can reverse the behavior (grab the window and drag it) with the option setting panel.


    Key customization

    You can customize the key binding (except line-editing keymap) by describing ~/.w3m/keymap. For example,
    
       keymap C-o NEXT_PAGE
    
    
    binds `NEXT_PAGE' function (normally bound to SPC and C-v) to control-o. See README.func for list of available functions. Original and Lynx-like keymap definitions are provided (keymap.default and keymap.lynx) as examples.

    Local CGI

    You can run CGI scripts using w3m, without any HTTP server. It means that w3m behaves like an HTTP server and activates CGI script, then w3m reads the output of the script and display it. The bookmark registration and helper-app editor are realized as local CGI scripts. Using local CGI, w3m can be used as a general purpose form interface.

    For security reason, CGI scripts invoked by w3m must be in one of these directories.

    The CGI script can use special header `w3m-control:' to control w3m. This field can take any function (see README.func), and the specified function is invoked after the document is displayed. For example, The CGI output

    
    Content-Type: text/plain
    W3m-control: BACK
    
    
    will display blank page and delete that buffer immediately. This is useful when you don't want to display any page after the script is invoked. The next example
    
    Content-Type: text/plain
    W3m-control: DELETE_PREVBUF
    
    contents.....
    
    will override the current buffer.

    One w3m-control: header have to contain only one function, but you can include more than one w3m-control: lines in the HTTP header. In addition, you can specify an argument to GOTO function:

    
    Content-Type: text/plain
    W3m-control: GOTO http://www.yahoo.com/
    
    
    This example works exactly the same way to the Location header:
    
    Content-Type: text/plain
    Location: http://www.yahoo.com/
    
    
    Note that this header has no effect when the CGI script is invoked through HTTP server.