summaryrefslogtreecommitdiff
path: root/.vim/vimrc
blob: d241ab6b68fc5f5b33d1c8eee9df7c055ec17c49 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
"               __       _           _
"   ___   __ _ / _| ___ | |__   __ _| |__   ___
"  / __| / _' | |_ / _ \|  _ \ / _' |  _ \ / _ \
" | |__ / (_| |  _|  __/| |_) / (_| | |_) |  __/
"  \___|\___._|_|  \___||____/\___._|____/ \___/
"
" Filename:   vimrc

" General Settings {{{{{{

filetype plugin indent on
syntax enable
set nocompatible
set modeline
set modelines=5
set nobackup
set nowritebackup
set updatetime=300
set hidden
set noswapfile
set laststatus=2
set shortmess+=c

let g:markdown_fenced_languages = ['javascript', 'js=javascript', 'json=javascript']

let $RTP=split(&runtimepath, ',')[0]
let $RC="$HOME/.vim/vimrc"

" }}}}}}

" Plugins {{{

call plug#begin('~/.vim/plugged')

source ~/.config/vim/plugins/ale.vim
source ~/.config/vim/plugins/coc.vim
source ~/.config/vim/plugins/commentary.vim
source ~/.config/vim/plugins/dirvish.vim
source ~/.config/vim/plugins/gitbranch.vim
source ~/.config/vim/plugins/javascript.vim
source ~/.config/vim/plugins/lightline.vim
source ~/.config/vim/plugins/maximizer.vim
source ~/.config/vim/plugins/onedark.vim
source ~/.config/vim/plugins/polyglot.vim

call plug#end()


" }}}

" Colors {{{

if (has("termguicolors"))
    set termguicolors
endif

" joshdick/onedark.vim
colorscheme onedark

" }}}

" Tabs and Spaces {{{

set autoindent
set smartindent
set expandtab
set tabstop=4
set shiftwidth=4

" }}}

" File Find {{{

" Search down into subfolders
set path+=~/Scripts/**,~/Documents/**
set wildmenu

" }}}

" UI {{{

set number
set relativenumber
set cursorline
set showcmd
set cmdheight=1
set completeopt=menuone,noinsert,noselect
set splitright
set splitbelow
set ignorecase
set smartcase
set showmatch
set signcolumn=yes
set incsearch
set diffopt+=vertical
set foldenable
set foldlevelstart=10
set foldnestmax=10
set foldmethod=marker

" }}}

" Commands {{{

" Use ^] to jump to tag under cursor
" Use g^] for ambiguous tags
" Use ^t to jump back up the tag stack
command! MakeTags !ctags -R *

" }}}

" Keybindings {{{

let mapleader="\<space>"

" Quick navigation between splits
nmap <silent> <c-h> <c-w>h
nmap <silent> <c-j> <c-w>j
nmap <silent> <c-k> <c-w>k
nmap <silent> <c-l> <c-w>l

" Delete all buffers
nmap <leader>Q :bufdo bdelete<CR>

nmap <leader>ve :edit $MYVIMRC<CR>
nmap <leader>vr :source $MYVIMRC <bar> :doautocmd BufRead<CR>

nnoremap <leader>m :MaximizerToggle!<CR>
nnoremap <leader>F :ALEFix<CR>
nnoremap <leader>d :cd %:p:h<CR>:pwd<CR>

" Copy & Paste with system-clipboard
vnoremap <c-c> "+y
nnoremap <c-v> "+p

" Quickly escape to normal mode
imap jj <Esc>

" Allow gf to open non-existent files
map gf :edit <cfile><CR>

" Open the current file in the default program
nmap <leader>x :!xdg-open %<CR><CR>

" }}}

" vim:foldlevel=0