Created
June 23, 2025 17:24
-
-
Save Lev-Stambler/bcab32ff058a529857609b3d8311ce7d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- require("config.lazy") | |
local options = { noremap = true } | |
vim.g.mapleader = ';' | |
vim.keymap.set("i", "jj", "<Esc>", options) | |
vim.keymap.set('n', '<leader>n', ':bnext<CR>', { noremap = true, silent = true }) | |
vim.keymap.set('n', '<leader>p', ':bprevious<CR>', { noremap = true, silent = true }) | |
vim.keymap.set('n', '<leader>d', ':bdelete<CR>', { noremap = true, silent = true }) | |
vim.keymap.set('n', '<leader><leader>', '<C-^>', { noremap = true, silent = true }) | |
-- because I am a Chad | |
vim.opt.mouse = "" | |
-- basic setup | |
vim.opt.number = true | |
vim.opt.relativenumber = true | |
vim.opt.spell = true | |
vim.opt.spelllang = 'en' | |
-- clipboard | |
vim.o.clipboard = "unnamedplus" | |
-- Yank to clipboard | |
vim.api.nvim_set_keymap('n', '<leader>y', '"+y', { noremap = true, silent = true }) | |
vim.api.nvim_set_keymap('v', '<leader>y', '"+y', { noremap = true, silent = true }) | |
-- Yank entire line to clipboard | |
vim.api.nvim_set_keymap('n', '<leader>Y', '"+yy', { noremap = true, silent = true }) | |
-- Paste from clipboard | |
vim.api.nvim_set_keymap('n', '<leader>p', '"+p', { noremap = true, silent = true }) | |
vim.api.nvim_set_keymap('n', '<leader>P', '"+P', { noremap = true, silent = true }) | |
-- Paste from clipboard in visual mode | |
vim.api.nvim_set_keymap('v', '<leader>p', '"+p', { noremap = true, silent = true }) | |
vim.api.nvim_set_keymap('v', '<leader>P', '"+P', { noremap = true, silent = true }) | |
-- Lazy Package Manager | |
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" | |
if not vim.loop.fs_stat(lazypath) then | |
vim.fn.system({ | |
"git", | |
"clone", | |
"--filter=blob:none", | |
"https://github.com/folke/lazy.nvim.git", | |
"--branch=stable", -- latest stable release | |
lazypath, | |
}) | |
end | |
vim.opt.rtp:prepend(lazypath) | |
require("lazy").setup({ | |
"lervag/vimtex", | |
"petRUShka/vim-sage", | |
{ | |
"neovim/nvim-lspconfig", | |
config = function() | |
require('lspconfig').pyright.setup{} | |
end | |
}, | |
{ | |
'autozimu/LanguageClient-neovim', | |
branch = 'next', | |
build = 'bash install.sh', | |
lazy = true, -- Load lazily | |
}, | |
{ | |
'junegunn/fzf', | |
lazy = true, -- Load lazily | |
}, | |
{ | |
'mrcjkb/rustaceanvim', | |
version = '^5', -- Recommended | |
lazy = false, -- This plugin is already lazy | |
}, | |
--"williamboman/mason.nvim", | |
--"williamboman/mason-lspconfig.nvim", | |
"hrsh7th/cmp-nvim-lsp", | |
"hrsh7th/nvim-cmp", | |
-------------- AI Tooling ------------- | |
"greggh/claude-code.nvim", | |
dependencies = { | |
"nvim-lua/plenary.nvim", -- Required for git operations | |
}, | |
"github/copilot.vim", | |
--{ | |
-- "olimorris/codecompanion.nvim", | |
-- opts = {}, | |
-- dependencies = { | |
-- "nvim-lua/plenary.nvim", | |
-- "nvim-treesitter/nvim-treesitter", | |
-- "ravitemer/mcphub.nvim" | |
-- }, | |
--}, | |
{ | |
"echasnovski/mini.diff", | |
config = function() | |
local diff = require("mini.diff") | |
diff.setup({ | |
-- Disabled by default | |
source = diff.gen_source.none(), | |
}) | |
end, | |
}, | |
{ | |
"MeanderingProgrammer/render-markdown.nvim", | |
ft = { "markdown", "codecompanion" } | |
}, | |
-------------- End AI Tooling ------------- | |
{ | |
"iamcco/markdown-preview.nvim", | |
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, | |
ft = { "markdown" }, | |
build = function() vim.fn["mkdp#util#install"]() end, | |
}, | |
"sirver/ultisnips", | |
"ckunte/latex-snippets-vim", | |
-- mason.nvim. | |
-- typst | |
{ | |
"williamboman/mason.nvim", | |
opts = { | |
typst_path = "/home/lev/.cargo/bin/typst" | |
}, | |
}, | |
{ | |
'chomosuke/typst-preview.nvim', | |
lazy = false, -- or ft = 'typst' | |
version = '1.*', | |
opts = { | |
debug = true, | |
typst_path = "/home/lev/.cargo/bin/typst" | |
}, -- lazy.nvim will implicitly calls `setup {}` | |
}, | |
-- Emojis | |
"junegunn/vim-emoji", | |
"rebelot/kanagawa.nvim", -- color theme | |
"iagorrr/noctishc.nvim", | |
{ | |
"scottmckendry/cyberdream.nvim", | |
lazy = false, | |
priority = 1000, | |
}, | |
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 }, -- color theme | |
-- nvim | |
{ | |
'Julian/lean.nvim', | |
event = { 'BufReadPre *.lean', 'BufNewFile *.lean' }, | |
dependencies = { | |
'neovim/nvim-lspconfig', | |
'nvim-lua/plenary.nvim', | |
-- you also will likely want nvim-cmp or some completion engine | |
}, | |
-- see details below for full configuration options | |
opts = { | |
lsp = {}, | |
mappings = true, | |
} | |
}, | |
{ | |
'saghen/blink.cmp', | |
-- optional: provides snippets for the snippet source | |
dependencies = { 'rafamadriz/friendly-snippets' }, | |
-- use a release tag to download pre-built binaries | |
version = '1.*', | |
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust | |
-- build = 'cargo build --release', | |
-- If you use nix, you can build from source using latest nightly rust with: | |
-- build = 'nix run .#build-plugin', | |
---@module 'blink.cmp' | |
---@type blink.cmp.Config | |
opts = { | |
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) | |
-- 'super-tab' for mappings similar to vscode (tab to accept) | |
-- 'enter' for enter to accept | |
-- 'none' for no mappings | |
-- | |
-- All presets have the following mappings: | |
-- C-space: Open menu or open docs if already open | |
-- C-n/C-p or Up/Down: Select next/previous item | |
-- C-e: Hide menu | |
-- C-k: Toggle signature help (if signature.enabled = true) | |
-- | |
-- See :h blink-cmp-config-keymap for defining your own keymap | |
keymap = { preset = 'default' }, | |
appearance = { | |
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' | |
-- Adjusts spacing to ensure icons are aligned | |
nerd_font_variant = 'mono' | |
}, | |
-- (Default) Only show the documentation popup when manually triggered | |
completion = { documentation = { auto_show = false } }, | |
-- Default list of enabled providers defined so that you can extend it | |
-- elsewhere in your config, without redefining it, due to `opts_extend` | |
sources = { | |
default = { 'lsp', 'path', 'snippets', 'buffer' }, | |
}, | |
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance | |
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, | |
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` | |
-- | |
-- See the fuzzy documentation for more information | |
fuzzy = { implementation = "prefer_rust_with_warning" } | |
}, | |
opts_extend = { "sources.default" } | |
}, | |
{ | |
"nvim-treesitter/nvim-treesitter", | |
build = ":TSUpdate", | |
config = function() | |
require("nvim-treesitter.configs").setup({ | |
ensure_installed = { "svelte" }, | |
highlight = { | |
enable = true, | |
}, | |
}) | |
end, | |
}, | |
-- Circom | |
"iden3/vim-circom-syntax", | |
"othree/html5.vim", | |
"evanleck/vim-svelte", | |
"neovim/nvim-lspconfig", | |
-- Juypter notebook, | |
"luk400/vim-jukit", | |
-- Custom Parameters (with defaults) | |
{ | |
"David-Kunz/gen.nvim", | |
opts = { | |
model = "mistral", -- The default model to use. | |
quit_map = "q", -- set keymap to close the response window | |
retry_map = "<c-r>", -- set keymap to re-send the current prompt | |
accept_map = "<c-cr>", -- set keymap to replace the previous selection with the last result | |
host = "localhost", -- The host running the Ollama service. | |
port = "11434", -- The port on which the Ollama service is listening. | |
display_mode = "float", -- The display mode. Can be "float" or "split" or "horizontal-split". | |
show_prompt = false, -- Shows the prompt submitted to Ollama. | |
show_model = false, -- Displays which model you are using at the beginning of your chat session. | |
no_auto_close = false, -- Never closes the window automatically. | |
file = false, -- Write the payload to a temporary file to keep the command short. | |
hidden = false, -- Hide the generation window (if true, will implicitly set `prompt.replace = true`), requires Neovim >= 0.10 | |
init = function(options) pcall(io.popen, "ollama serve > /dev/null 2>&1 &") end, | |
-- Function to initialize Ollama | |
command = function(options) | |
local body = {model = options.model, stream = true} | |
return "curl --silent --no-buffer -X POST http://" .. options.host .. ":" .. options.port .. "/api/chat -d $body" | |
end, | |
-- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped). | |
-- This can also be a command string. | |
-- The executed command must return a JSON object with { response, context } | |
-- (context property is optional). | |
-- list_models = '<omitted lua function>', -- Retrieves a list of model names | |
debug = false -- Prints errors and the command which is run. | |
} | |
}, | |
}) | |
-- vimtex | |
vim.g.vimtex_view_method = "zathura" | |
vim.g.maplocalleader = "," | |
vim.o.foldmethod = "expr" | |
vim.o.foldexpr="vimtex#fold#level(v:lnum)" | |
vim.o.foldtext="vimtex#fold#text()" | |
vim.o.foldlevel=2 | |
-- Minimal lsp config | |
local lspconfig = require("lspconfig") | |
lspconfig.texlab.setup {} | |
-- Use LspAttach autocommand to only map the following keys | |
-- after the language server attaches to the current buffer | |
vim.api.nvim_create_autocmd("LspAttach", { | |
group = vim.api.nvim_create_augroup("UserLspConfig", {}), | |
callback = function(ev) | |
-- Enable completion triggered by <c-x><c-o> | |
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" | |
-- Buffer local mappings. | |
-- See `:help vim.lsp.*` for documentation on any of the below functions | |
local opts = { buffer = ev.buf } | |
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) | |
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) | |
vim.keymap.set("n", "gR", vim.lsp.buf.rename, opts) | |
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) | |
end, | |
}) | |
-- nvim-cmp | |
local cmp = require("cmp") | |
cmp.setup({ | |
sources = cmp.config.sources({ | |
{ name = "buffer" }, | |
{ name = "nvim_lsp" }, | |
}), | |
mapping = cmp.mapping.preset.insert({ | |
["<C-Space>"] = cmp.mapping.complete(), | |
["<C-u>"] = cmp.mapping.scroll_docs(-4), | |
["<C-d>"] = cmp.mapping.scroll_docs(4), | |
["<C-l>"] = cmp.mapping.confirm({ select = true }), | |
}), | |
}) | |
-- color scheme | |
local themes = { "catppuccin-latte", "cyberdream", "kanagawa", "kanagawa-wave" } | |
local current_theme = 1 | |
function ToggleTheme() | |
current_theme = current_theme % #themes + 1 | |
vim.cmd("colorscheme " .. themes[current_theme]) | |
end | |
vim.cmd("colorscheme " .. themes[current_theme]) | |
vim.api.nvim_set_keymap('n', '<leader>tt', ':lua ToggleTheme()<CR>', { noremap = true, silent = true }) | |
-- Langauge Server | |
vim.api.nvim_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', { noremap = true, silent = true }) | |
vim.api.nvim_set_keymap('n', '<leader>a', '<cmd>lua vim.lsp.buf.code_action()<CR>', { noremap = true, silent = true }) | |
vim.api.nvim_set_keymap('n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>', { noremap = true, silent = true }) | |
-- Typst | |
vim.g.typst_conceal_emoji = 1 -- Conceal emoji | |
vim.o.completefunc = 'emoji#complete' -- For ctrl X ctrl U completion | |
-- Gen.nvim | |
vim.keymap.set({ 'n', 'v' }, '<leader>]', ':Gen<CR>') | |
-- Typst | |
require("lspconfig")["tinymist"].setup { | |
settings = { | |
formatterMode = "typstyle", | |
exportPdf = "onSave", | |
semanticTokens = "disable" | |
} | |
} | |
vim.api.nvim_create_user_command("OpenPdf", function() | |
local filepath = vim.api.nvim_buf_get_name(0) | |
if filepath:match("%.typ$") then | |
os.execute("open " .. vim.fn.shellescape(filepath:gsub("%.typ$", ".pdf"))) | |
-- replace open with your preferred pdf viewer | |
-- os.execute("zathura " .. vim.fn.shellescape(filepath:gsub("%.typ$", ".pdf"))) | |
end | |
end, {}) | |
-- pin the main file | |
--vim.lsp.buf.execute_command({ command = 'tinymist.pinMain', arguments = { vim.api.nvim_buf_get_name(0) } }) | |
---- unpin the main file | |
--vim.lsp.buf.execute_command({ command = 'tinymist.pinMain', arguments = { nil } }) | |
vim.api.nvim_create_autocmd("LspAttach", { | |
callback = function(args) | |
local client = vim.lsp.get_client_by_id(args.data.client_id) | |
if client and client.name == "tinymist" then | |
local bufname = vim.api.nvim_buf_get_name(args.buf) | |
if bufname:match("main%.typ$") then | |
local success, err = pcall(vim.lsp.buf.execute_command, { | |
command = 'tinymist.pinMain', | |
arguments = { bufname } | |
}) | |
if success then | |
vim.notify("Attached main.typ file") | |
end | |
if not success then | |
vim.notify("Failed to execute tinymist.pinMain: " .. tostring(err), vim.log.levels.WARN) | |
end | |
end | |
end | |
end | |
}) | |
-- Svelte | |
require('lspconfig').svelte.setup{ | |
-- Basic setup | |
capabilities = require('cmp_nvim_lsp').default_capabilities(), | |
-- Optional settings | |
settings = { | |
svelte = { | |
plugin = { | |
html = { completions = { enable = true } }, | |
svelte = { completions = { enable = true } } | |
} | |
} | |
} | |
} | |
require('nvim-treesitter.configs').setup { | |
ensure_installed = { "svelte" }, | |
highlight = { | |
enable = true, | |
}, | |
} | |
------------ AI Tooling ------------- | |
--require("codecompanion").setup({ | |
-- strategies = { | |
-- chat = { | |
-- adapter = "gemini", | |
-- }, | |
-- inline = { | |
-- adapter = "gemini", | |
-- }, | |
-- }, | |
--}) | |
-- | |
--vim.keymap.set({ "n", "v" }, "<C-a>", "<cmd>CodeCompanionActions<cr>", { noremap = true, silent = true }) | |
--vim.keymap.set({ "n", "v" }, "<leader>a", "<cmd>CodeCompanionChat Toggle<cr>", { noremap = true, silent = true }) | |
--vim.keymap.set("v", "ga", "<cmd>CodeCompanionChat Add<cr>", { noremap = true, silent = true }) | |
-- | |
-- Expand 'cc' into 'CodeCompanion' in the command line | |
--vim.cmd([[cab cc CodeCompanion]]) | |
require("claude-code").setup() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment