summaryrefslogtreecommitdiff
path: root/.config/nvim/lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua')
-rw-r--r--.config/nvim/lua/keybindings.lua82
-rw-r--r--.config/nvim/lua/options.lua38
-rw-r--r--.config/nvim/lua/plugins.lua228
3 files changed, 348 insertions, 0 deletions
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', '<leader>ff', ":Telescope find_files cwd= theme=dropdown<cr>")
+vim.keymap.set('n', '<leader>fm', ":Telescope find_files cwd=D:/Optics/CODEV/Macros theme=dropdown<cr>")
+vim.keymap.set('n', '<leader>fc', ":Telescope find_files cwd=C:/CODEV202403/macro theme=dropdown<cr>")
+vim.keymap.set('n', '<leader>fl', ":Telescope find_files cwd=C:/CODEV202403/lens theme=dropdown<cr>")
+
+vim.keymap.set("n", "<leader>pp", ":Telescope file_browser cwd= theme=dropdown<cr>")
+vim.keymap.set("n", "<leader>pm", ":Telescope file_browser cwd=D:/Optics/CODEV/Macros theme=dropdown<cr>")
+vim.keymap.set("n", "<leader>pc", ":Telescope file_browser cwd=C:/CODEV202403/macro theme=dropdown<cr>")
+vim.keymap.set("n", "<leader>pl", ":Telescope file_browser cwd=C:/CODEV202403/lens theme=dropdown<cr>")
+
+vim.keymap.set('n', "<leader>gg", ":Telescope live_grep cwd= theme=dropdown<cr>")
+vim.keymap.set('n', "<leader>gm", ":Telescope live_grep cwd=D:/Optics/CODEV/Macros theme=dropdown<cr>")
+vim.keymap.set('n', "<leader>gc", ":Telescope live_grep cwd=C:/CODEV202403/macro theme=dropdown<cr>")
+vim.keymap.set('n', "<leader>gl", ":Telescope live_grep cwd=C:/CODEV202403/lens theme=dropdown<cr>")
+
+
+vim.keymap.set('n', "<leader>b", ":Telescope buffers theme=dropdown<cr>")
+
+vim.keymap.set('n', '<leader>u', ":UndotreeToggle<CR>")
+vim.keymap.set('n', '<leader>G', ":Git<CR>")
+-- General Keybindings
+vim.keymap.set("i", "jk", "<Esc>")
+vim.keymap.set("n","<leader>w", ":w<cr>")
+vim.keymap.set("n","<leader>q", ":q<cr>")
+vim.keymap.set("n","<C-c>", ":bd<cr>")
+vim.keymap.set("i","<C-c>", ":bd<cr>")
+vim.keymap.set("n","<leader>Q", ":q!<cr>")
+vim.keymap.set("n","<leader>o", "o<Esc>")
+vim.keymap.set("n","<leader>O", "O<Esc>")
+vim.keymap.set("i", "<leader>e", "<Space>e")
+--File Formatting
+vim.keymap.set("n","<leader>S", "ggVG=")
+-- Moving Lines around
+vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
+vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
+vim.keymap.set("n", "J", "mzJ`z")
+--Fast Vertical Navigation
+vim.keymap.set("n", "<C-d>", "<C-d>zz")
+vim.keymap.set("n", "<C-u>", "<C-u>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", "<leader>p", [["_dP]])
+-- copying into system clipboard
+vim.keymap.set({"n", "v"}, "<leader>y", [["+y]])
+vim.keymap.set("n", "<leader>Y", [["+Y]])
+-- Put into Void Register
+vim.keymap.set({"n", "v"}, "<leader>d", [["_d]])
+-- Quick Fix List Navingation
+--vim.keymap.set("n", "<C-k>", ":cnext<CR>zz")
+--vim.keymap.set("n", "<C-j>", ":cprev<CR>zz")
+vim.keymap.set("n", "<leader>k", ":lnext<CR>zz")
+vim.keymap.set("n", "<leader>j", ":lprev<CR>zz")
+-- Terminal Navigation
+-- vim.keymap.set("n", "<leader>tt", ":ToggleTerm size=60 direction=horizontal shell=powershell<cr>")
+vim.keymap.set("n", "<leader>t", ":ToggleTerm<cr>")
+-- vim.keymap.set("n", "<C-t>", ":ToggleTerm<cr>")
+-- vim.keymap.set("i", "<C-t>", ":ToggleTerm<cr>")
+-- vim.keymap.set("n", "<leader>tt", ":vertical 60 vsplit | terminal pwsh.exe<cr>")
+-- vim.keymap.set("n", "<leader>tj", ":term pwsh.exe<cr>")
+vim.keymap.set("t", "jk", [[<C-\><C-n>]])
+vim.keymap.set("t", "<C-h>", [[<C-\><C-n><C-W>h]])
+vim.keymap.set("t", "<C-j>", [[<C-\><C-n><C-W>j]])
+vim.keymap.set("t", "<C-k>", [[<C-\><C-n><C-W>k]])
+vim.keymap.set("t", "<C-l>", [[<C-\><C-n><C-W>l]])
+--Sending lines and file to the internal terminal I had before <C-O> to make the cursor move to the previous position but this doesnt seem to be a good option
+vim.keymap.set({"n", "i"},"<C-r><C-k>", ":ToggleTermSendCurrentLine<cr>j")
+vim.keymap.set("n","<C-r><C-j>", "ggVG:'<,'>ToggleTermSendVisualLines<cr>")
+vim.keymap.set("i","<C-r><C-j>", "<Esc>ggVG:'<,'>ToggleTermSendVisualLines<cr><Esc>i")
+vim.keymap.set("v","<C-r><C-k>", ":ToggleTermSendVisualLines<cr><Esc>")
+-- Buffer Navigation
+vim.keymap.set("n", "<C-h>", [[<C-W>h]])
+vim.keymap.set("n", "<C-j>", [[<C-W>j]])
+vim.keymap.set("n", "<C-k>", [[<C-W>k]])
+vim.keymap.set("n", "<C-l>", [[<C-W>l]])
+-- Undo Remapping
+vim.keymap.set("n", "U", "<C-r>")
+
+vim.keymap.set("n", "-", ":Oil<CR>", { 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({
+ ['<C-Space>'] = cmp.mapping.complete(),
+ ['<C-u>'] = cmp.mapping.scroll_docs(-4),
+ ['<C-d>'] = cmp.mapping.scroll_docs(4),
+ ['<C-f>'] = cmp_action.luasnip_jump_forward(),
+ ['<C-b>'] = 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 = '<leader>/',
+ ---Block-comment toggle keymap
+ block = 'gbc',
+ },
+ ---LHS of operator-pending mappings in NORMAL and VISUAL mode
+ opleader = {
+ ---Line-comment keymap
+ line = '<leader>/',
+ ---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
+ },
+
+})
+
Back to https://optics-design.com