k2nr / ViChrome

vi like key binds for Google Chrome
233 stars 40 forks source link

have to put in http:// to go to url #28

Closed rever0f closed 12 years ago

rever0f commented 12 years ago

first thanks vichrome is the best vim thing i have found for chromium.

when going to a new tab I have to type in the http. rather not. here is the patch file data for mode.coffee to add an option to tabopennew and open with -u flag to open http auto by typing or by mapping.

am a nub at coffeescript/submitting patches and probably a number of other things. i apologize if i offend. manifest.json mode.js modejs.old model.js modecoffee.patch modejs.new modejs.patch [inkling@atreyu k2nr-ViChrome-f984147]$ cat modecoffee.patch *\ coffee/mode.coffee 2011-12-21 14:29:28.839894850 -0500 --- coffee/modecoffee.old 2011-12-21 13:59:28.092983666 -0500


* 24,34 ** sources = [ { class : "CandSourceGoogleSuggest" } ]

  • else if opt.eurl
  • baseCom += " u"
  • dscr += " URL"
  • sources = [
  • ] else sources = [ { class: "CandSourceGoogleSuggest", num: 3, reqPrefix: true } --- 24,29 ----

    * 48,54 ** when "-w" then web = true when "-h" then history = true when "-g","g" then search = true

  •       when "-u","u"  then eurl = true
        else urls.push arg
    
    if interactive or bookmark or history or web

    --- 43,48 ----

    * 57,63 ** history : history web : web search : search

  •           eurl     : eurl
        com = "Open" + urls.join(' ')
        @enterInteractiveOpen( com, opt )
    else if search

    --- 51,56 ----

    * 67,80 **

        url = "http://" + g.model.getSetting("searchEngine") + "/search?gcx=c&sourceid=chrome&ie=UTF-8&q=" + word + "&qscrl=1"
        g.view.open( url, "_self" )
  • else if eurl
  • word = ""
  • word += "+" + encodeURIComponent(i) for i in urls

    - word = word.substr(1)

  • url = "http://" + word

    - g.view.open( url, "_self" )

      else
          g.view.open( urls[0], "_self" )

--- 60,65 ----


* 88,94 ** when "-w" then web = true when "-h" then history = true when "-g","g" then search = true

  •       when "-u","u"  then eurl      = true
        else words.push arg
    
    if interactive or bookmark or history or web

    --- 73,78 ----

    * 97,103 ** history : history web : web search : search

  • eurl : eurl com = "OpenNewTab " + words.join(' ') @enterInteractiveOpen( com, opt ) else if search --- 81,86 ----

    * 109,123 ** urls = [] urls.push url chrome.extension.sendRequest {command : "TabOpenNew", args : urls, times : times}, g.handler.onCommandResponse

  • else if eurl
  • word = ""
  • word += "+" + encodeURIComponent(i) for i in words

    - word = word.substr(1)

  • url = "http://" + word
  • urls = []
  • urls.push url
  • chrome.extension.sendRequest {command : "TabOpenNew", args : urls, times : times}, g.handler.onCommandResponse else chrome.extension.sendRequest {command : "TabOpenNew", args : words, times : times}, g.handler.onCommandResponse

--- 92,97 ----

k2nr commented 12 years ago

Thanks for the patch.

It may be better to automatically add http:// by default if the specified string doesn't have a scheme name(i.e. [scheme-name]://) because currently :Open and :TabOpenNew always doesn't work without scheme name. With the above spec, I think -u option isn't needed.

If you agree with me, I will implement the feature.

rever0f commented 12 years ago

that sounds much better.