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