VSCodeVim / Vim

:star: Vim for Visual Studio Code
http://aka.ms/vscodevim
MIT License
13.75k stars 1.31k forks source link

.vimrc support #463

Open johnfn opened 8 years ago

johnfn commented 8 years ago

The VSCodeVim team prioritizes issues based on reaction count.


Support an actual .vimrc file alongside our current settings.json.

Allow users to specify a location for the .vimrc insite the settings.json file.

Support basic .vimrc commands.

rebornix commented 8 years ago

Yup, assign this to me as I'm working on a prototype.

johnfn commented 8 years ago

sick!

jpoon commented 7 years ago

Re-opening this -- we don't have .vimrc support.

johnfn commented 7 years ago

I'm gonna close this as although it's true that we don't support .vimrc, I believe our settings.json support is a solid equivalent, except better because it has autocomplete and documentation popups.

If anyone disagrees, feel free to open a conversation on this issue.

kristiandupont commented 7 years ago

Well, I have a shared vimrc file for vim and vsvim. I would have loved to include that from here as well.

wfxr commented 7 years ago

I also expect vimrc support feature. Almost everyone using vscodevim knows how to config vimrc. So documentation popups feature is not that important as far as I see.

I agree setting.json is good, but I think reuse and DRY means much. We can use vimrc in vsvim, ideavim, neovim, etc, but we cant't use vscode setting.json anywhere else. That's the problem.

Maybe support both setting.json and vimrc is a better way?

johnfn commented 7 years ago

I see your argument. Reopening this issue.

pietvanzoen commented 7 years ago

+1 for this feature. Is there any update?

johnfn commented 7 years ago

It's certainly on my radar, however it is currently deprioritized because:

If a bunch of people thumbs up the original issue, I'll certainly reconsider :)

polunzh commented 7 years ago

+1 for this feature. Is there any update?

johnfn commented 7 years ago

@polunzh The update is the post I made 9 days ago right above you. :P

If you're curious, we pretty much tackle issues in this order: https://github.com/VSCodeVim/Vim/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc

atedja commented 7 years ago

Just discovered Visual Studio Code, and immediately installed this plugin only to discover my .vimrc isn't being recognized :cry: I can't use vim mode without my vimrc, too many keybindings that I have developed over the years and too lazy to port them over to this plugin.

Chillee commented 7 years ago

@atedja Luckily, very good progress is being made on that front. Through neovim integration, we'll be able to support your entire .vimrc (including plugins)!

https://github.com/VSCodeVim/Vim/pull/1897 is the PR you want to track.

mvalkon commented 6 years ago

@johnfn any status updates on this issue? I think it's currently the third highest prioritised task. Thanks!

For a temporary quick-hack, does anyone have a tool for converting keybindings from a .vimrc (or an .init.vim) into settings.json?

nickbrooking commented 6 years ago

Looks like this is now the #1 requested issue, hopefully we can see this supported soon? This is the only thing preventing me from using VSCode.

canyon289 commented 6 years ago

I also would really like the ability to switch between vscode and vim when needed. This is a must for me!

skylarmb commented 5 years ago

not having to manually re-create my entire 375 line .vimrc in a json file would be ideal... either a one-time converter or first-party support would be awesome

bluprince13 commented 5 years ago

I would be super keen to have this. It's not practical to duplicate key bindings in both vscode's settings and .vimrc.

vinceau commented 5 years ago

@rebornix any updates on this issue?

johnfn commented 5 years ago

Unlike our other highly upvoted issues which are difficult due to VSCode API limitations, this one is completely doable. Even without much experience in the codebase, someone could take a whack at this, since all you have to do is basically regex match a bunch of lines of a file. And getting even small sections of vimrc parsing up and running would probably be useful to lots of folks.

devanshuDesai commented 5 years ago

Working on a third-party script to port .vimrc to settings.json right now. I'll update this with a link to the repo soon.

abduwaly commented 5 years ago

Any update on this issue? I'd love to share my .vimrc with all of the IDEs on my machine , especially as I've a huge customize configurations/mappings

Sheepolution commented 5 years ago

I wrote a simple parser for this in Python.

Download

Example

.vim

nmap nt gg
nnoremap + <C-a>
vnoremap Y :w<CR>

settings.json

{
    "vim.normalModeKeyBindings": [
        {
            "before": ["n", "t"],
            "after": ["g", "g"]
        }
    ],
    "vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": ["+"],
            "after": ["<C-a>"]
        }
    ],
    "vim.visualModeKeyBindingsNonRecursive": [
        {
            "before": ["Y"],
            "commands": [":w"]
        }
    ]
}
drewboardman commented 5 years ago

Is there any word on the progress of this? I think it's a highly desirable feature and it's looks like that's been the case for 3+ years.

john-dulaney commented 5 years ago

+1 To this feature, I was just able to import my .vimrc into Visual Studio 2015's Vim plugin, and now I'm surprised VSCodeVim doesn't support this.

nykc commented 5 years ago

Why is this not a thing yet? As an avid vim user I am trying to pickup VSCode fulltime for development, and keep my vim for my DevOps work. While the vim bindings offer a familiar interface I cannot leverage any of the real benefits of my .vimrc which I spent over 10 years developing...

skylarmb commented 5 years ago

In the meantime this is an excellent solution: https://github.com/neoclide/coc.nvim

drNoob13 commented 5 years ago

I think what we need right now is not implementing the .vimrc support in vscodevim right out of the box.

Instead, we should build a .vimrc to vscode-compatible json coverter to leverage the current vscode capability.

devanshuDesai commented 5 years ago

I have created a JSON converter to address this issue. Feel free to check out and contribute to this repository: vsc2vim

liulangrenaaa commented 5 years ago

I have expect this feature for a very long time.

isaiahfisher commented 4 years ago

Is there any new updates on feature progress? I am relatively new to working on plugins for vscode and working on larger community projects but if no one has figured out how to tackle this yet I could try to take a swing at it. I just need to know where to start.

J-Fields commented 4 years ago

@isaiahfisher https://github.com/VSCodeVim/Vim/pull/3908 is the current state of things. That PR could use some love, if you're interested in contributing.

J-Fields commented 4 years ago

Hey all! With the release of 1.12, I'm excited to announce that VSCodeVim now supports remappings from a .vimrc file! Special thanks go to @rdnlsmith and @Sheepolution for their great work on this.

To get started, set vim.vimrc.enable and vim.vimrc.path appropriately. You can then run the new Edit .vimrc command from the command palette.

Please note that other settings, plugins, etc. are still not supported via .vimrc. In addition, this feature shouldn't be considered 100% stable, so please test it out and submit issues with any feedback you have!

duqcyxwd commented 4 years ago

@J-Fields Do we have some examples of what we currently support?

filyp commented 4 years ago

It looks that inoremap doesn't work, while imap and nnoremap are fine.

thosakwe commented 4 years ago

Does this support <leader> mappings? I haven't been able to get any of my bindings to work at all, whether with leader or localleader.

EDIT: It turns out that you must set the leader key in VSCode's settings, not just in your .vimrc

berknam commented 4 years ago

Does this support <leader> mappings? I haven't been able to get any of my bindings to work at all, whether with leader or localleader.

EDIT: It turns out that you must set the leader key in VSCode's settings, not just in your .vimrc

Currently only the remaps are read from the .vimrc. Everything else needs to be set in vscode settings.

kyprifog commented 4 years ago

Just my 2 cents, but as a long time vim user often with intellij this not being figured out is my number one reason why I haven't more seriously considered switching to vscode for a while now. Don't really want to learn vscodes unique syntax for how to set up settings.json for my vimrc file.

mieubrisse commented 3 years ago

~Any progress on this front? Per the comment earlier, it looks like this is the most-upvoted issue via https://github.com/VSCodeVim/Vim/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc (as posted in https://github.com/VSCodeVim/Vim/issues/463#issuecomment-285596507 )~

EDIT: Looks like I spoke too soon and this is actually working, modulo a bug!

laoshaw commented 2 years ago

jetbrains can read .vimrc just fine, hope vscode can do the same some day.

bhingston-va commented 2 years ago

jetbrains can read .vimrc just fine, hope vscode can do the same some day.

I'm not sure if it's considered or untrivial, but I enjoy how jetbrains just swallows my vimrc and am not annoyed by the silent failures (basically it reads and supports what it can). It still works even after refactoring my vimrc into subfolders (few years ago) and just "plugged" from my main vimrc call plug#begin('~/dotfiles/vimide/.vim/plugged').

I'm excited to see active development on this.