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 'ap/vim-css-color' Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } Plug 'darrikonn/vim-gofmt', { 'do': ':GoUpdateBinaries' } call plug#end() let g:airline_powerline_fonts=1 " Some basics: set go=a set mouse=a set nohlsearch set clipboard+=unnamedplus set incsearch set ignorecase set smartcase set linebreak set noswapfile set nobackup set undodir=~/.config/nvim/undodir set undofile "let g:gruvbox_contrast_dark = 'hard' "if exists('+termguicolors') " let &t_8f = "\[38;2;%lu;%lu;%lum" " let &t_8b = "\[38;2;%lu;%lu;%lum" "endif "let g:gruvbox_invert_selection = '0' "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 \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ coc#refresh() inoremap pumvisible() ? "\" : "\" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction nmap gd (coc-definition) nmap gr (coc-references) nmap rr (coc-rename) nnoremap prw :CocSearch =expand("") inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" " fzf remaps "nnoremap :GFiles nnoremap :GFiles nnoremap :Files let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.5, 'highlight': 'Comment' } } " Spell-check set to o, 'o' for 'orthography': map o :setlocal spell! spelllang=en_au " Splits open at the bottom and right, which is non-retarded, unlike vim defaults. set splitbelow splitright " Shortcutting split navigation, saving a keypress: nnoremap h nnoremap j nnoremap k nnoremap l " Check file in shellcheck: map s :!clear && shellcheck % " Replace all is aliased to S. nnoremap :%s//g " For chrome extension development " nnoremap :set syntax= " Navigating with guides inoremap /<++>"_c4l vnoremap /<++>"_c4l map /<++>"_c4l " Remember last cursor position autocmd BufReadPost * if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif " Copy entire document noremap y ggyG map y ggyG autocmd BufNewFile,BufRead *.gohtml set syntax=html