diff options
| author | nic <ra@afu.re> | 2025-07-27 00:48:40 -0400 |
|---|---|---|
| committer | nic <ra@afu.re> | 2025-07-27 00:48:40 -0400 |
| commit | 1e5effbcb5219421a2f1b0cb2a95889db6decd09 (patch) | |
| tree | f687490e9a83217cca3c9677fe8618addce8fb83 | |
| parent | ff53f949eb24cd6c5904b2feed0ee72814bf3cbf (diff) | |
switch to Lazy-vim
| -rw-r--r-- | .config/nvim/init.lua | 134 |
1 files changed, 102 insertions, 32 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index e02a957..0a00854 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,24 +1,75 @@ vim.g.mapleader = "," --- Auto-install vim-plug if not present -local install_path = vim.fn.stdpath('config')..'/autoload/plug.vim' -if vim.fn.empty(vim.fn.glob(install_path)) > 0 then - print("Downloading junegunn/vim-plug to manage plugins...") - vim.fn.system({ - 'curl', '-fLo', install_path, '--create-dirs', - 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' - }) - vim.cmd('autocmd VimEnter * PlugInstall') +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("config") .. "/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) + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' } + }, + { + 'vimwiki/vimwiki', + -- Use `init`, NOT `config`, to set globals before load. + init = function() + vim.g.vimwiki_ext2syntax = { + ['.Rmd'] = 'markdown', + ['.rmd'] = 'markdown', + ['.md'] = 'markdown', + ['.markdown'] = 'markdown', + ['.mdown'] = 'markdown' + } + vim.g.vimwiki_list = { + { path = '~/.local/share/vimwiki', syntax = 'markdown', ext = '.md' }, + { path = '~/.local/share/vimwiki/Finance', syntax = 'markdown', ext = '.md' }, + { path = '~/.local/share/vimwiki/Finance/Fundamentals', syntax = 'markdown', ext = '.md' }, + { path = '~/.local/share/vimwiki/Finance/Research', syntax = 'markdown', ext = '.md' }, + { path = '~/.local/share/vimwiki/Finance/Research/Tickers', syntax = 'markdown', ext = '.md' }, + { path = '~/.local/share/vimwiki/cs', syntax = 'markdown', ext = '.md' }, + { path = '~/.local/share/vimwiki/cs/Gentoo', syntax = 'markdown', ext = '.md' }, + { path = '~/.local/share/vimwiki/arcana', syntax = 'markdown', ext = '.md' }, + { path = '~/.local/share/Cuisine', syntax = 'markdown', ext = '.md' }, + } + vim.g.vimwiki_sync_commit_message = 'Auto from nzxt - %c' + end, + -- Optionally, you can lazy-load Vimwiki only for specific filetypes or via keymaps: +-- event = "BufEnter *.md", +-- keys = { "<leader>ww"}, + }, + { + 'michal-h21/vimwiki-sync', + init = function() + vim.g.vimwiki_sync_commit_message = 'Auto from nzxt - %c' + end, + }, + { + 'MeanderingProgrammer/render-markdown.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, + ---@module 'render-markdown' + ---@type render.md.UserConfig + opts = {}, +} + }, --- Plugin declarations in pure Lua -local Plug = vim.fn['plug#'] -vim.call('plug#begin', vim.fn.stdpath('config')..'/plugged') -Plug('bling/vim-airline') -Plug('ap/vim-css-color') -Plug('vimwiki/vimwiki') -Plug('michal-h21/vimwiki-sync') -vim.call('plug#end') + -- automatically check for plugin updates + checker = { enabled = true }, +}) -- General settings vim.opt.title = true @@ -35,6 +86,23 @@ vim.opt.backup = false vim.cmd('colorscheme bloomberg') --vim.cmd('hi Normal ctermbg=NONE') --vim.cmd('hi NonText ctermbg=NONE') +-- + +--require("pyrepl").setup({ +-- url = "http://localhost:5000/execute" +--}) + +--vim.keymap.set('v', '<leader>p', function() +-- require('pyrepl').run_selected_lines() +-- end, { desc = "Run selected lines" }) + +--require ............ + +require('lualine').setup() + +--ensure render-markdown also render vimwiki +vim.treesitter.language.register('markdown', 'vimwiki') + -- Basics vim.keymap.set('n', 'c', '"_c') @@ -78,21 +146,21 @@ vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { pattern = { "Xresourc vim.api.nvim_create_autocmd("BufWritePost", { pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, command = "!xrdb %" }) -- Vimwiki configuration -vim.g.vimwiki_ext2syntax = {['.Rmd'] = 'markdown', ['.rmd'] = 'markdown', ['.md'] = 'markdown', ['.markdown'] = 'markdown', ['.mdown'] = 'markdown'} - -vim.g.vimwiki_list = { - {path = '~/.local/share/vimwiki', syntax = 'markdown', ext = '.md'}, - {path = '~/.local/share/vimwiki/Finance', syntax = 'markdown', ext = '.md'}, - {path = '~/.local/share/vimwiki/Finance/Fundamentals', syntax = 'markdown', ext = '.md'}, - {path = '~/.local/share/vimwiki/Finance/Research', syntax = 'markdown', ext = '.md'}, - {path = '~/.local/share/vimwiki/Finance/Research/Tickers', syntax = 'markdown', ext = '.md'}, - {path = '~/.local/share/vimwiki/cs', syntax = 'markdown', ext = '.md'}, - {path = '~/.local/share/vimwiki/cs/Gentoo', syntax = 'markdown', ext = '.md'}, - {path = '~/.local/share/vimwiki/arcana', syntax = 'markdown', ext = '.md'}, - {path = '~/.local/share/Cuisine', syntax = 'markdown', ext = '.md'} -} +--vim.g.vimwiki_ext2syntax = {['.Rmd'] = 'markdown', ['.rmd'] = 'markdown', ['.md'] = 'markdown', ['.markdown'] = 'markdown', ['.mdown'] = 'markdown'} + +--vim.g.vimwiki_list = { +-- {path = '~/.local/share/vimwiki', syntax = 'markdown', ext = '.md'}, +-- {path = '~/.local/share/vimwiki/Finance', syntax = 'markdown', ext = '.md'}, +-- {path = '~/.local/share/vimwiki/Finance/Fundamentals', syntax = 'markdown', ext = '.md'}, +-- {path = '~/.local/share/vimwiki/Finance/Research', syntax = 'markdown', ext = '.md'}, +-- {path = '~/.local/share/vimwiki/Finance/Research/Tickers', syntax = 'markdown', ext = '.md'}, +-- {path = '~/.local/share/vimwiki/cs', syntax = 'markdown', ext = '.md'}, +-- {path = '~/.local/share/vimwiki/cs/Gentoo', syntax = 'markdown', ext = '.md'}, +-- {path = '~/.local/share/vimwiki/arcana', syntax = 'markdown', ext = '.md'}, +-- {path = '~/.local/share/Cuisine', syntax = 'markdown', ext = '.md'} +--} -vim.g.vimwiki_sync_commit_message = 'Auto from nzxt - %c' +--vim.g.vimwiki_sync_commit_message = 'Auto from nzxt - %c' vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { pattern = { "/tmp/calcurse*", "~/.calcurse/notes/*" }, command = "set filetype=markdown" }) vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { pattern = { "*.ms", "*.me", "*.mom", "*.man" }, command = "set filetype=groff" }) @@ -108,4 +176,6 @@ vim.keymap.set("n", "<leader>o", ":setlocal spell! spelllang=en_us<CR>", { desc -- Compile document, be it groff/LaTeX/markdown/etc. vim.keymap.set("n", "<leader>c", ':w! | !compiler "%"<CR>', { desc = "Compile document, be it groff/LaTeX/markdown/etc." }) -- Open corresponding .pdf/.html or preview -vim.keymap.set("n", "<leader>p", ':!opout "%"<CR><CR>', { desc = "Open PDF/HTML/preview for current file" }) +--vim.keymap.set("n", "<leader>p", ':!opout "%"<CR><CR>', { desc = "Open PDF/HTML/preview for current file" }) + +vim.keymap.set('v', '<leader>p', function() require('pyrepl').run_selected_lines() end, { desc = "Run selected lines" }) |
