From f0e13819fbc7e070ec6ea7d6ccf9a7bdbdd54503 Mon Sep 17 00:00:00 2001 From: Trianta <56975502+Trimutex@users.noreply.github.com> Date: Tue, 16 Jan 2024 18:32:22 -0600 Subject: [PATCH] Added nvim --- nvim/after/plugin/binds.lua | 27 +++++++ nvim/after/plugin/settings.lua | 46 +++++++++++ nvim/init.lua | 2 + nvim/lazy-lock.json | 23 ++++++ nvim/lua/trianta/init.lua | 3 + nvim/lua/trianta/lazy.lua | 144 +++++++++++++++++++++++++++++++++ nvim/lua/trianta/remap.lua | 2 + nvim/lua/trianta/set.lua | 26 ++++++ update.sh | 2 + 9 files changed, 275 insertions(+) create mode 100644 nvim/after/plugin/binds.lua create mode 100644 nvim/after/plugin/settings.lua create mode 100644 nvim/init.lua create mode 100644 nvim/lazy-lock.json create mode 100644 nvim/lua/trianta/init.lua create mode 100644 nvim/lua/trianta/lazy.lua create mode 100644 nvim/lua/trianta/remap.lua create mode 100644 nvim/lua/trianta/set.lua diff --git a/nvim/after/plugin/binds.lua b/nvim/after/plugin/binds.lua new file mode 100644 index 0000000..f9abc7b --- /dev/null +++ b/nvim/after/plugin/binds.lua @@ -0,0 +1,27 @@ +-- Telescope +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'pf', builtin.find_files, {}) +vim.keymap.set('n', '', builtin.git_files, {}) +vim.keymap.set('n', 'ps', function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }) +end) + +-- Harpoon +local mark = require("harpoon.mark") +local ui = require("harpoon.ui") +vim.keymap.set("n", "a", mark.add_file) +vim.keymap.set("n", "", ui.toggle_quick_menu) + +vim.keymap.set("n", "", function() ui.nav_file(1) end) +vim.keymap.set("n", "", function() ui.nav_file(2) end) +vim.keymap.set("n", "", function() ui.nav_file(3) end) +vim.keymap.set("n", "", function() ui.nav_file(4) end) + +-- Zenmode +vim.keymap.set("n", "pz", function() + require("zen-mode").toggle({ + window = { + width = 90, + } + }) +end) diff --git a/nvim/after/plugin/settings.lua b/nvim/after/plugin/settings.lua new file mode 100644 index 0000000..3661941 --- /dev/null +++ b/nvim/after/plugin/settings.lua @@ -0,0 +1,46 @@ +-- lsp-zero +local lsp = require('lsp-zero') + +lsp.preset('recommended') +lsp.setup() + +-- Treesitter +vim.opt.runtimepath:append("~/.local/share/nvim/parsers") + +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "c", "cpp", "javascript", "lua", "vim" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + parser_install_dir = "~/.local/share/nvim/parsers", + + highlight = { + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} + +-- Obsidian +vim.opt.conceallevel = 1 + +-- Colors +function ColorMyPencils(color) + color = color or "catppuccin-frappe" + vim.cmd.colorscheme(color) + + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) +end + +ColorMyPencils() diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..988c157 --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,2 @@ +require('trianta') + diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json new file mode 100644 index 0000000..b70ffee --- /dev/null +++ b/nvim/lazy-lock.json @@ -0,0 +1,23 @@ +{ + "LuaSnip": { "branch": "master", "commit": "82108e7e31cc6fc223cc5df5cae6d89f70bb199f" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" }, + "harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" }, + "lsp-zero.nvim": { "branch": "v1.x", "commit": "aa36afcf7a59fbd98008c9a434593c423d3d649a" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" }, + "mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" }, + "nvim": { "branch": "main", "commit": "5e36ca599f4aa41bdd87fbf2c5aae4397ac55074" }, + "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, + "nvim-lspconfig": { "branch": "master", "commit": "7eed8b2150192e5ad05e1886fdf133493ddf2928" }, + "nvim-treesitter": { "branch": "master", "commit": "97ba59c6f532072e456b3d1f2413560e689c132b" }, + "obsidian.nvim": { "branch": "main", "commit": "a9ae6b20560d716a5f9b89252e4ea29c8e64617a" }, + "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, + "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, + "todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" }, + "twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" } +} \ No newline at end of file diff --git a/nvim/lua/trianta/init.lua b/nvim/lua/trianta/init.lua new file mode 100644 index 0000000..eddc4a1 --- /dev/null +++ b/nvim/lua/trianta/init.lua @@ -0,0 +1,3 @@ +require("trianta.remap") +require("trianta.lazy") +require("trianta.set") diff --git a/nvim/lua/trianta/lazy.lua b/nvim/lua/trianta/lazy.lua new file mode 100644 index 0000000..50811c2 --- /dev/null +++ b/nvim/lua/trianta/lazy.lua @@ -0,0 +1,144 @@ +-- 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 lazy.nvim]] + +return require('lazy').setup({ + -- Packer can manage itself + "folke/lazy.nvim", + { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } + }, + { "catppuccin/nvim", as = "catppuccin" }, + { + "nvim-telescope/telescope.nvim", branch = '0.1.x', + -- or , branch = '0.1.x', + dependencies = {"nvim-lua/plenary.nvim"}, + }, + + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + }, + "nvim-treesitter/playground", + "ThePrimeagen/harpoon", + { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v1.x', + dependencies = { + -- LSP Support + "neovim/nvim-lspconfig", -- Required + 'williamboman/mason.nvim', -- Optional + 'williamboman/mason-lspconfig.nvim', -- Optional + + -- Autocompletion + 'hrsh7th/nvim-cmp', -- Required + 'hrsh7th/cmp-nvim-lsp', -- Required + 'hrsh7th/cmp-buffer', -- Optional + 'hrsh7th/cmp-path', -- Optional + 'saadparwaiz1/cmp_luasnip', -- Optional + 'hrsh7th/cmp-nvim-lua', -- Optional + + -- Snippets + 'L3MON4D3/LuaSnip', -- Required + 'rafamadriz/friendly-snippets', -- Optional + }, + }, + { + "epwalsh/obsidian.nvim", + version = "*", -- recommended, use latest release instead of latest commit + lazy = true, + ft = "markdown", + dependencies = { + "nvim-lua/plenary.nvim", + }, + opts = { + workspaces = { + { + name = "trinote", + path = "~/sync/obsidian/Trinote/", + }, + }, + }, + ui = { + enable = true + } + }, + { + "folke/twilight.nvim", + opts = { + dimming = { + alpha = 0.25, -- amount of dimming + -- we try to get the foreground from the highlight groups or fallback color + color = { "Normal", "#ffffff" }, + term_bg = "#000000", -- if guibg=NONE, this will be used to calculate text color + inactive = false, -- when true, other windows will be fully dimmed (unless they contain the same buffer) + }, + context = 10, -- amount of lines we will try to show around the current line + treesitter = true, -- use treesitter when available for the filetype + -- treesitter is used to automatically expand the visible text, + -- but you can further control the types of nodes that should always be fully expanded + expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types + "function", + "method", + "table", + "if_statement", + }, + exclude = {}, -- exclude these filetypes + }, +}, +-- Lua +{ + "folke/zen-mode.nvim", + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + { + window = { + backdrop = 0.95, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal + -- height and width can be: + -- * an absolute number of cells when > 1 + -- * a percentage of the width / height of the editor when <= 1 + -- * a function that returns the width or the height + width = 120, -- width of the Zen window + height = 1, -- height of the Zen window + -- by default, no options are changed for the Zen window + -- uncomment any of the options below, or add other vim.wo options you want to apply + options = { + -- signcolumn = "no", -- disable signcolumn + -- number = false, -- disable number column + -- relativenumber = false, -- disable relative numbers + -- cursorline = false, -- disable cursorline + -- cursorcolumn = false, -- disable cursor column + -- foldcolumn = "0", -- disable fold column + -- list = false, -- disable whitespace characters + }, + }, + plugins = { + options = { + enabled = true, + ruler = false, -- disables the ruler text in the cmd line area + showcmd = false, -- disables the command in the last line of the screen + -- you may turn on/off statusline in zen mode by setting 'laststatus' + -- statusline will be shown only if 'laststatus' == 3 + laststatus = 0, -- turn off the statusline in zen mode + }, + twilight = { enabled = true }, -- enable to start Twilight when zen mode opens + }, + -- callback where you can add custom code when the Zen window opens + on_open = function(win) + end, + -- callback where you can add custom code when the Zen window closes + on_close = function() + end, + } + } +} +}) diff --git a/nvim/lua/trianta/remap.lua b/nvim/lua/trianta/remap.lua new file mode 100644 index 0000000..b760350 --- /dev/null +++ b/nvim/lua/trianta/remap.lua @@ -0,0 +1,2 @@ +vim.g.mapleader = " " +vim.keymap.set("n", "pv", vim.cmd.Ex) diff --git a/nvim/lua/trianta/set.lua b/nvim/lua/trianta/set.lua new file mode 100644 index 0000000..d6f4184 --- /dev/null +++ b/nvim/lua/trianta/set.lua @@ -0,0 +1,26 @@ +vim.opt.nu = true + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +vim.opt.wrap = true + +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.termguicolors = true + +vim.opt.scrolloff = 8 +vim.opt.signcolumn = "yes" + +vim.opt.updatetime = 50 + +vim.opt.colorcolumn = "80" + +vim.g.mapleader = " " + +vim.opt.mouse = "" diff --git a/update.sh b/update.sh index de8f608..a70f56d 100755 --- a/update.sh +++ b/update.sh @@ -4,3 +4,5 @@ echo "Syncing dotfiles with alacritty..." rsync --recursive ~/.config/alacritty $(dirname "$0") echo "Syncing dotfiles with hypr..." rsync --recursive ~/.config/hypr $(dirname "$0") +echo "Syncing dotfiles with nvim..." +rsync --recursive ~/.config/nvim $(dirname "$0")