This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/onramp-to-vim-configuration
Just in case anyone else needs it, you some times need to manually reload $MYVIMRC configs:
Hey… I’m having trouble with getting to recognize my symbolic link
these are my exact commands
rm -rf code
mkdir -p code/dotfiles/vimrc
ln -s ~/code/dotfiles/vimrc ~/.vimrc
ERROR: Cannot source a directory: “$HOME/.vimrc”
FIX?: ln -s ~/code/dotfiles/vimrc/.vimrc ~/.vimrc
in your writeup below the video it says this…
$ ln -s ~/code/dotfiles/vimrc ~/.vimrc
in your video you run
$ ln -s ~/code/dotfiles/vim/vimrc ~/.vimrc
either way I do it…
it returns the following error when I open vim
Cannot source a directory: “$HOME/.vimrc”
I think it’s a problem in your video, but I got it to work. And sorry for the crappy formatting of this response…
Hey @thedanotto, sorry for the confusion. The symbolic link needs to be created to point at your existing vimrc file, whereever that is on your computer. The second argument,
.vimrc will always be the same as Vim always looks to the same file, specifically
~/.vimrc for configuration.
As an example:
$ pwd /Users/christoomey/other-code/vim $ ls vimrc $ cd ~ $ pwd /Users/christoomey $ ln -s ~/other-code/vim/vimrc .vimrc
After making the symlink you can confirm it is set by running
$ ls -laFG .vimrc lrwxr-xr-x 1 christoomey staff 42 Jul 1 11:58 .vimrc@ -> /Users/christoomey/code/dotfiles/vim/vimrc
It should point to the actual file. You can also
cat the file from your home dir to confirm.
I’ve also updated the video notes to match the video. Thanks for the heads up on that!
Thanks, Chris. But in my case I didn’t have an existing vimrc file. That started my confusion, I suppose. But to really beat this horse to death…
ln -s ~/other-code/vim/vimrc should be a file and not a directory? And that’s the file I edit?
One other thing that didn’t work as seamlessly as the video…
nmap <leader>so :source $MYVIMRC<CR>
wasn’t refreshing $MYVIMRC, I would have to exit vim and restart it. But the following line did work.
nmap <leader>so :w <cr> <bar> :source $MYVIMRC<CR>
And lastly… the whole reason I’m watching this video right now is in this video at 7:57 he types
RTcontroller todos and it automagically opens up the todos controller. Could you provide the config for that?
YESSSSSSSSSSSSSS, figured it out.
had to install this…
but the new version uses
Hi @thedanotto, glad you got it all sorted it out! Just for completeness sake, your
vimrc file should already exist before running a symlink command. A symlink exists to take an existing file in some alternate directory, and make it seem as if it lives in the target directory.
@benorenstein That binding.pry mapping is genius. I’ll be trying that one and the rd for running rspec. Thanks for showing some of your file!
Hey I’m having no success in getting
imap <C-s> <esc>:w<cr> to work at all-it just doesn’t do anything.
- OSX Elcapitan
- Terminal 2.6.1(361.1)
- Vim 7.4.936
Hi @nguyenj, Control-S has special use with relation to flow control. In order to use it as a Vim shortcut, you’ll need to disable flow control in the shell that launches Vim. Here’s a snippet from @benorenstein’s dotfiles where he does that for zsh.
Once you change that setting in your shell you should be able to map Control-S in Vim.
Hi @geoffharcourt, on mapping I had the same issue @nguynj had. The solution I found was to add
stty -ixon in my .zshrc based on this SO post. My understanding is it disables XON/XOFF flow control. Not sure if that’s equivalent to
stty start undef and
stty stop undef.
I’m not a shell expect, but from
man stty that looks like it has the same effect.
FWIW, I found after a while that I stopped using that
<C-s> mapping and just relied on
:w for saves and on saving the current buffer whenever I ran a test.
One thing I’ve noticed:
:browse set doesn’t behave as shown in the video by default. On my clean Vim install,
:browse set brings up a list of options and their current values, whereas
:opt brings up the list of all possible options. Is this behavior that’s changed recently? The
:help page for
:opt says it’s aliased as
:browse set, but in practice this isn’t the case.
Hmm, not sure what to make of that. You can check if any custom plugin commands are overriding by running
verbose command set and check the output, but otherwise I’m not sure what’s going on here.
How incredibly odd.
verbose command set didn’t show anything, and I was able to replicate the incorrect
browse set behavior on another computer’s Vim installation. I’ll do some more digging and see if I can’t get to the bottom of this– any recommendations on where to look?
I have noticed in Ben’s dotfiles that he remaps
, to the leader key.
In an earlier episode you guys mention that
, are very useful to repeat a find forwards or backwards. But with this mapping, you can’t repeat backwards. Do you just not use them at all, or how do you manage them?
Hey @jeromedalbert, I’m not sure if Ben currently does this, but I’ve personally moved away from it a while back. In general I prefer to not map over existing functionality whenever possible these days.
That said, if anyone is doing this (or a similar mapping that takes over an built in mapping), you can actually swap them such that
; would be
: would be
;. This makes entering commands, possibly the more common case, easier since you don’t have to hold shift, but also still allows “repeat most recent f,F,t,T motion” by using shift.
" Swap ; and : nnoremap ; : nnoremap : ;
Cool, I used to use
, too, but to avoid remapping over existing functionality, and also because I found it much easier on the fingers in the long run, I have personally mapped
By the way, repeatedly using the VIM default shortcuts started giving me slight RSI symptoms (!) so I went way overboard by remapping my MBP keys to behave like the ADM-3A terminal keyboard used by the creator of Vi.
Caps lock becomes
Escape (I tab with
Ctrl+i) and in normal mode
:. Way easier on my fingers in the long run, and the symptoms have disappeared. Also the hands are always on the home row now.
Firstly, geat trail!
There are two problems I am facing:
1 - I have set Space as my leader key, but while I specify these insert maps:
There is a delay every time I hit space while typing.
2 - I am trying to move from Atom, where all the project files are displayed on the left, which I hugely miss, but any type of file explorer is deemed anti-pattern here, so what would be the workaround for the incompleteness feeling without a file explorer always visible?