I'm using basic version vimrc from https://github.com/amix/vimrc. No problem if I put my vimrc at /home/{user}/.vimrc, but if I put it in /etc/vimrc (arch) or /etc/vim/vimrc (debian), it becomes a problem.

The problem is: I cannot use:

let mapleader = ","

And then make a mapping that uses <leader>:

map <leader>tf :tabnew **/*    "fuzzy search file and open in new tab
map <leader>tn :tabnew<cr>     "open a blank new tab

Or just mapping a <space>:

map <space> /
map <c-space> ?

At my arch workstation, I open vim from konsole. In my debian server, I ssh-ed to open it (so, a tty).

Edit (more information) with command :map with global vimrc (from @statox link):

   0             ^
   <Leader>m   * mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
v  <C-S-k>       :m'<-2<cr>`>my`<mzgv`yo`z
v  <C-S-j>       :m'>+<cr>`<my`>mzgv`yo`z
n  <C-S-k>       mz:m-2<cr>`z
n  <C-S-j>       mz:m+<cr>`z
   <leader>cd    :cd %:p:h<cr>:pwd<cr>
   <leader>te    :tabedit <c-r>=expand("%:p:h")<cr>/
   <leader>tf    :call fzf#run({'sink': 'tabedit'})<cr>
   <leader>tc    :tabclose<cr>
   <leader>tn    :tabnew<cr>
   <leader>tz    :tabnew **/*
n  <c-space>   * ?
n  <space>     * /

So, most of the keys are not mapped correctly except a few like map 0 ^

And this is :map command when I drop the vimrc to ~/.vim/vimrc

   0             ^
   ,m   * mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
v  <C-S-k>       :m'<-2<cr>`>my`<mzgv`yo`z
v  <C-S-j>       :m'>+<cr>`<my`>mzgv`yo`z
n  <C-S-k>       mz:m-2<cr>`z
n  <C-S-j>       mz:m+<cr>`z
   ,cd    :cd %:p:h<cr>:pwd<cr>
   ,te    :tabedit <c-r>=expand("%:p:h")<cr>/
   ,tf    :call fzf#run({'sink': 'tabedit'})<cr>
   ,tc    :tabclose<cr>
   ,tn    :tabnew<cr>
   ,tz    :tabnew **/*
n  <c-space>   * ?
  • What is the error message you got?
    – tivn
    Sep 16, 2018 at 16:10
  • there's no error message. It just the 'shortcut' is not functioning.
    – tonny
    Sep 16, 2018 at 18:56
  • 1
    You need to specify clearly what you expect, what you type, whether the mapping is used before you apply the foreign vimrc or not. I see <leader>tf is not in the foreign vimrc while map <space> is.
    – tivn
    Sep 17, 2018 at 2:50
  • 2
    Also I don't think that putting your complete vimrc in /etc is a good idea: your vimrc contains your mappings and your configurations, other users don't need such a complete generic vimrc (since they can override it with their own vimrc). And if you do that so you can have your configuration when editing a file as root, don't edit files as root use sudoedit instead.
    – statox
    Sep 17, 2018 at 9:26
  • 1
    @tivn vim does in fact read ~/.vim/vimrc (theres a specific order it searches in though)
    – D. Ben Knoble
    Sep 17, 2018 at 13:01

2 Answers 2


One thing I've just seen is that if cpo contains <, then special characters like <leader> won't be handled right:

        <   Disable the recognition of special key codes in |<>|
            form in mappings, abbreviations, and the "to" part of
            menu commands.  For example, the command
            ":map X <Tab>" results in X being mapped to:
                '<' included:   "<Tab>"  (5 characters)
                '<' excluded:   "^I"     (^I is a real <Tab>)
            Also see the 'k' flag above.

The default for vi (note: not vim) is all flags—perhaps the global vimrc is being read by vi or vim in compatible mode?

  • 1
    It’s this. The existence of a user vimrc causes nocompatible to be set implicitly, but the existence of a system-wide vimrc does not (See :help compatible). Adding an explicit set nocompatible will fix this, and is probably a good idea generally.
    – Rich
    Jan 10, 2020 at 23:35

I'll list my alternative ideas that doesn't solve the actual problem:

  1. put the vimrc file elsewhere (prefer in /etc/skel/.vim/vimrc) then make a softlink to local .vim/vimrc. The command: mkdir .vim && sudo ln -s /etc/skel/.vim/vimrc .vim/vimrc
  • Hey tonny, did you ever manage to solve this?
    – D. Ben Knoble
    Dec 11, 2019 at 22:08
  • @guntbert lol welp /shrug I can hope
    – D. Ben Knoble
    Dec 11, 2019 at 22:45
  • @D.BenKnoble nope. Still not solved. Until now, I put the .vimrc in my users .vim folder.
    – tonny
    Jul 2, 2020 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.