← Back to Upcase

Configuration

@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!

1 Like

Hey I’m having no success in getting imap <C-s> <esc>:w<cr> to work at all-it just doesn’t do anything.

System spec:

  • 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 ; and , 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 :, and : 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 Leader to Space.

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 Ctrl, Tab becomes Escape (I tab with Ctrl+i) and in normal mode - becomes :. 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:
imap <leader>jk <esc>
imap <leader>kj <esc>

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?

Cheers!

Hi @mfsi-akshay, thanks for the kind words!

The delay you’re experiencing in insert mode is expected as Vim has to wait after you hit space to see if you’re going to then hit jk. In general I recommend not having any leader mappings in insert mode. Instead, the most common thing I’ve see is to map jk and kj directly (without <leader> before them). You’ll see the same delay with the first character of those pairs you type, but once you hit any other key Vim will respond. jk and kj are rare enough sequences that you’re likely safe to use them.

In the past I used NERDtree to provide a project file layout sidebar. It works very well, and if you’re really missing it then by all means give NERDtree a shot. In my case, I’ve found a combination of vim-vinegar (minimal directory explorer functionality) and CtrlP / fzf (fuzzy file finders) do much faster and more intuitive.

Most of all, I’d recommend trying out a few different things and seeing what works for you.

If anyone else has trouble to get space working as leader:
I had to map the “original” space to “no operation” to get it working.
nnoremap <Space> <Nop>
(Space might be mapped to “move right” in normal mode)

You certainly can! That said, https://github.com/BlakeWilliams/vim-pry is a plug-in that provides this behavior for you.

1 Like

Hi chris, I downloaded your dot files and made a symbolic to the vimrc as you said. I also Installed the vim-plug, vim is opening with no errors but i get nothing working.

Hi @chaand625, I wouldn’t necessarily recommend using my dotfiles directly as they’re very much specific to my workflows and preferences. If you’re looking for a good foundational set, and one that is intended for use by many people, the thoughtbot dotfiles are a perfect starting point. They also include specific instructions for installing and setting them up. With those as a foundation you can always scan through mine and find any specific things you want to borrow and use as additions to the thoughtbot ones. Hope that helps!

1 Like

@christoomey Hello Chris, Do you still use Exuberant Ctags? I am wondering which version should i use to index my files :slight_smile:

Hey there @pBorak. I’m actually between workflows right now, but I do use ctags some of the time, specifically universal ctags (a fork of the fork that was exuberant ctags I believe).

More recently I’ve been experimenting with coc.nvim which does a fantastic job with languages like javascript and typescript, and has reasonable ruby support via solargraph, although unfortunately go to definition via solargraph seems to not be implemented, so likely still want ctags for that.

Hope that helps!

1 Like