mirror of
https://github.com/starr-dusT/dotfiles.git
synced 2025-02-19 19:27:31 -08:00
refactor vimrc
This commit is contained in:
parent
c68e2d98e3
commit
fd603cb09f
@ -5,17 +5,18 @@
|
|||||||
" general
|
" general
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
" automatically write files when changing when multiple files open
|
syntax enable
|
||||||
set autowrite
|
|
||||||
set number
|
set number
|
||||||
set colorcolumn=79
|
set colorcolumn=79
|
||||||
syntax enable
|
set autowrite " automatically write files on close
|
||||||
|
|
||||||
|
let mapleader = " " " map leader to Space
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" wildmenu
|
" wildmenu
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
" Ignore compiled files
|
" ignore compiled files
|
||||||
set wildignore=*.o,*~,*.pyc
|
set wildignore=*.o,*~,*.pyc
|
||||||
if has("win16") || has("win32")
|
if has("win16") || has("win32")
|
||||||
set wildignore+=.git\*,.hg\*,.svn\*
|
set wildignore+=.git\*,.hg\*,.svn\*
|
||||||
@ -23,35 +24,48 @@ else
|
|||||||
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
|
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
|
||||||
endif
|
endif
|
||||||
|
|
||||||
set path=$PWD/** " enable fuzzy finding in the vim command line
|
" enable fuzzy finding in the vim command line
|
||||||
|
set path=$PWD/**
|
||||||
set nowildmenu
|
set nowildmenu
|
||||||
set wildmode=list:full
|
set wildmode=list:full
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" netrw
|
" netrw
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
let g:netrw_banner = 0
|
|
||||||
|
let g:netrw_banner = 0 " disable dumb banner
|
||||||
|
|
||||||
|
" use l and h for up/down dir
|
||||||
augroup netrw_setup | au!
|
augroup netrw_setup | au!
|
||||||
au FileType netrw nmap <buffer> l <CR>
|
au FileType netrw nmap <buffer> l <CR>
|
||||||
au FileType netrw nmap <buffer> h -
|
au FileType netrw nmap <buffer> h -
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
map <leader>e :Ex <cr> " open explorer
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" keys
|
" marks
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
" map leader to Space
|
" allow only global marks
|
||||||
let mapleader = " "
|
noremap <silent> <expr> ' "'".toupper(nr2char(getchar()))
|
||||||
|
noremap <silent> <expr> m "m".toupper(nr2char(getchar()))
|
||||||
|
sunmap '
|
||||||
|
sunmap m
|
||||||
|
|
||||||
" movement
|
nnoremap <silent> ' :call ListSelect("marks", "'")<CR> " list jumps/marks
|
||||||
|
map <leader>md :delmarks A-Z0-9 <cr> " clear marks
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" misc keys
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
" move between splits with hjkl
|
||||||
map <C-j> <C-W>j
|
map <C-j> <C-W>j
|
||||||
map <C-k> <C-W>k
|
map <C-k> <C-W>k
|
||||||
map <C-h> <C-W>h
|
map <C-h> <C-W>h
|
||||||
map <C-l> <C-W>l
|
map <C-l> <C-W>l
|
||||||
|
|
||||||
" netrw
|
|
||||||
map <leader>e :Ex <cr>
|
|
||||||
|
|
||||||
" find
|
" find
|
||||||
map <leader>ff :find *
|
map <leader>ff :find *
|
||||||
|
|
||||||
@ -71,3 +85,28 @@ map <F4> :set spell!<CR>
|
|||||||
" better use of arrow keys, number increment/decrement
|
" better use of arrow keys, number increment/decrement
|
||||||
nnoremap <up> <C-a>
|
nnoremap <up> <C-a>
|
||||||
nnoremap <down> <C-x>
|
nnoremap <down> <C-x>
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" helpers
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
" display and select from a list of marks and jumps
|
||||||
|
" https://vi.stackexchange.com/a/42965
|
||||||
|
"
|
||||||
|
function ListSelect(command, jump)
|
||||||
|
execute a:command
|
||||||
|
echohl Question
|
||||||
|
echo "Enter mark (ESC to cancel): "
|
||||||
|
echohl NONE
|
||||||
|
let mark = toupper(nr2char(getchar()))
|
||||||
|
redraw
|
||||||
|
if mark !=# "\e"
|
||||||
|
try
|
||||||
|
execute "normal! g" .. a:jump .. mark
|
||||||
|
catch
|
||||||
|
echohl ErrorMsg
|
||||||
|
echo substitute(v:exception, "^Vim(.*):", "", "")
|
||||||
|
echohl NONE
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user