diff options
author | Toby Vincent <tobyv13@gmail.com> | 2022-03-04 18:18:22 -0600 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2022-03-04 18:18:22 -0600 |
commit | 0d3b11c231b5d8536fdc8fbddf167956ec999cc6 (patch) | |
tree | 62ddbcfe49228773a5b7425db81a12947dc09450 /nvim/lua | |
parent | 6a36592700b75e3658584db672f09ee33b2ba840 (diff) |
feat: more tmux/neovim/alacritty
Diffstat (limited to 'nvim/lua')
-rw-r--r-- | nvim/lua/theprimeagen/debugger.lua | 19 | ||||
-rw-r--r-- | nvim/lua/theprimeagen/git-worktree.lua | 29 | ||||
-rw-r--r-- | nvim/lua/theprimeagen/harpoon.lua | 13 | ||||
-rw-r--r-- | nvim/lua/theprimeagen/init.lua | 19 | ||||
-rw-r--r-- | nvim/lua/theprimeagen/lsp.lua | 191 | ||||
-rw-r--r-- | nvim/lua/theprimeagen/telescope.lua | 222 |
6 files changed, 0 insertions, 493 deletions
diff --git a/nvim/lua/theprimeagen/debugger.lua b/nvim/lua/theprimeagen/debugger.lua deleted file mode 100644 index c935273..0000000 --- a/nvim/lua/theprimeagen/debugger.lua +++ /dev/null @@ -1,19 +0,0 @@ -local dap_install = require("dap-install") -dap_install.config("chrome", {}) - - -local dap = require("dap"); -dap.configurations.typescriptreact = { -- change to typescript if needed - { - type = "chrome", - request = "attach", - program = "${file}", - cwd = vim.fn.getcwd(), - sourceMaps = true, - protocol = "inspector", - port = 9222, - webRoot = "${workspaceFolder}" - } -} - -require('dap.ext.vscode').load_launchjs() diff --git a/nvim/lua/theprimeagen/git-worktree.lua b/nvim/lua/theprimeagen/git-worktree.lua deleted file mode 100644 index 7c3bce9..0000000 --- a/nvim/lua/theprimeagen/git-worktree.lua +++ /dev/null @@ -1,29 +0,0 @@ -local Worktree = require("git-worktree") - -local function is_nrdp(path) - local found = path:find(vim.env["NRDP"]) - return type(found) == "number" and found > 0 -end - -local function is_tvui(path) - local found = path:find(vim.env["TVUI"]) - return type(found) == "number" and found > 0 -end - -local M = {} -function M.execute(path, just_build) - if is_nrdp(path) then - local command = string.format(":silent !tmux-nrdp tmux %s %s", path, just_build) - vim.cmd(command) - elseif is_tvui(path) then - print("EXECUTE ", path) - local command = string.format(":!tmux-tvui %s", path) - vim.cmd(command) - end -end - -Worktree.on_tree_change(function(_ --[[op]], path, _ --[[upstream]]) - M.execute(path.path) -end) - -return M diff --git a/nvim/lua/theprimeagen/harpoon.lua b/nvim/lua/theprimeagen/harpoon.lua deleted file mode 100644 index 4f1543e..0000000 --- a/nvim/lua/theprimeagen/harpoon.lua +++ /dev/null @@ -1,13 +0,0 @@ -require("harpoon").setup({ - nav_first_in_list = true, - projects = { - ["/home/theprimeagen/work/nrdp/backport-2"] = { - term = { - cmds = { - "ninja -C /home/theprimeagen/work/nrdp/builds/backport-2 -j 25 && cp compile_commands.json /home/theprimeagen/work/nrdp/backport-2\n", - } - } - } - } -}) - diff --git a/nvim/lua/theprimeagen/init.lua b/nvim/lua/theprimeagen/init.lua deleted file mode 100644 index 5db4e28..0000000 --- a/nvim/lua/theprimeagen/init.lua +++ /dev/null @@ -1,19 +0,0 @@ -require("theprimeagen.telescope") -require("theprimeagen.git-worktree") -require("theprimeagen.debugger") -require("theprimeagen.harpoon") -require("theprimeagen.lsp") - -P = function(v) - print(vim.inspect(v)) - return v -end - -if pcall(require, "plenary") then - RELOAD = require("plenary.reload").reload_module - - R = function(name) - RELOAD(name) - return require(name) - end -end diff --git a/nvim/lua/theprimeagen/lsp.lua b/nvim/lua/theprimeagen/lsp.lua deleted file mode 100644 index 3911c72..0000000 --- a/nvim/lua/theprimeagen/lsp.lua +++ /dev/null @@ -1,191 +0,0 @@ -local sumneko_root_path = "/home/mpaulson/personal/lua-language-server" -local sumneko_binary = sumneko_root_path .. "/bin/lua-language-server" - -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.completion.completionItem.snippetSupport = true - --- Setup nvim-cmp. -local cmp = require("cmp") -local source_mapping = { - buffer = "[Buffer]", - nvim_lsp = "[LSP]", - nvim_lua = "[Lua]", - path = "[Path]" -} -local lspkind = require("lspkind") -require("lspkind").init({ - mode = 'Text' -}) - -cmp.setup({ - snippet = { - expand = function(args) - -- For `vsnip` user. - -- vim.fn["vsnip#anonymous"](args.body) - - -- For `luasnip` user. - require("luasnip").lsp_expand(args.body) - - -- For `ultisnips` user. - -- vim.fn["UltiSnips#Anon"](args.body) - end - }, - mapping = { - ["<C-u>"] = cmp.mapping.scroll_docs(-4), - ["<C-d>"] = cmp.mapping.scroll_docs(4), - ["<C-Space>"] = cmp.mapping.complete() - }, - - formatting = { - format = function(entry, vim_item) - vim_item.kind = lspkind.presets.default[vim_item.kind] - local menu = source_mapping[entry.source.name] - vim_item.menu = menu - return vim_item - end - }, - - sources = {{ - name = "nvim_lsp" - }, -- For vsnip user. - -- { name = 'vsnip' }, - -- For luasnip user. - { - name = "luasnip" - }, -- For ultisnips user. - -- { name = 'ultisnips' }, - { - name = "buffer" - }} -}) - -local function config(_config) - return vim.tbl_deep_extend("force", { - capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) - }, _config or {}) -end - -require("lspconfig").tsserver.setup(config()) - ---[[ I cannot seem to get this woring on new computer.. -require("lspconfig").clangd.setup(config({ - cmd = { "clangd", "--background-index", "--log=verbose" }, - root_dir = function() - print("clangd-Rootdir", vim.loop.cwd()) - return vim.loop.cwd() - end, -})) ---]] -require("lspconfig").ccls.setup(config()) - -require("lspconfig").jedi_language_server.setup(config()) - -require("lspconfig").svelte.setup(config()) - -require("lspconfig").solang.setup(config()) - -require("lspconfig").cssls.setup(config()) - -require("lspconfig").gopls.setup(config({ - cmd = {"gopls", "serve"}, - settings = { - gopls = { - analyses = { - unusedparams = true - }, - staticcheck = true - } - } -})) - -require('rust-tools').setup(config({ - tools = { - autoSetHints = true, - hover_with_actions = true, - runnables = { - use_telescope = true - }, - inlay_hints = { - show_parameter_hints = false, - parameter_hints_prefix = "", - other_hints_prefix = "" - } - }, - - -- all the opts to send to nvim-lspconfig - -- these override the defaults set by rust-tools.nvim - -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer - server = { - -- on_attach is a callback called when the language server attachs to the buffer - -- on_attach = on_attach, - settings = { - -- to enable rust-analyzer settings visit: - -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc - ["rust-analyzer"] = { - -- enable clippy on save - checkOnSave = { - command = "clippy" - } - } - } - } -})) - -require("lspconfig").sumneko_lua.setup(config({ - cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}, - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = "LuaJIT", - -- Setup your lua path - path = vim.split(package.path, ";") - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = {"vim"} - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = { - [vim.fn.expand("$VIMRUNTIME/lua")] = true, - [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true - } - } - } - } -})) - -local opts = { - -- whether to highlight the currently hovered symbol - -- disable if your cpu usage is higher than you want it - -- or you just hate the highlight - -- default: true - highlight_hovered_item = true, - - -- whether to show outline guides - -- default: true - show_guides = true -} - -require("symbols-outline").setup(opts) - -local snippets_paths = function() - local plugins = {"friendly-snippets"} - local paths = {} - local path - local root_path = vim.env.HOME .. "/.vim/plugged/" - for _, plug in ipairs(plugins) do - path = root_path .. plug - if vim.fn.isdirectory(path) ~= 0 then - table.insert(paths, path) - end - end - return paths -end - -require("luasnip.loaders.from_vscode").lazy_load({ - paths = snippets_paths(), - include = nil, -- Load all languages - exclude = {} -}) diff --git a/nvim/lua/theprimeagen/telescope.lua b/nvim/lua/theprimeagen/telescope.lua deleted file mode 100644 index 2be6bbb..0000000 --- a/nvim/lua/theprimeagen/telescope.lua +++ /dev/null @@ -1,222 +0,0 @@ -local pickers = require("telescope.pickers") -local finders = require("telescope.finders") -local previewers = require("telescope.previewers") -local action_state = require("telescope.actions.state") -local conf = require("telescope.config").values -local actions = require("telescope.actions") - -require("telescope").setup({ - defaults = { - file_sorter = require("telescope.sorters").get_fzy_sorter, - prompt_prefix = " >", - color_devicons = true, - - file_previewer = require("telescope.previewers").vim_buffer_cat.new, - grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, - qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, - - mappings = { - i = { - ["<C-x>"] = false, - ["<C-q>"] = actions.send_to_qflist, - }, - }, - }, - extensions = { - fzy_native = { - override_generic_sorter = false, - override_file_sorter = true, - }, - }, -}) - -require("telescope").load_extension("git_worktree") -require("telescope").load_extension("fzy_native") - -local M = {} - -function M.reload_modules() - -- Because TJ gave it to me. Makes me happpy. Put it next to his other - -- awesome things. - local lua_dirs = vim.fn.glob("./lua/*", 0, 1) - for _, dir in ipairs(lua_dirs) do - dir = string.gsub(dir, "./lua/", "") - require("plenary.reload").reload_module(dir) - end -end - -M.search_dotfiles = function() - require("telescope.builtin").find_files({ - prompt_title = "< VimRC >", - cwd = vim.env.DOTFILES, - hidden = true, - }) -end - -local function set_background(content) - vim.fn.system("dconf write /org/mate/desktop/background/picture-filename \"'" .. content .. "'\"") -end - -local function select_background(prompt_bufnr, map) - local function set_the_background(close) - local content = require("telescope.actions.state").get_selected_entry(prompt_bufnr) - set_background(content.cwd .. "/" .. content.value) - if close then - require("telescope.actions").close(prompt_bufnr) - end - end - - map("i", "<C-p>", function() - set_the_background() - end) - - map("i", "<CR>", function() - set_the_background(true) - end) -end - -local function image_selector(prompt, cwd) - return function() - require("telescope.builtin").find_files({ - prompt_title = prompt, - cwd = cwd, - - attach_mappings = function(prompt_bufnr, map) - select_background(prompt_bufnr, map) - - -- Please continue mapping (attaching additional key maps): - -- Ctrl+n/p to move up and down the list. - return true - end, - }) - end -end - -M.anime_selector = image_selector("< Anime Bobs > ", "~/personal/anime") - -local function refactor(prompt_bufnr) - local content = require("telescope.actions.state").get_selected_entry(prompt_bufnr) - require("telescope.actions").close(prompt_bufnr) - require("refactoring").refactor(content.value) -end - -M.refactors = function() - require("telescope.pickers").new({}, { - prompt_title = "refactors", - finder = require("telescope.finders").new_table({ - results = require("refactoring").get_refactors(), - }), - sorter = require("telescope.config").values.generic_sorter({}), - attach_mappings = function(_, map) - map("i", "<CR>", refactor) - map("n", "<CR>", refactor) - return true - end, - }):find() -end - -M.git_branches = function() - require("telescope.builtin").git_branches({ - attach_mappings = function(_, map) - map("i", "<c-d>", actions.git_delete_branch) - map("n", "<c-d>", actions.git_delete_branch) - return true - end, - }) -end - -M.dev = function(opts) - opts = opts or {} - - opts.cwd = opts.cwd or vim.loop.fs_realpath(vim.loop.cwd()) - print("HEY BAE", opts.cwd) - - local possible_files = vim.api.nvim_get_runtime_file("/lua/**/dev.lua", true) - local local_files = {} - for _, raw_f in ipairs(possible_files) do - local real_f = vim.loop.fs_realpath(raw_f) - - if string.find(real_f, opts.cwd, 1, true) then - table.insert(local_files, real_f) - end - end - - local dev = local_files[1] - local loaded = loadfile(dev) - local ok, mod = pcall(loaded) - if not ok then - print("===================================================") - print("HEY PRIME. YOUR CODE DOESNT WORK. THIS IS NOT ON ME") - print("===================================================") - return - end - - -- P(mod) - local objs = {} - for k, v in pairs(mod) do - local debug_info = debug.getinfo(v) - table.insert(objs, { - filename = string.sub(debug_info.source, 2), - text = k, - }) - end - - local mod_name = vim.split(dev, "/lua/") - if #mod_name ~= 2 then - print("===================================================") - print("HEY PRIME. I DO NOT KNOW HOW TO FIND THIS FILE:") - print(dev) - print("===================================================") - end - mod_name = string.gsub(mod_name[2], ".lua$", "") - mod_name = string.gsub(mod_name, "/", ".") - - pickers.new({ - finder = finders.new_table({ - results = objs, - entry_maker = function(entry) - return { - value = entry, - text = entry.text, - display = entry.text, - ordinal = entry.text, - filename = entry.filename, - } - end, - }), - sorter = conf.generic_sorter(opts), - previewer = previewers.builtin.new(opts), - attach_mappings = function(_, map) - actions.select_default:replace(function(...) - -- print("SELECTED", vim.inspect(action_state.get_selected_entry())) - local entry = action_state.get_selected_entry() - actions.close(...) - - mod[entry.value.text]() - end) - - map("i", "<tab>", function(...) - local entry = action_state.get_selected_entry() - actions.close(...) - - vim.schedule(function() - -- vim.cmd(string.format([[normal!]], entry.value.text)) - vim.api.nvim_feedkeys( - vim.api.nvim_replace_termcodes( - string.format("<esc>:lua require('%s').%s()", mod_name, entry.value.text), - true, - false, - true - ), - "n", - true - ) - end) - end) - - return true - end, - }):find() -end - -return M |