]> git.r.bdr.sh - rbdr/dotfiles/blame - vimrc
Add install script
[rbdr/dotfiles] / vimrc
CommitLineData
b100af91
BB
1set nocompatible
2
0e40ccc4
BB
3"
4" Basics
5"
6
b100af91
BB
7set number
8set ruler
9syntax on
10
11" Set encoding
12set encoding=utf-8
13
14" Whitespace stuff
15set nowrap
16set tabstop=2
17set shiftwidth=2
18set softtabstop=2
19set expandtab
20set list listchars=tab:\ \ ,trail:ยท
21
22" Searching
23set hlsearch
24set incsearch
25set ignorecase
26set smartcase
27
28" Tab completion
29set wildmode=list:longest,list:full
30set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*
31
32" Status bar
33set laststatus=2
34
0e40ccc4
BB
35" allow backspacing over everything in insert mode
36set backspace=indent,eol,start
b100af91 37
0e40ccc4
BB
38" Show (partial) command in the status line
39set showcmd
b100af91
BB
40
41" Remember last location in file
42if has("autocmd")
43 au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
44 \| exe "normal g'\"" | endif
45endif
46
0e40ccc4
BB
47"
48" File Type Config
49"
b100af91
BB
50
51" make uses real tabs
52au FileType make set noexpandtab
53
54" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby
55au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby
56
b100af91
BB
57" make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ )
58au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79
59
6e876679
BB
60" snes syntax highlighting
61au BufNewFile,BufRead *.asm,*.s set filetype=snes"
62
b100af91
BB
63" load the plugin and indent settings for the detected filetype
64filetype plugin indent on
32081fee 65filetype plugin on
d9b5e620 66set omnifunc=syntaxcomplete#Complete
b100af91 67
0e40ccc4
BB
68" Directories for swp files
69set backupdir=~/.vim/.backup
70set directory=~/.vim/.backup
71
72" Include local vimrc
73if filereadable(expand("~/.vimrc.local"))
74 source ~/.vimrc.local
75endif
76
77"
78" Tool Configs
79"
80
81" CTags
82map <Leader>rt :!ctags --extra=+f -R *<CR><CR>
83map <C-\> :tnext<CR>
84
b100af91
BB
85" Opens an edit command with the path of the currently edited file filled in
86" Normal mode: <Leader>e
87map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
88
89" Opens a tab edit command with the path of the currently edited file filled in
90" Normal mode: <Leader>t
91map <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR>
92
0e40ccc4
BB
93" % to bounce from do to end etc.
94runtime! macros/matchit.vim
b100af91 95
0e40ccc4
BB
96" Dank Mono Italics
97highlight Keyword cterm=italic
b100af91 98
0e40ccc4
BB
99" FZF config
100set rtp+=/usr/local/opt/fzf
b100af91 101
0e40ccc4
BB
102" Inserts the path of the currently edited file into a command
103noremap <C-P> :FZF <CR>
b100af91 104
0e40ccc4
BB
105" ALE config
106let g:ale_linters = {'javascript': ['eslint']}
b100af91 107
0e40ccc4
BB
108"
109" A E S T H E T I C S
110"
b100af91 111
0e40ccc4
BB
112" Color Column
113let &colorcolumn="80,150"
b100af91 114
0e40ccc4
BB
115" Default color scheme
116set termguicolors
117color rbdr
b100af91 118
0e40ccc4
BB
119" Map colors to vim colors
120let g:fzf_colors =
121\ { 'fg': ['fg', 'Normal'],
122 \ 'bg': ['bg', 'Normal'],
123 \ 'hl': ['fg', 'Comment'],
124 \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
125 \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
126 \ 'hl+': ['fg', 'Statement'],
127 \ 'info': ['fg', 'PreProc'],
128 \ 'border': ['fg', 'Ignore'],
129 \ 'prompt': ['fg', 'Conditional'],
130 \ 'pointer': ['fg', 'Exception'],
131 \ 'marker': ['fg', 'Keyword'],
132 \ 'spinner': ['fg', 'Label'],
133 \ 'header': ['fg', 'Comment'] }
b100af91 134
0e40ccc4
BB
135"
136" Editing Shortcuts
137"
b100af91 138
b100af91
BB
139" Folding Settings
140set foldmethod=syntax
141set foldnestmax=10
142set nofoldenable
143set foldlevel=1
321ecaca 144
7da00f60 145" Relative numbers
b4df7438
BB
146autocmd FocusLost * :set norelativenumber
147autocmd InsertEnter * :set norelativenumber
7da00f60
BB
148autocmd InsertLeave * :set relativenumber
149autocmd CursorMoved * :set relativenumber
150
151function! NumberToggle()
152 if(&relativenumber == 1)
b4df7438 153 set norelativenumber
7da00f60
BB
154 else
155 set relativenumber
156 endif
157endfunction
158
159nnoremap <C-n> :call NumberToggle()<cr>
35771083 160
138316b6
BB
161
162" Move things up and down using Ctrl + Shift
163nnoremap <C-S-j> :m .+1<CR>==
164nnoremap <C-S-k> :m .-2<CR>==
165inoremap <C-S-j> <Esc>:m .+1<CR>==gi
166inoremap <C-S-k> <Esc>:m .-2<CR>==gi
167vnoremap <C-S-j> :m '>+1<CR>gv=gv
168vnoremap <C-S-k> :m '<-2<CR>gv=gv
3293278c 169
3293278c 170"
0e40ccc4 171" Plug Config
3293278c
BB
172"
173
0e40ccc4
BB
174call plug#begin('~/.vim/plugged')
175
3293278c
BB
176" Syntaxes
177Plug 'rbdr/api-notation.vim'
178Plug 'elzr/vim-json'
179Plug 'mustache/vim-mode'
180Plug 'othree/yajs.vim'
181Plug 'ARM9/snes-syntax-vim'
182Plug 'posva/vim-vue'
183Plug 'leafOfTree/vim-svelte-plugin'
184Plug 'bumaociyuan/vim-swift'
185Plug 'udalov/kotlin-vim'
186
187" Editing
188Plug 'jiangmiao/auto-pairs'
0e40ccc4 189Plug 'tpope/vim-endwise'
3293278c
BB
190Plug 'michaeljsmith/vim-indent-object'
191
192" Tools
193Plug 'editorconfig/editorconfig-vim'
0e40ccc4 194Plug 'dense-analysis/ale'
3293278c
BB
195Plug 'vim-scripts/LargeFile'
196Plug 'tpope/vim-fugitive'
197Plug 'milkypostman/vim-togglelist'
198Plug 'jremmen/vim-ripgrep'
199Plug 'lifepillar/vim-mucomplete'
200
201" List ends here. Plugins become visible to Vim after this call.
202call plug#end()