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> * ?
noremapvariants over plainmap– D. Ben Knoble Sep 16 '18 at 22:38<leader>tfis not in the foreign vimrc whilemap <space>is. – tivn Sep 17 '18 at 02:50<space>doesn't work you could check this question of mine How to debug a mapping? if you follow the steps of the answer and report the results here it might be easier to help you. Also the usual pitfalls: - don't put a comment on the same line as a mapping, specify the mode of your mappings (nmapinstead ofmap) and use the nonrecursive version of the commands (nnoremapinstead ofnmap) – statox Sep 17 '18 at 09:22/etcis 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 usesudoeditinstead. – statox Sep 17 '18 at 09:26<leader>is not processed. You can try to map it to anything, but it won't work. Same with<space>. Nearly all mapping won't work if I place it at global config folder (/etc/) – tonny Sep 17 '18 at 10:38etc. Sometimes I juggle between users and use vim. If I must put vim to each users, it's annoying. When I updating my vimrc, I must override all local vimrc for each user.
– tonny Sep 17 '18 at 11:11sudoedit? Noted. Will try that.~/.vim/vimrc. Try move it to~/.vimrcor ensure yousourceit from this file if it is exist. – tivn Sep 17 '18 at 12:03~/.vim/vimrc(theres a specific order it searches in though) – D. Ben Knoble Sep 17 '18 at 13:01~/.vim/vimrcbut on vim 7.4 of my Linux it is indeed read unless~/.vimrcexist. – tivn Sep 17 '18 at 13:52~/.vim/vimrcis not a global, but a local config, like @D. Ben Knoble stated. And all local config, whether~/.vimrcor '~/.vim/vimrc' is working correctly. What's not working is when you placed thevimrcto/etc(make it global) – tonny Sep 17 '18 at 15:11<leader>correctly (but only sometimes) – D. Ben Knoble Dec 18 '18 at 00:50