Code Monkey home page Code Monkey logo

smalltalkvimmode's Introduction

Smalltalk Vim Mode

Vim Mode for Playground, System Browser, Debugger in Pharo.

Install SmalltalkVimMode

Prerequisites

  • Latest Pharo 6.1 image.
  • Pharo VM for Pharo 6.1. (It doesn't work in the latest Pharo. I have tried to fix it, but my Smalltalk skill is rusty, I have no idea what went wrong.)

Execute the code in a Playground in Pharo

baseline   := 'SmalltalkVimMode'.
repository := 'github://unchartedworks/SmalltalkVimMode:master'. 
metacello  := [ Metacello new baseline: baseline; repository: repository ].
get        := [ metacello value get ].
load       := [ metacello value onConflict: [:ex | ex allow]; load ].
actions    := {get . load}.
apply      := [ :action | action value ].
actions do: apply.

Shortcuts

Main

Esc enter normal mode

i enter insert mode

V enter visual mode per line

Normal mode

Comment/Uncomment

Command + / comment/uncomment selected code, if there is no selection, the current line will be commented/uncommented.

Navigation keys

h left

N h left N times

j down

N j down N times

k up

N k up N times

l right

N l right N times

0 move the cursor to the first character in the line

$ move the cursor to the last character in the line

^ move the cursor to the first non-blank character in the line

g_ move the cursor to the last non-blank character in the line

w move forward to the start of the next word (next alphanumeric word)

N w move forward to the start of the next N words (next N alphanumeric words)

W move forward to the start of the next word (delimited by a white space)

N W move forward to the start of the next N words (delimited by a white space)

e move forward to the end of the next word (next alphanumeric word)

N e move forward to the end of the next N words (next N alphanumeric words)

E move forward to the end of the next word (delimited by a white space)

N E move forward to the end of the next N words (delimited by a white space)

b move backward to the start of previous word (previous alphanumeric word)

N b move backward to the start of previous N words (previous N alphanumeric words)

B move backward to teh start of previous word (delimited by a white space)

N B move backward to teh start of previous N words (delimited by a white space)

gg move to the beginning of the buffer

G move to the end of the buffer

fx move forward to the next occurrence of character x to the right

N fx move forward to the Nth occurrence of character x to the right

tx move forward to before the next occurrence of character x to the rigtht

N tx move forward to before the Nth occurrence of character x to the right

Fx move forward to the Nth occurrence of character x to the left

N Fx move forward to the Nth occurrence of character x to the left

Tx move forward to after the previous occurrence of character x to the left

N Tx move forward to after the Nth occurrence of character x to the left

Insert text

a insert text after the cursor

A insert text at the end of the line

i insert text before the cursor

o begin a new line below the cursor

O begin a new line above the cursor

Delete text

x delete character at the cursor

N x delete N characters from the cursor

dw delete a word.

N dw delete N words.

d0 delete to the beginning of a line.

d$ delete to the end of a line.

dgg delete to the beginning of the file.

dG delete to the end of the file.

dd delete line

N dd delete N lines

Simple replace text

r peplace the character under the cursor

R replace characters instead of inserting them

Copy/Paste text

yy copy current line into storage buffer

p paste storage buffer after current line

N p paste N times storage buffer after current line

Undo/Redo operation

u undo the last operation

N u undo the last N operations

Ctrl + rredo the last undo operation

N Ctrl + rredo the last N undo operations

smalltalkvimmode's People

Contributors

capsulecorplab avatar seandenigris avatar webcpu 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smalltalkvimmode's Issues

Not working for Pharo 9

I see that this was supported for Pharo 6 so expecting it to automatically work for Pharo 9 was a bit of a stretch. However, my fingers are trained for vim after 25 years and hard to go over to a mouse to do selective editing. Any chance to get this ressurected to work for Pharo 9?

How to install?

Hi!
I executed the code in the playground, but I don't see a way to activate the vim mode.

Load script in README

The current script is very cool!

That said, it may throw seasoned Pharo-ers of because the style is so unusual. I assume it's a functional style? IMHO it may be better to show that off elsewhere giving the context to understand what the point is. A more traditional script would be:

Metacello new
	baseline: 'SmalltalkVimMode';
	repository: 'github://unchartedworks/SmalltalkVimMode';
	onConflict: [ :ex | ex allow ];
	load.

NB: also notice that #get isn't needed because it's included in #load

Could not find accessor for "version"

Cool project idea, didn't even expect this to exist!

On a new 6.1 64-bit image obtained via Pharo launcher, I opened the playground, pasted the instructions, and chose "Do it". The full error received was 'Could not find accessor for variable named "version"'. I tried the alternative script suggested by someone in the issues (for readability reasons, not due to any errors) and that failed the same way.

I tried on the most recent 8.0 64-bit version just to see if the error was any different, and the code runs without any issue; however it sadly doesn't do anything that I could notice.

Apologies if this was something obvious, or I misunderstood the directions. Cheers.

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.