summaryrefslogtreecommitdiff
path: root/neovim/init.vim
blob: e49f9d6bc64e06d72b86a5f6fd9d3e1be952998d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
" ================ Settings ================

" Show current line number absolute, others relative
set number
set relativenumber

" Highlight current line and column
set cursorline
set cursorcolumn

" Make tabs and trailing spaces visible
set list
set listchars=tab:>-,trail:-
set tabstop=4 " Width of tab char
set shiftwidth=4 " Width of indentation

" Highlight matching [], {}, and ()
set showmatch

" Case-insensitive search unless capitals are used
set ignorecase
set smartcase

" Spare SSDs from unnecessary writes
set noswapfile
set shada="NONE"
set viminfo="NONE"

" Make some commands more intuitive for wrapped lines
nnoremap j gj
nnoremap k gk
"nnoremap 0 g0
"nnoremap ^ g^
"nnoremap $ g$

" Tolerate commonly mistyped commands
command WQ wq
command Wq wq
command Q q
command W w

" Ensure proper syntax highlighting
autocmd BufRead,BufFilePre,BufNewFile *.asm set filetype=nasm
autocmd BufRead,BufFilePre,BufNewFile *.md,*.pdc set filetype=markdown.pandoc



" ================ Plugins =================

" Start plugin manager (https://github.com/junegunn/vim-plug)
call plug#begin('~/.config/nvim/plug')

" Better terminal integration (https://github.com/wincent/terminus)
Plug 'wincent/terminus'

" My favourite colour scheme (https://github.com/joshdick/onedark.vim)
Plug 'joshdick/onedark.vim'

" Lightweight statusline (https://github.com/itchyny/lightline.vim)
Plug 'itchyny/lightline.vim'
" Also apply onedark theme to statusline
let g:lightline = { 'colorscheme' : 'onedark' }
" Only let lightline show current mode
set noshowmode

" Better syntax packs (https://github.com/sheerun/vim-polyglot)
Plug 'sheerun/vim-polyglot'
let g:polyglot_disabled = [] " blacklist

" Markdown syntax (https://github.com/vim-pandoc/vim-pandoc-syntax)
" which properly highlights LaTeX maths code inside documents
Plug 'vim-pandoc/vim-pandoc-syntax'

" Convenient movement (https://github.com/justinmk/vim-sneak)
Plug 'justinmk/vim-sneak'
let g:sneak#use_ic_scs = 1 " smartcase

call plug#end()

" Apply onedark colour scheme (must come after plug#end)
if (has('termguicolors'))
    set termguicolors
endif
colorscheme onedark
" Clear background colour to improve contrast
hi Normal guibg=none