summaryrefslogtreecommitdiff
path: root/.config/nvim/init.vim
blob: 5cba9a4864917c35b725480ecdad17f4365e977d (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
if &compatible
  set nocompatible
endif
filetype plugin on
filetype indent on
syntax on

set number
set relativenumber
let g:netrw_banner = v:false
set title
set nohlsearch
set noincsearch
set laststatus=2

set background=dark
augroup CustomizeColorScheme
  autocmd!
  autocmd ColorScheme,VimEnter * highlight Normal ctermbg=NONE guibg=NONE
augroup END
silent! colorscheme wildcharm

set list
set listchars=tab:..,trail:_,extends:>,precedes:<,nbsp:~

set scrolloff=5
set splitbelow
set splitright

set path+=**
set completeopt=menu,menuone,popup,fuzzy
set ignorecase

set undofile
set undolevels=10000

let g:mapleader = ' '
nnoremap <Leader>s :setlocal spell!<CR>
nnoremap <C-p> :e **/*

"if has('nvim-0.11')
"  if executable('clangd')
"    lua vim.lsp.enable('clangd')
"  endif
"  if executable('gopls')
"    lua vim.lsp.enable('gopls')
"  endif
"endif

if has('nvim')
  augroup StartTreesitter
    autocmd!
    autocmd FileType * lua pcall(vim.treesitter.start)
  augroup END
endif

inoremap (;<CR> (<CR>);<C-c>O
inoremap (<CR>  (<CR>)<C-c>O
inoremap [;<CR> [<CR>];<C-c>O
inoremap [<CR>  [<CR>]<C-c>O
inoremap {;<CR> {<CR>};<C-c>O
inoremap {<CR>  {<CR>}<C-c>O
inoremap " ""<Left>
inoremap ' ''<Left>

function! s:CreateAbbrs(ft) abort
  for a in glob(split(&rtp, ',')[0] .. '/abbr/' .. a:ft .. '/*', 0, 1)
    execute 'iabbrev <buffer> ' .. fnamemodify(a, ':t:r') .. ' <C-o>:-1read ' .. a .. '<CR>'
  endfor
endfunction
command! -nargs=1 CreateAbbrs call s:CreateAbbrs(<f-args>)
inoremap <C-f> <C-o>/@<CR><C-o>x
inoremap <C-b> <C-o>?@<CR><C-o>x

augroup AutoCreateAbbrs
  autocmd!
  for a in glob(split(&rtp, ',')[0] .. '/abbr/*', 0, 1)
    let ft = fnamemodify(a, ':t:r')
    execute 'autocmd FileType ' .. ft .. ' CreateAbbrs ' .. ft
  endfor
augroup END