Giter Site home page Giter Site logo

drracket-vim-tool's Introduction

DrRacket Vim Tool

Build Status Coverage Status

This plugin adds vim-like editing to DrRacket.

The plugin is still far from feature-complete, so bug reports and pull requests appreciated!

Requires Racket v6.0 or newer.

To install:

  • raco pkg install drracket-vim-tool (via package catalog)

or

  • raco pkg install git://github.com/takikawa/drracket-vim-tool (directly via Github)

Now when you load DrRacket, you should see a vim option in the Edit menu. Click that to enable vim mode.

This plugin is released under the GPLv3. Patches welcome.


Copyright © 2013-2016 Asumu Takikawa

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

drracket-vim-tool's People

Contributors

asgavar avatar dreadwail avatar florence avatar leifandersen avatar m4burns avatar martindemello avatar rfindler avatar stamourv avatar takikawa avatar tov 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

drracket-vim-tool's Issues

Space should be inserted when hitting `J`

When hitting the capital J key, the current line, and next line, get appended together on the same line. However, these two line are supposed to be separated by a space.

So for example, hitting J on line one of the following file:

Line 1 Text
Line 2 Text

Should result in:

Line 1 Text Line 2 Text

However, in vim-tool, the space is missing, giving you:

Line 1 TextLine 2 Text

Lowercase 'a' does not append.

Lowercase a is currently equivalent to lowecase i. It should append to the current cursor position rather then insert there.

Packages installed, although setup reported errors

When I install it in my Racket 6.2:

Error invoking tool #path:/Users/user/Library/Racket/6.2/pkgs/drracket-vim-tool;("tool.rkt")

Users/bialy/Library/Racket/6.2/pkgs/drracket-vim-tool/private/text.rkt:181:15: conjoin: unbound identifier in module
in: conjoin

Search does not loop

When doing a search (via hitting /), I can hit n to go to the next result, however, when I reach the bottom most result in the file, it does not loop around to the first result in the file.

r key doesn't work.

In vim, I can move my cursor to a letter, hit r, and then another letter, and the letter under the cursor will be replaced with the letter I just pressed.

This behavior appears to be missing in drracket-vim-tool.

Can't leave vim mode.

When I disable vim mode, DrRacket fails to return back to it's previous state, and the cursor continues to highlight a single character.

To replicate:

  1. Enter Vim mode (if not already in it).
  2. Try to leave vim mode.

You see that the key bindings go back to normal, however the cursor still is a block.

Visual line selection grows monitonically.

If you hit V to use visual line selection, the amount of text that is select only grows and never shrinks.

To replicate:

Hit V to enter visual line mode.
Press j and k to move the cursor up and down.

Each time you hit j or k, one more line should be highlighted.

Error invoking tool! enqueue-front!: Unbound identifier in module?

I'm currently using 5.3 version Drracket, when I tried to install your tool, some error occur like below.

Error invoking tool #<path:C:\Program Files\Racket\vim-tool\drracket-vim-tool>;(
"tool.rkt")

C:\Program Files\Racket\vim-tool\drracket-vim-tool\private\text.rkt:78:9: enqueu
e-front!: unbound identifier in module
in: enqueue-front!
channel-put: contract violation
expected: channel?
given: #f
context...:
C:\Program Files\Racket\collects\racket\private\misc.rkt:168:2: channel-put

How can I get it right?

Not entire buffer is coppied.

This one is a doozy, and I'm not sure what the issue is. So I'll just give you the steps to reproduce it.

  1. Start with the following 10 line buffer:

    #lang racket
    
    (define x
      (compile
       #'(begin
           +
           (define + 5)
           +)))
    
    
    
  2. Copy lines 3-8 by:
    2a. Starting on line 3, hit V.
    2b. Hit j 5 times.
    2c. Hit y.

  3. Go to line 9 and hit p to paste.

Note that the new buffer is:

#lang racket

(define x
  (compile
   #'(begin
       +
       (define + 5)
       +)))
 (define 
  (compile
   #'(begin
       +
       (define + 5)
       +)))


First, note that the second s-expression is magically indented, and note the lack of a second x.

Indentation not correct.

Again, I'm not 100% sure if this is vim mode, or just a bug in drracket.

But when I try to type a for loop, I get incorrect indetation

Given the code:

(for ([i (in-range 10)])
  i)

When I hit tab on the second line, the i gets indented as if for was a regular function.

Vin normal mode stops working

I can start up vim mode in normal mode but once I go to insert I can't go back - It used to work I'm not sure what changed. I am using Dr. Racket 6.1.1

'x' does not modify copy-paste buffer

To reproduce: type in any buffer type 'xp'

expected result: the selected character i moved one char to the right

actual result: the selected character is deleted, and whatever is in your copy/paste buffer gets pasted in

Incorrect behavior when pressing space.

Space acts incorrectly under the following two circumstances.

  1. If you are on the last character of the last line of the file and press space, the cursor loops around to the first character of that line, rather then doing nothing.
  2. If the line is empty and the user presses space, the cursor doesn't do anything, rather than going to the first character of the next line.

Highlighting text with mouse and hitting 'x' only deletes one character. (Highlighting with the mouse shold enter visual mode)

If I write out a word, and highlight it with the mouse, and hit 'x', it only deletes the first character of the word, rather than the whole word.

If however, I hit v, and then highlight it with the mouse, and hit 'x', it deletes it.

I suspect what the issue here is that highlighting text doesn't enter visual mode, which it likely should. (Unless maybe it's in command mode?)

Note though that highlighting and hitting 'd' does work find though.

: text stays after escape

If I type :a, and then hit escape, and decide I want to type another colon command again, when I hit :, the text that was previously there appears again.

Incorrect line wrapping

If you hit l on an empty line, it goes to the next line (rather then doing nothing, as it should.

Likewise, if you are on the beginning of a line, and hit j, it goes to the previous line, rather then doing nothing, as it should.

Paren Matching does not happen

I'm not 100% sure if this is due to vim mode, or a bug in DrRacket. However, whenever I put the cursor over a paren the s-expression I surround does not get highlighted.

Furthermore, extraneous closing parens are no longer marked. Thus making it hard to determine when to stop hitting closing paren.

Cannot backspace after :w

If you type :w, and start typing some more text, you cannot backspace further beyond the w.

So, type ':w foo', and keep hitting backspace, and the ':w' will stay there.

dd fails to delete empty first line

If the first line of your file is an empty line, and you hit dd, then the cursor simply goes to the second line without deleting the first line.

Space in command mode should go to next character.

When the end user presses space in command mode, the cursor should go to the next character. Additionally, when the end user presses space at the end of a line, it should go to the first character on the next line.

'o' splits text if line is wrapped.

If I have line wrapping for DrRacket enabled, and I hit 'o' on a line that is wrapped to multiple lines (not on the last line of the wrap) to create a new line, it splits the line at the end of the line, and puts the text at the end of the line, rather than putting a new line at the end.

Use a DSL to specify vim commands

I'm not satisfied with the way that keyboard commands are currently parsed. I'd like to specify commands declaratively, keeping around a table mapping either sequences of keys or regular expressions of keys to procedures.

Ctrl-C to escape insert mode

In vim pressing ctrl-c leaves insert mode. It is an alternative to pressing the escape key. Could that be implemented here? My muscle memory is committed to Ctrl-c!

pkg is a unrecognized command

Here I'm using Racket 5.1.1. Running raco pkg install drracket-vim-tool/ as specified on README.md doesn't work. Seems pkg option is removed from raco.

There is a setup option in the usage message of raco which I suspect would be replacement for pkg. But running it returns something more nasty:

collection-path: collection not found: #<path:install> in any of: (#<path:/home/santosh/.racket/5.1.1/collects> #<path:/usr/share/racket/collects>)

 === context ===
cloop
/usr/share/racket/collects/setup/setup-unit.rkt:197:6
/usr/share/racket/collects/racket/private/more-scheme.rkt:390:13: hash-ref!
/usr/share/racket/collects/racket/list.rkt:240:0: filter-map
/usr/share/racket/collects/setup/setup-go.rkt: [running body]
/usr/share/racket/collects/setup/main.rkt: [running body]
/usr/share/racket/collects/raco/main.rkt: [running body]

dd on empty file causes error.

I get the following error when I run dd on an empty file:

kill in text%: bad argument combination: 0 -1 1
context...:
next
/Users/leif/rsrc/drracket-vim-tool/private/text.rkt:309:6: do-delete method in ...ool/private/text.rkt:51:4
/Users/leif/rsrc/drracket-vim-tool/private/text.rkt:144:17
/Users/leif/rsrc/gui/gui-lib/mred/private/wxme/editor-canvas.rkt:457:2: on-char method in editor-canvas%
/Users/leif/racket/racket/collects/racket/private/more-scheme.rkt:148:2: call-with-break-parameterization
/Users/leif/racket/racket/collects/racket/private/more-scheme.rkt:265:2: call-with-exception-handler
/Users/leif/rsrc/gui/gui-lib/mred/private/wx/cocoa/window.rkt:790:4: dispatch-on-char method in window%
/Users/leif/rsrc/gui/gui-lib/mred/private/wx/common/queue.rkt:454:6

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.