|
|
- 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 = "\<Esc>[38;2;%lu;%lu;%lum"
- " let &t_8b = "\<Esc>[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 <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)
- nmap <leader>rr <Plug>(coc-rename)
- nnoremap <leader>prw :CocSearch <C-R>=expand("<cword>")<CR><CR>
-
- 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>
-
- let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.5, 'highlight': 'Comment' } }
-
- " 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 <c-s> :%s//g<Left><Left>
-
- " For chrome extension development
- " nnoremap <c-h> :set syntax=
-
- " 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
-
- " Copy entire document
- noremap <leader>y <Esc>ggyG<C-o>
- map <leader>y <Esc>ggyG<C-o>
-
- autocmd BufNewFile,BufRead *.gohtml set syntax=html
-
|