vim: tidy
This commit is contained in:
132
vimrc
132
vimrc
@@ -1,23 +1,9 @@
|
||||
" Adapted from Dan's .vimrc, and Sven Gucke's vimrc.forall - Paul
|
||||
|
||||
if empty(glob('~/.vim/autoload/plug.vim'))
|
||||
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
||||
endif
|
||||
|
||||
"if has("unix") || has("gui_macvim")
|
||||
" let s:uname = system("uname -s")
|
||||
" if s:uname == "Darwin" || has("gui_macvim")
|
||||
" echom "Remapping Escape"
|
||||
" "make jj do esc"
|
||||
" inoremap § <Esc>
|
||||
|
||||
" "make esc do nothing"
|
||||
" inoremap <Esc> <Nop>
|
||||
" endif
|
||||
"endif
|
||||
|
||||
call plug#begin('~/.vim/plugged')
|
||||
Plug 'junegunn/vim-easy-align/'
|
||||
|
||||
@@ -66,7 +52,7 @@ call plug#begin('~/.vim/plugged')
|
||||
call plug#end()
|
||||
|
||||
let mapleader = ' '
|
||||
let maplocalleader = ' '
|
||||
let maplocalleader = ','
|
||||
|
||||
" Edit another file in the same directory as the current file. Uses expression
|
||||
" to extract path from current file's path (thanks to Douglas Potts)
|
||||
@@ -95,8 +81,8 @@ nnoremap <leader>wl viwu
|
||||
nnoremap <C-U> viwU
|
||||
nnoremap <C-L> viwu
|
||||
|
||||
nmap <c-s-down> ddp
|
||||
nmap <c-s-up> dd2jp
|
||||
nnoremap <c-s-up> dd2kp
|
||||
nnoremap <c-s-down> ddp
|
||||
|
||||
nnoremap <leader>q :Bdelete<CR>
|
||||
|
||||
@@ -106,8 +92,14 @@ nnoremap Q @@
|
||||
" Close all folds
|
||||
nnoremap c- zM
|
||||
|
||||
" nmap <leader>cw y/ <CR>
|
||||
nmap <leader>wp 0v$gq
|
||||
nnoremap <leader>cw y/ <CR>
|
||||
nnoremap <leader>wp 0v$gq
|
||||
|
||||
inoremap jk <esc>
|
||||
" inoremap <esc> <nop>
|
||||
|
||||
color desert
|
||||
" colorscheme dracula
|
||||
|
||||
set ignorecase smartcase
|
||||
set incsearch
|
||||
@@ -116,18 +108,7 @@ set complete=.,b,u,]
|
||||
|
||||
set wildignore+=deps/*,node_modules/*,*.sw?
|
||||
|
||||
" color desert
|
||||
colorscheme dracula
|
||||
" if has("AirlineTheme")
|
||||
" if has("gui_running")
|
||||
" let g:airline_theme="papercolor"
|
||||
" endif
|
||||
" endif
|
||||
|
||||
" enable syntax highlighting if it is supported
|
||||
if has("syntax")
|
||||
syntax on
|
||||
endif
|
||||
syntax on
|
||||
|
||||
" Turn off the beeping ('cause it's annoying)
|
||||
set noerrorbells
|
||||
@@ -200,21 +181,34 @@ augroup END
|
||||
" Apply the muttrc colouring to mutt setup files:
|
||||
au BufNewFile,BufRead .mutt.* set ft=muttrc
|
||||
|
||||
augroup filetype_elixir
|
||||
augroup filetype elixir
|
||||
autocmd!
|
||||
autocmd BufRead * imap ii IO.inspect(
|
||||
" autocmd BufRead * imap ip IO.puts(
|
||||
augroup END
|
||||
|
||||
augroup filetype_vue
|
||||
augroup filetype vue
|
||||
autocmd!
|
||||
autocmd BufRead * imap cll console.log()<Esc>==f(a
|
||||
autocmd BufRead,BufNewFile *.vue inoremap cll console.log()<left>
|
||||
call TabSize(2)
|
||||
iabbrev template <template><cr><tab><div><cr></div><cr></template
|
||||
iabbrev script <script><cr>export default {<cr>name: ""<cr>};<cr></script
|
||||
iabbrev style <style scoped><cr></style
|
||||
augroup END
|
||||
|
||||
augroup filetype_javascript
|
||||
augroup filetype javascript
|
||||
autocmd!
|
||||
autocmd BufRead,BufNewFile * imap cll console.log()<Esc>==f(a
|
||||
autocmd BufRead,BufNewFile *.js inoremap cll console.log()<left>
|
||||
call TabSize(2)
|
||||
" inoremap <localleader>\li logger.info("
|
||||
" inoremap <localleader>\cli <esc>3cwlogger.info("i
|
||||
iabbrev <buffer> iff if()<left>
|
||||
augroup END
|
||||
|
||||
augroup filetype make
|
||||
autocmd!
|
||||
call TabSize(8)
|
||||
set noexpandtab
|
||||
augroup END
|
||||
|
||||
" Automatic typo fixing
|
||||
@@ -223,8 +217,6 @@ iab compomemt component
|
||||
" Disable the command 'K' (keyword lookup)
|
||||
" map K <NUL>
|
||||
|
||||
" Insert file
|
||||
map <C-K>e :read
|
||||
" List current buffers
|
||||
map <C-L> :buffers<CR>
|
||||
" Reformat selected text; normal mode only so we don't accidentally wrap a
|
||||
@@ -263,8 +255,6 @@ nnoremap <leader>wfw :set winfixwidth
|
||||
" Fix the height of the window
|
||||
nnoremap <leader>wfh :set winfixheight
|
||||
|
||||
nnoremap <leader>qw /\s<CR>i"<ESC>?\s<CR>i"<ESC>
|
||||
|
||||
" map <C-Up> :wincmd k<CR>
|
||||
" map <C-Down> :wincmd j<CR>
|
||||
|
||||
@@ -275,6 +265,7 @@ map <C-CR> @a
|
||||
|
||||
" Set swapsync to 'nothing' - potentially more data loss (no forced write to disk
|
||||
" on swap write), but makes writes faster. I'm willing to take the chance. :-)
|
||||
" Not supported on Neovim.
|
||||
if !has("nvim")
|
||||
set sws=
|
||||
endif
|
||||
@@ -295,16 +286,18 @@ noremap <C-G> 2<C-G>
|
||||
" VIM - Editing and updating the vimrc:
|
||||
" As I often make changes to this file I use these commands
|
||||
" to start editing it and also update it:
|
||||
if has("unix")
|
||||
let vimrc='~/.vimrc'
|
||||
else
|
||||
" ie: if has("dos16") || has("dos32") || has("win32")
|
||||
let vimrc='$VIM\_vimrc'
|
||||
endif
|
||||
" Redundant - replaced by $MYVIMRC
|
||||
" if has("unix")
|
||||
" let vimrc='~/.vimrc'
|
||||
" else
|
||||
" " ie: if has("dos16") || has("dos32") || has("win32")
|
||||
" let vimrc='$VIM\_vimrc'
|
||||
" endif
|
||||
|
||||
" Re-source and edit vimrc, respectively
|
||||
nn ,u :source <C-R>=vimrc<CR><CR>
|
||||
nn ,v :edit <C-R>=vimrc<CR><CR>
|
||||
nnoremap ,u :source <C-R>=vimrc<CR><CR>
|
||||
" nnoremap ,v :edit <C-R>=vimrc<CR><CR>
|
||||
nnoremap ,v :vsplit $MYVIMRC<CR>
|
||||
|
||||
nn ,s :mks! Session.vim<CR>
|
||||
|
||||
@@ -357,33 +350,16 @@ set ruler
|
||||
" set nohlsearch
|
||||
|
||||
" Return makes a new line at the cursor without entering insert mode
|
||||
map <CR> i<CR><ESC>
|
||||
nmap <CR> i<CR><ESC>
|
||||
|
||||
" Cut text down to size (C-J does not pre-join the lines)
|
||||
map <C-J> 74\|bi<CR><ESC>
|
||||
map <C-S-J> J74\|bi<CR><ESC>
|
||||
|
||||
" <Tab> and <S-Tab> indent and unindent code
|
||||
map <Tab> :><CR>
|
||||
map <S-Tab> :<<CR>
|
||||
map <C-S-Tab> :<<CR><DOWN>
|
||||
|
||||
" get man page of current function or open current URL in netscape
|
||||
map <F1> :!man <cword><CR>
|
||||
"map <S-F1> ?[ \t'"()<>{}[\]]<CR>ly/[ \t'"()<>{}[\]]<CR>:!gnome-moz-remote --newwin <C-R>"<CR>
|
||||
|
||||
" Use fzf to find files
|
||||
map <F2> :Files<CR>
|
||||
map <C-P> :Files<CR>
|
||||
map <C-O> :Files <C-R>=expand("%:p:h")<CR>
|
||||
|
||||
nnoremap <silent> <leader>m :FZFMru<CR>
|
||||
|
||||
map <F3> :Ag <C-R>=expand("<cword>")<CR><CR>
|
||||
nnoremap <leader>f :Ag <C-R>=expand("<cword>")<CR><CR>
|
||||
|
||||
" use F4 to bring up NERDTree
|
||||
map <F4> :NERDTree<CR>
|
||||
nnoremap <leader>n :NERDTreeToggle<cr>
|
||||
|
||||
" Use F6 to swap buffers
|
||||
@@ -396,23 +372,10 @@ nnoremap <leader>ss :syntax sync fromstart<CR>
|
||||
|
||||
nnoremap <leader>t :TagbarToggle<CR>
|
||||
|
||||
" repeat the last command on the next line (F12 is Again on Sun keyboards)
|
||||
map <F12> j.
|
||||
|
||||
" use Print Screen to print the current file
|
||||
map <F22> :!a2ps %<CR>
|
||||
|
||||
" date functions
|
||||
map ,dn i<CR><CR><ESC>k!!date +'\%d/\%m/\%y'<CR>kJJ
|
||||
map ,dw i<CR><CR><ESC>k!!date +'\%V'<CR>kJJ
|
||||
|
||||
" (double) quote up the word under the cursor
|
||||
map ` bi"<ESC>wwhi"<ESC>
|
||||
|
||||
" use GNU make (gnu_make is a script to perform builds with GNU make
|
||||
" and filter results into GNU format error report)
|
||||
" :set mp=gnu_make
|
||||
" :set mp=make
|
||||
nnoremap ,dn i<CR><CR><ESC>k!!date +'\%d/\%m/\%y'<CR>kJJ
|
||||
nnoremap ,dw i<CR><CR><ESC>k!!date +'\%V'<CR>kJJ
|
||||
|
||||
" xterm title magic
|
||||
if "$TERM" != "dumb"
|
||||
@@ -470,7 +433,6 @@ function! ToggleWindowHorizontalVerticalSplit()
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> <leader>wst :call ToggleWindowHorizontalVerticalSplit()<cr>
|
||||
" inoremap <lt>/ </<C-x><C-o><Esc>==gi
|
||||
|
||||
" COC configuration
|
||||
if version >= 800
|
||||
@@ -604,6 +566,7 @@ if version >= 800
|
||||
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
||||
endif
|
||||
|
||||
" <Tab> and <S-Tab> indent and unindent code
|
||||
nmap <Tab> :><CR>
|
||||
vmap <Tab> :><CR>
|
||||
nnoremap <leader>f :Ag <C-R>=expand("<cword>")<CR><CR>
|
||||
@@ -614,9 +577,6 @@ nmap <silent> tF :TestFile<CR>
|
||||
nmap <silent> tS :TestSuite<CR>
|
||||
nmap <silent> tL :TestLast<CR>
|
||||
nmap <silent> tG :TestVisit<CR>d
|
||||
" nmap <C-M> :<CR>
|
||||
" nmap <C-M> :Make<CR>
|
||||
" nmap <C-S-M> :Make!<CR>
|
||||
|
||||
" Opening with the default program
|
||||
if has('macunix')
|
||||
@@ -633,6 +593,8 @@ elseif has('unix')
|
||||
nnoremap gH :!xdg-open %:p:h<CR>
|
||||
" Open in Browser
|
||||
nnoremap gB :!xdg-open %<CR>
|
||||
else
|
||||
echom "Don't know how to open on this platform."
|
||||
endif
|
||||
|
||||
" Markdown folding
|
||||
|
||||
Reference in New Issue
Block a user