Code Monkey home page Code Monkey logo

chromium-vim's Introduction

#What is cVim?

Vim for Google Chrome. I hate using the mouse, especially after learning Vim. With my desktop (Linux), I have a lot of key bindings that make doing things easier: I open Chrome with Alt+w, I close a window with Alt+Shift+d, I open a terminal with Alt+t. This is harder to do with Chrome because it has no section for customizing keyboard shortcuts, and it is still necessary to use the mouse to do things like click links. cVim aims to eliminate this problem as best as the Chrome extensions API will allow it to.

#Where can I get cVim?

  • There are two ways:
  • You can install it through the Chrome web store
  • You can download the .zip file here and enable cVim by going to the chrome://extensions URL and checking developer mode, then pointing Chrome to the unzipped folder via the Load unpacked extensions... button.

Why is this different than Vimium, ViChrome, or Vrome?

These extensions do a wonderful job of adding Vim-like keybindings to Google Chrome, but they lack many of the features that Firefox Addon, Pentadactyl, have.

  • What features does cVim add to Chrome?
  • Google/IMDB/Wikipedia/Amazon/Duckduckgo/Yahoo/Bing search completion
  • Support for custom search engines
  • History and Bookmark search/completion with bookmark folder support
  • Caret/Visual mode
  • Efficient link hints (with support for custom mappings)
  • Support for custom keyboard mappings
  • Regex page search with highlighting
  • Command bar with tab-completion
  • Smooth scrolling

#cVim Help ###cVimrc

  • Boolean cVimrc settings are enabled with the command 'set' + <SETTING_NAME> and disabled with the command 'set' + no<SETTING_NAME> (for example, set regexp and set noregexp)
  • Boolean cVimrc settings can be inversed by adding "!" to the end
  • Other settings are defined with = used as a separator and are prefixed by let (for example, let hintcharacters="abc")
setting type description default
searchlimit integer set the amount of results displayed in the command bar 20
scrollstep integer set the amount of pixels scrolled when using the scrollUp and scrollDown commands 75
timeoutlen integer The amount of time to wait for a <Leader> mapping in milliseconds 1000
fullpagescrollpercent integer set the percent of the page to be scrolled by when using the scrollFullPageUp and scrollFullPageDown commands 85
typelinkhintsdelay integer the amount of time (in milliseconds) to wait before taking input after opening a link hint with typelinkhints and numerichints enabled 500
scrollduration integer the duration of smooth scrolling 20
zoomfactor integer the step size when zooming the page in/out 0.1
hud boolean show the heads-up-display true
regexp boolean use regexp in find mode true
ignorecase boolean ignore search case in find mode true
linkanimations boolean show fade effect when link hints open and close false
numerichints boolean use numbers for link hints instead of a set of characters false
dimhintcharacters boolean dim letter matches in hint characters rather than remove them from the hint true
defaultnewtabpage boolean use the default chrome://newtab page instead of a blank page false
cncpcompletion boolean use and to cycle through completion results (requires you to set the nextCompletionResult keybinding in the chrome://extensions page (bottom right) false
smartcase boolean case-insensitive find mode searches except when input contains a capital letter true
incsearch boolean begin auto-highlighting find mode matches when input length is greater thant two characters true
typelinkhints boolean (numerichints required) type text in the link to narrow down numeric hints false
autohidecursor boolean hide the mouse cursor when scrolling (useful for Linux, which doesn't auto-hide the cursor on keydown) false
autofocus boolean allows websites to automatically focus an input box when they are first loaded true
insertmappings boolean use insert mappings to navigate the cursor in text boxes (see bindings below) true
smoothscroll boolean use smooth scrolling true
autoupdategist boolean if a GitHub Gist is used to sync settings, pull updates every hour (and when Chrome restarts) false
completionengines array of strings use only the specified search engines []
blacklists array of strings disable cVim on the sites matching one of the patterns []
mapleader string The default <Leader> key \
highlight string the highlight color in find mode "#ffff00"
defaultengine string set the default search engine "google"
locale string set the locale of the site being completed/searched on (see example configuration below) ""
activehighlight string the highlight color for the current find match "#ff9632"
homedirectory string the directory to replace ~ when using the file command ""
qmark <alphanumeric charcter> string add a persistent QuickMark (e.g. let qmark a = ["http://google.com", "http://reddit.com"]) none
previousmatchpattern string (regexp) the pattern looked for when navigating a page's back button ((?!last)(prev(ious)?|back|«|less|<|‹| )+)
nextmatchpattern string (regexp) the pattern looked for when navigation a page's next button ((?!first)(next|more|>|›|»|forward| )+)
hintcharacters string (alphanumeric) set the default characters to be used in link hint mode "asdfgqwertzxcvb"
barposition string <br>["top", "bottom"] set the default position of the command bar "top"

###Example configuration

" Settings
set nohud
set nosmoothscroll
set noautofocus "The opposite of autofocus; this setting stops sites from focusing on an input box when they load
set typelinkhints
let searchlimit = 30
let scrollstep = 70
let barposition = "bottom"
let locale = "uk" "Current choices are 'jp' and 'uk'. This allows cVim to use sites like google.co.uk or google.co.jp to search rather than google.com. Support is currently very limited. Let me know if you need a different locale for one of the completion/search engines
let hintcharacters = "abc123"
let searchengine dogpile = "http://www.dogpile.com/search/web?q=%s" "If you leave out the '%s' at the end of the URL, your query will be appended to the link. Otherwise, your query will replace the '%s'.
let completionengines = ["google", "amazon", "imdb", "dogpile"]
let searchalias g = "google" "Create a shortcut for search engines. For example, typing ':tabnew g example' would act the same way as ':tabnew google example'
let qmark a = ["http://www.reddit.com", "http://www.google.com", "http://twitter.com"]  "Open all of these in a tab with `gnb` or open one of these with <N>goa where <N>
let blacklists = ["https://mail.google.com/*", "*://*.reddit.com/*"]
let mapleader = ","

" Mappings

map <Leader>r reloadTabUncached
map <Leader>x :restore<Space>

map j scrollUp "This remaps the default 'j' mapping
map gb :buffer<Space> "You can use <Space>, which is interpreted as a literal " " character, to enter buffer completion mode
unmap k "The unmaps the default 'k' mapping

map f F "This remaps the default 'f' mapping to the current 'F' mapping

map <C-h> :set hud!<CR> "Toggle the current HUD display value
map <C-i> :set numerichints!<CR> "Switch between alphabetical hint characters and numeric hints
map <C-u> rootFrame
map <M-h> previousTab
map <C-d> scrollPageDown
map <C-e> scrollPageUp
iunmap <C-y>
imap <C-m> deleteWord
map X :execute gTx<CR> "Close the current tab and move to the one before it

###Blacklists

  • You can blacklist specific commands on chosen domains by adding the keybinding after the blacklist URL. For instance, if you want smooth scrolling enabled with the <Up> and <Down> keys, but not on pages like Chrome's built-in PDF viewer (in which the up and down keys won't respond if they have been mapped), your cVimrc would look like this:
map <Up> scrollUp
map <Down> scrollDown

and the blacklists setting would have look like this:

let blacklists = ["*://*/*.pdf <Up> <Down>"]

###Mappings

  • Normal mappings are defined with the following structure: map <KEY> <MAPPING_NAME>
  • Insert mappings use the same structure, but use the command "imap" instead of "map"
  • Control, meta, and alt can be used also:
<C-u> "Ctrl + u
<M-u> "Meta + u
<A-u> "Alt  + u
  • It is also possible to unmap default bindings with unmap <KEY> and insert bindings with iunmap <KEY>
  • To unmap all default keybindings, use unmapAll. To unmap all default insert bindings, use iunmapAll

###Tabs

  • Commands that open links (:tabnew and :open) have three different properties
  • ! => Open in a new tab
  • & => Open in a new tab (inactive/unfocused)
  • * => Pin the tab
  • The use of these properties are best explained with examples:
:open! google<CR> "This is the same as :tabnew google<CR>
:open google!<CR> "This is another way of writing the above (these flags can can be added to either the base command or the end of the final command)

:open& google<CR> "This will open Google in a new inactive tab

:open&* google<CR> "The will open Google in a new inactive, pinned tab
:tabnew google&*<CR> "Once again, this will do the same thing as the above command
:open google&*<CR> "Again, same as above

:open google!& "Here, the & flag will cancel out the ! flag, opening Google in a new inactive tab

"More examples
:bookmarks my_bookmark.com& "inactive,new tab
:bookmarks&* my_bookmark.com "inactive,pinned,new tab
:bookmarks! my_bookmark.com "new tab
:bookmarks my_bookmark.com "same tab

#Keybindings

Movement Mapping name
j, s scroll down scrollDown
k, w scroll up scrollUp
h scroll left scrollLeft
l scroll right scrollRight
d scroll half-page down scrollPageDown
unmapped scroll full-page down scrollFullPageDown
u, e scroll half-page up scrollPageUp
unmapped scroll full-page up scrollFullPageUp
gg scroll top the top of the page scrollToTop
G scroll to the bottom of the page scrollToBottom
0 scroll to the left of the page scrollToLeft
$ scroll to the right of the page scrollToRight
gi go to first input box goToInput
gI go to the last focused input box by gi goToLastInput
zz center page to current search match (middle) centerMatchH
zt center page to current search match (top) centerMatchT
zb center page to current search match (bottom) centerMatchB
Link Hints
f open link in current tab createHint
F open link in new tab createTabbedHint
unmapped open link in new tab (active) createActiveTabbedHint
W open link in new window createHintWindow
A repeat last hint command openLastHint
q trigger a hover event (mouseover + mouseenter) createHoverHint
Q trigger a unhover event (mouseout + mouseleave) createUnhoverHint
mf open multiple links createMultiHint
mr reverse image search multiple links multiReverseImage
my yank multiple links (open the list of links with P) multiYankUrl
gy copy url from link to clipboard yankUrl
gr reverse image search (google images) reverseImage
; change the link hint focus
QuickMarks
M<*> create quickmark <*> addQuickMark
go<*> open quickmark <*> in the current tab openQuickMark
gn<*> open quickmark <*> in a new tab <N> times openQuickMarkTabbed
Miscellaneous
a alias to ":tabnew google " :tabnew google
. repeat the last command repeatCommand
: open command bar openCommandBar
<A-z> toggle cVim (same as disable cVim option in toolbar icon) toggleCvim
unmapped toggle the blacklist on the current domain toggleBlacklisted
/ open search bar openSearchBar
? open search bar (reverse search) openSearchBarReverse
I search through browser history :history
<N>g% scroll <N> percent down the page percentScroll
zr restart Google Chrome :chrome://restart<CR>
i enter insert mode (escape to exit) insertMode
r reload the current tab reloadTab
gR reload the current tab + local cache reloadTabUncached
;<*> create mark <*> setMark
'' go to last scroll position lastScrollPosition
'<*> go to mark <*> goToMark
none reload all tabs reloadAllTabs
cr reload all tabs but current reloadAllButCurrent
zi zoom page in zoomPageIn
zo zoom page out zoomPageOut
z0 zoom page to original size zoomOrig
z<Enter> toggle image zoom (same as clicking the image on image-only pages) toggleImageZoom
gd alias to :chrome://downloads<CR> :chrome://downloads<CR>
yy copy the url of the current page to the clipboard yankDocumentUrl
b search through bookmarks :bookmarks
p open the clipboard selection openPaste
P open the clipboard selection in a new tab openPasteTab
gj hide the download shelf hideDownloadsShelf
gf cycle through iframes nextFrame
gF go to the root frame rootFrame
gq stop the current tab from loading cancelWebRequest
gQ stop all tabs from loading cancelAllWebRequests
gu go up one path in the URL goUpUrl
gU go to to the base URL goToRootUrl
gs go to the view-source:// page for the current Url goToSource
Tab Navigation
gt, K, R navigate to the next tab nextTab
gT, J, E navigate to the previous tab previousTab
g0, g$ go to the first/last tab firstTab, lastTab
<C-S-h>, gh open the last URL in the current tab's history in a new tab openLastLinkInTab
<C-S-l>, gl open the next URL from the current tab's history in a new tab openNextLinkInTab
x close the current tab quit
gxT close the tab to the left of the current tab closeTabLeft
gxt close the tab to the right of the current tab closeTabRight
gx0 close all tabs to the left of the current tab closeTabsToLeft
gx$ close all tabs to the right of the current tab closeTabsToRight
X open the last closed tab lastClosedTab
t :tabnew :tabnew
T :tabnew <CURRENT URL> :tabnew @%
O :open <CURRENT URL> :open @%
<N>% switch to tab <N> goToTab
H, S go back goBack
L, D go forward goForward
B search for another active tab :buffer
< move current tab left moveTabLeft
> move current tab right moveTabRight
]] click the "next" link on the page (see nextmatchpattern above) nextMatchPattern
[[ click the "back" link on the page (see previousmatchpattern above) previousMatchPattern
gp pin/unpin the current tab pinTab
<C-6> toggle the focus between the last used tabs lastUsedTab
Find Mode
n next search result nextSearchResult
N previous search result previousSearchResult
v enter visual/caret mode (highlight current search/selection) toggleVisualMode
V enter visual line mode from caret mode/currently highlighted search toggleVisualLineMode
Visual/Caret Mode
<Esc> exit visual mode to caret mode/exit caret mode to normal mode
v toggle between visual/caret mode
h, j, k, l move the caret position/extend the visual selection
y copys the current selection
n select the next search result
N select the previous search result
p open highlighted text in current tab
P open highlighted text in new tab
Text boxes
<C-i> move cursor to the beginning of the line beginningOfLine
<C-e> move cursor to the end of the line endOfLine
<C-u> delete to the beginning of the line deleteToBeginning
<C-o> delete to the end of the line deleteToEnd
<C-y> delete back one word deleteWord
<C-p> delete forward one word deleteForwardWord
<C-h> move cursor back one word backwardWord
<C-l> move cursor forward one word forwardWord
<C-f> move cursor forward one letter forwardChar
<C-b> move cursor back one letter backwardChar

#Command Mode

Command Description
:tabnew (autocomplete) open a new tab with the typed/completed search
:new (autocomplete) open a new window with the typed/completed search
:open (autocomplete) open the typed/completed url/google search
:history (autocomplete) search through browser history
:bookmarks (autocomplete) search through bookmarks
:bookmarks /<folder> (autocomplete) browse bookmarks by folder/open all bookmarks from folder
:set (autocomplete) temporarily change a cVim setting
:chrome:// (autocomplete) open a chrome:// url
:tabhistory (autocomplete) browse the different history states of the current tab
:quit close the current tab
:restore (autocomplete) restore a previously closed tab (newer versions of Chrome only)
:tabattach (autocomplete) move the current tab to another open window
:file (autocomplete) [expirimental] open a local file
:duplicate duplicate the current tab
:settings open the settings page
:nohlsearch clear the highlighted text from the last search
:execute execute a sequence of keys (Useful for mappings. For example, "map j :execute 2j")
:buffer (autocomplete) change to a different tab
:mksession create a new session from the current tabs in the active window
:delsession (autocomplete) delete a saved session
:session (autocomplete) open the tabs from a saved session in a new window

#Tips

  • You can use @% in "open" commands to specify the current URL. For example, ":open @%" would essentially refresh the current page.
  • Prepend a number to the command to repeat that command N times
  • Use the up/down arrows in command/find mode to navigate through previously executed commands/searches -- you can also use this to search for previously executed commands starting with a certain combination of letters (for example, entering "ta" in the command bar and pressing the up arrow will search command history for all matches beginning with "ta"

chromium-vim's People

Contributors

1995eaton avatar freeo avatar itchyny avatar soli avatar stoeffel avatar tsfoster avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.