You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

204 lines
7.8 KiB

let mapleader =","
if ! filereadable(expand('~/.config/nvim/autoload/plug.vim'))
echo "Downloading junegunn/vim-plug to manage plugins..."
silent !mkdir -p ~/.config/nvim/autoload/
silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.config/nvim/autoload/plug.vim
autocmd VimEnter * PlugInstall
endif
call plug#begin('~/.config/nvim/plugged')
Plug 'morhetz/gruvbox'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
"Plug 'vim-scripts/jcommenter.vim'
"Plug 'SirVer/ultisnips'
"Plug 'phux/vim-snippets'
"Plug 'tobyS/vmustache'
"Plug 'tobyS/pdv'
Plug 'Rican7/php-doc-modded'
Plug 'jreybert/vimagit'
Plug 'bling/vim-airline'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'rbong/vim-flog'
Plug 'ap/vim-css-color'
call plug#end()
" Some basics:
set go=a
set mouse=a
set nohlsearch
set clipboard+=unnamedplus
set incsearch
set smartcase
set noswapfile
set nobackup
set undodir=~/.config/nvim/undodir
set undofile
colorscheme gruvbox
set background=dark
nnoremap c "_c
set nocompatible
filetype plugin on
syntax on
set encoding=utf-8
set number relativenumber
" Indent marks
"set listchars=tab:\|_
"set list
" Tab 2 spaces
filetype plugin indent on
set tabstop=2 softtabstop=2 expandtab shiftwidth=2 smarttab
" Disables automatic commenting on newline:
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" coc
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
nmap <leader>gd <Plug>(coc-definition)
nmap <leader>gr <Plug>(coc-references)
inoremap <expr> <C-j> pumvisible() ? "\<Down>" : "\<C-j>"
inoremap <expr> <C-k> pumvisible() ? "\<Up>" : "\<C-k>"
" fzf remaps
"nnoremap <C-p> :GFiles<CR>
nnoremap <C-q> :GFiles<CR>
nnoremap <C-a> :Files<CR>
" php-doc-modded
nnoremap <C-c> :call PhpDocSingle()<CR>i
"nnoremap <C-P> :call PhpDocSingle()<CR>
"vnoremap <C-P> :call PhpDocRange()<CR>
let g:pdv_cfg_autoEndClass = 0
let g:pdv_cfg_autoEndFunction = 0
" Spell-check set to <leader>o, 'o' for 'orthography':
map <leader>o :setlocal spell! spelllang=en_au<CR>
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
set splitbelow splitright
" Shortcutting split navigation, saving a keypress:
" nnoremap <C-h> <C-w>h
" nnoremap <C-j> <C-w>j
" nnoremap <C-k> <C-w>k
" nnoremap <C-l> <C-w>l
" Check file in shellcheck:
map <leader>s :!clear && shellcheck %<CR>
" Replace all is aliased to S.
nnoremap S :%s//g<Left><Left>
" Ensure files are read as what I want:
let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
let g:vimwiki_list = [{'path': '~/vimwiki', 'syntax': 'markdown', 'ext': '.md'}]
autocmd BufRead,BufNewFile *.ms,*.me,*.mom,*.man set filetype=groff
autocmd BufRead,BufNewFile *.tex set filetype=tex
" Automatically deletes all trailing whitespace on save.
autocmd BufWritePre * %s/\s\+$//e
" Rebind $ to <leader>d
nnoremap <leader>d $
" Navigating with guides
inoremap <leader><leader> <Esc>/<++><Enter>"_c4l
vnoremap <leader><leader> <Esc>/<++><Enter>"_c4l
map <leader><leader> <Esc>/<++><Enter>"_c4l
" Remember last cursor position
autocmd BufReadPost * if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
" Update CHANGELOG message
inoremap <leader>C Update CHANGELOG<esc>:wq<cr>
"""HTML
autocmd FileType html inoremap <leader>b <b></b><Space><++><Esc>FbT>i
autocmd FileType html inoremap <leader>it <em></em><Space><++><Esc>FeT>i
autocmd FileType html inoremap <leader>1 <h1></h1><Enter><Enter><++><Esc>2kf<i
autocmd FileType html inoremap <leader>2 <h2></h2><Enter><Enter><++><Esc>2kf<i
autocmd FileType html inoremap <leader>3 <h3></h3><Enter><Enter><++><Esc>2kf<i
autocmd FileType html inoremap <leader>p <p></p><Enter><Enter><++><Esc>02kf>a
autocmd FileType html inoremap <leader>a <a<Space>href=""><++></a><Space><++><Esc>14hi
autocmd FileType html inoremap <leader>e <a<Space>target="_blank"<Space>href=""><++></a><Space><++><Esc>14hi
autocmd FileType html inoremap <leader>ul <ul><Enter><li></li><Enter></ul><Enter><Enter><++><Esc>03kf<i
autocmd FileType html inoremap <leader>li <Esc>o<li></li><Esc>F>a
autocmd FileType html inoremap <leader>ol <ol><Enter><li></li><Enter></ol><Enter><Enter><++><Esc>03kf<i
autocmd FileType html inoremap <leader>im <img src="" alt="<++>"><++><esc>Fcf"a
autocmd FileType html inoremap <leader>td <td></td><++><Esc>Fdcit
autocmd FileType html inoremap <leader>tr <tr></tr><Enter><++><Esc>kf<i
autocmd FileType html inoremap <leader>th <th></th><++><Esc>Fhcit
autocmd FileType html inoremap <leader>tab <table><Enter></table><Esc>O
autocmd FileType html inoremap <leader>gr <font color="green"></font><Esc>F>a
autocmd FileType html inoremap <leader>rd <font color="red"></font><Esc>F>a
autocmd FileType html inoremap <leader>yl <font color="yellow"></font><Esc>F>a
autocmd FileType html inoremap <leader>dt <dt></dt><Enter><dd><++></dd><Enter><++><esc>2kcit
autocmd FileType html inoremap <leader>dl <dl><Enter><Enter></dl><enter><enter><++><esc>3kcc
autocmd FileType html inoremap &<space> &amp;<space>
autocmd FileType html inoremap á &aacute;
autocmd FileType html inoremap é &eacute;
autocmd FileType html inoremap í &iacute;
autocmd FileType html inoremap ó &oacute;
autocmd FileType html inoremap ú &uacute;
autocmd FileType html inoremap ä &auml;
autocmd FileType html inoremap ë &euml;
autocmd FileType html inoremap ï &iuml;
autocmd FileType html inoremap ö &ouml;
autocmd FileType html inoremap ü &uuml;
autocmd FileType html inoremap ã &atilde;
autocmd FileType html inoremap &etilde;
autocmd FileType html inoremap ĩ &itilde;
autocmd FileType html inoremap õ &otilde;
autocmd FileType html inoremap ũ &utilde;
autocmd FileType html inoremap ñ &ntilde;
autocmd FileType html inoremap à &agrave;
autocmd FileType html inoremap è &egrave;
autocmd FileType html inoremap ì &igrave;
autocmd FileType html inoremap ò &ograve;
autocmd FileType html inoremap ù &ugrave;
""MARKDOWN
" autocmd Filetype markdown,rmd map <leader>w yiWi[<esc>Ea](<esc>pa)
" autocmd Filetype markdown,rmd inoremap <leader>n ---<Enter><Enter>
" autocmd Filetype markdown,rmd inoremap <leader>b ****<++><Esc>F*hi
" autocmd Filetype markdown,rmd inoremap <leader>s ~~~~<++><Esc>F~hi
" autocmd Filetype markdown,rmd inoremap <leader>e **<++><Esc>F*i
" autocmd Filetype markdown,rmd inoremap <leader>h ====<Space><++><Esc>F=hi
" autocmd Filetype markdown,rmd inoremap <leader>i ![](<++>)<++><Esc>F[a
" autocmd Filetype markdown,rmd inoremap <leader>a [](<++>)<++><Esc>F[a
" autocmd Filetype markdown,rmd inoremap <leader>1 #<Space><Enter><++><Esc>kA
" autocmd Filetype markdown,rmd inoremap <leader>2 ##<Space><Enter><++><Esc>kA
" autocmd Filetype markdown,rmd inoremap <leader>3 ###<Space><Enter><++><Esc>kA
" autocmd Filetype markdown,rmd inoremap <leader>l --------<Enter>
" autocmd Filetype rmd inoremap <leader>r ```{r}<CR>```<CR><CR><esc>2kO
" autocmd Filetype rmd inoremap <leader>p ```{python}<CR>```<CR><CR><esc>2kO
" autocmd Filetype rmd inoremap <leader>c ```<cr>```<cr><cr><esc>2kO
""".php
autocmd FileType php inoremap <leader>f public function <Enter>{<Enter><Tab><++><Enter>}<Esc>kkk$i
autocmd FileType php inoremap <leader>t $this
autocmd FileType php inoremap <leader>u use Thirty4\Theme\Form\\<++>;<Esc>5hi
autocmd FileType php inoremap <leader>s 'url' => [ 'select', [ 'name' => '' ]],<Esc>4hi
autocmd FileType php inoremap <leader>v var_dump();<CR>die();<Esc>k$hi