]> git.r.bdr.sh - rbdr/dotfiles/blame - config/nvim/init.vim
Update defaults
[rbdr/dotfiles] / config / nvim / init.vim
CommitLineData
252cea16
RBR
1"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2" Style
3"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4" Editor Style
5set number " Show number column
6set nowrap " Don't wrap text
7set list " Display tabs and trailing space
8let &colorcolumn="80,150" " Show color columns
9
10" Color
11set termguicolors
12color rbdr
13
14" Tab Style (Always override with editorconfig)
15set tabstop=2 " 2 Spaces per tab
16set shiftwidth=2 " Spaces used in Autoindent
17set softtabstop=2 " Spaces used when soft tabbing
18set expandtab " Always use spaces
19
20"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
21" Behavior
22"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
23" Search Behavior
24set ignorecase " Ignore case when searching
25set smartcase " Unless we use both cases in search
26
27" Autocomplete Behavior
28set wildmode=list:longest,list:full " Autocomplete common matching string
29 " first, and then the full match.
30
31" Folding Behavior
32set foldmethod=syntax " Use syntax highlight to define folds
33set foldnestmax=10 " Max 10 folds
34set foldlevelstart=99 " Start with all folds open
35
36" Relative Number Behavior
37autocmd FocusLost * :set norelativenumber
38autocmd InsertEnter * :set norelativenumber
39autocmd InsertLeave * :set relativenumber
40autocmd CursorMoved * :set relativenumber
41
42function! NumberToggle()
43 if(&relativenumber == 1)
44 set norelativenumber
45 else
46 set relativenumber
47 endif
48endfunction
49
50nnoremap <C-n> :call NumberToggle()<cr>
51
52" Move lines / blocks up and down using Ctrl + Shift
53nnoremap <C-S-j> :m .+1<CR>==
54nnoremap <C-S-k> :m .-2<CR>==
55inoremap <C-S-j> <Esc>:m .+1<CR>==gi
56inoremap <C-S-k> <Esc>:m .-2<CR>==gi
57vnoremap <C-S-j> :m '>+1<CR>gv=gv
58vnoremap <C-S-k> :m '<-2<CR>gv=gv
59
60"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
61" File Specific Behavior
62"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
63" Makefiles
64au FileType make set noexpandtab " Makefiles need real tabs
65
66" SNES files
67au BufNewFile,BufRead *.asm,*.s set filetype=snes"
68"
69
70"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
71" Local Overrides
72"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
73if filereadable(expand("~/.init.local.vim"))
74 source ~/.init.local.vim
75endif
76
77"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
78" Plugin Specific Behavior
79"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
80" FZF
81set rtp+=$FZF_VIM_PATH " Load FZF vim plugin
82noremap <C-P> :FZF <CR>
83let g:fzf_layout = { 'down': '40%' }
84let g:fzf_colors =
85\ { 'fg': ['fg', 'Normal'],
86 \ 'bg': ['bg', 'Normal'],
87 \ 'hl': ['fg', 'Comment'],
88 \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
89 \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
90 \ 'hl+': ['fg', 'Statement'],
91 \ 'info': ['fg', 'PreProc'],
92 \ 'border': ['fg', 'Ignore'],
93 \ 'prompt': ['fg', 'Conditional'],
94 \ 'pointer': ['fg', 'Exception'],
95 \ 'marker': ['fg', 'Keyword'],
96 \ 'spinner': ['fg', 'Label'],
97 \ 'header': ['fg', 'Comment'] }
98
99" Svelte Config
100let g:vim_svelte_plugin_use_typescript = 1
101
102" Limelight / Goyo config
103
104let g:limelight_conceal_ctermfg = 'gray'
105let g:limelight_conceal_guifg = 'DarkGray'
106
107autocmd! User GoyoEnter Limelight
108autocmd! User GoyoLeave Limelight!
109nnoremap <leader>i :Limelight!!<CR>==
110inoremap <leader>i <Esc>:Limelight!!<CR>==gi
111vnoremap <leader>i :<C-u>Limelight!!<CR>gv=gv
112nnoremap <leader>g :Goyo<CR>==
113inoremap <leader>g <Esc>:Goyo<CR>==gi
114vnoremap <leader>g :<C-u>Goyo<CR>gv=gv
115
116" Plug
117runtime plugins.vim