Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.vimrc keybindings not loaded though settings are in place #4384

Closed
willhaslett opened this issue Dec 15, 2019 · 9 comments · Fixed by #4449
Closed

.vimrc keybindings not loaded though settings are in place #4384

willhaslett opened this issue Dec 15, 2019 · 9 comments · Fixed by #4449

Comments

@willhaslett
Copy link

willhaslett commented Dec 15, 2019

Describe the bug
Vanilla VScode install. .vimrc keybindings not working

To Reproduce
Steps to reproduce the behavior:

  1. Verify Vim extension installed
  2. Set vim.vimrc.enable and vim.vimrc.path
  3. Restart VScode
  4. No keybindings
  5. Create custom .vimrc with only keybindings in case other content is causing a problem
  6. Same results

Expected behavior
Vim plugin loads .vimrc keybindings

Environment (please complete the following information):

  • VSCode version: 1.41.0
  • OS: Mac

Additional context
.vimrc:

:imap <C-b> <Space>{\|x\| }<esc>i
:nmap <D-j> <C-W><C-W>
:nmap z :Bdelete<cr>
:nmap Z :bufdo :Bdelete<cr>
:map <S-Tab> :tabp<cr>
:nmap <Tab> :tabn<cr>
:nmap ; :vsp<Enter>:wincmd l<Enter>
:nmap <S-b> :belowright split<Enter>
:nmap <D-;> :sp<Enter>
:nmap <S-t> :NERDTreeToggle<Enter>
:nmap <D-l> :! ls -l<Enter>
:nmap <D-f> :set fullscreen<Enter>
:nmap <D-F> :set nofullscreen<Enter>
:nmap t :tabnew<Enter>
:nmap e :edit 
:nmap E :view 
:nmap , :w<Enter>
:nmap q :q<Enter>
:nmap Q :q!<Enter>
:nmap f :%s///g<Left><Left><Left>
:nmap ? /def 
:nmap sp :set paste<Enter>
:nnoremap <Enter> i<Enter><ESC>
:nmap clower :%s/[A-Z]/\L&/g
:nmap <Space> 50j
:nmap <S-i> i<Space><Esc>r
:nmap s :source ~/.vimrc<Enter>
@J-Fields
Copy link
Member

nmap, not :nmap

@willhaslett
Copy link
Author

No dice. Here is my vimrc:

will@wh~/.vscode $ cat vimrc
nmap <D-j> <C-W><C-W>
nmap z :Bdelete<cr>
nmap Z :bufdo :Bdelete<cr>
map <S-Tab> :tabp<cr>
nmap <Tab> :tabn<cr>
nmap ; :vsp<Enter>:wincmd l<Enter>
nmap <S-b> :belowright split<Enter>
nmap <D-;> :sp<Enter>
nmap <S-t> :NERDTreeToggle<Enter>
nmap <D-l> :! ls -l<Enter>
nmap <D-f> :set fullscreen<Enter>
nmap <D-F> :set nofullscreen<Enter>
nmap t :tabnew<Enter>
nmap e :edit
nmap E :view
nmap , :w<Enter>
nmap q :q<Enter>
nmap Q :q!<Enter>
nmap f :%s///g<Left><Left><Left>
nmap ? /def
nmap sp :set paste<Enter>
nnoremap <Enter> i<Enter><ESC>
nmap clower :%s/[A-Z]/\L&/g
nmap <Space> 50j
nmap <S-i> i<Space><Esc>r
nmap s :source ~/.vimrc<Enter>

Here is my settings.json:

{
    "workbench.startupEditor": "newUntitledFile",
    "vim.cursorStylePerMode.insert": "line-thin",
    "vim.vimrc.enable": true,
    "vim.debug.silent": true,
    "dart.openDevTools": "flutter",
    "editor.fontFamily": "Hack",
    "dart.debugExternalLibraries": true,
    "vim.vimrc.path": "$HOME/.vscode/vimrc"
}

Verification at the path is correct:

will@wh~/.vscode $ pwd
/Users/will/.vscode

will@wh~/.vscode $ ls -l
total 16
-rw-r--r--   1 will  staff  695 Dec 15 11:57 argv.json
drwxr-xr-x  14 will  staff  448 Dec 18 17:40 extensions
-rw-r--r--   1 will  staff  653 Dec 19 10:49 vimrc

will@wh~/.vscode $ echo $HOME
/Users/will

@J-Fields
Copy link
Member

"vim.vimrc.path": "$HOME/.vscode/vimrc"

$HOME should be fine but as a sanity check, could you try using the raw absolute path?

Unix users have had a lot of issues with 1.12, and it occurs to me that a path issue could possibly be the culprit?

@J-Fields
Copy link
Member

@willhaslett Can you try using the fully-resolved path and let me know if that solves the issue for you?

@willhaslett
Copy link
Author

Yes, it's working now. :)

@J-Fields
Copy link
Member

Thanks for verifying! So the issue seems to be that $HOME does not resolve to your actual home path?

@cvaldev
Copy link
Contributor

cvaldev commented Dec 31, 2019

@J-Fields Correct, it seems expandHome() was only considering the case of ~. I've got a possible fix for this.

@willhaslett
Copy link
Author

There's more to it than that. It was not working with the full path before, but is now. Also, a week ago, after trying once again and using $HOME in the plugin path, it started working. Then, today, when I went to verify for you, the plugin (patch installed?) could not find the .vimrc using the $HOME env var (error alert from plugin). Then, when I switched it to the full path, it started working again. Just verified again that it works with the full path, but not with $HOME now.

@J-Fields
Copy link
Member

Hmm, strange. We should be expanding environment variables, ideally with some unit tests.

@CVVPK A PR improving matters would be very much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants