Is it possible to use a vimrc?


#1

I’d like to use my vimrc with cloud9’s vim mode. how do I do so?

the ide is capable of recognizing and emulating the commands. i dislike having to type :set so=7 and all that other stuff every time i launch it


Vim as Editor with Cloud9
#2

For now the only way is to use cloud9 init script (open it from cloud9 menu).
Using it you can define keybindings like

Which commands other than map and set do you need? And which set options?
I don’t think :set so=7 is supported by cloud9 vim mode.


#3

thanks much for the help! unfortunately defining those keybindings did nothing for me, i had copied that snippet exactly as you shared it and change the mappings to reflect what I wanted.

your right so=7 isn’t supported, but if i do want to go about setting things I do find are supported, how would I do so? Thanks!

(also… tiny nitpick. anyway to change the cursor color from bright red and stop it from blinking?)


#4

What mappings did you set? Key notation maybe slightly different from vim as it is not case insensitive https://github.com/ajaxorg/ace/blob/master/lib/ace/keyboard/vim.js#L901

Only 3-4 options are supported in set (search for defineOption(' in the file above)
Currently there is no clear way to set them. But many of vim options have equivalents in cloud9.
If you list which options do you want to modify, (here or in a bug report to Ace) we can implement them or find cloud9 equivalents.

To change cursor style use your opne your user stylesheet menu item and add something like this:

.normal-mode .ace_cursor{
    border: 1px solid lime;
    background-color: lime;
    opacity: 0.4!important;
}
.normal-mode .ace_hidden-cursors .ace_cursor{
    background-color: transparent;
}

#5

cursor code worked great - thank you!

this is the code I put in my init script. (yes, I did something wrong that’s obvious to you. I’m a programming noob trying to figure this out still :P)

require([“plugins/c9.ide.ace.keymaps/vim/keymap”], function(vim) {
vim.map(“j”, “gj”, “normal”)
vim.map(“gk”, “gk”, “normal”)
vim.map(“jk”, “”, “normal”)
vim.map(",b", “c9:build”, “normal”)
vim.map(",g", “c9:run”, “normal”)
});


#6

I think it doesn’t work because of vim.map("gk", "gk", "normal") probably should be vim.map("k", "gk", "normal")
What does vim.map("jk", "", "normal") supposed to do in vim? It doesn’t do anything in cloud9 now.


#7

whoops, somehow the code was copied incorrectly. here’s what I actually put:

require(["plugins/c9.ide.ace.keymaps/vim/keymap"], function(vim) {
    vim.map("j", "gj", "normal")
    vim.map("k", "gk", "normal")
    vim.map("jk", "<Esc>", "normal")
    vim.map(",b", "c9:build", "normal")
    vim.map(",g", "c9:run", "normal")
});

hmm… formatting is a little screwy. for the line vim.map(“jk”, “”, “normal”), I put < Esc > in the empty quotes


#8

Maybe you mean vim.map("jk", "<Esc>", "insert")? If you add jk mapping to normal mode it will override j mapping before.

formatting is a little screwy.

use ```js to keep code formatting.