diff --git a/vimrc b/vimrc index f0b7ea2..d9cd815 100644 --- a/vimrc +++ b/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 ยง - -" "make esc do nothing" -" inoremap -" 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 wl viwu nnoremap viwU nnoremap viwu -nmap ddp -nmap dd2jp +nnoremap dd2kp +nnoremap ddp nnoremap q :Bdelete @@ -106,8 +92,14 @@ nnoremap Q @@ " Close all folds nnoremap c- zM -" nmap cw y/ -nmap wp 0v$gq +nnoremap cw y/ +nnoremap wp 0v$gq + +inoremap jk +" inoremap + +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()==f(a + autocmd BufRead,BufNewFile *.vue inoremap cll console.log() + call TabSize(2) + iabbrev template export default {name: ""};==f(a + autocmd BufRead,BufNewFile *.js inoremap cll console.log() call TabSize(2) + " inoremap \li logger.info(" + " inoremap \cli 3cwlogger.info("i + iabbrev iff if() +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 -" Insert file -map e :read " List current buffers map :buffers " Reformat selected text; normal mode only so we don't accidentally wrap a @@ -263,8 +255,6 @@ nnoremap wfw :set winfixwidth " Fix the height of the window nnoremap wfh :set winfixheight -nnoremap qw /\si"?\si" - " map :wincmd k " map :wincmd j @@ -275,6 +265,7 @@ map @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 2 " 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 =vimrc -nn ,v :edit =vimrc +nnoremap ,u :source =vimrc +" nnoremap ,v :edit =vimrc +nnoremap ,v :vsplit $MYVIMRC nn ,s :mks! Session.vim @@ -357,33 +350,16 @@ set ruler " set nohlsearch " Return makes a new line at the cursor without entering insert mode -map i +nmap i " Cut text down to size (C-J does not pre-join the lines) map 74\|bi map J74\|bi -" and indent and unindent code -map :> -map :< -map :< - -" get man page of current function or open current URL in netscape -map :!man -"map ?[ \t'"()<>{}[\]]ly/[ \t'"()<>{}[\]]:!gnome-moz-remote --newwin " - " Use fzf to find files -map :Files map :Files map :Files =expand("%:p:h") - nnoremap m :FZFMru - -map :Ag =expand("") -nnoremap f :Ag =expand("") - -" use F4 to bring up NERDTree -map :NERDTree nnoremap n :NERDTreeToggle " Use F6 to swap buffers @@ -396,23 +372,10 @@ nnoremap ss :syntax sync fromstart nnoremap t :TagbarToggle -" repeat the last command on the next line (F12 is Again on Sun keyboards) -map j. - -" use Print Screen to print the current file -map :!a2ps % " date functions -map ,dn ik!!date +'\%d/\%m/\%y'kJJ -map ,dw ik!!date +'\%V'kJJ - -" (double) quote up the word under the cursor -map ` bi"wwhi" - -" 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 ik!!date +'\%d/\%m/\%y'kJJ +nnoremap ,dw ik!!date +'\%V'kJJ " xterm title magic if "$TERM" != "dumb" @@ -470,7 +433,6 @@ function! ToggleWindowHorizontalVerticalSplit() endfunction nnoremap wst :call ToggleWindowHorizontalVerticalSplit() -" inoremap / ==gi " COC configuration if version >= 800 @@ -604,6 +566,7 @@ if version >= 800 nnoremap p :CocListResume endif +" and indent and unindent code nmap :> vmap :> nnoremap f :Ag =expand("") @@ -614,9 +577,6 @@ nmap tF :TestFile nmap tS :TestSuite nmap tL :TestLast nmap tG :TestVisitd -" nmap : -" nmap :Make -" nmap :Make! " Opening with the default program if has('macunix') @@ -633,6 +593,8 @@ elseif has('unix') nnoremap gH :!xdg-open %:p:h " Open in Browser nnoremap gB :!xdg-open % +else + echom "Don't know how to open on this platform." endif " Markdown folding