.\" Process this file with
.\" groff -man -Tascii vimb.1
.TH vimb 1 "DATE" "vimb/VERSION" "Vimb Manual"
-
.SH NAME
vimb - Vim Browser - A modal web browser based on webkit thats inspired by
vim the great editor.
-
.SH SYNOPSIS
.BI "vimb [" "OPTION" "] [" "URI" "]"
-
.SH DESCRIPTION
vimb is a webkit based web browser that behaves like the vimperator
plugin for the firefox and usage paradigms from the great editor vim. The goal
of vimb is to build a completely keyboard-driven, efficient and pleasurable
browsing-experience.
-
.SH OPTIONS
Mandatory arguments to long options are mandatory for short options too.
.TP
.TP
.B "\-v, \-\-version"
Print build and version information.
-
.SH MODES
vimb is modal an has following main modes:
.TP
by vimb, all other keystrokes are given to the webview to handle them. This
allows to use websites that uses keybindings itself, that might be swallowed
by vimb else.
-
.SH NORMAL MODE COMMANDS
Some of the Normal Model Commands can have a numeric count to multiply the
effect of the command. If a command supports the count this is shown as
\fB[N]\fP.
-
.SS General
.TP
.B :
.TP
.B CTRL\-Q
Quit the browser.
-
.SS Navigation
.TP
.B o
.TP
.B CTRL\-C
Stop loading the current page.
-
.SS Motion
.TP
.BI [ N ]CTRL\-F
.TP
.BI [ N ]k
Scroll page \fIN\fP steps up.
-
.SS Hinting
The hinting is the way to do what you would do with the mouse in common
mouse-driven browsers. Open url, yank uri, save page and so on. If the hinting
typing part of their text (\fIhint\fP) to narrow down the result. When an
element has been selected, it is automatically clicked or used (depending on
\fImode\fP) and hint mode ends.
-
.RS 0
Following keys have special meanings in Hints mode:
.IP \fB<CR>\fP
.IP "\fB<Esc>, CTRL\-C, CTRL\-[\fP"
Exits Hints mode without selecting an element
.RE
-
.TP
.B f
Is an alias for the \fB;o\fP hint mode.
.TP
.B ;\-y
Yank hint's destination location into primary and secondary clipboard.
-
.SS Searching
.TP
.BI / QUERY ", ?" QUERY
.BI [ N ]N
Search for \fIN\fPnth previous search result depending on current serach
direction.
-
.SS Zooming
.TP
.BI [ N ]z\-i
.TP
.B z\-z
Reset Zoom.
-
.SS Yank
.TP
.B y
.TP
.B Y
Yank the current selection into clipboard.
-
.SH COMMAND MODE
-
.SS Command Line Editing
.TP
.B <Esc>, CTRL\-[, CTRL-C
.TP
.B CTRL\-V
Pass the next key press directly to gtk.
-
.SS Command Line History
.TP
.B <Tab>
.TP
.B <Down>
Step forward in the command history.
-
.SS Open
.TP
-.BI ":o[pen] [" URI "], o [" URI ]
+.BI ":o[pen] [" URI ]
Open the give \fIURI\fP into current window. If \fIURI\fP is empty the
configured 'home-page' is opened.
.TP
-.BI ":t[abopen] [" URI "], t [" URI ]
+.BI ":t[abopen] [" URI ]
Open the give \fIURI\fP into a new window. If \fIURI\fP is empty the
configured 'home-page' is opened.
-
.SS Key Mapping
-
Key mappings allow to alter actions of key presses. Each key mapping is
associated with a mode and only has effect when the mode is active. Following
commands allow the user to substitute one sequence of key presses by another.
Note that the \fIlhs\fP ends with the first found space. If you want to use
space also in the {lhs} you have to escape this with a single `\\' like shown
in the examples.
-
.RS 0
Standard key mapping commands are provided for these modes \fIm\fP:
.IP \fBn\fP
.IP \fBc\fP
Command Line mode: When typing into the vimbs command line.
.RE
-
Most keys in key sequences are represented simply by the character that you
see on the screen when you type them. However, as a number of these characters
have special meanings, and a number of keys have no visual representation, a
As special key names have the format \fI<...>\fP. Following special keys can
be used <Left>, <Up>, <Right>, <Down> for the cursor keys, <Tab>, <Esc>, <CR>,
-<F1>-<F12>, <C-F1>-<C-F12> and <C-A>-<C-Z>.
-
+<F1>-<F12> and <C-A>-<C-Z>.
.TP
.BI ":nm[ap] {" lhs "} {" rhs }
.TP
.BI ":im[ap] {" lhs "} {" rhs }
.TP
.BI ":cm[ap] {" lhs "} {" rhs }
-Map the key-sequence \fIlhs\fP to \fIrhs\fP for the applicable mode.
+Map the key sequence \fIlhs\fP to \fIrhs\fP for the modes where the map
+command applies. The result, including \fIrhs\fP, is then further scanned for
+mappings. This allows for nested and recursive use of mappings.
-.TP
-.BI ":nu[nmap] {" lhs }
-.TP
-.BI ":iu[nmap] {" lhs }
-.TP
-.BI ":cu[nmap] {" lhs }
-Remove the mapping of \fIlhs\fP for the applicable mode.
-
-.RS 0
+.RS
Example:
.IP ":cmap <C-G>h /home/user/downloads/"
Adds a keybind to insert a file path into the input box. This could be useful
.IP ":nmap \\\\\ \\\\\ 50G;o"
Example which mappes two spaces to go to 50% of the page, start hinting mode.
.RE
-
+.TP
+.BI ":nn[oremap] {" lhs "} {" rhs }
+.TP
+.BI ":ino[remap] {" lhs "} {" rhs }
+.TP
+.BI ":cno[remap] {" lhs "} {" rhs }
+Map the key sequence \fIlhs\fP to \fIrhs\fP for the mode where the map command
+applies. Disallow mapping of \fIrhs\fP, to avoid nested and recursive
+mappings. Often used to redefine a command.
+.TP
+.BI ":nu[nmap] {" lhs }
+.TP
+.BI ":iu[nmap] {" lhs }
+.TP
+.BI ":cu[nmap] {" lhs }
+Remove the mapping of \fIlhs\fP for the applicable mode.
.SS Bookmarks
.TP
.BI ":bma [" TAGS ]
.BI ":bmr [" URI ]
Removes all bookmarks for given \fIURI\fP or if not given the current opened
page.
-
.SS Shortcuts
Shortcuts allows to open URL build up from a named template with additional
parameters. If a shortcut named 'dd' is defined, you can use it with `:open dd
.IP ":shortcut-add gh=https://github.com/$0/$1"
to build urls from given parameters. Can be called `:open gh fanglingsu vimb'.
.RE
-
.TP
.BI ":shortcut-remove " "SHORTCUT"
Remove the search engine to the given \fISHORTCUT\fP.
.BI ":shortcut-default " "SHORTCUT"
Set the shortcut for given \fISHORTCUT\fP as the default. It doesn't matter if
the \fISHORTCUT\fP is already in use or not to be able to set it.
-
.SS Settings
.TP
.BI ":se[t] " VAR = VALUE
.TP
.BI ":se[t] " VAR !
Toggle the value of boolean variable \fIVAR\fP and display the new set value.
-
.SS Queue
The queue allows to mark URLs for later reding (something like a read it later
list). This list is shared between the single instances of vimb. Only
.TP
.B :qc[lear]
Removes all entries from queue.
-
.SS Misc
.TP
.BI ":sh[ellcmd] " CMD
.B :ha[rdcopy]
Print current document. Open a GUI dialog where you can select the printer,
number of copies, orientation, etc.
-
.SH INPUT MODE
-
.TP
.B <Esc>, CTRL\-[
Switch back to normal mode.
.TP
.B CTRL\-Z
Enter the pass-through mode.
-
.SH COMPLETIONS
The completions are triggered by pressing `<Tab>` or `<shift-tab>` in the
activated inputbox. Depending of the current inserted content different
.TP
.B boomark tags
The boomark tag completion allows to insert already used bookmars for the
-`:bma ` or `:bookmark-add ` commands.
+`:bma ` commands.
.TP
.B search
The search completion allow to get a filtered list of already done searches.
This completion starts by `/` or `?` in inputbox and performs a prefix
comparison for further typed chars.
-
.SH FILES
.I $XDG_CONFIG_HOME/vimb/config
.RS
.RE
.I $XDG_CONFIG_HOME/vimb/bookmark
.RS
-Holds the bookmarks saved with command `bookmark-add'.
+Holds the bookmarks saved with command `bma'.
.RE
.I $XDG_CONFIG_HOME/vimb/queue
.RS
-Holds the read it later queue filled by `hint-queue-push' or `queue-push' if
+Holds the read it later queue filled by `qpush' if
vimb has been compiled with QUEUE feature.
.RE
.I $XDG_CONFIG_HOME/vimb/scripts.js
File for userdefined css styles. These file is used if the config variable
`stylesheet' is enabled.
.RE
-
.SH ENVIRONMENT
.TP
.B HOME
.B http_proxy
If this variable is set to an none empty value, and the configuration option
`proxy' is enabled, this will be used as http proxy.
-
.SH "REPORTING BUGS"
Report bugs to the main project page on https://github.com/fanglingsu/vimb/issues
.br
or on the mailing list https://lists.sourceforge.net/lists/listinfo/vimb-users.
-
.SH AUTHOR
Daniel Carl
EX_EVAL,
EX_HARDCOPY,
EX_CMAP,
+ EX_CNOREMAP,
EX_IMAP,
EX_NMAP,
+ EX_NNOREMAP,
EX_CUNMAP,
EX_IUNMAP,
+ EX_INOREMAP,
EX_NUNMAP,
EX_NORMAL,
EX_OPEN,
* searching for a matching command if the next compared character did not
* match. */
static ExInfo commands[] = {
- /* command code func flags */
+ /* command code func flags */
{"bma", EX_BMA, ex_bookmark, EX_FLAG_RHS},
{"bmr", EX_BMR, ex_bookmark, EX_FLAG_RHS},
{"cmap", EX_CMAP, ex_map, EX_FLAG_LHS|EX_FLAG_RHS},
+ {"cnoremap", EX_CNOREMAP, ex_map, EX_FLAG_LHS|EX_FLAG_RHS},
{"cunmap", EX_CUNMAP, ex_unmap, EX_FLAG_LHS},
{"hardcopy", EX_HARDCOPY, ex_hardcopy, EX_FLAG_NONE},
{"eval", EX_EVAL, ex_eval, EX_FLAG_RHS},
{"imap", EX_IMAP, ex_map, EX_FLAG_LHS|EX_FLAG_RHS},
+ {"inoremap", EX_INOREMAP, ex_map, EX_FLAG_LHS|EX_FLAG_RHS},
{"iunmap", EX_IUNMAP, ex_unmap, EX_FLAG_LHS},
{"nmap", EX_NMAP, ex_map, EX_FLAG_LHS|EX_FLAG_RHS},
+ {"nnoremap", EX_NNOREMAP, ex_map, EX_FLAG_LHS|EX_FLAG_RHS},
{"normal", EX_NORMAL, ex_normal, EX_FLAG_BANG|EX_FLAG_LHS},
{"nunmap", EX_NUNMAP, ex_unmap, EX_FLAG_LHS},
{"open", EX_OPEN, ex_open, EX_FLAG_RHS},
static gboolean ex_map(const ExArg *arg)
{
- char *lhs, *rhs;
-
if (!arg->lhs->len || !arg->rhs->len) {
return false;
}
- lhs = arg->lhs->str;
- rhs = arg->rhs->str;
+ /* instead of using the EX_XMAP constants we use the first char of the
+ * command name as mode and the second to determine if noremap is used */
+ map_insert(arg->lhs->str, arg->rhs->str, arg->name[0], arg->name[1] != 'n');
- if (arg->code == EX_NMAP) {
- map_insert(lhs, rhs, 'n');
- } else if (arg->code == EX_CMAP) {
- map_insert(lhs, rhs, 'c');
- } else {
- map_insert(lhs, rhs, 'i');
- }
return true;;
}
extern VbCore vb;
typedef struct {
- char *in; /* input keys */
- int inlen; /* length of the input keys */
- char *mapped; /* mapped keys */
- int mappedlen; /* length of the mapped keys string */
- char mode; /* mode for which the map is available */
+ char *in; /* input keys */
+ int inlen; /* length of the input keys */
+ char *mapped; /* mapped keys */
+ int mappedlen; /* length of the mapped keys string */
+ char mode; /* mode for which the map is available */
+ gboolean remap; /* if false do not remap the {rhs} of this map */
} Map;
static struct {
/* copy the mapped string into the queue */
strncpy(map.queue, match->mapped, match->mappedlen);
map.qlen += match->mappedlen - match->inlen;
- if (match->inlen <= match->mappedlen) {
- map.resolved = match->inlen;
- } else {
+
+ /* without remap the mapped chars are resolved now */
+ if (!match->remap) {
map.resolved = match->mappedlen;
+ } else if (match->inlen <= match->mappedlen
+ && !strncmp(match->in, match->mapped, match->inlen)
+ ) {
+ map.resolved = match->inlen;
}
} else {
/* first char is not mapped but resolved */
map_handle_keys((guchar*)keys, len, use_map);
}
-void map_insert(char *in, char *mapped, char mode)
+void map_insert(char *in, char *mapped, char mode, gboolean remap)
{
int inlen, mappedlen;
char *lhs = convert_keys(in, strlen(in), &inlen);
/* if lhs was already mapped, remove this first */
map_delete_by_lhs(lhs, inlen, mode);
- /* TODO replace keysymbols in 'in' and 'mapped' string */
Map *new = g_new(Map, 1);
new->in = lhs;
new->inlen = inlen;
new->mapped = rhs;
new->mappedlen = mappedlen;
new->mode = mode;
+ new->remap = remap;
map.list = g_slist_prepend(map.list, new);
}