Adding my initial nvim config

This commit is contained in:
Daniel 2024-02-04 20:53:56 -05:00
commit 0968185578
13 changed files with 314 additions and 0 deletions

View File

@ -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()

49
after/plugin/lsp.lua Normal file
View File

@ -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", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>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", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
vim.keymap.set("i", "<C-h>", 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({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<Tab>'] = cmp.mapping.confirm({ select = true }),
['<C-Space>'] = cmp.mapping.complete(),
}),
})

7
after/plugin/lualine.lua Normal file
View File

@ -0,0 +1,7 @@
require('lualine').setup {
options = {
-- theme = "catppuccin"
theme = "onedark"
-- ... the rest of your lualine config
}
}

25
after/plugin/neotree.lua Normal file
View File

@ -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 = {
['<leftrelease>'] = 'open'
}
}
},
})
vim.keymap.set('n', '<leader>b', ':Neotree toggle<CR>')

View File

@ -0,0 +1,5 @@
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fs', builtin.grep_string, {})
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})

View File

@ -0,0 +1,3 @@
require('transparent').clear_prefix('BufferLine')
require('transparent').clear_prefix('NeoTree')
-- require('transparent').clear_prefix('lualine')

View File

@ -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,
},
})

View File

@ -0,0 +1 @@
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)

1
init.lua Normal file
View File

@ -0,0 +1 @@
require("pippy")

25
lazy-lock.json Normal file
View File

@ -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" }
}

29
lua/pippy/init.lua Normal file
View File

@ -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

63
lua/pippy/lazy.lua Normal file
View File

@ -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 = {} },
})

18
lua/pippy/remap.lua Normal file
View File

@ -0,0 +1,18 @@
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
vim.keymap.set({"n", "v"}, "<leader>y", [["+y]])
vim.keymap.set("n", "<leader>Y", [["+Y]])
vim.keymap.set("n", "<leader>sg", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]]) --Global Search And Replace
vim.keymap.set("n", "<leader>ss", [[:.,$s/\<<C-r><C-w>\>/<C-r><C-w>/gIc<Left><Left><Left><Left>]]) --Search and replace incremental
vim.keymap.set("n", "<C-f>", [[/\<<C-r><C-w>\>/<CR>]]) -- ctrl find