1
0
Fork 0
mirror of synced 2024-11-05 08:58:59 -05:00
ultimate-vim/README.md

111 lines
3.8 KiB
Markdown
Raw Normal View History

2019-08-07 14:34:24 -04:00
# The Ultimate vimrc - Addons Edition
2019-08-06 19:24:33 -04:00
Additional mappings and a few modifications. [EasyMotion](https://github.com/easymotion/vim-easymotion) is included in the plugins.
2012-05-29 12:19:29 -04:00
2019-08-07 14:34:24 -04:00
## How to install the Addons Edition?
2012-05-29 17:32:24 -04:00
### Install for your own user only
2012-05-29 17:32:24 -04:00
2019-08-07 15:01:15 -04:00
git clone --depth=1 https://github.com/aquaductape/vimrc.git ~/.vim_runtime && sh ~/.vim_runtime/install_awesome_vimrc.sh
2012-05-29 17:32:24 -04:00
2019-08-06 19:24:33 -04:00
### Install for multiple users
2019-04-19 04:33:56 -04:00
2019-08-06 19:24:33 -04:00
To install for multiple users, the repository needs to be cloned to a location accessible for all the intended users.
2019-04-19 04:33:56 -04:00
2019-08-07 14:34:24 -04:00
git clone --depth=1 https://github.com/aquaductape/vimrc.git /opt/vim_runtime
sh /opt/vim_runtime/install_awesome_parameterized.sh /opt/vim_runtime user0 user1 user2
2019-08-06 19:24:33 -04:00
# to install for all users with home directories
2019-08-07 14:34:24 -04:00
sh /opt/vim_runtime/install_awesome_parameterized.sh /opt/vim_runtime --all
Naturally, `/opt/vim_runtime` can be any directory, as long as all the users specified have read access.
2019-08-07 14:08:09 -04:00
2019-08-07 15:15:42 -04:00
## What was Changed?
`basic.vim`
let mapleader = " "
2019-08-07 14:44:15 -04:00
## What was Added?
2019-08-07 14:08:09 -04:00
2019-08-07 14:44:15 -04:00
Some mappings are commented out
2019-08-07 14:08:09 -04:00
2019-08-07 15:15:42 -04:00
`basic.vim`
" Display line numbers
set number
2019-08-07 14:08:09 -04:00
" Treat long lines as break lines (useful when moving around in them)
map j gj
map k gk
" Remap VIM ESC to normal mode from insert mode using jj
" only issue when you need to literally type two jj's in insert mode therefore you must type slowly
imap jj <Esc>
" Just like traditional Select All, Ctrl+a
map <C-a> ggVG
" Remap VIM H to first non-blank character
map H ^
" Remap VIM L to last blank character
map L $
" Clears highlighting
map <C-n> :noh<return>
" Replace word by occurence, press '.' to move to the next occurence which auto replaces with new word. I use it to rename variables. So far I haven't found a mapping that does it by scope reliably like vscode.
nnoremap gr *``cgn
" This loop remaps all 'alt key + character' to '\e + character'
" On my vim(windows, but some other windows users didn't have a problem)
" it won't recognize the Meta key when Alt is pressed
" https://vi.stackexchange.com/questions/2350/how-to-map-alt-key/2363
" for i in range(97,122)
" let c = nr2char(i)
" execute "set <M-".c.">=\e".c.""
" " On the 'j' iteration it would look like this
" " --> execute \"set <M-j>=\ej"
" endfor
" These two mappings are a quality of life improvement of copy/pasting from the clipboard
" Effectively this paste map applies the indent within the pasted content from the indent level that you're at when you invoke the pasting
" http://tilvim.com/2014/03/18/a-better-paste.html
map <Leader>p :set paste<CR>o<esc>"*]p:set nopaste<cr>
vmap <Leader>y "+y
2019-08-07 15:15:42 -04:00
`plugins_config.vim`
2019-08-07 14:08:09 -04:00
" Turn on case-insensitive feature
let g:EasyMotion_smartcase = 1
2019-08-07 14:14:00 -04:00
" Open a NERDTree automatically when vim starts up if no files were specified
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Open NERDTree automatically when vim starts up on opening a directory
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif
" Shortcut to open NERDTree
map <C-t> :NERDTreeToggle<CR>
" Close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
2019-08-07 14:44:15 -04:00
## Removed
2019-08-07 15:15:42 -04:00
`basic.vim`
2019-08-07 14:44:15 -04:00
map <leader>pp :setlocal paste!<cr>
2019-08-08 08:29:33 -04:00
" Map <Space> to / (search) and Ctrl-<Space> to ? (backwards search)
map <space> /
map <c-space> ?
2019-08-07 14:44:15 -04:00
2019-08-07 15:15:42 -04:00
`plugins_config.vim`
2019-08-07 14:44:15 -04:00
map <leader>nn :NERDTreeToggle<cr>
map <leader>nb :NERDTreeFromBookmark<Space>
map <leader>nf :NERDTreeFind<cr>