From ad4fe21238f87235646bafbeddb10f864dd5f642 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 2 May 2025 15:57:52 +0200 Subject: Initial Commit --- .config/nvim/lua/keybindings.lua | 82 ++++++++++++++ .config/nvim/lua/options.lua | 38 +++++++ .config/nvim/lua/plugins.lua | 228 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 348 insertions(+) create mode 100644 .config/nvim/lua/keybindings.lua create mode 100644 .config/nvim/lua/options.lua create mode 100644 .config/nvim/lua/plugins.lua (limited to '.config/nvim/lua') diff --git a/.config/nvim/lua/keybindings.lua b/.config/nvim/lua/keybindings.lua new file mode 100644 index 0000000..eeff55f --- /dev/null +++ b/.config/nvim/lua/keybindings.lua @@ -0,0 +1,82 @@ +vim.g.mapleader = " " +vim.keymap.set('n', 'ff', ":Telescope find_files cwd= theme=dropdown") +vim.keymap.set('n', 'fm', ":Telescope find_files cwd=D:/Optics/CODEV/Macros theme=dropdown") +vim.keymap.set('n', 'fc', ":Telescope find_files cwd=C:/CODEV202403/macro theme=dropdown") +vim.keymap.set('n', 'fl', ":Telescope find_files cwd=C:/CODEV202403/lens theme=dropdown") + +vim.keymap.set("n", "pp", ":Telescope file_browser cwd= theme=dropdown") +vim.keymap.set("n", "pm", ":Telescope file_browser cwd=D:/Optics/CODEV/Macros theme=dropdown") +vim.keymap.set("n", "pc", ":Telescope file_browser cwd=C:/CODEV202403/macro theme=dropdown") +vim.keymap.set("n", "pl", ":Telescope file_browser cwd=C:/CODEV202403/lens theme=dropdown") + +vim.keymap.set('n', "gg", ":Telescope live_grep cwd= theme=dropdown") +vim.keymap.set('n', "gm", ":Telescope live_grep cwd=D:/Optics/CODEV/Macros theme=dropdown") +vim.keymap.set('n', "gc", ":Telescope live_grep cwd=C:/CODEV202403/macro theme=dropdown") +vim.keymap.set('n', "gl", ":Telescope live_grep cwd=C:/CODEV202403/lens theme=dropdown") + + +vim.keymap.set('n', "b", ":Telescope buffers theme=dropdown") + +vim.keymap.set('n', 'u', ":UndotreeToggle") +vim.keymap.set('n', 'G', ":Git") +-- General Keybindings +vim.keymap.set("i", "jk", "") +vim.keymap.set("n","w", ":w") +vim.keymap.set("n","q", ":q") +vim.keymap.set("n","", ":bd") +vim.keymap.set("i","", ":bd") +vim.keymap.set("n","Q", ":q!") +vim.keymap.set("n","o", "o") +vim.keymap.set("n","O", "O") +vim.keymap.set("i", "e", "e") +--File Formatting +vim.keymap.set("n","S", "ggVG=") +-- Moving Lines around +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") +vim.keymap.set("n", "J", "mzJ`z") +--Fast Vertical Navigation +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +-- Search terms stay in the middle +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") +-- pasting something instead of current text +vim.keymap.set("x", "p", [["_dP]]) +-- copying into system clipboard +vim.keymap.set({"n", "v"}, "y", [["+y]]) +vim.keymap.set("n", "Y", [["+Y]]) +-- Put into Void Register +vim.keymap.set({"n", "v"}, "d", [["_d]]) +-- Quick Fix List Navingation +--vim.keymap.set("n", "", ":cnextzz") +--vim.keymap.set("n", "", ":cprevzz") +vim.keymap.set("n", "k", ":lnextzz") +vim.keymap.set("n", "j", ":lprevzz") +-- Terminal Navigation +-- vim.keymap.set("n", "tt", ":ToggleTerm size=60 direction=horizontal shell=powershell") +vim.keymap.set("n", "t", ":ToggleTerm") +-- vim.keymap.set("n", "", ":ToggleTerm") +-- vim.keymap.set("i", "", ":ToggleTerm") +-- vim.keymap.set("n", "tt", ":vertical 60 vsplit | terminal pwsh.exe") +-- vim.keymap.set("n", "tj", ":term pwsh.exe") +vim.keymap.set("t", "jk", [[]]) +vim.keymap.set("t", "", [[h]]) +vim.keymap.set("t", "", [[j]]) +vim.keymap.set("t", "", [[k]]) +vim.keymap.set("t", "", [[l]]) +--Sending lines and file to the internal terminal I had before to make the cursor move to the previous position but this doesnt seem to be a good option +vim.keymap.set({"n", "i"},"", ":ToggleTermSendCurrentLinej") +vim.keymap.set("n","", "ggVG:'<,'>ToggleTermSendVisualLines") +vim.keymap.set("i","", "ggVG:'<,'>ToggleTermSendVisualLinesi") +vim.keymap.set("v","", ":ToggleTermSendVisualLines") +-- Buffer Navigation +vim.keymap.set("n", "", [[h]]) +vim.keymap.set("n", "", [[j]]) +vim.keymap.set("n", "", [[k]]) +vim.keymap.set("n", "", [[l]]) +-- Undo Remapping +vim.keymap.set("n", "U", "") + +vim.keymap.set("n", "-", ":Oil", { desc = "Open parent directory" }) + diff --git a/.config/nvim/lua/options.lua b/.config/nvim/lua/options.lua new file mode 100644 index 0000000..50ad3ca --- /dev/null +++ b/.config/nvim/lua/options.lua @@ -0,0 +1,38 @@ +--Sets automatic update of the file internals +vim.api.nvim_exec([[ + autocmd FocusGained,BufEnter,BufWinEnter,WinEnter,CursorHold,CursorHoldI * checktime + autocmd FileChangedShellPost * echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None | checktime +]],{}) +vim.api.nvim_exec([[set shortmess=I]],{}) + + +vim.opt.termguicolors = true + +vim.opt.splitbelow = true +vim.opt.splitright = true + +vim.opt.relativenumber = true +vim.opt.number = true +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME").."/.vim/undodir" +vim.opt.undofile = true + +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.scrolloff = 999 +vim.opt.updatetime = 50 + +vim.opt.wrap = true + +vim.opt.virtualedit = "block" +vim.opt.inccommand = "split" +vim.opt.ignorecase = true + +vim.cmd[[set laststatus=2]] diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua new file mode 100644 index 0000000..52e0622 --- /dev/null +++ b/.config/nvim/lua/plugins.lua @@ -0,0 +1,228 @@ +-- lazy plugin manager +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + -- bootstrap lazy.nvim + -- stylua: ignore + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + }) +end +vim.opt.rtp:prepend(vim.env.LAZY or lazypath) + +require("lazy").setup({ + -- Colorscheme + { + "folke/tokyonight.nvim", + init = function() + vim.cmd.colorscheme("tokyonight-night") + end + }, + + { + 'tpope/vim-fugitive', + }, + + { + { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v3.x', + lazy = true, + config = false, + init = function() + -- Disable automatic setup, we are doing it manually + vim.g.lsp_zero_extend_cmp = 0 + vim.g.lsp_zero_extend_lspconfig = 0 + end, + }, + + { + 'williamboman/mason.nvim', + lazy = false, + config = true, + }, + + { + 'neovim/nvim-lspconfig', + dependencies = { + {'hrsh7th/cmp-nvim-lsp'}, + } + }, + + -- Autocompletion + { + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + dependencies = { + {'L3MON4D3/LuaSnip', + 'hrsh7th/cmp-path', + }, + }, + config = function() + -- Here is where you configure the autocompletion settings. + local lsp_zero = require('lsp-zero') + lsp_zero.extend_cmp() + + -- And you can configure cmp even more, if you want to. + local cmp = require('cmp') + local cmp_action = lsp_zero.cmp_action() + + cmp.setup({ + formatting = lsp_zero.cmp_format(), + sources = { + { name = 'nvim_lsp' }, -- Enable LSP-based completion + { name = 'path' }, -- Enables path completion + { name = 'buffer' }, -- Buffer source for plain text completion + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp_action.luasnip_jump_forward(), + [''] = cmp_action.luasnip_jump_backward(), + }), + + -- }, + }) + end + }, + -- LSP + { + 'neovim/nvim-lspconfig', + cmd = {'LspInfo', 'LspInstall', 'LspStart'}, + event = {'BufReadPre', 'BufNewFile'}, + dependencies = { + {'hrsh7th/cmp-nvim-lsp'}, + {'williamboman/mason-lspconfig.nvim'}, + }, + config = function() + -- This is where all the LSP shenanigans will live + local lsp_zero = require('lsp-zero') + lsp_zero.extend_lspconfig() + + lsp_zero.on_attach(function(client, bufnr) + -- see :help lsp-zero-keybindings + -- to learn the available actions + lsp_zero.default_keymaps({buffer = bufnr}) + end) + + require('mason-lspconfig').setup({ + ensure_installed = {}, + handlers = { + lsp_zero.default_setup, + lua_ls = function() + -- (Optional) Configure lua language server for neovim + local lua_opts = lsp_zero.nvim_lua_ls() + require('lspconfig').lua_ls.setup(lua_opts) + end, + } + }) + end + } + + }, + + { + 'nvim-telescope/telescope.nvim', + -- or , branch = '0.1.x', + dependencies = { 'nvim-lua/plenary.nvim' } + }, + + { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + config = function () + local configs = require("nvim-treesitter.configs") + + configs.setup({ + ensure_installed = { "c", "lua", "vim", "vimdoc", "cpp", "python"}, --add "neorg here" + sync_install = false, + highlight = { + enable = true + }, + indent = { + enable = true + }, + }) + end + }, + + {'akinsho/toggleterm.nvim', + version = "*", + opts = { + shell = "pwsh.exe -NoLogo", + winbar = { + enabled =false + }, + direction = 'float', + border = 'none', -- No border around the terminal + } + }, + { + 'windwp/nvim-autopairs', + event = "InsertEnter", + config = true + -- use opts = {} for passing setup options + -- this is equivalent to setup({}) function +}, + + { + 'numToStr/Comment.nvim', + lazy = false, + opts= { + ---Add a space b/w comment and the line + padding = true, + ---Whether the cursor should stay at its position + sticky = true, + ---Lines to be ignored while (un)comment + ignore = nil, + ---LHS of toggle mappings in NORMAL mode + toggler = { + ---Line-comment toggle keymap + line = '/', + ---Block-comment toggle keymap + block = 'gbc', + }, + ---LHS of operator-pending mappings in NORMAL and VISUAL mode + opleader = { + ---Line-comment keymap + line = '/', + ---Block-comment keymap + block = 'gb', + }} + }, + + + { + 'nvim-treesitter/nvim-treesitter-context' + }, + { + "lervag/vimtex", + lazy = false, -- we don't want to lazy load VimTeX + -- tag = "v2.15", -- uncomment to pin to a specific release + init = function() + -- VimTeX configuration goes here, e.g. + vim.g.vimtex_view_method = "mupdf" + end + }, + + + { + "ThePrimeagen/harpoon", + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim" } + }, + { + 'stevearc/oil.nvim', + opts = {}, + -- Optional dependencies + -- dependencies = { "echasnovski/mini.icons" }, + dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if prefer nvim-web-devicons + }, + +}) + -- cgit v1.2.3