vim: minor vimrc formatting change

This commit is contained in:
Fernando Schauenburg 2020-12-15 17:21:48 +01:00
parent 3a168c72a0
commit 36582437f4

View file

@ -83,7 +83,7 @@ endif
" }}}
" Plugins {{{
call plug#begin('$XDG_CONFIG_HOME/vim/bundle')
call plug#begin('$XDG_CONFIG_HOME/vim/bundle')
Plug 'altercation/vim-colors-solarized'
Plug 'bronson/vim-trailing-whitespace'
Plug 'elzr/vim-json'
@ -130,28 +130,28 @@ endif
highlight link srecChecksum Type
Plug 'keith/swift.vim'
Plug 'chr4/nginx.vim'
call plug#end()
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")
" 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
silent! colorscheme solarized
filetype plugin indent on
syntax enable
silent! colorscheme solarized
filetype plugin indent on
syntax enable
" }}}
" Functions {{{
" Cycle through relativenumber + number, number (only), and no numbering.
function! VimrcCycleNumbers() abort
" Cycle through relativenumber + number, number (only), and no numbering.
function! VimrcCycleNumbers() abort
if exists('+relativenumber')
execute {
\ '00': 'set relativenumber | set number',
@ -161,77 +161,76 @@ endif
else
set number! " No relative numbering, just toggle numbers on and off.
endif
endfunction
endfunction
" Turn fold text from this:
"
" +--- 2 lines: text of first line in fold --------------------------
"
" into this:
"
" ··· 2: text of first line in fold ······························
function! VimrcFoldText() abort
" Turn fold text from this:
"
" +--- 2 lines: text of first line in fold --------------------------
"
" into this:
"
" ··· 2: text of first line in fold ······························
function! VimrcFoldText() abort
let l:level=substitute(v:folddashes, '-', '·', 'g')
let l:count=(v:foldend - v:foldstart + 1)
let l:title=substitute(getline(v:foldstart), '\v *', '', '')
return l:level . ' ' . l:count . ': ' . l:title . ' '
endfunction
endfunction
" }}}"
" Mappings {{{
let mapleader = "\<space>"
let maplocalleader = ","
let mapleader = "\<space>"
let maplocalleader = ","
" better navigation for wrapped lines
noremap j gj
noremap k gk
" better navigation for wrapped lines
noremap j gj
noremap k gk
" quickly exit insert mode
inoremap jk <esc>
" quickly exit insert mode
inoremap jk <esc>
" retain selection when indenting/unindenting in visual mode
vnoremap > ><cr>gv
vnoremap < <<cr>gv
" retain selection when indenting/unindenting in visual mode
vnoremap > ><cr>gv
vnoremap < <<cr>gv
" better searching (case insensitive & expand on previous)
nnoremap // /\c
nnoremap /// /<C-R>/
" better searching (case insensitive & expand on previous)
nnoremap // /\c
nnoremap /// /<C-R>/
" window resizing similar to the way I have tmux set up
nnoremap <c-w><c-k> 5<c-w>+
nnoremap <c-w><c-j> 5<c-w>-
nnoremap <c-w><c-h> 5<c-w><
nnoremap <c-w><c-l> 5<c-w>>
" window resizing similar to the way I have tmux set up
nnoremap <c-w><c-k> 5<c-w>+
nnoremap <c-w><c-j> 5<c-w>-
nnoremap <c-w><c-h> 5<c-w><
nnoremap <c-w><c-l> 5<c-w>>
" easier window navigation
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
" easier window navigation
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
" easier tab navigation
nnoremap <c-n> :tabprevious<cr>
nnoremap <c-m> :tabnext<cr>
" easier tab navigation
nnoremap <c-n> :tabprevious<cr>
nnoremap <c-m> :tabnext<cr>
" quickly change background
nnoremap <leader>bg
" quickly change background
nnoremap <leader>bg
\ :let &background = &background ==# 'light' ? 'dark' : 'light'<cr>
" turn off search highlight
nnoremap <leader>h :nohlsearch<cr>
" turn off search highlight
nnoremap <leader>h :nohlsearch<cr>
" toggle NERDTree
nnoremap <leader>n :NERDTreeToggle<cr>
" toggle NERDTree
nnoremap <leader>n :NERDTreeToggle<cr>
" toggle rainbow parens
nnoremap <leader>p :RainbowParentheses!!<cr>
" toggle rainbow parens
nnoremap <leader>p :RainbowParentheses!!<cr>
" fix whitespace
nnoremap <leader>w :FixWhitespace<cr>
" cycle through line numbering modes
nnoremap <silent> <leader>l :call VimrcCycleNumbers()<CR>
" fix whitespace
nnoremap <leader>w :FixWhitespace<cr>
" cycle through line numbering modes
nnoremap <silent> <leader>l :call VimrcCycleNumbers()<CR>
" }}}"
augroup vimrc " {{{