diff --git a/.config/nvim/after/plugin/cmp.lua b/.config/nvim/after/plugin/cmp.lua new file mode 100644 index 0000000..208d7e8 --- /dev/null +++ b/.config/nvim/after/plugin/cmp.lua @@ -0,0 +1,35 @@ +local cmp = require('cmp') + +cmp.setup({ + sources = { + { + name = "nvim_lsp", + priority = 1000 + }, + { + name = "luasnip", + priority = 750 + }, + { + name = "buffer", + priority = 500 + }, + { + name = "path", + priority = 250 + } + }, + mapping = cmp.mapping.preset.insert({ + -- Enter key confirms completion item + [''] = cmp.mapping.confirm({ + select = false + }), + + -- Ctrl + space triggers completion menu + [''] = cmp.mapping.complete() + }), + snippet = { + expand = function(args) require('luasnip').lsp_expand(args.body) end + } +}) + diff --git a/.config/nvim/after/plugin/conf.lua b/.config/nvim/after/plugin/conf.lua new file mode 100644 index 0000000..ec9832a --- /dev/null +++ b/.config/nvim/after/plugin/conf.lua @@ -0,0 +1,9 @@ +require("neoconf").setup(); +require("neodev").setup(); +require('nvim-ts-autotag').setup() +require('Comment').setup({ + pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook() +}) +require('ts_context_commentstring').setup({}) +require("bufferline").setup {} +require("transparent").setup() diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua new file mode 100644 index 0000000..38b0ccc --- /dev/null +++ b/.config/nvim/after/plugin/lsp.lua @@ -0,0 +1,62 @@ +require("luasnip.loaders.from_vscode").lazy_load() + +vim.keymap.set('n', 'gl', 'lua vim.diagnostic.open_float()') +vim.keymap.set('n', '[d', 'lua vim.diagnostic.goto_prev()') +vim.keymap.set('n', ']d', 'lua vim.diagnostic.goto_next()') + +vim.api.nvim_create_autocmd('LspAttach', { + desc = 'LSP actions', + callback = function(args) + local bufnr = args.buf + local client = vim.lsp.get_client_by_id(args.data.client_id) + + local opts = { + buffer = bufnr + } + + require("which-key").register({ + ['K'] = { + function() vim.lsp.buf.hover() end, + 'Hover Diagnostic' + }, + ["g"] = { + d = { + function() vim.lsp.buf.definition() end, + 'Jump Definition' + }, + D = { + function() vim.lsp.buf.declaration() end, + 'Jump Declaration' + }, + i = { + function() vim.lsp.buf.implementation() end, + 'View Implementation' + }, + o = { + function() vim.lsp.buf.type_definition() end, + 'Jump Type Definition' + }, + r = { + function() vim.lsp.buf.references() end, + 'View References' + }, + s = { + function() vim.lsp.buf.signature_help() end, + 'Signature Help' + } + }, + ["l"] = { + r = { + function() vim.lsp.buf.rename() end, + 'Rename' + }, + a = { + function() vim.lsp.buf.code_action() end, + 'Code Action' + } + } + + }, opts) + + end +}) diff --git a/.config/nvim/after/plugin/mason.lua b/.config/nvim/after/plugin/mason.lua new file mode 100644 index 0000000..0774641 --- /dev/null +++ b/.config/nvim/after/plugin/mason.lua @@ -0,0 +1,39 @@ +local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities() + +local default_setup = function(server) + require('lspconfig')[server].setup({ + capabilities = lsp_capabilities + }) + +end + +require('mason').setup({}) +require('mason-lspconfig').setup({ + ensure_installed = { + "clangd", + "eslint", + "html", + "lua_ls", + "rust_analyzer", + "tailwindcss", + "tsserver", + "typos_lsp" + + }, + handlers = { + default_setup + } +}) + +local required_formatters = { + "black", + "clang-format", + "luaformatter", + "prettier" +} + +for _, value in pairs(required_formatters) do + if not require("mason-registry").is_installed(value) then + vim.cmd("MasonInstall " .. value) + end +end diff --git a/.config/nvim/after/plugin/nvim-formatter.lua b/.config/nvim/after/plugin/nvim-formatter.lua new file mode 100644 index 0000000..e2261d2 --- /dev/null +++ b/.config/nvim/after/plugin/nvim-formatter.lua @@ -0,0 +1,50 @@ +local formatters = require("formatter.defaults"); +local util = require "formatter.util" + +local lua_format = function() + return { + exe = "lua-format", + stdin = true, + args = { + "--column-table-limit=1" + } + } +end + +require("formatter").setup { + logging = true, + log_level = vim.log.levels.WARN, + filetype = { + lua = lua_format, + rust = require("formatter.filetypes.rust").rustfmt, + cpp = require("formatter.filetypes.cpp").clangformat, + python = require("formatter.filetypes.python").black, + + -- JS Land + javascript = formatters.prettier, + javascriptreact = formatters.prettier, + typescript = formatters.prettier, + typescriptreact = formatters.prettier, + css = formatters.prettier, + scss = formatters.prettier, + less = formatters.prettier, + html = formatters.prettier, + json = formatters.prettier, + yaml = formatters.prettier, + markdown = formatters.prettier, + graphql = formatters.prettier, + vue = formatters.prettier, + svelte = formatters.prettier + + } +} + +local augroup = vim.api.nvim_create_augroup +local autocmd = vim.api.nvim_create_autocmd +augroup("__formatter__", { + clear = true +}) +autocmd("BufWritePost", { + group = "__formatter__", + command = ":FormatWriteLock" +}) diff --git a/.config/nvim/after/plugin/nvim-lint.lua b/.config/nvim/after/plugin/nvim-lint.lua new file mode 100644 index 0000000..f087d32 --- /dev/null +++ b/.config/nvim/after/plugin/nvim-lint.lua @@ -0,0 +1,9 @@ +require("lint").linters_by_ft = {} + +vim.api.nvim_create_autocmd({ + "BufWritePost" +}, { + callback = function() + require("lint").try_lint() + end +}) diff --git a/.config/nvim/after/plugin/rich.lua b/.config/nvim/after/plugin/rich.lua new file mode 100644 index 0000000..cb189bf --- /dev/null +++ b/.config/nvim/after/plugin/rich.lua @@ -0,0 +1,3 @@ +require("presence").setup({ + main_image = "file" +}) diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/after/plugin/treesitter.lua new file mode 100644 index 0000000..dbc8807 --- /dev/null +++ b/.config/nvim/after/plugin/treesitter.lua @@ -0,0 +1,18 @@ +require'nvim-treesitter.configs'.setup { + ensure_installed = {}, + modules = {}, + ignore_install = {}, + + sync_install = false, + + auto_install = true, + + highlight = { + enable = true, + additional_vim_regex_highlighting = false + }, + + autotag = { + enable = true + } +} diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..9da7af5 --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,24 @@ +vim.g.loaded_netrwPlugin = 1 +vim.g.loaded_netrw = 1 + +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) +vim.loader.enable() +vim.g.mapleader = " " + +require("lazy").setup("plugins") -- Load Plugins +require("config.keybinds") -- Load keybinds +require("config.default_settings"); -- Load Settings +require("config.autocmd"); + +vim.cmd.colorscheme "catppuccin" diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..491501a --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,34 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "f3b3d3446bcbfa62d638b1903ff00a78b2b730a1" }, + "bufferline.nvim": { "branch": "main", "commit": "d6cb9b7cac52887bcac65f8698e67479553c0748" }, + "catppuccin": { "branch": "main", "commit": "9703f227bfab20d04bcee62d2f08f1795723b4ae" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "dashboard-nvim": { "branch": "master", "commit": "413442b12d85315fc626c44a0ce4929b213ef604" }, + "formatter.nvim": { "branch": "master", "commit": "cb4778b8432f1ae86dae4634c0b611cb269a4c2f" }, + "friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" }, + "lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" }, + "lsp-zero.nvim": { "branch": "v3.x", "commit": "abac76482ec3012a2b359ba956a74e2ffd33d46f" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "60f6805b12a12e8a912aeb2f975dec1794a8994e" }, + "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, + "neo-tree.nvim": { "branch": "main", "commit": "7d3b02073e59ed9ef271795787de76d0de8f5294" }, + "neoconf.nvim": { "branch": "main", "commit": "4ef6c6c5882e7e16209173fb8c47414202843384" }, + "neodev.nvim": { "branch": "main", "commit": "fdf6b3c58caf3ed1bfe40822d5dac340fc18c33b" }, + "nui.nvim": { "branch": "main", "commit": "c3c7fd618dcb5a89e443a2e1033e7d11fdb0596b" }, + "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, + "nvim-lint": { "branch": "master", "commit": "99f93757276ea55c35bbe74ad2a3d25fc504643b" }, + "nvim-lspconfig": { "branch": "master", "commit": "aa199c5bbdbb7fd28b56212a89206f13db02799e" }, + "nvim-treesitter": { "branch": "master", "commit": "ca46eb3ac96cd96e963895004589f0c9b2a44491" }, + "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" }, + "nvim-web-devicons": { "branch": "master", "commit": "14ac5887110b06b89a96881d534230dac3ed134d" }, + "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, + "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, + "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, + "transparent.nvim": { "branch": "main", "commit": "fd35a46f4b7c1b244249266bdcb2da3814f01724" }, + "ultimate-autopair.nvim": { "branch": "v0.6", "commit": "f4125108b58f2a3a5bb30bcee91927ea88cdfa34" }, + "undotree": { "branch": "master", "commit": "9dbbf3b7d19dda0d22ceca461818e4739ad8154d" }, + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } +} \ No newline at end of file diff --git a/.config/nvim/lua/config/autocmd.lua b/.config/nvim/lua/config/autocmd.lua new file mode 100644 index 0000000..8a75d7b --- /dev/null +++ b/.config/nvim/lua/config/autocmd.lua @@ -0,0 +1,16 @@ +vim.api.nvim_create_augroup("dashboard_open", { + clear = true +}); + +vim.api.nvim_create_autocmd("VimEnter", { + desc = "Open Dashboard", + group = "dashboard_open", + once = true, + callback = function() + if not vim.g.dashboard_opened then + -- vim.cmd "Dashboard" + if vim.fn.argc() > 0 then vim.cmd "Neotree show" end + vim.g.dashboard_opened = true + end + end +}) diff --git a/.config/nvim/lua/config/default_settings.lua b/.config/nvim/lua/config/default_settings.lua new file mode 100644 index 0000000..34ba840 --- /dev/null +++ b/.config/nvim/lua/config/default_settings.lua @@ -0,0 +1,27 @@ +vim.wo.nu = true; +vim.wo.relativenumber = true; + +-- Use system clipboard +vim.opt.clipboard = 'unnamedplus' + +-- persistent undo +vim.opt.undodir = "/tmp/nvim_undo" +vim.opt.undofile = true + +vim.opt.smartindent = true; + +vim.opt.hlsearch = false; +vim.opt.incsearch = true; + +vim.opt.termguicolors = true; + +vim.opt.scrolloff = 8; + +vim.opt.updatetime = 50; + +vim.opt.colorcolumn = "80"; +vim.opt.wrap = false; + +vim.opt.tabstop = 4; +vim.opt.shiftwidth = 4; +vim.opt.expandtab = true; diff --git a/.config/nvim/lua/config/keybinds.lua b/.config/nvim/lua/config/keybinds.lua new file mode 100644 index 0000000..d18f6c6 --- /dev/null +++ b/.config/nvim/lua/config/keybinds.lua @@ -0,0 +1,96 @@ +local wk = require("which-key") + +wk.register({ + f = { + name = "find", -- optional group name + F = { + "Telescope find_files", + "Find File" + }, + f = { + "Telescope git_files", + "Find File" + }, + s = { + "Telescope live_grep", + "Find File" + }, + b = { + "Telescope buffers", + "Find Buffer" + }, + S = { + "Telescope lsp_workspace_symbols", + "Find Workspace Symbol" + + } + }, + ['b'] = { + name = "buffer", + b = { + "bp", + "Buffer Previous" + }, + n = { + "bn", + "Buffer Next" + }, + ["|"] = { + "vsplit", + "Vertical Split" + }, + ['"'] = { + "split", + "Split" + } + + }, + u = { + "UndotreeToggle", + "Undo Tree" + }, + ["/"] = { + function() + require("Comment.api").toggle.linewise.count(vim.v.count > 0 and + vim.v.count or 1) + end, + "Comment Line" + } + +}, { + prefix = "" +}) + +wk.register({ + J = { + ":m '>+1gv=gv", + "Move Block" + }, + K = { + ":m '<-2gv=gv", + "Move Block" + }, + ["/"] = { + "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", + "Comment Block" + + }, + [""] = { + ">gv", + "Tabin" + }, + [""] = { + "/", +-- "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())") + +-- vim.keymap.set("v", "", ">gv") +-- vim.keymap.set("v", "", "e", + "Neotree toggle", + desc = "NeoTree" + } + }, + config = function() + require("neo-tree").setup({ + close_if_last_window = true, + enable_normal_mode_for_inputs = true, + filesystem = { + filtered_items = { + hide_dotfiles = false + } + } + }) + end, + cmd = "Neotree" + }, + { + 'nvim-telescope/telescope.nvim', + tag = '0.1.5', + dependencies = { + 'nvim-lua/plenary.nvim' + } + } +} diff --git a/README.md b/README.md index 47d6b67..13bb9a4 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ -# Dotfiles +# Dot files -Mean to be used with GNU stow, used for managing dotfiles acorss my systems. Or other files I need acorss everything +Mean to be used with GNU stow, used for managing dot files across my systems. +Or other files I need across everything + +## Commands + +This command does not work... +~~ For the sake of my own sanity, I am using the `--dotfiles` option, this allows ~~ +~~ for use to to use the file path `dot-config` instead of `.config`. Because ~~ +~~ having these files hidden inside of a editors/ls does not make sense here. ~~