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> * ?
<leader>tf
is not in the foreign vimrc whilemap <space>
is. – tivn Sep 17 '18 at 2:50/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 usesudoedit
instead. – statox Sep 17 '18 at 9:26~/.vim/vimrc
(theres a specific order it searches in though) – D. Ben Knoble♦ Sep 17 '18 at 13:01