From 7d211e2e6570ef443fb393cae67aa0d053629994 Mon Sep 17 00:00:00 2001 From: A-Larsen Date: Tue, 6 Oct 2026 10:29:04 -0400 Subject: [PATCH 1/1] first commit --- README.adoc | 7 + UltiSnips/all.snippets | 9 + UltiSnips/asciidoc.snippets | 12 + UltiSnips/asciidoctor.snippets | 26 +++ UltiSnips/c.snippets | 339 ++++++++++++++++++++++++++++ UltiSnips/cpp.snippets | 211 +++++++++++++++++ UltiSnips/html.snippets | 110 +++++++++ UltiSnips/htmldjango.snippets | 114 ++++++++++ UltiSnips/javascript.snippets | 5 + UltiSnips/markdown.snippets | 0 UltiSnips/org.snippets | 11 + UltiSnips/python.snippets | 20 ++ UltiSnips/vim.snippets | 4 + after/plugin/fzf.vim | 1 + after/plugin/global.vim | 66 ++++++ after/plugin/gruvbox.lua | 24 ++ after/plugin/lsp.lua | 30 +++ after/plugin/nerdtree.vim | 135 +++++++++++ after/plugin/rainbow-delimiters.lua | 47 ++++ after/plugin/treesitter.lua | 9 + after/syntax/c.vim | 298 ++++++++++++++++++++++++ init.lua | 2 + lazy-lock.json | 22 ++ lua/config/lazy.lua | 68 ++++++ lua/config/plugins/lazydev.lua | 13 ++ lua/nyquist/global.lua | 51 +++++ lua/nyquist/init.lua | 3 + lua/nyquist/packer.lua | 26 +++ lua/nyquist/remap.lua | 159 +++++++++++++ nvim | 1 + old/remaps.vim.old | 76 +++++++ plugin/fugitive.lua | 1 + plugin/fzf-lua.lua | 9 + plugin/lightline.vim | 10 + plugin/lsp.lua | 2 + plugin/nerdtree.vim | 3 + plugin/ultisnips.vim | 8 + plugin/undotree.vim | 1 + plugin/vim-SyntaxRange.vim | 0 plugin/vim-asciidoctor.vim | 5 + plugin/vim-grammarous.vim | 2 + 41 files changed, 1940 insertions(+) create mode 100644 README.adoc create mode 100644 UltiSnips/all.snippets create mode 100644 UltiSnips/asciidoc.snippets create mode 100644 UltiSnips/asciidoctor.snippets create mode 100644 UltiSnips/c.snippets create mode 100644 UltiSnips/cpp.snippets create mode 100644 UltiSnips/html.snippets create mode 100644 UltiSnips/htmldjango.snippets create mode 100644 UltiSnips/javascript.snippets create mode 100644 UltiSnips/markdown.snippets create mode 100644 UltiSnips/org.snippets create mode 100644 UltiSnips/python.snippets create mode 100644 UltiSnips/vim.snippets create mode 100644 after/plugin/fzf.vim create mode 100644 after/plugin/global.vim create mode 100644 after/plugin/gruvbox.lua create mode 100644 after/plugin/lsp.lua create mode 100644 after/plugin/nerdtree.vim create mode 100644 after/plugin/rainbow-delimiters.lua create mode 100644 after/plugin/treesitter.lua create mode 100644 after/syntax/c.vim create mode 100644 init.lua create mode 100644 lazy-lock.json create mode 100644 lua/config/lazy.lua create mode 100644 lua/config/plugins/lazydev.lua create mode 100644 lua/nyquist/global.lua create mode 100644 lua/nyquist/init.lua create mode 100644 lua/nyquist/packer.lua create mode 100644 lua/nyquist/remap.lua create mode 160000 nvim create mode 100644 old/remaps.vim.old create mode 100644 plugin/fugitive.lua create mode 100644 plugin/fzf-lua.lua create mode 100644 plugin/lightline.vim create mode 100644 plugin/lsp.lua create mode 100644 plugin/nerdtree.vim create mode 100644 plugin/ultisnips.vim create mode 100644 plugin/undotree.vim create mode 100644 plugin/vim-SyntaxRange.vim create mode 100644 plugin/vim-asciidoctor.vim create mode 100644 plugin/vim-grammarous.vim diff --git a/README.adoc b/README.adoc new file mode 100644 index 0000000..fb492a0 --- /dev/null +++ b/README.adoc @@ -0,0 +1,7 @@ += nvim configuration files +Yes most of this is just from _The Primeagen's_ config. I had a custom vim +config before neovim and knew I had to update to neovim and lsp. + +== Links +- https://www.youtube.com/watch?v=EOWPb7Id1d4&t=354s[Developing in Windows] +- https://www.youtube.com/watch?v=w7i4amO_zaE&t=908s[The Primeagen] diff --git a/UltiSnips/all.snippets b/UltiSnips/all.snippets new file mode 100644 index 0000000..0358507 --- /dev/null +++ b/UltiSnips/all.snippets @@ -0,0 +1,9 @@ +snippet #meta +########################################################### +# author: Austin Larsen +# +# synopsis: $1 +# +# date: ${2:`date`} +########################################################### +endsnippet diff --git a/UltiSnips/asciidoc.snippets b/UltiSnips/asciidoc.snippets new file mode 100644 index 0000000..431765b --- /dev/null +++ b/UltiSnips/asciidoc.snippets @@ -0,0 +1,12 @@ +snippet source +[source,$1] +---- +$2 +---- +endsnippet + +snippet ---- +---- +$2 +---- +endsnippet diff --git a/UltiSnips/asciidoctor.snippets b/UltiSnips/asciidoctor.snippets new file mode 100644 index 0000000..b2798fa --- /dev/null +++ b/UltiSnips/asciidoctor.snippets @@ -0,0 +1,26 @@ +snippet quote +[quote, $1] +---- +$2 +---- +endsnippet + +snippet source +[source, $1] +---- +$2 +---- +endsnippet + +snippet ---- +---- +$2 +---- +endsnippet + +snippet |=== +[%header, cols="$1"] +|=== +| $2 +|=== +endsnippet diff --git a/UltiSnips/c.snippets b/UltiSnips/c.snippets new file mode 100644 index 0000000..2ab0096 --- /dev/null +++ b/UltiSnips/c.snippets @@ -0,0 +1,339 @@ +snippet meta +/* --------------------------------------------------------------------------- + * author: Austin Larsen + * synopsis: $1 + * date: ${2:`date`} + * --------------------------------------------------------------------------- + * + * $0 + */ +endsnippet + +snippet tstruct +typedef struct _$1 { + $2 +} $1; +endsnippet + +snippet tenum +typedef enum _$1 { + $2 +} $1; +endsnippet + +snippet maina +int main(int argc, char **argv) +{ + $1 +} +endsnippet + +snippet enum "Enum" +enum ${1:name} { + ${2:/* data */} +}; /* enum $1 */ +endsnippet + +snippet main +int main(void) +{ + $1 +} +endsnippet + +snippet defhead +#ifndef _$1_H_ +#define _$1_H_ + +$2 + +#endif // _$1_H_ +endsnippet + +snippet fori +for (int i = $1; i < $2; ++i) { + $3 +} +endsnippet + +snippet for +for ($1; $2; $3) { + $4 +} +endsnippet + +snippet inc< +#include <${1:stdio}.h> +endsnippet + +snippet incq +#include "$1.h" +endsnippet + +snippet malloc +$1 *${2:a} = malloc($3); + +$4 + +free($2); +endsnippet + +snippet switch +switch ($1) { + $2 +} +endsnippet + +snippet case +case ${1:0}: +{ + $2 + break; +} +endsnippet + +snippet casev +case ${1:0}: $2 break; +endsnippet + +snippet printfa +printf("$1", ${2:variable}); +endsnippet + +snippet DEF +#define $1 +endsnippet + +snippet /* +/* $1 +*/ +endsnippet + +snippet /*v +/* $1 */ +endsnippet + +snippet }elif +} else if($1:condition) { + $2 +} +endsnippet + +snippet strcmp0 +strcmp($1, $2) == 0 +endsnippet + +snippet ifstrcmp0 +if ( strcmp($1, $2) == 0 ) { + $3 +} +endsnippet + +# string literal +snippet strcmpl0 +strcmp($1, "$2") == 0 +endsnippet + +snippet ifstrcmpl0 +if(strcmp($1, "$2") == 0){ + $3 +} +endsnippet + +snippet chararr +char $1[] = { + $3, +}; +endsnippet + +snippet do +do { + $3 +}while($2); +endsnippet + +snippet defaultv +default: $2 break; +endsnippet + +snippet default +default: { + $1 + break; +}$2 +endsnippet + +snippet printf +printf("$1"); +endsnippet + +snippet puts +puts("$1"); +endsnippet + + +snippet func +${1:void} ${2:function_name}(${3:variables}) +{ + $5 +} +endsnippet + +snippet vfunc +void ${2:function_name}($2) + $3 +{ + $4 +} +endsnippet + +snippet ifunc +int ${2:function_name}($2) + $3 +{ + $4 +} +endsnippet + +snippet ui8func +uint8_t ${2:function_name}($3) +{ + $6 +} +endsnippet + +snippet ui16func +uint16_t ${2:function_name}($3) +{ + $6 +} +endsnippet + +snippet ui32func +uint32_t ${2:function_name}($3) +{ + $6 +} +endsnippet + +snippet ui64func +uint64_t ${2:function_name}($3) +{ + $6 +} +endsnippet + +snippet vpfunc +void * ${2:function_name}($2) + $3 +{ + $4 +} +endsnippet + +snippet cfunc +char $2($3) +{ + $6 +} +endsnippet + +snippet cpfunc +char * $2($3) +{ + $6 +} +endsnippet + +snippet ipfunc +int * $2($3) +{ + $6 +} +endsnippet + +snippet ui8pfunc +uint8_t * ${2:function_name}($3) +{ + $6 +} +endsnippet + +snippet ui16pfunc +uint16_t * ${2:function_name}($3) +{ + $6 +} +endsnippet + +snippet ui32pfunc +uint32_t * ${2:function_name}($3) +{ + $6 +} +endsnippet + +snippet ui64pfunc +uint64_t * ${2:function_name}($3) +{ + $6 +} +endsnippet + +snippet while +while ($1) { + $2 +} +endsnippet + +snippet perr +fprintf(stderr, "$1"); +endsnippet + +snippet #if +#if $1 +#endif +endsnippet + +snippet if +if ($1) { + $2 +} +endsnippet + +snippet luaclib +#include +#include + +// array of functions to be use in lua +// element format: {char * lua_function_name, int (*lua_function) (lua_State*)} +__declspec(dllexport) luaL_Reg $1[] = { + {NULL, NULL} +}; + +__declspec(dllexport) int luaopen_$2(lua_State *L) +{ + luaL_newlib(L, mylib); + return 1; +} +endsnippet + +snippet dllexport +__declspec(dllexport) ${1:void} $2($3) +{ + $4 +} +endsnippet + +snippet flua +int l_${1:function_name}(lua_State *L) +{ + $3 + return $2; +} +endsnippet + +snippet memset +memset(&$1, ${2:0}, ${3:sizeof($4)}); +endsnippet + diff --git a/UltiSnips/cpp.snippets b/UltiSnips/cpp.snippets new file mode 100644 index 0000000..48978a1 --- /dev/null +++ b/UltiSnips/cpp.snippets @@ -0,0 +1,211 @@ +snippet meta +/* --------------------------------------------------------------------------- + * author: Austin Larsen + * synopsis: $1 + * date: ${2:`date`} + * --------------------------------------------------------------------------- + * + * $0 + */ +endsnippet + +snippet tstruct +typedef struct _$1 { + $2 +} $1; +endsnippet + +snippet maina +int +main(int argc, char **argv){ + $1 +} +endsnippet + +snippet main +int +main(){ + $1 +} +endsnippet + +snippet ns +namespace $1 { + +} // namespace $1 +endsnippet + +snippet cout +std::cout << $1 << ${3:"\n"}; +endsnippet + +snippet defhead +#ifndef $1_H +#define $1_H + +$2 + +#endif // $1_H +endsnippet + +snippet fori +for(int i = $1; i < $2; ++i){ + $3 +} +endsnippet + +snippet for +for($1; $2; $3){ + $4 +} +endsnippet + +snippet inc< +#include <$1> +endsnippet + +snippet vec +std::vector<$1> $2 +endsnippet + +snippet incq +#include "$1" +endsnippet + +snippet malloc +$1 *${2:a} = malloc($3); + +$4 + +free($2); +endsnippet + +snippet switch +switch($1){ + $2 +} +endsnippet + +snippet case +case ${1:0}: { + $2 + break; +} +endsnippet + +snippet casev +case ${1:0}: $2 break; +endsnippet + +snippet printfa +printf("$1", $2); +endsnippet + +snippet DEF +#define $1 +endsnippet +# snippet /* +# /* $1 +# */ +# endsnippet + +snippet /* +/* $1 + */ +endsnippet + +snippet /*v +/* $1 */ +endsnippet + +snippet }elseif +}else if($1){ + $2 +} +endsnippet + +snippet strcmp0 +strcmp($1, $2) == 0 +endsnippet + +snippet ifstrcmp0 +if(strcmp($1, $2) == 0){ + $3 +} +endsnippet + +# string literal +snippet strcmpl0 +strcmp($1, "$2") == 0 +endsnippet + +snippet ifstrcmpl0 +if(strcmp($1, "$2") == 0){ + $3 +} +endsnippet + +snippet chararr +char $1[] = { + $3, +}; +endsnippet + +snippet do +do { + $3 +}while($2); +endsnippet + +snippet defaultv +default: $2 break; +endsnippet + +snippet default +default: { + $1 + break; +}$2 +endsnippet + +snippet printf +printf("$1"); +endsnippet + +snippet puts +puts("$1"); +endsnippet + + +snippet func +${1:void} $2($3) +$4 +{ + $5 +} +endsnippet + +snippet while +while($1){ + $2 +} +endsnippet + +snippet perr +fprintf(stderr, "$1"); +endsnippet + +snippet #if +#if $1 +#endif +endsnippet + +snippet if +if($1){ + $2 +} +endsnippet + +# snippet *p +# ($1); +# endsnippet diff --git a/UltiSnips/html.snippets b/UltiSnips/html.snippets new file mode 100644 index 0000000..531f5d2 --- /dev/null +++ b/UltiSnips/html.snippets @@ -0,0 +1,110 @@ +snippet html + + + + $1 + + + + + + +endsnippet + +snippet a +$2 +endsnippet + +snippet h1 +

$1

+endsnippet + +snippet h1-i +

$2

+endsnippet + +snippet h1-c +

$2

+endsnippet + +snippet h2 +

$1

+endsnippet + +snippet h2-i +

$2

+endsnippet + +snippet h2-c +

$2

+endsnippet + +snippet h3 +

$1

+endsnippet + +snippet h3-i +

$2

+endsnippet + +snippet h3-c +

$2

+endsnippet + +snippet script + + +endsnippet + +snippet script-s + +endsnippet + + +snippet lcss + +endsnippet + +snippet div +
+ $2 +
+endsnippet + +snippet div-i +
+ $3 +
+endsnippet + +snippet div-c +
+ $3 +
+endsnippet + +snippet span +$1 +endsnippet + +snippet span-i +$2 +endsnippet + +snippet span-c +$2 +endsnippet + +snippet body + + $1 + +endsnippet + +snippet +endsnippet diff --git a/UltiSnips/htmldjango.snippets b/UltiSnips/htmldjango.snippets new file mode 100644 index 0000000..425f1a2 --- /dev/null +++ b/UltiSnips/htmldjango.snippets @@ -0,0 +1,114 @@ +snippet html + + + + $1 + + + + + + +endsnippet + +snippet a +$2 +endsnippet + +snippet h1 +

$1

+endsnippet + +snippet h1-i +

$2

+endsnippet + +snippet h1-c +

$2

+endsnippet + +snippet h2 +

$1

+endsnippet + +snippet h2-i +

$2

+endsnippet + +snippet h2-c +

$2

+endsnippet + +snippet h3 +

$1

+endsnippet + +snippet h3-i +

$2

+endsnippet + +snippet h3-c +

$2

+endsnippet + +snippet script + + +endsnippet + +snippet script-s + +endsnippet + + +snippet lcss + +endsnippet + +snippet div +
+ $2 +
+endsnippet + +snippet div-i +
+ $3 +
+endsnippet + +snippet div-c +
+ $3 +
+endsnippet + +snippet span +$1 +endsnippet + +snippet span-i +$2 +endsnippet + +snippet span-c +$2 +endsnippet + +snippet body + + $1 + +endsnippet + +snippet +endsnippet + +snippet link + +endsnippet diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets new file mode 100644 index 0000000..baa7f9b --- /dev/null +++ b/UltiSnips/javascript.snippets @@ -0,0 +1,5 @@ +snippet for1 +for(let i = 0; i < $1.length; i++){ + +} +endsnippet diff --git a/UltiSnips/markdown.snippets b/UltiSnips/markdown.snippets new file mode 100644 index 0000000..e69de29 diff --git a/UltiSnips/org.snippets b/UltiSnips/org.snippets new file mode 100644 index 0000000..299e42e --- /dev/null +++ b/UltiSnips/org.snippets @@ -0,0 +1,11 @@ +snippet #+src +#+BEGIN_SRC ${1:c} +$2 +#+END_SRC +endsnippet + +snippet #+ex +#+BEGIN_EXAMPLE +$2 +#+END_EXAMPLE +endsnippet diff --git a/UltiSnips/python.snippets b/UltiSnips/python.snippets new file mode 100644 index 0000000..30b0019 --- /dev/null +++ b/UltiSnips/python.snippets @@ -0,0 +1,20 @@ +snippet def +def $1($2): + $3 +endsnippet + +snippet defa +def $1($2) -> $3: + $4 +endsnippet + +snippet defm +defm $1(self, $2): + $3 +endsnippet + +# annotations +snippet defma +def $1(self, $2) -> $3: + $4 +endsnippet diff --git a/UltiSnips/vim.snippets b/UltiSnips/vim.snippets new file mode 100644 index 0000000..f4022e0 --- /dev/null +++ b/UltiSnips/vim.snippets @@ -0,0 +1,4 @@ +snippet function +function $1() +functionend +endsnippet diff --git a/after/plugin/fzf.vim b/after/plugin/fzf.vim new file mode 100644 index 0000000..e7026fc --- /dev/null +++ b/after/plugin/fzf.vim @@ -0,0 +1 @@ +nnoremap ff :FZF diff --git a/after/plugin/global.vim b/after/plugin/global.vim new file mode 100644 index 0000000..7f2700f --- /dev/null +++ b/after/plugin/global.vim @@ -0,0 +1,66 @@ +" https://devhints.io/vimscript +function! DebugFunc(file) + silent only + let l:file = expand("%:p:h") . "/" . a:file + exec "Termdebug" . l:file + exec "norm! \j" + exec "norm! \j" + exec "norm! \L" +endfunction + + +function! MatchFilesFunc(pmatch, pfiles) + " QuickFixOpen + exec "vim /" . a:pmatch . "/ `find . -type f -name \"" . a:pfiles . "\"`" + copen +endfunction + +function! ToggleQuickfix() + NERDTreeClose + " Check if any window is a quickfix window + if exists('*getwininfo') + let l:quickfix_wins = filter(getwininfo(), 'v:val.quickfix') + if !empty(l:quickfix_wins) + " Quickfix is open: close it + cclose + return + endif + endif + " Quickfix is closed: open it (if there are items) + if len(getqflist()) > 0 + copen 10 " Open with height 10 (adjust as needed) + else + echom "Quickfix list is empty: cannot open." + endif +endfunction + +function TerminalOpen() + bel terminal + resize 12 + set nobl +endfunction + +function! PreviewImage() + " Grab the file path under the cursor + let l:file = expand('') + echo l:file + + " Check if the extension is an image + if l:file =~? '\.\(png\|jpg\|jpeg\)$' + " Execute feh with the 'scale-down' geometry logic + " Note the single quotes inside the double quotes for the shell + silent execute '!feh --geometry 1600x900 --auto-zoom ' . shellescape(l:file) . ' &' + redraw! + else + echo "Not a valid image path: " . l:file + endif +endfunction + +nnoremap gp :call PreviewImage() + +command! -nargs=1 Debug call DebugFunc() +command! -nargs=0 TermOpen call TerminalOpen() +command! -nargs=0 QuickFixOpen NERDTreeClose | silent only +command! -nargs=* MatchFiles call MatchFilesFunc() + +" autocmd VimEnter * call TerminalOpen() diff --git a/after/plugin/gruvbox.lua b/after/plugin/gruvbox.lua new file mode 100644 index 0000000..f67a907 --- /dev/null +++ b/after/plugin/gruvbox.lua @@ -0,0 +1,24 @@ +require("gruvbox").setup({ + terminal_colors = true, -- add neovim terminal colors + undercurl = true, + underline = true, + bold = true, + italic = { + strings = true, + emphasis = true, + comments = true, + operators = false, + folds = true, + }, + strikethrough = true, + invert_selection = false, + invert_signs = false, + invert_tabline = false, + inverse = true, -- invert background for search, diffs, statuslines and errors + contrast = "", -- can be "hard", "soft" or empty string + palette_overrides = {}, + overrides = {}, + dim_inactive = false, + transparent_mode = true, +}) +vim.cmd("colorscheme gruvbox") diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua new file mode 100644 index 0000000..dbdc057 --- /dev/null +++ b/after/plugin/lsp.lua @@ -0,0 +1,30 @@ +vim.diagnostic.config({virtual_text = true }) +-- use ctrl-x ctrl-o to start autocompletion +-- local _border = "single" + +vim.lsp.config("eslint", { + cmd = { "vscode-eslint-language-server", "--stdio" }, + filetypes = { + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "vue", + "svelte", + }, + root_markers = { + ".eslintrc", + ".eslintrc.js", + ".eslintrc.json", + "eslint.config.mjs", + "eslint.config.js", + "package.json", + }, + settings = { + format = false, -- do not fight prettier + }, +}) + +vim.lsp.enable("eslint") +vim.lsp.enable("clangd") + diff --git a/after/plugin/nerdtree.vim b/after/plugin/nerdtree.vim new file mode 100644 index 0000000..5a5d4f7 --- /dev/null +++ b/after/plugin/nerdtree.vim @@ -0,0 +1,135 @@ +let g:NERDTreeMarkedNodes = [] +let g:hilines = '' +let g:hilines_idx = -1 +let g:alpha = 'abcdefghijklmnopqrstuvwxyz' +let NERDTreeIgnore = ['\.o$', '\.spv$', "^.gitignore$"] + + +" I use enter and not o to open files +autocmd FileType nerdtree nunmap o + +" Create an autocommand specifically for NERDTree buffers +autocmd FileType nerdtree nnoremap op :call OpenWithFeh() +autocmd FileType nerdtree nnoremap og :call OpenWithGimp() + +function! OpenWithFeh() + " Get the path of the file under the cursor from NERDTree's internal state + let l:path = g:NERDTreeFileNode.GetSelected().path.str() + + " Check if it's a PNG (case insensitive) + if l:path =~? '\.png$' + " Launch feh and immediately return control to Vim + silent execute '!feh --geometry 1600x900 --auto-zoom ' . shellescape(l:path) . ' &' + redraw! + else + " If not a PNG, trigger the standard NERDTree 'o' functionality + execute "normal! o" + endif +endfunction + +function! OpenWithGimp() + let l:node = g:NERDTreeFileNode.GetSelected() + if l:node != {} + let l:path = l:node.path.str() + if l:path =~? '\.png$' + " Launch Gimp in the background + @echo "Opening in Gimp..." + silent execute '!gimp ' . shellescape(l:path) . ' &' + redraw! + else + " For non-images, 'e' usually opens the file in a new tab/split in some configs + " or we can just fall back to standard 'o' behavior + execute "normal! o" + endif + endif +endfunction + +function Hi(type, group) + if g:hilines !=# '' + if a:type ==# 'line' + let g:hilines .= '\|'.'\%'.line('.').'l' + elseif a:type ==# 'nonWhiteSpace' + let g:hilines .= '\|'.'\(\%'.line('.').'l\&\S\)' + endif + + else + if a:type ==# 'line' + let g:hilines = '\%'.line('.').'l' + elseif a:type ==# 'nonWhiteSpace' + let g:hilines = '\(\%'.line('.').'l\&\S\)' + endif + endif + let g:hilines_idx = g:hilines_idx + 1 + + exec 'match '.a:group.' /'.g:hilines.'/' + exec 'normal! m'.g:alpha[g:hilines_idx] +endfunction + +function ClearHi() + exec 'match none' + let g:hilines = '' + exec 'delmarks a-z' +endfunction + +call NERDTreeAddKeyMap({ + \ 'key': 'Mn', + \ 'callback': 'NERDTreeMarkNode', + \ 'quickhelpText': 'mark nodes for future editing', + \ 'scope': 'Node' }) + +" call NERDTreeMarkNode(NERDTreeFileNode.GetSelected()) +function! NERDTreeMarkNode(dirnode) + if match(bufname(), "NERD_tree") != 0 + return + endif + call Hi('nonWhiteSpace', 'Title') + let g:NERDTreeMarkedNodes += [a:dirnode.path.str()] +endfunction + +call NERDTreeAddKeyMap({ + \ 'key': 'Mc', + \ 'callback': 'NERDTreeClearMarks', + \ 'quickhelpText': 'unmark all nodes', + \ 'scope': 'all' }) + +function! NERDTreeClearMarks() + call ClearHi() + let g:NERDTreeMarkedNodes = [] +endfunction + +call NERDTreeAddKeyMap({ + \ 'key': 'Mx', + \ 'callback': 'NERDTreeMarkedExec', + \ 'quickhelpText': 'execute a shell command on all marked nodes', + \ 'scope': 'all' }) + +function! NERDTreeMarkedExec() + if empty(g:NERDTreeMarkedNodes) + echo 'no nodes selected' + return + endif + + let l:in = input('cmd: ') + + let l:allFiles = '' + + for file in g:NERDTreeMarkedNodes + let l:allFiles .= '"'.file.'" ' + endfor + + let l:cmd = substitute(l:in, '\s%n\(\>\|\s\)', ' '.l:allFiles, 'g') + + exec ':!'.l:cmd + call NERDTreeClearMarks() + NERDTreeRefreshRoot +endfunction + +nnoremap nn :NERDTreeToggle +nnoremap nd :exec 'NERDTree '.getcwd() +nnoremap nf :NERDTreeFind +nnoremap nF :exec 'NERDTree '.bufname() +nnoremap nc :NERDTreeClose +nnoremap nb :NERDTreeFromBookmark +nnoremap nma :call NERDTreeMarkNode(NERDTreeFileNode.GetSelected()) +nnoremap nmc :call NERDTreeClearMarks() +nnoremap nmx :call NERDTreeMarkedExec() diff --git a/after/plugin/rainbow-delimiters.lua b/after/plugin/rainbow-delimiters.lua new file mode 100644 index 0000000..27b9797 --- /dev/null +++ b/after/plugin/rainbow-delimiters.lua @@ -0,0 +1,47 @@ +-- This module contains a number of default definitions +local rainbow_delimiters = require 'rainbow-delimiters' + +vim.g.rainbow_delimiters = { + strategy = { + [''] = rainbow_delimiters.strategy['global'], + vim = rainbow_delimiters.strategy['local'], + }, + query = { + [''] = 'rainbow-delimiters', + lua = 'rainbow-blocks', + }, + highlight = { + 'RainbowDelimiterRed', + 'RainbowDelimiterYellow', + 'RainbowDelimiterBlue', + 'RainbowDelimiterOrange', + 'RainbowDelimiterGreen', + 'RainbowDelimiterViolet', + 'RainbowDelimiterCyan', + }, +} +-- ---@type rainbow_delimiters.config +-- +-- vim.g.rainbow_delimiters = { +-- strategy = { +-- [''] = 'rainbow-delimiters.strategy.global', +-- vim = 'rainbow-delimiters.strategy.local', +-- }, +-- query = { +-- [''] = 'rainbow-delimiters', +-- lua = 'rainbow-blocks', +-- }, +-- priority = { +-- [''] = 110, +-- lua = 210, +-- }, +-- highlight = { +-- 'RainbowDelimiterRed', +-- 'RainbowDelimiterYellow', +-- 'RainbowDelimiterBlue', +-- 'RainbowDelimiterOrange', +-- 'RainbowDelimiterGreen', +-- 'RainbowDelimiterViolet', +-- 'RainbowDelimiterCyan', +-- }, +-- } diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua new file mode 100644 index 0000000..cf1ff4a --- /dev/null +++ b/after/plugin/treesitter.lua @@ -0,0 +1,9 @@ +require("nvim-treesitter.configs").setup({ + ensure_installed = { "javascript", "html", "c", "lua", "vim", "bash"}, -- parsers you want + highlight = { + enable = true, -- ✅ this must be true + additional_vim_regex_highlighting = false, -- optional + }, + indent = { enable = true }, -- optional +}) + diff --git a/after/syntax/c.vim b/after/syntax/c.vim new file mode 100644 index 0000000..0bdbc78 --- /dev/null +++ b/after/syntax/c.vim @@ -0,0 +1,298 @@ +" Vim syntax file +" Language: C Additions +" Maintainer: Mikhail Wolfson +" URL: http://web.mit.edu/wolfsonm +" Last Change: 2010 Dec. 3 +" Version: 0.4 +" +" Changelog: +" 0.4 - updates and fixes to cDelimiter to fix break with foldmethod=syntax, +" entirely suggested and solved by Ivan Freitas +" +" 0.3 - updates and fixes to cUserFunctionPointer, thanks to +" Alexei +" 0.2 - change [] to operator +" 0.1 - initial upload, modification from vimscript#1201, Extended c.vim + + +" Common ANSI-standard functions +syn keyword cAnsiFunction MULU_ DIVU_ MODU_ MUL_ DIV_ MOD_ +syn keyword cAnsiFunction main typeof +syn keyword cAnsiFunction open close read write lseek dup dup2 +syn keyword cAnsiFunction fcntl ioctl +syn keyword cAnsiFunction wctrans towctrans towupper +syn keyword cAnsiFunction towlower wctype iswctype +syn keyword cAnsiFunction iswxdigit iswupper iswspace +syn keyword cAnsiFunction iswpunct iswprint iswlower +syn keyword cAnsiFunction iswgraph iswdigit iswcntrl +syn keyword cAnsiFunction iswalpha iswalnum wcsrtombs +syn keyword cAnsiFunction mbsrtowcs wcrtomb mbrtowc +syn keyword cAnsiFunction mbrlen mbsinit wctob +syn keyword cAnsiFunction btowc wcsfxtime wcsftime +syn keyword cAnsiFunction wmemset wmemmove wmemcpy +syn keyword cAnsiFunction wmemcmp wmemchr wcstok +syn keyword cAnsiFunction wcsstr wcsspn wcsrchr +syn keyword cAnsiFunction wcspbrk wcslen wcscspn +syn keyword cAnsiFunction wcschr wcsxfrm wcsncmp +syn keyword cAnsiFunction wcscoll wcscmp wcsncat +syn keyword cAnsiFunction wcscat wcsncpy wcscpy +syn keyword cAnsiFunction wcstoull wcstoul wcstoll +syn keyword cAnsiFunction wcstol wcstold wcstof +syn keyword cAnsiFunction wcstod ungetwc putwchar +syn keyword cAnsiFunction putwc getwchar getwc +syn keyword cAnsiFunction fwide fputws fputwc +syn keyword cAnsiFunction fgetws fgetwc wscanf +syn keyword cAnsiFunction wprintf vwscanf vwprintf +syn keyword cAnsiFunction vswscanf vswprintf vfwscanf +syn keyword cAnsiFunction vfwprintf swscanf swprintf +syn keyword cAnsiFunction fwscanf fwprintf zonetime +syn keyword cAnsiFunction strfxtime strftime localtime +syn keyword cAnsiFunction gmtime ctime asctime +syn keyword cAnsiFunction time mkxtime mktime +syn keyword cAnsiFunction difftime clock strlen +syn keyword cAnsiFunction strerror memset strtok +syn keyword cAnsiFunction strstr strspn strrchr +syn keyword cAnsiFunction strpbrk strcspn strchr +syn keyword cAnsiFunction memchr strxfrm strncmp +syn keyword cAnsiFunction strcoll strcmp memcmp +syn keyword cAnsiFunction strncat strcat strncpy +syn keyword cAnsiFunction strcpy memmove memcpy +syn keyword cAnsiFunction wcstombs mbstowcs wctomb +syn keyword cAnsiFunction mbtowc mblen lldiv +syn keyword cAnsiFunction ldiv div llabs +syn keyword cAnsiFunction labs abs qsort +syn keyword cAnsiFunction bsearch system getenv +syn keyword cAnsiFunction exit atexit abort +syn keyword cAnsiFunction realloc malloc free +syn keyword cAnsiFunction calloc srand rand +syn keyword cAnsiFunction strtoull strtoul strtoll +syn keyword cAnsiFunction strtol strtold strtof +syn keyword cAnsiFunction strtod atoll atol +syn keyword cAnsiFunction atoi atof perror +syn keyword cAnsiFunction ferror feof clearerr +syn keyword cAnsiFunction rewind ftell fsetpos +syn keyword cAnsiFunction fseek fgetpos fwrite +syn keyword cAnsiFunction fread ungetc puts +syn keyword cAnsiFunction putchar putc gets +syn keyword cAnsiFunction getchar getc fputs +syn keyword cAnsiFunction fputc fgets fgetc +syn keyword cAnsiFunction vsscanf vsprintf vsnprintf +syn keyword cAnsiFunction vscanf vprintf vfscanf +syn keyword cAnsiFunction vfprintf sscanf sprintf +syn keyword cAnsiFunction snprintf scanf printf +syn keyword cAnsiFunction fscanf fprintf setvbuf +syn keyword cAnsiFunction setbuf freopen fopen +syn keyword cAnsiFunction fflush fclose tmpnam +syn keyword cAnsiFunction tmpfile rename remove +syn keyword cAnsiFunction offsetof va_start va_end +syn keyword cAnsiFunction va_copy va_arg raise signal +syn keyword cAnsiFunction longjmp setjmp isunordered +syn keyword cAnsiFunction islessgreater islessequal isless +syn keyword cAnsiFunction isgreaterequal isgreater fmal +syn keyword cAnsiFunction fmaf fma fminl +syn keyword cAnsiFunction fminf fmin fmaxl +syn keyword cAnsiFunction fmaxf fmax fdiml +syn keyword cAnsiFunction fdimf fdim nextafterxl +syn keyword cAnsiFunction nextafterxf nextafterx nextafterl +syn keyword cAnsiFunction nextafterf nextafter nanl +syn keyword cAnsiFunction nanf nan copysignl +syn keyword cAnsiFunction copysignf copysign remquol +syn keyword cAnsiFunction remquof remquo remainderl +syn keyword cAnsiFunction remainderf remainder fmodl +syn keyword cAnsiFunction fmodf fmod truncl +syn keyword cAnsiFunction truncf trunc llroundl +syn keyword cAnsiFunction llroundf llround lroundl +syn keyword cAnsiFunction lroundf lround roundl +syn keyword cAnsiFunction roundf round llrintl +syn keyword cAnsiFunction llrintf llrint lrintl +syn keyword cAnsiFunction lrintf lrint rintl +syn keyword cAnsiFunction rintf rint nearbyintl +syn keyword cAnsiFunction nearbyintf nearbyint floorl +syn keyword cAnsiFunction floorf floor ceill +syn keyword cAnsiFunction ceilf ceil tgammal +syn keyword cAnsiFunction tgammaf tgamma lgammal +syn keyword cAnsiFunction lgammaf lgamma erfcl +syn keyword cAnsiFunction erfcf erfc erfl +syn keyword cAnsiFunction erff erf sqrtl +syn keyword cAnsiFunction sqrtf sqrt powl +syn keyword cAnsiFunction powf pow hypotl +syn keyword cAnsiFunction hypotf hypot fabsl +syn keyword cAnsiFunction fabsf fabs cbrtl +syn keyword cAnsiFunction cbrtf cbrt scalblnl +syn keyword cAnsiFunction scalblnf scalbln scalbnl +syn keyword cAnsiFunction scalbnf scalbn modfl +syn keyword cAnsiFunction modff modf logbl +syn keyword cAnsiFunction logbf logb log2l +syn keyword cAnsiFunction log2f log2 log1pl +syn keyword cAnsiFunction log1pf log1p log10l +syn keyword cAnsiFunction log10f log10 logl +syn keyword cAnsiFunction logf log ldexpl +syn keyword cAnsiFunction ldexpf ldexp ilogbl +syn keyword cAnsiFunction ilogbf ilogb frexpl +syn keyword cAnsiFunction frexpf frexp expm1l +syn keyword cAnsiFunction expm1f expm1 exp2l +syn keyword cAnsiFunction exp2f exp2 expl +syn keyword cAnsiFunction expf exp tanhl +syn keyword cAnsiFunction tanhf tanh sinhl +syn keyword cAnsiFunction sinhf sinh coshl +syn keyword cAnsiFunction coshf cosh atanhl +syn keyword cAnsiFunction atanhf atanh asinhl +syn keyword cAnsiFunction asinhf asinh acoshl +syn keyword cAnsiFunction acoshf acosh tanl +syn keyword cAnsiFunction tanf tan sinl +syn keyword cAnsiFunction sinf sin cosl +syn keyword cAnsiFunction cosf cos atan2l +syn keyword cAnsiFunction atan2f atan2 atanl +syn keyword cAnsiFunction atanf atan asinl +syn keyword cAnsiFunction asinf asin acosl +syn keyword cAnsiFunction acosf acos signbit +syn keyword cAnsiFunction isnormal isnan isinf +syn keyword cAnsiFunction isfinite fpclassify localeconv +syn keyword cAnsiFunction setlocale wcstoumax wcstoimax +syn keyword cAnsiFunction strtoumax strtoimax feupdateenv +syn keyword cAnsiFunction fesetenv feholdexcept fegetenv +syn keyword cAnsiFunction fesetround fegetround fetestexcept +syn keyword cAnsiFunction fesetexceptflag feraiseexcept fegetexceptflag +syn keyword cAnsiFunction feclearexcept toupper tolower +syn keyword cAnsiFunction isxdigit isupper isspace +syn keyword cAnsiFunction ispunct isprint islower +syn keyword cAnsiFunction isgraph isdigit iscntrl +syn keyword cAnsiFunction isalpha isalnum creall +syn keyword cAnsiFunction crealf creal cprojl +syn keyword cAnsiFunction cprojf cproj conjl +syn keyword cAnsiFunction conjf conj cimagl +syn keyword cAnsiFunction cimagf cimag cargl +syn keyword cAnsiFunction cargf carg csqrtl +syn keyword cAnsiFunction csqrtf csqrt cpowl +syn keyword cAnsiFunction cpowf cpow cabsl +syn keyword cAnsiFunction cabsf cabs clogl +syn keyword cAnsiFunction clogf clog cexpl +syn keyword cAnsiFunction cexpf cexp ctanhl +syn keyword cAnsiFunction ctanhf ctanh csinhl +syn keyword cAnsiFunction csinhf csinh ccoshl +syn keyword cAnsiFunction ccoshf ccosh catanhl +syn keyword cAnsiFunction catanhf catanh casinhl +syn keyword cAnsiFunction casinhf casinh cacoshl +syn keyword cAnsiFunction cacoshf cacosh ctanl +syn keyword cAnsiFunction ctanf ctan csinl +syn keyword cAnsiFunction csinf csin ccosl +syn keyword cAnsiFunction ccosf ccos catanl +syn keyword cAnsiFunction catanf catan casinl +syn keyword cAnsiFunction casinf casin cacosl +syn keyword cAnsiFunction cacosf cacos assert +syn keyword cAnsiFunction UINTMAX_C INTMAX_C UINT64_C +syn keyword cAnsiFunction UINT32_C UINT16_C UINT8_C +syn keyword cAnsiFunction INT64_C INT32_C INT16_C INT8_C + +" Common ANSI-standard Names +syn keyword cAnsiName PRId8 PRIi16 PRIo32 PRIu64 +syn keyword cAnsiName PRId16 PRIi32 PRIo64 PRIuLEAST8 +syn keyword cAnsiName PRId32 PRIi64 PRIoLEAST8 PRIuLEAST16 +syn keyword cAnsiName PRId64 PRIiLEAST8 PRIoLEAST16 PRIuLEAST32 +syn keyword cAnsiName PRIdLEAST8 PRIiLEAST16 PRIoLEAST32 PRIuLEAST64 +syn keyword cAnsiName PRIdLEAST16 PRIiLEAST32 PRIoLEAST64 PRIuFAST8 +syn keyword cAnsiName PRIdLEAST32 PRIiLEAST64 PRIoFAST8 PRIuFAST16 +syn keyword cAnsiName PRIdLEAST64 PRIiFAST8 PRIoFAST16 PRIuFAST32 +syn keyword cAnsiName PRIdFAST8 PRIiFAST16 PRIoFAST32 PRIuFAST64 +syn keyword cAnsiName PRIdFAST16 PRIiFAST32 PRIoFAST64 PRIuMAX +syn keyword cAnsiName PRIdFAST32 PRIiFAST64 PRIoMAX PRIuPTR +syn keyword cAnsiName PRIdFAST64 PRIiMAX PRIoPTR PRIx8 +syn keyword cAnsiName PRIdMAX PRIiPTR PRIu8 PRIx16 +syn keyword cAnsiName PRIdPTR PRIo8 PRIu16 PRIx32 +syn keyword cAnsiName PRIi8 PRIo16 PRIu32 PRIx64 + +syn keyword cAnsiName PRIxLEAST8 SCNd8 SCNiFAST32 SCNuLEAST32 +syn keyword cAnsiName PRIxLEAST16 SCNd16 SCNiFAST64 SCNuLEAST64 +syn keyword cAnsiName PRIxLEAST32 SCNd32 SCNiMAX SCNuFAST8 +syn keyword cAnsiName PRIxLEAST64 SCNd64 SCNiPTR SCNuFAST16 +syn keyword cAnsiName PRIxFAST8 SCNdLEAST8 SCNo8 SCNuFAST32 +syn keyword cAnsiName PRIxFAST16 SCNdLEAST16 SCNo16 SCNuFAST64 +syn keyword cAnsiName PRIxFAST32 SCNdLEAST32 SCNo32 SCNuMAX +syn keyword cAnsiName PRIxFAST64 SCNdLEAST64 SCNo64 SCNuPTR +syn keyword cAnsiName PRIxMAX SCNdFAST8 SCNoLEAST8 SCNx8 +syn keyword cAnsiName PRIxPTR SCNdFAST16 SCNoLEAST16 SCNx16 +syn keyword cAnsiName PRIX8 SCNdFAST32 SCNoLEAST32 SCNx32 +syn keyword cAnsiName PRIX16 SCNdFAST64 SCNoLEAST64 SCNx64 +syn keyword cAnsiName PRIX32 SCNdMAX SCNoFAST8 SCNxLEAST8 +syn keyword cAnsiName PRIX64 SCNdPTR SCNoFAST16 SCNxLEAST16 +syn keyword cAnsiName PRIXLEAST8 SCNi8 SCNoFAST32 SCNxLEAST32 +syn keyword cAnsiName PRIXLEAST16 SCNi16 SCNoFAST64 SCNxLEAST64 +syn keyword cAnsiName PRIXLEAST32 SCNi32 SCNoMAX SCNxFAST8 +syn keyword cAnsiName PRIXLEAST64 SCNi64 SCNoPTR SCNxFAST16 +syn keyword cAnsiName PRIXFAST8 SCNiLEAST8 SCNu8 SCNxFAST32 +syn keyword cAnsiName PRIXFAST16 SCNiLEAST16 SCNu16 SCNxFAST64 +syn keyword cAnsiName PRIXFAST32 SCNiLEAST32 SCNu32 SCNxMAX +syn keyword cAnsiName PRIXFAST64 SCNiLEAST64 SCNu64 SCNxPTR +syn keyword cAnsiName PRIXMAX SCNiFAST8 SCNuLEAST8 +syn keyword cAnsiName PRIXPTR SCNiFAST16 SCNuLEAST16 + +syn keyword cAnsiName errno environ + +syn keyword cAnsiName STDC CX_LIMITED_RANGE +syn keyword cAnsiName STDC FENV_ACCESS +syn keyword cAnsiName STDC FP_CONTRACT + +syn keyword cAnsiName AF_INET SOCK_STREAM INADDR_ANY AF_INET +syn keyword cAnsiName SOL_SOCKET SO_REUSEPORT SO_REUSEADDR +syn keyword cAnsiName SO_RCVTIMEO IPPROTO_TCP TCP_NODELAY +syn keyword cAnsiName SOCK_DGRAM POLLIN + +syn keyword cAnsiName and bitor not_eq xor +syn keyword cAnsiName and_eq compl or xor_eq +syn keyword cAnsiName bitand not or_eq + +hi def link cAnsiFunction cFunction +hi def link cAnsiName cIdentifier + +" Operators +syn match cOperator "\(<<\|>>\|[-+*/%&^|<>!=]\)=" +syn match cOperator "<<\|>>\|&&\|||\|++\|--\|->" +syn match cOperator "[.!~*&%<>^|=,+-]" +syn match cOperator "/[^/*=]"me=e-1 +syn match cOperator "/$" +syn match cOperator "&&\|||" +syn match cOperator "[][]" + +" Preprocs +syn keyword cDefined defined contained containedin=cDefine +hi def link cDefined cDefine + +" Functions +syn match cUserFunction "\<\h\w*\>\(\s\|\n\)*("me=e-1 contains=cType,cDelimiter,cDefine +syn match cUserFunctionPointer "(\s*\*\s*\h\w*\s*)\(\s\|\n\)*(" contains=cDelimiter,cOperator + +hi def link cUserFunction cFunction +hi def link cUserFunctionPointer cFunction + +" Delimiters +syn match cDelimiter "[();\\]" +" foldmethod=syntax fix, courtesy of Ivan Freitas +syn match cBraces display "[{}]" + +" Booleans +syn keyword cBoolean true false TRUE FALSE + +" Links +hi def link cFunction Function +hi def link cIdentifier Identifier +hi def link cDelimiter Delimiter +" foldmethod=syntax fix, courtesy of Ivan Freitas +hi def link cBraces Delimiter +hi def link cBoolean Boolean + +" 1. Highlight Struct Names (Vulkan style and CamelCase) +syn match cCustomStruct "\" +syn match cCustomStruct "\<[A-Z][a-z]\w\+Info\>" +hi def link cCustomStruct Type + +" 2. Highlight Struct Members (like .sType) +" Matches a dot followed by a word +syn match cStructMember "\.\@1<=\w\+" +" Matches an arrow followed by a word +syn match cStructMember "->\@2<=\w\+" +hi def link cStructMember Identifier + +" 3. Highlight Variable Names (Simplified) +" This highlights words followed by an assignment or used in declarations +syn match cVariable "\<\w\+\>\ze\s*=" +hi def link cVariable @variable diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..0794463 --- /dev/null +++ b/init.lua @@ -0,0 +1,2 @@ +require("config.lazy") +require("nyquist") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..aa11555 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,22 @@ +{ + "auto-pairs": { "branch": "master", "commit": "39f06b873a8449af8ff6a3eee716d3da14d63a76" }, + "fzf": { "branch": "master", "commit": "3f94bcb5bf93b0c04a7fc4087dff8f99e84e4a9b" }, + "fzf.vim": { "branch": "master", "commit": "ddc14a6a5471147e2a38e6b32a7268282f669b0a" }, + "gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" }, + "lazy.nvim": { "branch": "main", "commit": "db067881fff0fd4be8c00e5bde7492e0e1c77a2f" }, + "lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" }, + "lightline.vim": { "branch": "master", "commit": "e358557e1a9f9fc860416c8eb2e34c0404078155" }, + "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, + "nerdtree": { "branch": "master", "commit": "690d061b591525890f1471c6675bcb5bdc8cdff9" }, + "nvim-lspconfig": { "branch": "master", "commit": "92ee7d42320edfbb81f3cad851314ab197fa324a" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "8aafe2cbd89cd4090f573a98cab6b20366576fde" }, + "ultisnips": { "branch": "master", "commit": "b22a86f9dcc5257624bff3c72d8b902eac468aad" }, + "undotree": { "branch": "master", "commit": "178d19e00a643f825ea11d581b1684745d0c4eda" }, + "vim-SyntaxRange": { "branch": "master", "commit": "78004d2ec1d68f9d1d8b54c1803a52feb2f938f3" }, + "vim-asciidoctor": { "branch": "master", "commit": "d45364d662489e0ffcad0e2bc6f41c859ba58799" }, + "vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" }, + "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, + "vim-gitbranch": { "branch": "master", "commit": "1a8ba866f3eaf0194783b9f8573339d6ede8f1ed" }, + "vim-grammarous": { "branch": "master", "commit": "db46357465ce587d5325e816235b5e92415f8c05" } +} diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..1982439 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,68 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = "," +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "config.plugins" }, + { "folke/lazydev.nvim" }, + {"nvim-treesitter/nvim-treesitter", branch = 'master', lazy = false, build = ":TSUpdate"}, + {'mbbill/undotree'}, + {'tpope/vim-fugitive'}, + {'tpope/vim-commentary'}, + {'preservim/nerdtree'}, + {'itchyny/lightline.vim'}, + {'SirVer/ultisnips'}, + {'jiangmiao/auto-pairs'}, + {'itchyny/vim-gitbranch'}, + {'habamax/vim-asciidoctor'}, + {'inkarkat/vim-SyntaxRange'}, + {'hiphish/rainbow-delimiters.nvim'}, + {'junegunn/fzf', build = ':fzf#install()' }, + {'junegunn/fzf.vim'}, + {'rhysd/vim-grammarous'}, + {'neovim/nvim-lspconfig'}, + {'folke/lazydev.nvim'}, + -- {'pangloss/vim-javascript'}, + -- { + -- 'esmuellert/nvim-eslint', + -- config = function() + -- require('nvim-eslint').setup({}) + -- end, + -- }, + {"ellisonleao/gruvbox.nvim", priority = 1000 , config = true, opts = ...}, + { + "mason-org/mason.nvim", + opts = {} + }, + }, + ui = { + border = "single", -- ✅ adds a border around Lazy TUI window + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + -- install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + -- checker = { enabled = true }, +}) diff --git a/lua/config/plugins/lazydev.lua b/lua/config/plugins/lazydev.lua new file mode 100644 index 0000000..0dc57d2 --- /dev/null +++ b/lua/config/plugins/lazydev.lua @@ -0,0 +1,13 @@ +return { + { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + }, + }, + }, +} diff --git a/lua/nyquist/global.lua b/lua/nyquist/global.lua new file mode 100644 index 0000000..18f38ac --- /dev/null +++ b/lua/nyquist/global.lua @@ -0,0 +1,51 @@ +vim.g.pymode_python = 'python3' +vim.opt.list = false +vim.opt.listchars = { tab = ">.", trail = ".", extends = "#", nbsp = "." } +vim.opt.hlsearch = true +vim.opt.incsearch = true +vim.opt.cursorline = true +vim.api.nvim_set_hl(0, "CursorColumn", {ctermbg=8}) +vim.api.nvim_set_hl(0, "CursorLine", {ctermbg=8}) + vim.api.nvim_set_hl(0, "CursorLine", { bg = "#000000" }) +vim.opt.conceallevel = 3 +vim.opt.relativenumber = true +vim.opt.showtabline = 2 +vim.opt.number = true +vim.opt.foldcolumn = "1" +vim.opt.tabstop = 4 +vim.opt.softtabstop= 0 +vim.opt.expandtab = true +vim.opt.shiftwidth=4 +vim.opt.smarttab = true +vim.opt.wrap = false +vim.opt.textwidth=80 +vim.opt.termguicolors = true +vim.opt.winborder = 'bold' +vim.opt.colorcolumn = '80' + + +vim.cmd[[ +packadd termdebug +let s:fontsize = 12 +function! AdjustFontSize(amount) + let s:fontsize = s:fontsize+a:amount + :execute "GuiFont! Consolas:h" . s:fontsize +endfunction + +function! SetFontSize(amount) + let s:fontsize = a:amount + :execute "GuiFont! Consolas:h" . s:fontsize +endfunction + +if has("win32") + nnoremap +endif + +noremap :call AdjustFontSize(1)= +noremap :call AdjustFontSize(-1)= +inoremap :call AdjustFontSize(1)=a +inoremap :call AdjustFontSize(-1)=a +inoremap :call SetFontSize(10)=a +nnoremap :call SetFontSize(10)= +" autocmd BufEnter,BufRead,BufNewFile *.lua :bufdo lua vim.diagnostic.disable() +]] diff --git a/lua/nyquist/init.lua b/lua/nyquist/init.lua new file mode 100644 index 0000000..c48f555 --- /dev/null +++ b/lua/nyquist/init.lua @@ -0,0 +1,3 @@ +require("nyquist.remap") +require("nyquist.global") + diff --git a/lua/nyquist/packer.lua b/lua/nyquist/packer.lua new file mode 100644 index 0000000..65c5ec7 --- /dev/null +++ b/lua/nyquist/packer.lua @@ -0,0 +1,26 @@ +-- This file can be loaded by calling `lua require('plugins')` from your init.vim + +-- Only required if you have packer configured as `opt` +vim.cmd [[packadd packer.nvim]] + +return require('packer').startup(function(use) + -- use('wbthomason/packer.nvim') + -- use("ellisonleao/gruvbox.nvim" ) + -- use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate'}) + -- use('mbbill/undotree') + -- use('tpope/vim-fugitive') + -- use('tpope/vim-commentary') + -- use('preservim/nerdtree') + -- use('itchyny/lightline.vim') + -- use('SirVer/ultisnips') + -- use('jiangmiao/auto-pairs') + -- use('itchyny/vim-gitbranch') + -- use('habamax/vim-asciidoctor') + -- use('inkarkat/vim-SyntaxRange') + -- use('hiphish/rainbow-delimiters.nvim') + -- use('junegunn/fzf', { run = ':fzf#install()'} ) + -- use('junegunn/fzf.vim') + -- use('rhysd/vim-grammarous') + -- use('neovim/nvim-lspconfig') + -- use('folke/lazydev.nvim') +end) diff --git a/lua/nyquist/remap.lua b/lua/nyquist/remap.lua new file mode 100644 index 0000000..f167519 --- /dev/null +++ b/lua/nyquist/remap.lua @@ -0,0 +1,159 @@ +vim.g.mapleader = "," + +-- souringing text with _ +vim.keymap.set("v", "s\"", "c\"\"\"", {silent = true}) +vim.keymap.set("v", "s'", "c'\"'", {silent = true}) +vim.keymap.set("v", "s`", "c`\"`", {silent = true}) +vim.keymap.set("v", "s(", "c(\")", {silent = true}) +vim.keymap.set("v", "s[", "c[\"]", {silent = true}) +vim.keymap.set("v", "s{", "c{\"}", {silent = true}) +vim.keymap.set("v", "s*", "c*\"*", {silent = true}) +vim.keymap.set("v", "s=", "c=\"=", {silent = true}) +vim.keymap.set("v", "s~", "c~\"~", {silent = true}) + +-- insert cursor movement +vim.keymap.set("i", "", "O") +vim.keymap.set("i", "", "A") +vim.keymap.set("i", "", "A") + +--tabs +vim.keymap.set("t", "N", "tabnew") +vim.keymap.set("n", "N", "tabnew") +vim.keymap.set("t", "n", "tabnext") +vim.keymap.set("t", "p", "tabprev") +vim.keymap.set("n", "n", "tabnext") +vim.keymap.set("n", "p", "tabprev") + +vim.keymap.set("n", "tt", ":TermOpen") + +-- quickfix +vim.keymap.set("n", "cc", ":MatchFiles ") +vim.keymap.set("n", "co", ":call ToggleQuickfix()") +vim.keymap.set("n", "cn", ":cnext") +vim.keymap.set("n", "cp", ":cprev") + +-- help Termdebug +vim.keymap.set("n", "dd", ":Debug ") +vim.keymap.set("n", "da", ":Arguments ") +vim.keymap.set("n", "dr", ":Run") +vim.keymap.set("n", "db", ":Break") +vim.keymap.set("n", "ds", ":Step") +vim.keymap.set("n", "dc", ":Continue") +vim.keymap.set("n", "de", ":Stop") +vim.keymap.set("n", "df", ":Finish") +vim.keymap.set("n", "de", ":Evaluate") +vim.keymap.set("n", "dn", ":Over") -- the next command + +vim.keymap.set("n", "dC", ":Clear") +vim.keymap.set("n", "dF", ":Frame ") +vim.keymap.set("n", "dU", ":Up ") +vim.keymap.set("n", "dD", ":Down ") +vim.keymap.set("n", "dS", ":Source") +vim.keymap.set("n", "dA", ":Asm") +vim.keymap.set("n", "dV", ":Var") + +-- LSP +vim.keymap.set("n", "]g", vim.diagnostic.goto_next) + +local match_active = false + +vim.keymap.set('n', 'f', function() + if match_active then + vim.cmd("match none") + match_active = false + else + local word = vim.fn.expand("") + -- We use \V for "very nomagic" to ensure special characters in the word don't break the search + vim.cmd("match Search /\\V" .. word .. "/") + match_active = true + end +end, { desc = "Toggle highlight for word under cursor" }) + + +vim.keymap.set('n', 'F', [[:match Search /]], { desc = "Type pattern to highlight" }) + +-- save the buffer +vim.keymap.set("n", "W", "w!") + +-- help registers +vim.keymap.set("v", "", "\"+y | call system('xclip -selection clipboard -i', @0)") + +-- run test programs +-- vim.keymap.set("n", "rt", ":bel split | set norelativenumber | set nonumber | term runtst %:p:h | :normal Gi") + +-- quick search and replace +-- use the dot command in normal mode to replace more matches +vim.keymap.set("n", "s", "ye*Ncgn") + +-- quick quit window +vim.keymap.set("n", "q", "q!") +vim.keymap.set("n", "/", "set hlsearch/") + +-- turning on and off options +vim.keymap.set("n", "s", "set smartcase!set smartcase?") +vim.keymap.set("n", "i", "set ignorecase!set ignorecase?") +vim.keymap.set("n", "l", "set list!set list?") +vim.keymap.set("n", "h", "set hlsearch!set hlsearch?") +vim.keymap.set("i", "", ":read !") + +-- move a block of code as one +-- vim.keymap.set("v", "J", "m '>+1gv=gv") +-- vim.keymap.set("v", "K", "m '<-2gv=gv") + +-- when going through searches, keep cursor in the middle +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") + +-- Function to delete all buffers except the current one +-- -- Function to delete all non-visible buffers +function deleteNonVisibleBuffers() + -- Get all current windows + local windows = vim.api.nvim_list_wins() + -- Create a set to track visible buffers + local visible_bufs = {} + + -- Iterate through each window and collect visible buffers + for _, win in ipairs(windows) do + local buf = vim.api.nvim_win_get_buf(win) + visible_bufs[buf] = true + end + + -- Get a list of all buffers + local buffers = vim.api.nvim_list_bufs() + + for _, buf in ipairs(buffers) do + -- Check if the buffer is not visible + if not visible_bufs[buf] then + -- Safely delete the buffer; ignore errors + pcall(vim.api.nvim_buf_delete, buf, { force = true }) + end + end + print("none visible buffers deleted") +end + +-- Map the function to a key combination +-- Example: bd to delete non-visible buffers +vim.api.nvim_set_keymap('n', 'bo', ':lua deleteNonVisibleBuffers()', { noremap = true, silent = true }) + + +-- buffer +vim.keymap.set("n", "bp", "bp") -- buffer previous +vim.keymap.set("n", "bn", "bn") -- buffer next +vim.keymap.set("n", "bc", "%bd|e#|bd#") -- delete all buffers except the current buffer +vim.keymap.set("n", "bd", "bd") -- delete current buffer +vim.keymap.set("n", "bi", "set nobl") -- don't show this in buffer list +vim.keymap.set("n", "bl", "ls") -- list all the buffers +vim.keymap.set("n", "bs", ":b ") -- list search for a uffer +-- doing :b and then tying in a string and then tab will show you a +-- list of buffers that have the string +-- ls will show you the list of buffers +-- bd will delete a buffer by its number + + +-- makes the current file executable and runs the file +-- vim.keymap.set("n", "x", "python %") +-- Function to delete all buffers except the current one + +-- Map the function to a key combination +-- Example: bd to delete other buffers + diff --git a/nvim b/nvim new file mode 160000 index 0000000..566f500 --- /dev/null +++ b/nvim @@ -0,0 +1 @@ +Subproject commit 566f500485c7a6615a52f98a796a30b40ef0c846 diff --git a/old/remaps.vim.old b/old/remaps.vim.old new file mode 100644 index 0000000..6b4dd87 --- /dev/null +++ b/old/remaps.vim.old @@ -0,0 +1,76 @@ +" souringing text with _ +vnoremap s" c""" +vnoremap s' c'"' +vnoremap s` c`"` +vnoremap s( c(") +vnoremap s[ c["] +vnoremap s{ c{"} +vnoremap s* c*"* +vnoremap s= c="= +vnoremap s~ c~"~ + +" insert cursor movement +inoremap O +inoremap A +nnoremap Dd :call Debug() + +"tab moving +tmap N :tabnew +nmap N :tabnew +tnoremap n :tabnext +tnoremap p :tabprev +nnoremap n :tabnext +nnoremap p :tabprev +nnoremap W :w! + +" help registers +vnoremap "+y | call system('xclip -selection clipboard -i', @0) + +" run test programs +nnoremap rt :bel split \| set norelativenumber \| set nonumber \| term runtst %:p:h \| :normal Gi + +" quick search and replace +nnoremap s ye*Ncgn + +" quick save buffer +nnoremap W :w! + +" quick quit window +nnoremap q :q! +nnoremap / :set hlsearch/ + +" tab chaning +tmap N :tabnew +nmap N :tabnew +tnoremap n :tabnext +tnoremap p :tabprev +nnoremap n :tabnext +nnoremap p :tabprev + +" how should cases be handled when searching? +nnoremap :set smartcase!:set smartcase? +nnoremap :set ignorecase!:set ignorecase? + +" show list (period for spaces, etc) +nnoremap l :set list! + +" move a block of code as one +vnoremap J :m '>+1gv=gv +vnoremap K :m '<-2gv=gv + +" when going through searches, keep cursor in the middle +nnoremap n nzzzv +nnoremap N Nzzzv + +" clear highlights when searching +" nnoremap :g:/\(./\|\n/\)/\@!:echo "searches cleared" +" +" clear highlights when searching +nnoremap h :set hlsearch! + +" makes the current file executable +" +function Execute() +endfunction + +nnoremap x :!python % diff --git a/plugin/fugitive.lua b/plugin/fugitive.lua new file mode 100644 index 0000000..80c9070 --- /dev/null +++ b/plugin/fugitive.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "gs", vim.cmd.Git) diff --git a/plugin/fzf-lua.lua b/plugin/fzf-lua.lua new file mode 100644 index 0000000..b98a609 --- /dev/null +++ b/plugin/fzf-lua.lua @@ -0,0 +1,9 @@ +vim.keymap.set("n", "ff", "Files") +vim.keymap.set("n", "fg", "GFiles") +vim.keymap.set("n", "fb", "Buffers") +vim.keymap.set("n", "fh", "History") +vim.keymap.set("n", "fc", "Commits") +vim.keymap.set("n", "fw", "Windows") +-- fzf = require('fzf-lua') +-- vim.keymap.set("n", "f", "Files") +-- vim.keymap.set("n", "b", "Buffers") diff --git a/plugin/lightline.vim b/plugin/lightline.vim new file mode 100644 index 0000000..e54057b --- /dev/null +++ b/plugin/lightline.vim @@ -0,0 +1,10 @@ +let g:lightline = { + \ 'active': { + \ 'left': [ [ 'mode', 'paste' ], + \ [ 'gitbranch', 'readonly', 'modified' ] ] + \ }, + \ 'component_function': { + \ 'gitbranch': 'gitbranch#name' + \ }, + \ 'colorscheme': 'wombat', +\ } diff --git a/plugin/lsp.lua b/plugin/lsp.lua new file mode 100644 index 0000000..fb6d7f8 --- /dev/null +++ b/plugin/lsp.lua @@ -0,0 +1,2 @@ +-- vim.lsp.enable("clangd") +-- vim.lsp.enable("lua_ls") diff --git a/plugin/nerdtree.vim b/plugin/nerdtree.vim new file mode 100644 index 0000000..0cb3b3b --- /dev/null +++ b/plugin/nerdtree.vim @@ -0,0 +1,3 @@ +let NERDTreeIgnore = ['\.pyc$', '__pycache__', '.git'] +let g:NERDTreeWinPos = 'right' +let NERDTreeMinimalUI=1 diff --git a/plugin/ultisnips.vim b/plugin/ultisnips.vim new file mode 100644 index 0000000..dd5ceae --- /dev/null +++ b/plugin/ultisnips.vim @@ -0,0 +1,8 @@ +let g:UltiSnipsExpandTrigger="" +let g:UltiSnipsJumpForwardTrigger="" +let g:UltiSnipsJumpBackwardTrigger="" + +" If you want :UltiSnipsEdit to split your window. +let g:UltiSnipsEditSplit="horizontal" + +nnoremap U :UltiSnipsEdit:resize 10 diff --git a/plugin/undotree.vim b/plugin/undotree.vim new file mode 100644 index 0000000..279b042 --- /dev/null +++ b/plugin/undotree.vim @@ -0,0 +1 @@ +nnoremap u :UndotreeToggleh diff --git a/plugin/vim-SyntaxRange.vim b/plugin/vim-SyntaxRange.vim new file mode 100644 index 0000000..e69de29 diff --git a/plugin/vim-asciidoctor.vim b/plugin/vim-asciidoctor.vim new file mode 100644 index 0000000..4fe400d --- /dev/null +++ b/plugin/vim-asciidoctor.vim @@ -0,0 +1,5 @@ +let g:asciidoctor_fenced_languages = ['python', 'c', 'lua', 'javascript', 'sql', 'bash', 'diff', 'vim', 'asciidoc', 'cpp', 'nasm', 'yaml'] +let g:asciidoctor_folding = 1 +let g:asciidoctor_fold_options = 1 +let g:asciidoctor_syntax_conceal = 1 +let g:asciidoctor_syntax_indented = 0 diff --git a/plugin/vim-grammarous.vim b/plugin/vim-grammarous.vim new file mode 100644 index 0000000..fc3d7ae --- /dev/null +++ b/plugin/vim-grammarous.vim @@ -0,0 +1,2 @@ +let g:grammarous#jar_url = 'https://www.languagetool.org/download/LanguageTool-5.9.zip' +nnoremap G GrammarousCheck -- 2.43.0