file restructure complete
This commit is contained in:
parent
32873f9271
commit
93db8defcd
282
vimrc
282
vimrc
|
@ -1,5 +1,4 @@
|
|||
filetype off " required
|
||||
set ttyfast
|
||||
|
||||
source vimrc.plugins.vim
|
||||
source vimrc.functions.vim
|
||||
|
@ -8,285 +7,4 @@ for f in split(glob('vimrc.d/*.vim'), '\n')
|
|||
exe 'source' f
|
||||
endfor
|
||||
|
||||
|
||||
" #settings{{{
|
||||
" set t_Sf=<Esc>[3%p1%dm " foreground colour
|
||||
if &term == 'xterm-256color'
|
||||
set termguicolors
|
||||
endif
|
||||
|
||||
syntax on
|
||||
colorscheme customred256
|
||||
|
||||
set guioptions-=mTrLb
|
||||
set guioptions+=c
|
||||
|
||||
" set t_Sb=<Esc>[4%p1%dm " background coloru
|
||||
|
||||
set updatetime=100
|
||||
|
||||
set backupdir=~/.vimtmp
|
||||
set directory=~/.vimtmp
|
||||
|
||||
set tags+=./.tags,.tags;/home/ray/
|
||||
|
||||
" persisitent undo file
|
||||
set undodir=/home/ray/.vim/undodir
|
||||
set undofile
|
||||
|
||||
set clipboard=unnamedplus
|
||||
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
set wildmenu
|
||||
set wildmode=longest:full,full
|
||||
|
||||
set hidden
|
||||
|
||||
set background=dark
|
||||
set number relativenumber
|
||||
set hlsearch
|
||||
|
||||
set foldcolumn=1
|
||||
|
||||
set iskeyword+=-
|
||||
set scrolloff=10
|
||||
set showcmd
|
||||
set incsearch
|
||||
|
||||
set laststatus=2
|
||||
|
||||
set foldmethod=manual
|
||||
|
||||
set showmode
|
||||
|
||||
set autoindent
|
||||
set breakindent
|
||||
set showbreak=↳
|
||||
|
||||
set mouse=a
|
||||
|
||||
set listchars=eol:¬,tab:->,trail:~,extends:>,precedes:<,space:·
|
||||
|
||||
set textwidth=180
|
||||
set formatoptions=cq
|
||||
set wrapmargin=0
|
||||
"}}}
|
||||
|
||||
" key #mappings{{{
|
||||
let g:mapleader = "\<space>"
|
||||
|
||||
nnoremap <space>rc :so $MYVIMRC<CR>
|
||||
|
||||
" Focus on current fold, close the rest
|
||||
nnoremap <space>zz zMzvzz
|
||||
|
||||
" replace current word with last yanked/deleted text
|
||||
nnoremap <space>rr "_diwP
|
||||
" replace current word with last yanked text
|
||||
nnoremap <space>ry diw"0P
|
||||
|
||||
inoremap jk <esc>
|
||||
|
||||
nnoremap A :call CheckLineEnding()<CR>
|
||||
|
||||
nnoremap <space>co :!clear;
|
||||
|
||||
nnoremap <space>gs :!clear; echo 'git status'; git status<CR>
|
||||
nnoremap <space>gd :!clear; echo 'git diff'; git diff<CR>
|
||||
nnoremap <space>ga :!clear; git add %; git status<CR>
|
||||
nnoremap <space>gA :!clear; git add .; git status<CR>
|
||||
nnoremap <space>gc :!clear; git commit -m ''<Left>
|
||||
nnoremap <space>gg :!clear; git add %; git commit -m ''<Left>
|
||||
nnoremap <space>gp :!clear; echo 'git push'; git push<CR>
|
||||
nnoremap <space>gl :!clear; git log<CR>
|
||||
|
||||
" netrw
|
||||
nnoremap <space>ex :Ex<CR>
|
||||
nnoremap <space>ee :e .<CR>
|
||||
nnoremap <space>eq :Rex<CR>
|
||||
|
||||
" better window navigaton
|
||||
nnoremap <C-h> <C-w>h
|
||||
nnoremap <C-l> <C-w>l
|
||||
nnoremap <C-k> <C-w>k
|
||||
nnoremap <C-j> <C-w>j
|
||||
|
||||
nnoremap <Esc>j :resize -5<CR>
|
||||
nnoremap <Esc>k :resize +5<CR>
|
||||
nnoremap <Esc>l :vertical resize +5<CR>
|
||||
nnoremap <Esc>h :vertical resize -5<CR>
|
||||
nnoremap <Esc>= <C-w>=
|
||||
|
||||
"location list and quickfix mappings
|
||||
nnoremap <space>ll :botright lwindow<CR>
|
||||
nnoremap <space>lp :lprev<CR>
|
||||
nnoremap <space>ln :lnext<CR>
|
||||
nnoremap <space>lc :lclose<CR>
|
||||
nnoremap <space>llh :lhistory<CR>
|
||||
nnoremap <space>llp :lolder<CR>
|
||||
nnoremap <space>lln :lnewer<CR>
|
||||
|
||||
nnoremap <space>qf :botright cwindow<CR>
|
||||
nnoremap <space>qp :cprev<CR>
|
||||
nnoremap <space>qn :cnext<CR>
|
||||
nnoremap <space>qc :cclose<CR>
|
||||
nnoremap <space>qfh :chistory<CR>
|
||||
nnoremap <space>qfp :colder<CR>
|
||||
nnoremap <space>qfn :cnewer<CR>
|
||||
|
||||
nnoremap <space>nh :noh<CR>
|
||||
|
||||
" quick grep of visual selection
|
||||
vnoremap <space>gr y:grep! -R <C-r>" .
|
||||
|
||||
" open quickfix window of TODOs
|
||||
nnoremap <space>td :grep! -R '// *TODO' .<CR>:botright cwindow<CR>:echo len(getqflist()) 'TODOs'<CR>
|
||||
|
||||
" brace/quotes completion
|
||||
inoremap {{ {}<left>
|
||||
inoremap {<CR> {<CR>}<esc>O
|
||||
inoremap {; {<CR>};<esc>O
|
||||
inoremap }} {{}}<Left><Left>
|
||||
|
||||
inoremap (( ()<Left>
|
||||
inoremap (; ();<Left><Left>
|
||||
|
||||
inoremap [[ []<Left>
|
||||
inoremap [<CR> [<CR>]<esc>O
|
||||
|
||||
inoremap "" ""<Left>
|
||||
inoremap "; "";<Left><Left>
|
||||
inoremap '' ''<Left>
|
||||
inoremap '; '';<Left><Left>
|
||||
|
||||
inoremap ;; ;<esc>
|
||||
|
||||
nnoremap <space>nn :set invrelativenumber<CR>
|
||||
nnoremap <space>hl :nohlsearch<CR>
|
||||
|
||||
" devdocs mapping
|
||||
nnoremap <space>dd :DD<CR>
|
||||
"}}}
|
||||
|
||||
" #abbreviations{{{
|
||||
iabbrev adn and
|
||||
iabbrev waht what
|
||||
iabbrev tehn then
|
||||
"}}}
|
||||
|
||||
" #autocommands{{{
|
||||
|
||||
" persistent folds
|
||||
augroup AutoSaveFolds
|
||||
autocmd!
|
||||
autocmd BufWritePost *.* mkview
|
||||
autocmd BufWinEnter *.* silent loadview
|
||||
augroup END
|
||||
|
||||
" fix higlight problems such as vertical-align etc
|
||||
augroup VimCSS3Syntax
|
||||
autocmd!
|
||||
autocmd FileType css setlocal iskeyword+=-
|
||||
augroup END
|
||||
|
||||
" Show trailing whitepace and spaces before a tab:
|
||||
augroup whitespaceerrors
|
||||
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL
|
||||
augroup END
|
||||
|
||||
" automatically reload if color scheme file written
|
||||
augroup coloreload
|
||||
au!
|
||||
au BufWritePost customred256.vim so $MYVIMRC
|
||||
augroup end
|
||||
|
||||
augroup linenumbering
|
||||
autocmd InsertEnter * :set norelativenumber
|
||||
autocmd InsertLeave * :set number relativenumber
|
||||
autocmd WinEnter * :set number relativenumber
|
||||
autocmd WinLeave * set norelativenumber
|
||||
augroup END
|
||||
|
||||
augroup colorcolumns
|
||||
autocmd WinEnter * set colorcolumn=80
|
||||
autocmd WinLeave * set colorcolumn=0
|
||||
augroup END
|
||||
|
||||
" Automatically reload .vimrc if chanaged
|
||||
augroup myvimrc
|
||||
au!
|
||||
au BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
|
||||
augroup END
|
||||
"}}}
|
||||
|
||||
" #functions{{{
|
||||
|
||||
" TODO better name
|
||||
function! GetStatusFrag(condition, colorname, conditionprefix, text) abort "{{{
|
||||
let l:frag='%#' . a:colorname . '#'
|
||||
let l:frag.=a:conditionprefix
|
||||
let l:frag.='%{(' . a:condition . ")?'" . a:text . "':''}"
|
||||
return l:frag
|
||||
endfunction"}}}
|
||||
|
||||
function! CheckLineEnding() abort "{{{
|
||||
:normal $
|
||||
if getline('.')[col('.')-1] == ';' || getline('.')[col('.')-1] == ','
|
||||
:startinsert
|
||||
else
|
||||
:startinsert!
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
" get name of syntax item
|
||||
function! SyntaxItem() abort "{{{
|
||||
return synIDattr(synID(line('.'),col('.'),1),'name') . ' -> ' . synIDattr(synIDtrans(synID(line('.'),col('.'),1)), 'name' )
|
||||
endfunction
|
||||
nnoremap <space>p :echom SyntaxItem()<CR>"}}}
|
||||
|
||||
" devdocs DD
|
||||
" https://gist.github.com/romainl/8d3b73428b4366f75a19be2dad2f0987#file-devdocs-vim
|
||||
function! s:Get_env() abort "{{{
|
||||
if has('win64') || has('win32') || has('win16')
|
||||
return 'WINDOWS'
|
||||
else
|
||||
return toupper(substitute(system('uname'), '\n', '', ''))
|
||||
endif
|
||||
endfunction
|
||||
" What command to use on what system
|
||||
let s:cmds = {'DARWIN': 'open', 'LINUX': 'qutebrowser', 'WINDOWS': 'start'}
|
||||
|
||||
" Build the URL stub
|
||||
let s:stub = s:cmds[<SID>Get_env()] . " 'http://devdocs.io/?q="
|
||||
|
||||
command! -nargs=* DD silent! call system(len(split(<q-args>, ' ')) == 0 ?
|
||||
\ s:stub . &ft . ' ' . expand('<cword>') . "'" : len(split(<q-args>, ' ')) == 1 ?
|
||||
\ s:stub . &ft . ' ' . <q-args> . "'" : s:stub . <q-args> . "'")
|
||||
"}}}
|
||||
|
||||
" use ranger as file manager
|
||||
if !exists('*RangerExplorer') "{{{
|
||||
function RangerExplorer() abort
|
||||
exec 'silent !ranger --choosefile=/tmp/vim_ranger_current_file ' . expand('%:p:h')
|
||||
if filereadable('/tmp/vim_ranger_current_file')
|
||||
exec 'edit ' . system('cat /tmp/vim_ranger_current_file')
|
||||
call system('rm /tmp/vim_ranger_current_file')
|
||||
endif
|
||||
redraw!
|
||||
endfun
|
||||
map <space>ra :call RangerExplorer()<CR>
|
||||
endif"}}}
|
||||
|
||||
function! GetLinterStatus(key) abort "{{{
|
||||
let l:linter = ale#statusline#Count(bufnr(''))
|
||||
|
||||
return l:linter[a:key]
|
||||
endfunction
|
||||
|
||||
"}}}
|
||||
"}}}
|
||||
|
||||
|
||||
" vim: foldmethod=marker
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
" persistent folds
|
||||
augroup AutoSaveFolds
|
||||
autocmd!
|
||||
autocmd BufWritePost *.* mkview
|
||||
autocmd BufWinEnter *.* silent loadview
|
||||
augroup END
|
||||
|
||||
" fix higlight problems such as vertical-align etc
|
||||
augroup VimCSS3Syntax
|
||||
autocmd!
|
||||
autocmd FileType css setlocal iskeyword+=-
|
||||
augroup END
|
||||
|
||||
" Show trailing whitepace and spaces before a tab:
|
||||
augroup whitespaceerrors
|
||||
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL
|
||||
augroup END
|
||||
|
||||
" automatically reload if color scheme file written
|
||||
augroup coloreload
|
||||
au!
|
||||
au BufWritePost customred256.vim so $MYVIMRC
|
||||
augroup end
|
||||
|
||||
augroup linenumbering
|
||||
autocmd InsertEnter * :set norelativenumber
|
||||
autocmd InsertLeave * :set number relativenumber
|
||||
autocmd WinEnter * :set number relativenumber
|
||||
autocmd WinLeave * set norelativenumber
|
||||
augroup END
|
||||
|
||||
augroup colorcolumns
|
||||
autocmd WinEnter * set colorcolumn=80
|
||||
autocmd WinLeave * set colorcolumn=0
|
||||
augroup END
|
||||
|
||||
" Automatically reload .vimrc if chanaged
|
||||
augroup myvimrc
|
||||
au!
|
||||
au BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
|
||||
augroup END
|
||||
|
||||
" vim: foldmethod=marker
|
|
@ -0,0 +1,102 @@
|
|||
" key #mappings{{{
|
||||
|
||||
nnoremap <space>rc :so $MYVIMRC<CR>
|
||||
|
||||
" Focus on current fold, close the rest
|
||||
nnoremap <space>zz zMzvzz
|
||||
|
||||
" replace current word with last yanked/deleted text
|
||||
nnoremap <space>rr "_diwP
|
||||
" replace current word with last yanked text
|
||||
nnoremap <space>ry diw"0P
|
||||
|
||||
inoremap jk <esc>
|
||||
|
||||
nnoremap A :call CheckLineEnding()<CR>
|
||||
|
||||
nnoremap <space>co :!clear;
|
||||
|
||||
nnoremap <space>gs :!clear; echo 'git status'; git status<CR>
|
||||
nnoremap <space>gd :!clear; echo 'git diff'; git diff<CR>
|
||||
nnoremap <space>ga :!clear; git add %; git status<CR>
|
||||
nnoremap <space>gA :!clear; git add .; git status<CR>
|
||||
nnoremap <space>gc :!clear; git commit -m ''<Left>
|
||||
nnoremap <space>gg :!clear; git add %; git commit -m ''<Left>
|
||||
nnoremap <space>gp :!clear; echo 'git push'; git push<CR>
|
||||
nnoremap <space>gl :!clear; git log<CR>
|
||||
|
||||
" netrw
|
||||
nnoremap <space>ex :Ex<CR>
|
||||
nnoremap <space>ee :e .<CR>
|
||||
nnoremap <space>eq :Rex<CR>
|
||||
|
||||
" better window navigaton
|
||||
nnoremap <C-h> <C-w>h
|
||||
nnoremap <C-l> <C-w>l
|
||||
nnoremap <C-k> <C-w>k
|
||||
nnoremap <C-j> <C-w>j
|
||||
|
||||
nnoremap <Esc>j :resize -5<CR>
|
||||
nnoremap <Esc>k :resize +5<CR>
|
||||
nnoremap <Esc>l :vertical resize +5<CR>
|
||||
nnoremap <Esc>h :vertical resize -5<CR>
|
||||
nnoremap <Esc>= <C-w>=
|
||||
|
||||
"location list and quickfix mappings
|
||||
nnoremap <space>ll :botright lwindow<CR>
|
||||
nnoremap <space>lp :lprev<CR>
|
||||
nnoremap <space>ln :lnext<CR>
|
||||
nnoremap <space>lc :lclose<CR>
|
||||
nnoremap <space>llh :lhistory<CR>
|
||||
nnoremap <space>llp :lolder<CR>
|
||||
nnoremap <space>lln :lnewer<CR>
|
||||
|
||||
nnoremap <space>qf :botright cwindow<CR>
|
||||
nnoremap <space>qp :cprev<CR>
|
||||
nnoremap <space>qn :cnext<CR>
|
||||
nnoremap <space>qc :cclose<CR>
|
||||
nnoremap <space>qfh :chistory<CR>
|
||||
nnoremap <space>qfp :colder<CR>
|
||||
nnoremap <space>qfn :cnewer<CR>
|
||||
|
||||
nnoremap <space>nh :noh<CR>
|
||||
|
||||
" quick grep of visual selection
|
||||
vnoremap <space>gr y:grep! -R <C-r>" .
|
||||
|
||||
" open quickfix window of TODOs
|
||||
nnoremap <space>td :grep! -R '// *TODO' .<CR>:botright cwindow<CR>:echo len(getqflist()) 'TODOs'<CR>
|
||||
|
||||
" brace/quotes completion
|
||||
inoremap {{ {}<left>
|
||||
inoremap {<CR> {<CR>}<esc>O
|
||||
inoremap {; {<CR>};<esc>O
|
||||
inoremap }} {{}}<Left><Left>
|
||||
|
||||
inoremap (( ()<Left>
|
||||
inoremap (; ();<Left><Left>
|
||||
|
||||
inoremap [[ []<Left>
|
||||
inoremap [<CR> [<CR>]<esc>O
|
||||
|
||||
inoremap "" ""<Left>
|
||||
inoremap "; "";<Left><Left>
|
||||
inoremap '' ''<Left>
|
||||
inoremap '; '';<Left><Left>
|
||||
|
||||
inoremap ;; ;<esc>
|
||||
|
||||
nnoremap <space>nn :set invrelativenumber<CR>
|
||||
nnoremap <space>hl :nohlsearch<CR>
|
||||
|
||||
" devdocs mapping
|
||||
nnoremap <space>dd :DD<CR>
|
||||
"}}}
|
||||
|
||||
" #abbreviations{{{
|
||||
iabbrev adn and
|
||||
iabbrev waht what
|
||||
iabbrev tehn then
|
||||
"}}}
|
||||
|
||||
" vim: foldmethod=marker
|
|
@ -0,0 +1,67 @@
|
|||
set ttyfast
|
||||
|
||||
" set t_Sf=<Esc>[3%p1%dm " foreground colour
|
||||
if &term == 'xterm-256color'
|
||||
set termguicolors
|
||||
endif
|
||||
|
||||
syntax on
|
||||
colorscheme customred256
|
||||
|
||||
set guioptions-=mTrLb
|
||||
set guioptions+=c
|
||||
|
||||
" set t_Sb=<Esc>[4%p1%dm " background coloru
|
||||
|
||||
set updatetime=100
|
||||
|
||||
set backupdir=~/.vimtmp
|
||||
set directory=~/.vimtmp
|
||||
|
||||
set tags+=./.tags,.tags;/home/ray/
|
||||
|
||||
" persisitent undo file
|
||||
set undodir=/home/ray/.vim/undodir
|
||||
set undofile
|
||||
|
||||
set clipboard=unnamedplus
|
||||
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
set wildmenu
|
||||
set wildmode=longest:full,full
|
||||
|
||||
set hidden
|
||||
|
||||
set background=dark
|
||||
set number relativenumber
|
||||
set hlsearch
|
||||
|
||||
set foldcolumn=1
|
||||
|
||||
set iskeyword+=-
|
||||
set scrolloff=10
|
||||
set showcmd
|
||||
set incsearch
|
||||
|
||||
set laststatus=2
|
||||
|
||||
set foldmethod=manual
|
||||
|
||||
set showmode
|
||||
|
||||
set autoindent
|
||||
set breakindent
|
||||
set showbreak=↳
|
||||
|
||||
set mouse=a
|
||||
|
||||
set listchars=eol:¬,tab:->,trail:~,extends:>,precedes:<,space:·
|
||||
|
||||
set textwidth=180
|
||||
set formatoptions=cq
|
||||
set wrapmargin=0
|
||||
|
||||
|
||||
" vim: foldmethod=marker
|
|
@ -0,0 +1,65 @@
|
|||
" TODO better name
|
||||
function! GetStatusFrag(condition, colorname, conditionprefix, text) abort "{{{
|
||||
let l:frag='%#' . a:colorname . '#'
|
||||
let l:frag.=a:conditionprefix
|
||||
let l:frag.='%{(' . a:condition . ")?'" . a:text . "':''}"
|
||||
return l:frag
|
||||
endfunction"}}}
|
||||
|
||||
function! CheckLineEnding() abort "{{{
|
||||
:normal $
|
||||
if getline('.')[col('.')-1] == ';' || getline('.')[col('.')-1] == ','
|
||||
:startinsert
|
||||
else
|
||||
:startinsert!
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
" get name of syntax item
|
||||
function! SyntaxItem() abort "{{{
|
||||
return synIDattr(synID(line('.'),col('.'),1),'name') . ' -> ' . synIDattr(synIDtrans(synID(line('.'),col('.'),1)), 'name' )
|
||||
endfunction
|
||||
nnoremap <space>p :echom SyntaxItem()<CR>"}}}
|
||||
|
||||
" devdocs DD
|
||||
" https://gist.github.com/romainl/8d3b73428b4366f75a19be2dad2f0987#file-devdocs-vim
|
||||
function! s:Get_env() abort "{{{
|
||||
if has('win64') || has('win32') || has('win16')
|
||||
return 'WINDOWS'
|
||||
else
|
||||
return toupper(substitute(system('uname'), '\n', '', ''))
|
||||
endif
|
||||
endfunction
|
||||
" What command to use on what system
|
||||
let s:cmds = {'DARWIN': 'open', 'LINUX': 'qutebrowser', 'WINDOWS': 'start'}
|
||||
|
||||
" Build the URL stub
|
||||
let s:stub = s:cmds[<SID>Get_env()] . " 'http://devdocs.io/?q="
|
||||
|
||||
command! -nargs=* DD silent! call system(len(split(<q-args>, ' ')) == 0 ?
|
||||
\ s:stub . &ft . ' ' . expand('<cword>') . "'" : len(split(<q-args>, ' ')) == 1 ?
|
||||
\ s:stub . &ft . ' ' . <q-args> . "'" : s:stub . <q-args> . "'")
|
||||
"}}}
|
||||
|
||||
" use ranger as file manager
|
||||
if !exists('*RangerExplorer') "{{{
|
||||
function RangerExplorer() abort
|
||||
exec 'silent !ranger --choosefile=/tmp/vim_ranger_current_file ' . expand('%:p:h')
|
||||
if filereadable('/tmp/vim_ranger_current_file')
|
||||
exec 'edit ' . system('cat /tmp/vim_ranger_current_file')
|
||||
call system('rm /tmp/vim_ranger_current_file')
|
||||
endif
|
||||
redraw!
|
||||
endfun
|
||||
map <space>ra :call RangerExplorer()<CR>
|
||||
endif"}}}
|
||||
|
||||
function! GetLinterStatus(key) abort "{{{
|
||||
let l:linter = ale#statusline#Count(bufnr(''))
|
||||
|
||||
return l:linter[a:key]
|
||||
endfunction
|
||||
|
||||
"}}}
|
||||
|
||||
" vim: foldmethod=marker
|
Loading…
Reference in New Issue