vim: minor vimrc formatting change
This commit is contained in:
parent
3a168c72a0
commit
36582437f4
1 changed files with 127 additions and 128 deletions
|
@ -83,155 +83,154 @@ endif
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" Plugins {{{
|
" Plugins {{{
|
||||||
call plug#begin('$XDG_CONFIG_HOME/vim/bundle')
|
call plug#begin('$XDG_CONFIG_HOME/vim/bundle')
|
||||||
Plug 'altercation/vim-colors-solarized'
|
Plug 'altercation/vim-colors-solarized'
|
||||||
Plug 'bronson/vim-trailing-whitespace'
|
Plug 'bronson/vim-trailing-whitespace'
|
||||||
Plug 'elzr/vim-json'
|
Plug 'elzr/vim-json'
|
||||||
" Make numbers and booleans stand out, important because of the
|
" Make numbers and booleans stand out, important because of the
|
||||||
" concealment used by vim-json.
|
" concealment used by vim-json.
|
||||||
highlight link jsonBraces Text
|
highlight link jsonBraces Text
|
||||||
highlight link jsonNumber Identifier
|
highlight link jsonNumber Identifier
|
||||||
highlight link jsonBoolean Identifier
|
highlight link jsonBoolean Identifier
|
||||||
highlight link jsonNull Identifier
|
highlight link jsonNull Identifier
|
||||||
Plug 'godlygeek/tabular' | Plug 'plasticboy/vim-markdown'
|
Plug 'godlygeek/tabular' | Plug 'plasticboy/vim-markdown'
|
||||||
let g:vim_markdown_conceal_code_blocks = 0
|
let g:vim_markdown_conceal_code_blocks = 0
|
||||||
Plug 'junegunn/rainbow_parentheses.vim'
|
Plug 'junegunn/rainbow_parentheses.vim'
|
||||||
let g:rainbow#pairs = [['(',')'], ['[',']'], ['{','}']]
|
let g:rainbow#pairs = [['(',')'], ['[',']'], ['{','}']]
|
||||||
Plug 'kien/ctrlp.vim'
|
Plug 'kien/ctrlp.vim'
|
||||||
let g:ctrlp_match_window = 'bottom,order:ttb'
|
let g:ctrlp_match_window = 'bottom,order:ttb'
|
||||||
let g:ctrlp_switch_buffer = 0 " open files in new buffer
|
let g:ctrlp_switch_buffer = 0 " open files in new buffer
|
||||||
let g:ctrlp_show_hidden = 1 " show hidden files
|
let g:ctrlp_show_hidden = 1 " show hidden files
|
||||||
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
|
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
|
||||||
Plug 'tpope/vim-commentary'
|
Plug 'tpope/vim-commentary'
|
||||||
Plug 'tpope/vim-fugitive'
|
Plug 'tpope/vim-fugitive'
|
||||||
Plug 'vim-airline/vim-airline'
|
Plug 'vim-airline/vim-airline'
|
||||||
Plug 'vim-airline/vim-airline-themes'
|
Plug 'vim-airline/vim-airline-themes'
|
||||||
if !exists('g:airline_symbols')
|
if !exists('g:airline_symbols')
|
||||||
let g:airline_symbols = {}
|
let g:airline_symbols = {}
|
||||||
endif
|
|
||||||
let g:airline_left_sep = ' '
|
|
||||||
let g:airline_left_alt_sep = ''
|
|
||||||
let g:airline_right_sep = ' '
|
|
||||||
let g:airline_right_alt_sep = ''
|
|
||||||
let g:airline_symbols.crypt = '🔒'
|
|
||||||
let g:airline_symbols.branch = '⎇'
|
|
||||||
let g:airline_symbols.paste = 'Ⓟ'
|
|
||||||
let g:airline_symbols.spell = '✔'
|
|
||||||
let g:airline_symbols.readonly = ' ⃠'
|
|
||||||
let g:airline_symbols.notexists = '∄'
|
|
||||||
let g:airline_symbols.whitespace = '✗'
|
|
||||||
Plug 'vim-scripts/srec.vim'
|
|
||||||
highlight link srecStart Comment
|
|
||||||
highlight link srecType Comment
|
|
||||||
highlight link srecLength WarningMsg
|
|
||||||
highlight link srec16BitAddress Constant
|
|
||||||
highlight link srec24BitAddress Constant
|
|
||||||
highlight link srec32BitAddress Constant
|
|
||||||
highlight link srecChecksum Type
|
|
||||||
Plug 'keith/swift.vim'
|
|
||||||
Plug 'chr4/nginx.vim'
|
|
||||||
call plug#end()
|
|
||||||
|
|
||||||
" This has to be here (as opposed to right after the Plug call) because the
|
|
||||||
" function airline#section#create doesn't exist before plug#end() is
|
|
||||||
" called. THe exists() call is still needed so no errors are generated on
|
|
||||||
" the very first time vim is run, as no plugins are installed yet.
|
|
||||||
if exists("airline#section#create")
|
|
||||||
if has('multi_byte') && &encoding ==# 'utf-8'
|
|
||||||
let g:airline_section_z = airline#section#create(['ℓ%4l/%L 𝚌%3v'])
|
|
||||||
else " line / total : col
|
|
||||||
let g:airline_section_z = airline#section#create(['L%4l/%L c%3v'])
|
|
||||||
endif
|
endif
|
||||||
endif
|
let g:airline_left_sep = ' '
|
||||||
|
let g:airline_left_alt_sep = ''
|
||||||
|
let g:airline_right_sep = ' '
|
||||||
|
let g:airline_right_alt_sep = ''
|
||||||
|
let g:airline_symbols.crypt = '🔒'
|
||||||
|
let g:airline_symbols.branch = '⎇'
|
||||||
|
let g:airline_symbols.paste = 'Ⓟ'
|
||||||
|
let g:airline_symbols.spell = '✔'
|
||||||
|
let g:airline_symbols.readonly = ' ⃠'
|
||||||
|
let g:airline_symbols.notexists = '∄'
|
||||||
|
let g:airline_symbols.whitespace = '✗'
|
||||||
|
Plug 'vim-scripts/srec.vim'
|
||||||
|
highlight link srecStart Comment
|
||||||
|
highlight link srecType Comment
|
||||||
|
highlight link srecLength WarningMsg
|
||||||
|
highlight link srec16BitAddress Constant
|
||||||
|
highlight link srec24BitAddress Constant
|
||||||
|
highlight link srec32BitAddress Constant
|
||||||
|
highlight link srecChecksum Type
|
||||||
|
Plug 'keith/swift.vim'
|
||||||
|
Plug 'chr4/nginx.vim'
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
silent! colorscheme solarized
|
" This has to be here (as opposed to right after the Plug call) because the
|
||||||
filetype plugin indent on
|
" function airline#section#create doesn't exist before plug#end() is
|
||||||
syntax enable
|
" called. The exists() call is still needed so no errors are generated on
|
||||||
|
" the very first time vim is run, as no plugins are installed yet.
|
||||||
|
if exists("airline#section#create")
|
||||||
|
if has('multi_byte') && &encoding ==# 'utf-8'
|
||||||
|
let g:airline_section_z = airline#section#create(['ℓ%4l/%L 𝚌%3v'])
|
||||||
|
else " line / total : col
|
||||||
|
let g:airline_section_z = airline#section#create(['L%4l/%L c%3v'])
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
silent! colorscheme solarized
|
||||||
|
filetype plugin indent on
|
||||||
|
syntax enable
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" Functions {{{
|
" Functions {{{
|
||||||
" Cycle through relativenumber + number, number (only), and no numbering.
|
" Cycle through relativenumber + number, number (only), and no numbering.
|
||||||
function! VimrcCycleNumbers() abort
|
function! VimrcCycleNumbers() abort
|
||||||
if exists('+relativenumber')
|
if exists('+relativenumber')
|
||||||
execute {
|
execute {
|
||||||
\ '00': 'set relativenumber | set number',
|
\ '00': 'set relativenumber | set number',
|
||||||
\ '01': 'set norelativenumber | set number',
|
\ '01': 'set norelativenumber | set number',
|
||||||
\ '10': 'set norelativenumber | set nonumber',
|
\ '10': 'set norelativenumber | set nonumber',
|
||||||
\ '11': 'set norelativenumber | set number' }[&number . &relativenumber]
|
\ '11': 'set norelativenumber | set number' }[&number . &relativenumber]
|
||||||
else
|
else
|
||||||
set number! " No relative numbering, just toggle numbers on and off.
|
set number! " No relative numbering, just toggle numbers on and off.
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Turn fold text from this:
|
" Turn fold text from this:
|
||||||
"
|
"
|
||||||
" +--- 2 lines: text of first line in fold --------------------------
|
" +--- 2 lines: text of first line in fold --------------------------
|
||||||
"
|
"
|
||||||
" into this:
|
" into this:
|
||||||
"
|
"
|
||||||
" ··· 2ℓ: text of first line in fold ······························
|
" ··· 2ℓ: text of first line in fold ······························
|
||||||
function! VimrcFoldText() abort
|
function! VimrcFoldText() abort
|
||||||
let l:level=substitute(v:folddashes, '-', '·', 'g')
|
let l:level=substitute(v:folddashes, '-', '·', 'g')
|
||||||
let l:count=(v:foldend - v:foldstart + 1)
|
let l:count=(v:foldend - v:foldstart + 1)
|
||||||
let l:title=substitute(getline(v:foldstart), '\v *', '', '')
|
let l:title=substitute(getline(v:foldstart), '\v *', '', '')
|
||||||
return l:level . ' ' . l:count . 'ℓ: ' . l:title . ' '
|
return l:level . ' ' . l:count . 'ℓ: ' . l:title . ' '
|
||||||
endfunction
|
endfunction
|
||||||
" }}}"
|
" }}}"
|
||||||
|
|
||||||
" Mappings {{{
|
" Mappings {{{
|
||||||
let mapleader = "\<space>"
|
let mapleader = "\<space>"
|
||||||
let maplocalleader = ","
|
let maplocalleader = ","
|
||||||
|
|
||||||
" better navigation for wrapped lines
|
" better navigation for wrapped lines
|
||||||
noremap j gj
|
noremap j gj
|
||||||
noremap k gk
|
noremap k gk
|
||||||
|
|
||||||
" quickly exit insert mode
|
" quickly exit insert mode
|
||||||
inoremap jk <esc>
|
inoremap jk <esc>
|
||||||
|
|
||||||
" retain selection when indenting/unindenting in visual mode
|
" retain selection when indenting/unindenting in visual mode
|
||||||
vnoremap > ><cr>gv
|
vnoremap > ><cr>gv
|
||||||
vnoremap < <<cr>gv
|
vnoremap < <<cr>gv
|
||||||
|
|
||||||
" better searching (case insensitive & expand on previous)
|
" better searching (case insensitive & expand on previous)
|
||||||
nnoremap // /\c
|
nnoremap // /\c
|
||||||
nnoremap /// /<C-R>/
|
nnoremap /// /<C-R>/
|
||||||
|
|
||||||
" window resizing similar to the way I have tmux set up
|
" window resizing similar to the way I have tmux set up
|
||||||
nnoremap <c-w><c-k> 5<c-w>+
|
nnoremap <c-w><c-k> 5<c-w>+
|
||||||
nnoremap <c-w><c-j> 5<c-w>-
|
nnoremap <c-w><c-j> 5<c-w>-
|
||||||
nnoremap <c-w><c-h> 5<c-w><
|
nnoremap <c-w><c-h> 5<c-w><
|
||||||
nnoremap <c-w><c-l> 5<c-w>>
|
nnoremap <c-w><c-l> 5<c-w>>
|
||||||
|
|
||||||
" easier window navigation
|
" easier window navigation
|
||||||
nnoremap <c-j> <c-w>j
|
nnoremap <c-j> <c-w>j
|
||||||
nnoremap <c-k> <c-w>k
|
nnoremap <c-k> <c-w>k
|
||||||
nnoremap <c-h> <c-w>h
|
nnoremap <c-h> <c-w>h
|
||||||
nnoremap <c-l> <c-w>l
|
nnoremap <c-l> <c-w>l
|
||||||
|
|
||||||
" easier tab navigation
|
" easier tab navigation
|
||||||
nnoremap <c-n> :tabprevious<cr>
|
nnoremap <c-n> :tabprevious<cr>
|
||||||
nnoremap <c-m> :tabnext<cr>
|
nnoremap <c-m> :tabnext<cr>
|
||||||
|
|
||||||
" quickly change background
|
" quickly change background
|
||||||
nnoremap <leader>bg
|
nnoremap <leader>bg
|
||||||
\ :let &background = &background ==# 'light' ? 'dark' : 'light'<cr>
|
\ :let &background = &background ==# 'light' ? 'dark' : 'light'<cr>
|
||||||
|
|
||||||
" turn off search highlight
|
" turn off search highlight
|
||||||
nnoremap <leader>h :nohlsearch<cr>
|
nnoremap <leader>h :nohlsearch<cr>
|
||||||
|
|
||||||
" toggle NERDTree
|
" toggle NERDTree
|
||||||
nnoremap <leader>n :NERDTreeToggle<cr>
|
nnoremap <leader>n :NERDTreeToggle<cr>
|
||||||
|
|
||||||
" toggle rainbow parens
|
" toggle rainbow parens
|
||||||
nnoremap <leader>p :RainbowParentheses!!<cr>
|
nnoremap <leader>p :RainbowParentheses!!<cr>
|
||||||
|
|
||||||
" fix whitespace
|
" fix whitespace
|
||||||
nnoremap <leader>w :FixWhitespace<cr>
|
nnoremap <leader>w :FixWhitespace<cr>
|
||||||
|
|
||||||
" cycle through line numbering modes
|
|
||||||
nnoremap <silent> <leader>l :call VimrcCycleNumbers()<CR>
|
|
||||||
|
|
||||||
|
" cycle through line numbering modes
|
||||||
|
nnoremap <silent> <leader>l :call VimrcCycleNumbers()<CR>
|
||||||
" }}}"
|
" }}}"
|
||||||
|
|
||||||
augroup vimrc " {{{
|
augroup vimrc " {{{
|
||||||
|
|
Loading…
Add table
Reference in a new issue