]> git.r.bdr.sh - rbdr/dotfiles/blame_incremental - vimrc
Add fzf autocomplete in ubuntu
[rbdr/dotfiles] / vimrc
... / ...
CommitLineData
1set nocompatible
2
3"
4" Basics
5"
6
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
35" allow backspacing over everything in insert mode
36set backspace=indent,eol,start
37
38" Show (partial) command in the status line
39set showcmd
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
47"
48" File Type Config
49"
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
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
60" snes syntax highlighting
61au BufNewFile,BufRead *.asm,*.s set filetype=snes"
62
63" load the plugin and indent settings for the detected filetype
64filetype plugin indent on
65filetype plugin on
66
67" Directories for swp files
68set backupdir=~/.vim/.backup
69set directory=~/.vim/.backup
70
71" Include local vimrc
72if filereadable(expand("~/.vimrc.local"))
73 source ~/.vimrc.local
74endif
75
76"
77" Tool Configs
78"
79
80" CTags
81map <Leader>rt :!ctags --extra=+f -R *<CR><CR>
82map <C-\> :tnext<CR>
83
84" Opens an edit command with the path of the currently edited file filled in
85" Normal mode: <Leader>e
86map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
87
88" Opens a tab edit command with the path of the currently edited file filled in
89" Normal mode: <Leader>t
90map <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR>
91
92" % to bounce from do to end etc.
93runtime! macros/matchit.vim
94
95" Dank Mono Italics
96highlight Keyword cterm=italic
97
98" FZF config
99set rtp+=$FZF_VIM_PATH
100
101" Inserts the path of the currently edited file into a command
102noremap <C-P> :FZF <CR>
103
104let g:fzf_layout = { 'down': '40%' }
105
106" Auto Pairs
107let g:AutoPairsMultilineClose = 0
108
109" ALE config
110let g:ale_linter_aliases = {'svelte': ['css', 'javascript']}
111let g:ale_linters = {
112 \'javascript': ['eslint'],
113 \'svelte': ['stylelint', 'eslint']
114 \}
115let g:ale_fixers = {
116 \'javascript': ['eslint'],
117 \'svelte': ['eslint']
118 \}
119let g:ale_fix_on_save = 1
120
121" Deoplete config
122let g:deoplete#enable_at_startup = 1
123inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
124inoremap <expr><S-tab> pumvisible() ? "\<c-p>" : "\<tab>"
125
126"
127" A E S T H E T I C S
128"
129
130" Color Column
131let &colorcolumn="80,150"
132
133" Default color scheme
134set termguicolors
135color rbdr
136
137" Map colors to vim colors
138let g:fzf_colors =
139\ { 'fg': ['fg', 'Normal'],
140 \ 'bg': ['bg', 'Normal'],
141 \ 'hl': ['fg', 'Comment'],
142 \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
143 \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
144 \ 'hl+': ['fg', 'Statement'],
145 \ 'info': ['fg', 'PreProc'],
146 \ 'border': ['fg', 'Ignore'],
147 \ 'prompt': ['fg', 'Conditional'],
148 \ 'pointer': ['fg', 'Exception'],
149 \ 'marker': ['fg', 'Keyword'],
150 \ 'spinner': ['fg', 'Label'],
151 \ 'header': ['fg', 'Comment'] }
152
153"
154" Editing Shortcuts
155"
156
157" Folding Settings
158set foldmethod=syntax
159set foldnestmax=10
160set nofoldenable
161set foldlevel=1
162
163" Relative numbers
164autocmd FocusLost * :set norelativenumber
165autocmd InsertEnter * :set norelativenumber
166autocmd InsertLeave * :set relativenumber
167autocmd CursorMoved * :set relativenumber
168
169function! NumberToggle()
170 if(&relativenumber == 1)
171 set norelativenumber
172 else
173 set relativenumber
174 endif
175endfunction
176
177nnoremap <C-n> :call NumberToggle()<cr>
178
179
180" Move things up and down using Ctrl + Shift
181nnoremap <C-S-j> :m .+1<CR>==
182nnoremap <C-S-k> :m .-2<CR>==
183inoremap <C-S-j> <Esc>:m .+1<CR>==gi
184inoremap <C-S-k> <Esc>:m .-2<CR>==gi
185vnoremap <C-S-j> :m '>+1<CR>gv=gv
186vnoremap <C-S-k> :m '<-2<CR>gv=gv
187
188" Limelight / Goyo config
189
190autocmd! User GoyoEnter Limelight
191autocmd! User GoyoLeave Limelight!
192nnoremap <C-S-l> :Limelight!!<CR>==
193inoremap <C-S-l> <Esc>:Limelight!!<CR>==gi
194vnoremap <C-S-l> :<C-u>Limelight!!<CR>gv=gv
195nnoremap <C-S-g> :Goyo<CR>==
196inoremap <C-S-g> <Esc>:Goyo<CR>==gi
197vnoremap <C-S-g> :<C-u>Goyo<CR>gv=gv
198
199"
200" Plug Config
201"
202
203call plug#begin('~/.vim/plugged')
204
205" Syntaxes
206Plug 'https://gitlab.com/rbdr/api-notation.vim.git'
207Plug 'elzr/vim-json'
208Plug 'mustache/vim-mode'
209Plug 'othree/yajs.vim'
210Plug 'ARM9/snes-syntax-vim'
211Plug 'posva/vim-vue'
212Plug 'leafOfTree/vim-svelte-plugin'
213Plug 'bumaociyuan/vim-swift'
214Plug 'udalov/kotlin-vim'
215Plug 'tikhomirov/vim-glsl'
216Plug 'jparise/vim-graphql'
217Plug 'digitaltoad/vim-pug'
218
219" Editing
220Plug 'tpope/vim-endwise'
221Plug 'rstacruz/vim-closer'
222Plug 'michaeljsmith/vim-indent-object'
223Plug 'editorconfig/editorconfig-vim'
224
225" Distraction free editing
226Plug 'junegunn/goyo.vim'
227Plug 'junegunn/limelight.vim'
228
229" Tools
230Plug 'editorconfig/editorconfig-vim'
231Plug 'dense-analysis/ale'
232Plug 'neoclide/coc.nvim', {'branch': 'release'}
233Plug 'vim-scripts/LargeFile'
234Plug 'tpope/vim-fugitive'
235Plug 'milkypostman/vim-togglelist'
236Plug 'jremmen/vim-ripgrep'
237
238" List ends here. Plugins become visible to Vim after this call.
239call plug#end()