mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-08-23 22:16:48 +00:00
add vim-leader
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: vim-leader
|
||||
homepage: https://webinstall.dev/vim-leader
|
||||
tagline: |
|
||||
vim leader maps Space as Leader, keep Backslash and Comma as aliases
|
||||
---
|
||||
|
||||
To update (replacing the current version) run `webi vim-leader`.
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
> `let mapleader = " "`
|
||||
|
||||
The `<Leader>` key is typically used for your own custom shortcuts.
|
||||
|
||||
By default it's mapped to `\` (backslash) - a legacy from a time when `\` was in
|
||||
a more accessible place - but most people remap it to `,` or ` ` (space).
|
||||
|
||||
This vim-leader plugin makes Space the Leader key, but also remaps `\` and `,`
|
||||
as aliases.
|
||||
|
||||
### How to configure manually
|
||||
|
||||
The Leader key **_MUST_** be defined before any mappings that use it (probably
|
||||
before any plugins) - pretty the first thing in your `~/.vimrc`.
|
||||
|
||||
```vim
|
||||
let mapleader = ' '
|
||||
nmap <bslash> <space>
|
||||
nmap , <space>
|
||||
```
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
function __init_vim_leader() {
|
||||
set -e
|
||||
set -u
|
||||
|
||||
mkdir -p "$HOME/.vim/plugins"
|
||||
rm -rf "$HOME/.vim/plugins/shell.vim"
|
||||
|
||||
echo ""
|
||||
|
||||
if [ ! -e "$HOME/.vimrc" ]; then
|
||||
touch "$HOME/.vimrc"
|
||||
fi
|
||||
|
||||
if ! grep '^let mapleader =' -r ~/.vimrc > /dev/null 2> /dev/null; then
|
||||
rm -rf ~/.vimrc.new.1
|
||||
printf '" Set Leader to Space (with \\ and , as aliases) by webinstall.dev/vim-shell\n' >> ~/.vimrc.new.1
|
||||
printf 'let mapleader = " "\n' >> ~/.vimrc.new.1
|
||||
printf 'nmap <bslash> <space>\n' >> ~/.vimrc.new.1
|
||||
printf 'nmap , <space>\n' >> ~/.vimrc.new.1
|
||||
printf '\n' >> ~/.vimrc.new.1
|
||||
cat ~/.vimrc >> ~/.vimrc.new.1
|
||||
mv ~/.vimrc.new.1 ~/.vimrc
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Vim Leader set to Space. Edit with 'vim ~/.vimrc'"
|
||||
}
|
||||
|
||||
__init_vim_leader
|
||||
Reference in New Issue
Block a user