From 1dcf16ef24c7ab3f82292ad9ae195febc6964f6a Mon Sep 17 00:00:00 2001 From: navewindre Date: Tue, 17 Sep 2024 07:20:56 +0200 Subject: ye --- config/nvim/ftdetect/HeavenCfg.vim | 1 + config/nvim/syntax/HeavenCfg.vim | 24 ++++++ vimrc | 170 ++++++++++++++++++++++++++++--------- 3 files changed, 153 insertions(+), 42 deletions(-) create mode 100644 config/nvim/ftdetect/HeavenCfg.vim create mode 100644 config/nvim/syntax/HeavenCfg.vim diff --git a/config/nvim/ftdetect/HeavenCfg.vim b/config/nvim/ftdetect/HeavenCfg.vim new file mode 100644 index 0000000..e8fac4b --- /dev/null +++ b/config/nvim/ftdetect/HeavenCfg.vim @@ -0,0 +1 @@ +au BufRead,BufNewFile *.hmap,*.hcfg set filetype=HeavenCfg diff --git a/config/nvim/syntax/HeavenCfg.vim b/config/nvim/syntax/HeavenCfg.vim new file mode 100644 index 0000000..3297f8e --- /dev/null +++ b/config/nvim/syntax/HeavenCfg.vim @@ -0,0 +1,24 @@ +function! DefineKeywords(keywords) + for keyword in a:keywords + execute 'syntax keyword HeavenCfgKeyword '. keyword + endfor + hi def link HeavenCfgKeyword Keyword +endfunction + +function! DefineSpecial(keywords) + for keyword in a:keywords + execute 'syntax keyword HeavenCfgSpecial '. keyword + endfor + hi def link HeavenCfgSpecial Special +endfunction + +call DefineKeywords( ['DEF', 'I32', 'F32', 'STR', 'BYTES', 'U8', 'CLR', 'VEC2', 'VEC3' ] ) + +call DefineSpecial( ['map', 'mat'] ) + +syntax match HeavenCfgVar /\<\w\+\>/ +syntax match HeavenCfgString /"[^"]*"/ +syntax match HeavenCfgNum /\v\d+(\.\d+)?([eE][+-]?\d+)?/ +hi def link HeavenCfgNum Number +hi def link HeavenCfgString String +hi def link HeavenCfgVar Variable diff --git a/vimrc b/vimrc index ca03404..b10ff8c 100644 --- a/vimrc +++ b/vimrc @@ -9,6 +9,8 @@ set showtabline=2 set nocompatible filetype plugin on +let g:mapleader = '\' + lua <'] = cmp.mapping.scroll_docs(-4), -- [''] = cmp.mapping.scroll_docs(4), @@ -82,17 +79,15 @@ lua <'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }), sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'vsnip' }, -- For vsnip users. - -- { name = 'luasnip' }, -- For luasnip users. - -- { name = 'ultisnips' }, -- For ultisnips users. - -- { name = 'snippy' }, -- For snippy users. - }, { - { name = 'buffer' }, + { name = 'nvim_lsp' }, + { name = 'vsnip' }, + -- { name = 'man' } + }, { + { name = 'buffer' } }) }) - -- Set configuration for specific filetype. + cmp.setup.filetype('gitcommit', { sources = cmp.config.sources({ { name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). @@ -110,14 +105,36 @@ lua < 1 + wincmd w + else + execute('call lightline#bufferline#go_previous()') + endif +endfunction function! SW() if winnr('$') > 1 wincmd w else - tabnext + execute('call lightline#bufferline#go_next()') endif endfunction @@ -326,8 +390,11 @@ function! Q() if exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) != -1 NERDTreeClose else - if winnr('$') > 1 - q + nohlsearch + if winnr('$') > 1 + close + elseif len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) > 1 + call feedkeys(':bd') else call feedkeys(':q') endif @@ -335,7 +402,7 @@ function! Q() endfunction function! GoToTab(tab_number) - execute 'tabn ' . a:tab_number + execute 'call lightline#bufferline#go(' . a:tab_number . ')' endfunction function! InputTabNumber() @@ -345,13 +412,25 @@ function! InputTabNumber() endif endfunction +function! TurnOffCDiag() + if &filetype == 'c' || &filetype == 'cpp' + ALEDisable + endif +endfunction + +autocmd BufReadPost * call TurnOffCDiag() + nnoremap :NERDTree inoremap :NERDTree vnoremap :NERDTree nnoremap :call Q() +nnoremap :call SWB() nnoremap :call SW() +noremap :tabn +noremap :tabp + nnoremap :call InputTabNumber() inoremap :call InputTabNumber() vnoremap :call InputTabNumber() @@ -361,15 +440,21 @@ nnoremap :Telescope current_buffer_fuzzy_find nnoremap :lua ToggleDiagnostics() -vnoremap >gv -nnoremap :VimspectorRestart +nnoremap b :VimspectorBreakpoints +nnoremap d :VimspectorDisassemble +nnoremap [ VimspectorUpFrame +nnoremap ] VimspectorDownFrame +nnoremap VimspectorBalloonEval + inoremap +vnoremap >gv vnoremap