From 0968185578d32c7ee7a09e1bee30f48cf1f1598d Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 4 Feb 2024 20:53:56 -0500 Subject: [PATCH] Adding my initial nvim config --- after/plugin/color_scheme.lua | 64 +++++++++++++++++++++++++++++++++++ after/plugin/lsp.lua | 49 +++++++++++++++++++++++++++ after/plugin/lualine.lua | 7 ++++ after/plugin/neotree.lua | 25 ++++++++++++++ after/plugin/telescope.lua | 5 +++ after/plugin/transparent.lua | 3 ++ after/plugin/treescript.lua | 24 +++++++++++++ after/plugin/undotree.lua | 1 + init.lua | 1 + lazy-lock.json | 25 ++++++++++++++ lua/pippy/init.lua | 29 ++++++++++++++++ lua/pippy/lazy.lua | 63 ++++++++++++++++++++++++++++++++++ lua/pippy/remap.lua | 18 ++++++++++ 13 files changed, 314 insertions(+) create mode 100644 after/plugin/color_scheme.lua create mode 100644 after/plugin/lsp.lua create mode 100644 after/plugin/lualine.lua create mode 100644 after/plugin/neotree.lua create mode 100644 after/plugin/telescope.lua create mode 100644 after/plugin/transparent.lua create mode 100644 after/plugin/treescript.lua create mode 100644 after/plugin/undotree.lua create mode 100644 init.lua create mode 100644 lazy-lock.json create mode 100644 lua/pippy/init.lua create mode 100644 lua/pippy/lazy.lua create mode 100644 lua/pippy/remap.lua diff --git a/after/plugin/color_scheme.lua b/after/plugin/color_scheme.lua new file mode 100644 index 0000000..e005815 --- /dev/null +++ b/after/plugin/color_scheme.lua @@ -0,0 +1,64 @@ +-- require("catppuccin").setup({ +-- flavour = "mocha", -- latte, frappe, macchiato, mocha +-- background = { -- :h background +-- light = "latte", +-- dark = "mocha", +-- }, +-- transparent_background = false, -- disables setting the background color. +-- show_end_of_buffer = false, -- shows the '~' characters after the end of buffers +-- term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`) +-- dim_inactive = { +-- enabled = false, -- dims the background color of inactive window +-- shade = "dark", +-- percentage = 0.15, -- percentage of the shade to apply to the inactive window +-- }, +-- no_italic = false, -- Force no italic +-- no_bold = false, -- Force no bold +-- no_underline = false, -- Force no underline +-- styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): +-- comments = { "italic" }, -- Change the style of comments +-- conditionals = { "italic" }, +-- loops = {}, +-- functions = {}, +-- keywords = {}, +-- strings = {}, +-- variables = {}, +-- numbers = {}, +-- booleans = {}, +-- properties = {}, +-- types = {}, +-- operators = {}, +-- }, +-- color_overrides = {}, +-- custom_highlights = {}, +-- integrations = { +-- cmp = true, +-- gitsigns = true, +-- nvimtree = true, +-- treesitter = true, +-- notify = false, +-- mini = { +-- enabled = true, +-- indentscope_color = "", +-- }, +-- -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) +-- }, +-- }) +-- +-- -- setup must be called before loading +-- vim.cmd.colorscheme "catppuccin" + +require('onedark').setup { + style = 'deep', + colors = { + green = '#00ffaa', -- redefine an existing color + }, + highlights = { + ["@keyword"] = {fg = '$green'}, + ["@string"] = {fg = '#ff9900'}, + ["@function"] = {fg = '#00ccff', sp = '$cyan', fmt = 'underline,italic'}, + ["@function.builtin"] = {fg = '#0059ff'}, + ["@variable"] = {fg = '#00FF88'}, + } +} +require('onedark').load() diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua new file mode 100644 index 0000000..0158631 --- /dev/null +++ b/after/plugin/lsp.lua @@ -0,0 +1,49 @@ +local lsp_zero = require('lsp-zero') + +lsp_zero.on_attach(function(client, bufnr) + local opts = {buffer = bufnr, remap = false} + -- disable semantic highlighting cause I like tree sitter's coloring better + client.server_capabilities.semanticTokensProvider = nil + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) + vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) + vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts) + vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) + vim.keymap.set("n", "vca", function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts) + vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) + vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) +end) + +require('mason').setup({}) +require('mason-lspconfig').setup({ + ensure_installed = {'lua_ls', 'jedi_language_server', 'rust_analyzer', 'clangd' }, + handlers = { + lsp_zero.default_setup, + lua_ls = function() + local lua_opts = lsp_zero.nvim_lua_ls() + require('lspconfig').lua_ls.setup(lua_opts) + end, + } +}) + +local cmp = require('cmp') +local cmp_select = {behavior = cmp.SelectBehavior.Select} + +cmp.setup({ + sources = { + {name = 'path'}, + {name = 'nvim_lsp'}, + {name = 'nvim_lua'}, + }, + formatting = lsp_zero.cmp_format(), + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.complete(), + }), +}) + + diff --git a/after/plugin/lualine.lua b/after/plugin/lualine.lua new file mode 100644 index 0000000..3e572b0 --- /dev/null +++ b/after/plugin/lualine.lua @@ -0,0 +1,7 @@ +require('lualine').setup { + options = { + -- theme = "catppuccin" + theme = "onedark" + -- ... the rest of your lualine config + } +} diff --git a/after/plugin/neotree.lua b/after/plugin/neotree.lua new file mode 100644 index 0000000..c1a0c9d --- /dev/null +++ b/after/plugin/neotree.lua @@ -0,0 +1,25 @@ +require('neo-tree').setup({ + sources = { + "filesystem", + "buffers", + }, + filesystem = { + filtered_items = { + visible = true, + hide_gitignored = false, + hide_hidden = false, + hide_dotfiles = false, + }, + follow_current_file = + { + enabled = true, + }, + window = { + mappings = { + [''] = 'open' + } + } + }, +}) + +vim.keymap.set('n', 'b', ':Neotree toggle') diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua new file mode 100644 index 0000000..afb984a --- /dev/null +++ b/after/plugin/telescope.lua @@ -0,0 +1,5 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'ff', builtin.find_files, {}) +vim.keymap.set('n', 'fg', builtin.live_grep, {}) +vim.keymap.set('n', 'fs', builtin.grep_string, {}) +vim.keymap.set('n', 'fh', builtin.help_tags, {}) diff --git a/after/plugin/transparent.lua b/after/plugin/transparent.lua new file mode 100644 index 0000000..bd12493 --- /dev/null +++ b/after/plugin/transparent.lua @@ -0,0 +1,3 @@ +require('transparent').clear_prefix('BufferLine') +require('transparent').clear_prefix('NeoTree') +-- require('transparent').clear_prefix('lualine') diff --git a/after/plugin/treescript.lua b/after/plugin/treescript.lua new file mode 100644 index 0000000..11f4df9 --- /dev/null +++ b/after/plugin/treescript.lua @@ -0,0 +1,24 @@ +require('nvim-treesitter.configs').setup({ + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "c", "cpp", "cuda", "lua", "python", "vim", "vimdoc", "query" }, + + -- 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, + + ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) + -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/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, + }, +}) diff --git a/after/plugin/undotree.lua b/after/plugin/undotree.lua new file mode 100644 index 0000000..b6b9276 --- /dev/null +++ b/after/plugin/undotree.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..b8d83ae --- /dev/null +++ b/init.lua @@ -0,0 +1 @@ +require("pippy") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..a5c0005 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,25 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "80a8528f084a97b624ae443a6f50ff8074ba486b" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "lazy.nvim": { "branch": "main", "commit": "16603c6917435d8446f7357cb61095138a417085" }, + "lsp-zero.nvim": { "branch": "v3.x", "commit": "bb874e8d832b66fa734b7b048d52eb9ed736bdcf" }, + "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "40301e1c74bc0946eece13edf2b1c561cc497491" }, + "mason.nvim": { "branch": "main", "commit": "eabf6d347fdb75be360d4c0ced1145670a171453" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "1236db954ce502eb5b340bcdb69aa057cc372e8d" }, + "neoconf.nvim": { "branch": "main", "commit": "00dcf2b81c45de1768b4171faa16729f0888cfb8" }, + "neodev.nvim": { "branch": "main", "commit": "80487e4f7bfa11c2ef2a1b461963db019aad6a73" }, + "nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" }, + "nvim-cmp": { "branch": "main", "commit": "51260c02a8ffded8e16162dcf41a23ec90cfba62" }, + "nvim-lspconfig": { "branch": "master", "commit": "d0467b9574b48429debf83f8248d8cee79562586" }, + "nvim-treesitter": { "branch": "master", "commit": "051ce73fcd4d6b77a313e87e1113fcd42cf54cd1" }, + "nvim-web-devicons": { "branch": "master", "commit": "5de460ca7595806044eced31e3c36c159a493857" }, + "onedark.nvim": { "branch": "master", "commit": "b9acd92ded2ba155867ca5af9d618e933d96e3b0" }, + "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, + "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, + "telescope.nvim": { "branch": "master", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, + "transparent.nvim": { "branch": "main", "commit": "fd35a46f4b7c1b244249266bdcb2da3814f01724" }, + "undotree": { "branch": "master", "commit": "170aa9e516b6926e6bddfe21bbf01f2283a00e7d" }, + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } +} \ No newline at end of file diff --git a/lua/pippy/init.lua b/lua/pippy/init.lua new file mode 100644 index 0000000..f43315e --- /dev/null +++ b/lua/pippy/init.lua @@ -0,0 +1,29 @@ +require("pippy.remap") +require("pippy.lazy") + +vim.opt.nu = true +vim.opt.relativenumber = true + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.swapfile = false +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +vim.opt.undofile = true + +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.termguicolors = true + +vim.opt.scrolloff = 8 +vim.opt.signcolumn = "yes" +vim.opt.isfname:append("@-@") + +vim.opt.updatetime = 50 + +vim.opt.colorcolumn = "80" +vim.opt.listchars = { space = '·', tab = '>~', eol = '↵'} +vim.opt.list = true diff --git a/lua/pippy/lazy.lua b/lua/pippy/lazy.lua new file mode 100644 index 0000000..998e571 --- /dev/null +++ b/lua/pippy/lazy.lua @@ -0,0 +1,63 @@ +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({ + "folke/which-key.nvim", + + {"nvim-treesitter/nvim-treesitter", build = ':TSUpdate'}, + "nvim-treesitter/playground", + + { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + } + }, + + -- { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, + "navarasu/onedark.nvim", + + "mbbill/undotree", + + { 'nvim-lualine/lualine.nvim', requires = { 'nvim-tree/nvim-web-devicons', opt = true } }, + + -- { 'feline-nvim/feline.nvim', branch = '0.5-compat' }, + -- + + { + 'nvim-telescope/telescope.nvim', + tag = '0.1.3', + dependencies = { + 'nvim-lua/plenary.nvim' + }, + }, + { + "folke/neoconf.nvim", + cmd = "Neoconf" + }, + + "folke/neodev.nvim", + {'williamboman/mason.nvim'}, + {'williamboman/mason-lspconfig.nvim'}, + {'VonHeikemen/lsp-zero.nvim', branch = 'v3.x'}, + {'neovim/nvim-lspconfig'}, + {'hrsh7th/cmp-nvim-lsp'}, + {'hrsh7th/nvim-cmp'}, + {'L3MON4D3/LuaSnip'}, + + {'xiyaowong/transparent.nvim'}, + { 'numToStr/Comment.nvim', opts = {} }, +}) diff --git a/lua/pippy/remap.lua b/lua/pippy/remap.lua new file mode 100644 index 0000000..60fff83 --- /dev/null +++ b/lua/pippy/remap.lua @@ -0,0 +1,18 @@ +vim.g.mapleader = " " +vim.keymap.set("n", "pv", vim.cmd.Ex) + +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") + +vim.keymap.set({"n", "v"}, "y", [["+y]]) +vim.keymap.set("n", "Y", [["+Y]]) + +vim.keymap.set("n", "sg", [[:%s/\<\>//gI]]) --Global Search And Replace +vim.keymap.set("n", "ss", [[:.,$s/\<\>//gIc]]) --Search and replace incremental +vim.keymap.set("n", "", [[/\<\>/]]) -- ctrl find +