Code Monkey home page Code Monkey logo

svim's Introduction

sVim

sVim is a Safari extension with shortcuts similar to Vim. The functionality of sVim will mostly follow the Chrome extension cVim.

Get it

  • Download the latest release
  • Releases and release notes are all uploaded to Github on the releases page
  • The extension will update via Safari Extension Updates

Help

Shortcuts

Keyboard Command Description Mapping Name
Movement
"j" scroll down scrollDown
"k" scroll up scrollUp
"h" scroll left scrollLeft
"l" scroll right scrollRight
"d" scroll half-page down scrollPageDown
"e", "u" scroll half-page up scrollPageUp
"shift+d" scroll full-page down scrollFullPageDown
"shift+e" scroll full-page up scrollFullPageUp
"shift+g" scroll to bottom of the page scrollToBottom
"g g" scroll to top of the page scrollToTop
"0" scroll to the left of the page scrollToLeft
"$" scroll to the right of the page scrollToRight
"g i" go to the first input box goToInput
"g n" find a "next page" link and navigate to it gotoNextPage
"g p" find a "previous page" link and navigate to it gotoPrevPage
Miscellaneous
"r" reload the current tab reloadTab
"z i" zoom page in zoomPageIn
"z o" zoom page out zoomPageOut
"z 0" zoom page to original size zoomOrig
"g r" toggle Safari reader if possible toggleReader
"g v" show sVimrc page showsVimrc
"g ?" open help page in new tab help
Tab Navigation
"g t", "shift+k" navigate to the next tab nextTab
"g shift+t", "shift+j" navigate to the previous tab previousTab
"g 0" go to the first tab firstTab
"g $" go to the last tab lastTab
"g l" go to the last active tab that's still open lastActiveTab
"x" close the current tab quit
"g x shift+t" close the tab to the left of the current tab closeTabLeft
"g x t" close the tab to the right of the current tab closeTabRight
"g x 0" close all tabs to the left of the current tab closeTabsToLeft
"g x $" close all tabs to the right of the current tab closeTabsToRight
"shift+x" open the last closed tab lastClosedTab
"ctrl+shift+x" open the last closed tab in background lastClosedTabBackground
"t" open new tab newTab
"shift+h" go back in history goBack
"shift+l" go forward in history goForward
"shift+," move current tab left moveTabLeft
"shift+." move current tab right moveTabRight
"g u" navigate to parent directory parentDirectory
"g shift+u" navigate to top directory topDirectory
"g d" navigate to parent domain parentDomain
"g h" navigate to home page homePage
Window Navigation
"w" open new window newWindow
"g w" navigate to the next window nextWindow
"g shift+w" navigate to the previous window previousWindow
Modes
"escape", "ctrl+[" enter normal mode normalMode
"i" enter insert mode insertMode
Link Hints
"f" open link in current tab createHint
"shift+f" open link in new background tab createTabbedHint
"ctrl+shift+f" open link in new foreground tab createForegroundHint
Clipboard
"y y" copy current URL to clipboard yankDocumentUrl

sVimrc

  • The sVimrc page is where you can customize sVim settings and css.
  • You can access the page by pressing g v or via the extension settings in Safari.
  • The sVimrc and sVimcss files can be synced via gist.
    • The gist id is found at the end of the url when viewing the gist.
    • Note it does not matter the name of your gist or the file, sVim will just grab the first file from the gist id supplied. I use sVim.rc and sVim.css.
  • For simplicity, strings in sVimrc should be wrapped in ".
  • Save the sVimrc page with command+s.
  • Goto or switch between sVimrc and sVimcss with ctrl+w.

sVimrc Commands

  • set
    • Used for boolean settings.
    • Prepend no to setting name to unset.
    • Set smooth scroll with set smoothscroll and unset with set nosmoothscroll.
  • let
    • Used to set non-boolean settings.
    • These settings can be of type integer, string or array.
    • Set new tab url like let newtaburl = "http://google.com".
    • Set scroll step like let scrollstep = 100.
    • Set black lists like let blacklists = ["*://example.com/stuff/*", "*://mail.google.com/*"].
  • map
    • Used to set/overwrite shortcuts.
    • sVim uses Mousetrap for shortcuts and keyboard commands should follow it's format.
    • You can use leader with <Leader> in the keyboard command.
    • Set the down arrow key to scroll down with map "down" scrollDown.
    • Set the leader key + the J key to scroll down with map "<Leader> j" scrollFullPageDown.
  • unmap
    • Used to remove a shortcut.
    • Remove j shortcut with unmap "j".
  • unmapAll
    • Used to remove all current shortcuts with unmapAll.
  • "
    • Used to add comments to sVimrc.
    • Comment by adding " to the beginning of the line (inline not supported).
    • Add comment like " This is a comment.

sVimrc Settings

Setting Name Description Type Default
preventdefaultesc prevent escape from exiting full screen, if unset then only prevent when not in normal mode boolean true
smoothscroll use smooth scrolling boolean true
fullpagescrollpercent percent of the page to scroll by when using scrollFullPageUp and scrollFullPageDown integer 85
lastactivetablimit number of last active tabs to remember integer 25
lastclosedtablimit number of closed tabs to remember integer 25
scrollduration duration of smooth scrolling integer 30
scrollstep amount of pixels scrolled when using scrollUp and scrollDown integer 60
zoomstep percent to zoom when using zoomPageIn and zoomPageOut integer 10
hintcharacters characters to be used in link hint mode string "asdfgqwertzxcvb"
homeurl url to use as home page string "topsites://"
mapleader key string ""
newtaburl url to use as the default new tab url string "topsites://"
blacklists disable sVim on the sites matching one of the patterns array []
nextpagetextpatterns a list of regex patterns used to find the "next page" link on the page array ["Next"]
prevpagetextpatterns a list of regex patterns used to find the "prev page" link on the page array ["Previous"]

sVimrc Example

" Settings
set nosmoothscroll
let fullpagescrollpercent = 100
let lastactivetablimit = 50;
let lastclosedtablimit = 50;
let scrollduration = 25
let scrollstep = 65
let zoomstep = 15
let hintcharacters = "1234567890";
let homeurl = "http://google.com";
let mapleader = ","
let newtaburl = "http://google.com"
let blacklists = ["*://example.com/stuff/*", "*://mail.google.com/*"]
let nextpagetextpatterns = ["Next"]
let prevpagetextpatterns = ["Prev(ious)?"]

" Shortcuts
map "q" nextTab
map "shift+q" previousTab
map "<Leader> h" closeTabLeft
map "<Leader> l" closeTabRight
map "down" scrollDown
map "up" scrollUp
map "left" scrollLeft
map "right" scrollRight
map "space" scrollFullPageDown

svim's People

Contributors

abrookins avatar deepsourcebot avatar flippidippi avatar isundaylee avatar jgregoryatiba avatar luchenyuxx avatar x-ji avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

svim's Issues

My most missing feature; search within the page

First a big thank you! I'am a heavy cVim user on my office Windows computer but sVim for may Mac at home is feature rich enough although I will tell you my most missing feature is a replacement for Ctrl-f (search with /)

Beyond the key-navigating the most used feature I like is the zoom function with a little zoomStep integer 5 value, excellent!

Cannot select 'blue' links.

In 1.0.4, after creating link shortcuts using 'f' or 'F', I see 'blue' links and 'yellow' links.
It is possible to click yellow ones using shortcuts but not blue ones.
What's the difference between them and how can I resolve it?

How to 'unpause' sVim

Hi,

I paused sVim and now I can't find a way to restore it, when I click on the toolbar button there is this 'Pause sVim' option checked which I click to restore sVim but nothing happens.

work before page is loaded?

I wish sVim can work before the page is loaded. For example, when a tab is loading, and I want to switch to another tab. This is impossible because sVim's shortcuts is blocked.

does not work in tabs with pages loaded from local disk

I just came across something odd: in tabs where the page is loaded from the local disk (i.e. the address bar reads file:///Users/xx/xx/xx.html), the shortcuts do not work (they work just fine on pages loaded over the internet). Any idea if this is expected behavior? I'm using Safari Version 9.1 on El Capitan 10.11.4.

Checkboxes can't be checked using 'f'

Title says it all. Can't seem to get this done.

This also seems to apply to some types of buttons (like the 'submit new issue' button here on GitHub itself).

"shift+f" stopped working

Just started using sVim today. "shift+f" worked earlier, but now it's stopped.

What changed (this may not be related)

  • I looked into how to recover focus from the address bar back into safari after pressing "ctrl+l". Pressing tab seems to do the trick

Uninstalls sVim, restarted computer, and reinstalled sVim. Still have the problem.

mapping to "z" does not work

For example if I had this line in the sVimrc map "z" goToInput, it does not work. Only if I press z two times, will it work.

Search for word / character in current page only

What I mean is that I wish there was a search, let's say by pressing / key. That would allow me to search for things (like cmd + f) but only for the active window at hand. Like this :

2016-11-28 at 23 47

Perhaps this would be possible to do as that would be extremely extremely handy for me as then I can search for text, arrow right and left to select more of the text and either copy it or google for it or anything. I just need to be able to select it without using trackpad or a mouse and without searching for the entire page with cmd + f.

Feature request: Allow bindings for pause/unpause of sVim

I would like to bind a mapping which toggles sVim's operation.

Sometimes a site has it's own keyboard shortcuts which overlap with sVim. This would allow quickly disabling sVim, using the site's specific keyboard shortcuts, and ten quickly enabling sVim again. Perhaps it could be mapped in the sVimrc like this:

map "s v" togglePause

Please add 'cmd + f' search function to sVim

I would really really like to map 'o' or "shift+f" key to search within a web page. I really think it shouldn't be that difficult to add as it should just call cmd + f hotkey in theory.

Thank you.

Searching active tabs?

This is the functionality achieved by pressing B in cVim. It allows you to search through all the open tabs and select the appropriate one. For me it's indispensable because I tend to open tons of tabs when working on projects and would like to make navigation easy. Is it not implemented because of some limitations of Safari, or is it simply not done yet? If it's the latter, I might try to look into it and come up with an implementation.

Open link in background tab (shift + f)

As i understand the "shift+f" should work as the "f", only it would open the hint link in a background tab. If that is correct, then this feature is not working for me.
Also, i would like to add that i loved your initiative to create this extension for safari. As in my usually old macs i use i can't handle firefox or chrome which always had vim extensions. So i appreciate your effort. And what you already did is a great job.

key "w" is maped twice.

"k", "w" scroll up scrollUp
"w" open new window newWindow

Maybe you should remove the scrollUp and scrollDown for "w" and "s" to make it more clear.....

Submit sVim to Safari Extensions Gallery

sVim should appear in the Safari Extensions Gallery and auto-update when we release new versions.

TODO:

  • Release latest version, 1.0.5
  • Submit signed 1.0.5 package to Safari Extensions Gallery
  • Do whatever Apple demands afterward

Unmap space from pageDown

I would like to use "space space" for createHint, but unmap "space" doesn't do it.

Is spacebar just hardcoded and unchangeable in safari?

Thanks for your work 😃

Open the last closed tab doesn't keep the tab's history

My os x version is 10.12.1 and safari version is 10.0.1 (12602.2.14.0.7).
I didn't know if it is a bug or just an uncompleted function. If I press the native cmd+shift+t to open the last closed tab, the reopened tab's history remains, which means I can go back/forward in history in this tab. But with the shift+x provided by sVim the tab's history is missing.
If the history could be kept by shift+x I'll appreciate for that.

unable to remap with sVimrc

Safari Version 10.1.1 (12603.2.4)
Latest stable sVim
trying those code in sVimrc and click save. The new setting do not get apply at all : (

unmapAll
map "p" scrollPageDown
map "q" scrollPageUp
map "f" scrollFullPageDown
map "w" scrollFullPageUp
map "a" goToInput
map	"r" previousTab
map "t" nextTab
map "d" quit
map "g" lastClosedTab
map "s" createHint

It this a know issues?

link selection requires confirmation

when pressing 'f' to show grid of links, pressing corresponding key does not immediately invoke link but requires 'enter' to confirm. This behavior is not present when selecting text fields.

Problem with --normal-- inserted into fields

There is a very annoying bug that happens when posting on certain forums, this one for example. Where any post you make adds

'--- normal ---' to the end of any post you make. This is very annoying. Is it possible to either fix this bug? Perhaps you might not what the reason might be for it.

Feature request: Site specific configurations

There's already a way to blacklist particular sites. I would find it extremely useful to alter mappings for specific sites as well. Many web applications today use their own keyboard shortcuts, but often these conflict with sVim. It would be nice to use alternate mappings for specific sites to have the best of both worlds.

Perhaps the sVimrc could implement if/endif with a matching test for the current URL. Here's an example of how that might look:

" use only a few basic nagivation mappings for site-one and site-two
if urlmatch(["*://*site-one.com/*","*://*.site-two.com/*"])
  unmapAll
  map "d" scrollPageDown
  map "u" scrollPageUp
  map "g g" scrollToTop
  map "shift-g" scrollToBottom
endif

Is this project dead?

I love the extension, but there haven't been any updates in a while, even though there are open issues.

Thanks

Custom CSS for link follow hints

It would be great if the CSS for the link hints could be customized in the sVim CSS. Currently it appears to be hardcoded.

Thanks for the great extension!

Google search arrow selection for results doesn't work

I have downloaded the extension and I am really liking it but there is one issue that is really important for me. When you make a google search and are presented with results. You can press down arrows to select the result you want right from the keyboard. I use that every time. However with the extension turned on, this no longer works. What should I change in the settings to make it work?

Here is a screencast I made to show exactly what I mean : http://quick.as/D9OzfZLVg

Thank you for such a great extension. I hope it would be possible to fix this and make it work.

I would absolutely love to have '/' hotkey be used for text selection

Such a feature is currently present in vimum and it works as follows, you press / hotkey and follow it by some text query, it then finds it on the page and you can do with it what you like. You can even go to visual mode after and select the exact text that you need whilst not once touching your trackpad / mouse.

Such a feature would be absolutely amazing to have. I would really love to help with adding it as it seems that the project is a bit abandoned unfortunately. :(

However I don't really know where I can start with adding such functionality. Thank you a lot and I hope someone will consider adding this feature.

Can't get "blacklists" to work

Very cool plugin. I'm using Safari 9.0.1 and release 1.0.4. No matter what I add to "blacklists," including the examples listed in the documentation, the plugin still intercepts key presses.

Sometimes I missing focus when typing

Hello guys,
Thanks a lot for your plug-in both creator and contributors.
I'm using OSX 10.11.5 (have used Yosemite as well).

The issue happens when I'm editing text in form or textarea – sometimes I loosing focus on field. This leads to sVim hotkeys got pressed instead of typing and mess begins. Unfocus happens randomly and start reproducing when I installed sVim.

I want to provide more info on that, but don't know where to grab logs.

Guys, I'm only one who facing this?

Thanks!

Focus address

there should be some way to focus the address field, e.g. to just open a new url in the current tab or edit the url in some way. in vimfx its 'o' ...

... or i just missed it ;)

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.