111 lines
2.5 KiB
VimL
111 lines
2.5 KiB
VimL
|
" Basic configurations
|
||
|
set clipboard=unnamedplus
|
||
|
set nocompatible
|
||
|
syntax on
|
||
|
set encoding=utf-8
|
||
|
set number
|
||
|
set textwidth=100
|
||
|
set novisualbell
|
||
|
|
||
|
let mapleader =","
|
||
|
set guicursor=v-c-sm:block,n-i-ci-ve:ver25,r-cr-o:hor20
|
||
|
|
||
|
" Spell-check set to <leader>o, 'o' for 'orthography':
|
||
|
map <leader>o :setlocal spell! spelllang=en_us<CR>
|
||
|
|
||
|
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
|
||
|
set splitbelow splitright
|
||
|
|
||
|
" Enable autocompletion:
|
||
|
set wildmode=longest,list,full
|
||
|
|
||
|
" Disables automatic commenting on newline:
|
||
|
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
|
||
|
|
||
|
" Indentations
|
||
|
" set smartindent
|
||
|
" set smarttab
|
||
|
set softtabstop=2
|
||
|
set shiftwidth=2
|
||
|
set expandtab
|
||
|
filetype plugin indent on
|
||
|
|
||
|
" Search and Replace
|
||
|
set ignorecase
|
||
|
set smartcase
|
||
|
set nohlsearch
|
||
|
" set hlsearch
|
||
|
set incsearch
|
||
|
|
||
|
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
|
||
|
set splitbelow splitright
|
||
|
|
||
|
nnoremap <C-j> :bprevious<CR>
|
||
|
nnoremap <C-k> :bnext<CR>
|
||
|
nnoremap <leader>b :Buffer<CR>
|
||
|
|
||
|
" Toggle line numbers
|
||
|
nmap <C-N><C-N> :set invnumber<CR>
|
||
|
|
||
|
" Other remaps
|
||
|
nnoremap F :Files<CR>
|
||
|
imap jj <Esc>
|
||
|
set backspace=indent,eol,start
|
||
|
nnoremap S :%s///g<Left><Left><Left>
|
||
|
noremap <Up> <Nop>
|
||
|
noremap <Down> <Nop>
|
||
|
noremap <Left> <Nop>
|
||
|
noremap <Right> <Nop>
|
||
|
|
||
|
" Edit .j2 as yaml files
|
||
|
au BufNewFile,BufReadPost *.yaml.j2 set filetype=yaml
|
||
|
|
||
|
" Remove trailing whitespace
|
||
|
autocmd BufWritePre * %s/\s\+$//e
|
||
|
|
||
|
" Whitespace as shown as dots
|
||
|
set list
|
||
|
set listchars=lead:·,trail:·,tab:»\ ,extends:»,precedes:«,nbsp:·
|
||
|
|
||
|
" Plugins
|
||
|
call plug#begin()
|
||
|
Plug 'junegunn/goyo.vim'
|
||
|
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||
|
Plug 'junegunn/fzf.vim'
|
||
|
Plug 'marklcrns/vim-smartq'
|
||
|
call plug#end()
|
||
|
|
||
|
" Smartq
|
||
|
let g:smartq_default_mappings = 0
|
||
|
nnoremap ZZ :w<CR>:SmartQ<CR>
|
||
|
nnoremap ZQ <Plug>(smartq_this)
|
||
|
|
||
|
" Goyo
|
||
|
autocmd vimenter * Goyo 100
|
||
|
function! s:goyo_enter()
|
||
|
set linebreak
|
||
|
set wrap
|
||
|
let b:quitting = 0
|
||
|
let b:quitting_bang = 0
|
||
|
autocmd QuitPre <buffer> let b:quitting = 1
|
||
|
cabbrev <buffer> q! let b:quitting_bang = 1 <bar> q!
|
||
|
endfunction
|
||
|
function! s:goyo_leave()
|
||
|
" Quit Vim if this is the only remaining buffer
|
||
|
if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
|
||
|
if b:quitting_bang
|
||
|
qa!
|
||
|
else
|
||
|
qa
|
||
|
endif
|
||
|
endif
|
||
|
endfunction
|
||
|
autocmd! User GoyoEnter call <SID>goyo_enter()
|
||
|
autocmd! User GoyoLeave call <SID>goyo_leave()
|
||
|
|
||
|
" Colours
|
||
|
highlight NonText ctermfg=DarkGrey
|
||
|
highlight SpecialKey ctermfg=DarkGrey
|
||
|
highlight StatusLine ctermbg=White ctermfg=DarkGrey
|
||
|
highlight LineNr ctermfg=DarkGrey
|