From 0ab89f02bad92bbd093f1f8a6bcbe27134d1048a Mon Sep 17 00:00:00 2001 From: Andrei Stoica Date: Wed, 24 Jan 2024 14:30:44 -0500 Subject: [PATCH] wip --- .aliases | 1 + .bashrc | 35 ++++++++++++++++++ .nvchad-custom/chadrc.lua | 4 +- .nvchad-custom/configs/lspconfig.lua | 2 +- .nvchad-custom/configs/overrides.lua | 55 ++++++++++++++++++++++++++++ .nvchad-custom/mappings.lua | 11 +++--- .nvchad-custom/plugins.lua | 24 ++++++++++-- .zshrc | 37 +++++++++++++++++++ 8 files changed, 156 insertions(+), 13 deletions(-) diff --git a/.aliases b/.aliases index c343b6e..f8679e7 100644 --- a/.aliases +++ b/.aliases @@ -41,3 +41,4 @@ alias venv='python -m venv' alias venv2='python2 -m venv' alias venv3='python3 -m venv' alias dotvenv='source .venv/bin/activate' +alias todo='rusty-tasks' diff --git a/.bashrc b/.bashrc index 38031c0..1778629 100644 --- a/.bashrc +++ b/.bashrc @@ -156,3 +156,38 @@ fi unset __conda_setup # <<< conda initialize <<< + + +# JINA_CLI_BEGIN + +## autocomplete +_jina() { + COMPREPLY=() + local word="${COMP_WORDS[COMP_CWORD]}" + + if [ "$COMP_CWORD" -eq 1 ]; then + COMPREPLY=( $(compgen -W "$(jina commands)" -- "$word") ) + else + local words=("${COMP_WORDS[@]}") + unset words[0] + unset words[$COMP_CWORD] + local completions=$(jina completions "${words[@]}") + COMPREPLY=( $(compgen -W "$completions" -- "$word") ) + fi +} + +complete -F _jina jina + +# session-wise fix +ulimit -n 4096 +export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES +# default workspace for Executors + +# JINA_CLI_END + + + + + + + diff --git a/.nvchad-custom/chadrc.lua b/.nvchad-custom/chadrc.lua index fe16c67..140e19a 100644 --- a/.nvchad-custom/chadrc.lua +++ b/.nvchad-custom/chadrc.lua @@ -5,8 +5,8 @@ local M = {} local highlights = require "custom.highlights" M.ui = { - theme = "tokyodark", - theme_toggle = { "tokyodark", "one_light" }, + theme = "onedark", + theme_toggle = { "onedark", "one_light" }, hl_override = highlights.override, hl_add = highlights.add, diff --git a/.nvchad-custom/configs/lspconfig.lua b/.nvchad-custom/configs/lspconfig.lua index 3cbf9ab..516dcd2 100644 --- a/.nvchad-custom/configs/lspconfig.lua +++ b/.nvchad-custom/configs/lspconfig.lua @@ -5,7 +5,7 @@ local lspconfig = require("lspconfig") -- if you just want default config for the servers then put them in a table local servers = - { "html", "cssls", "tsserver", "clangd", "docker_compose_language_service", "dockerls", "rust_analyzer", "pyright" } + { "html", "cssls", "tsserver", "clangd", "docker_compose_language_service", "dockerls", "rust_analyzer", "pyright", "grammarly" } for _, lsp in ipairs(servers) do lspconfig[lsp].setup({ diff --git a/.nvchad-custom/configs/overrides.lua b/.nvchad-custom/configs/overrides.lua index c22198d..e17a6cc 100644 --- a/.nvchad-custom/configs/overrides.lua +++ b/.nvchad-custom/configs/overrides.lua @@ -41,6 +41,7 @@ M.mason = { "jedi_language_server", + "docker_compose_language_service", "dockerls", }, @@ -62,4 +63,58 @@ M.nvimtree = { }, } +M.cmp = function (_, opts) + local cmp = require "cmp" + opts.experimental = { + ghost_text = true, + } + opts.sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "nvim_lua" }, + { name = "path" }, + { name = "buffer", keyword_length = 5}, + }) + + opts.mapping = cmp.config.mapping { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Insert, + select = true, + }, + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif require("luasnip").expand_or_jumpable() then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif require("luasnip").jumpable(-1) then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-jump-prev", true, true, true), "") + else + fallback() + end + end, { + "i", + "s", + }), + } + return opts +end + + return M + diff --git a/.nvchad-custom/mappings.lua b/.nvchad-custom/mappings.lua index 4b7f48f..1888f30 100644 --- a/.nvchad-custom/mappings.lua +++ b/.nvchad-custom/mappings.lua @@ -5,11 +5,11 @@ M.general = { n = { -- harpoon ["H"] = {function() require("harpoon.ui").toggle_quick_menu() end, "Open Harpoon" }, - ["a"] = {function() require("harpoon.mark").add_file() end, "Add file to Harpoon"}, - ["s"] = {function() require("harpoon.ui").nav_file(1) end, "Switch to file 1"}, - ["d"] = {function() require("harpoon.ui").nav_file(2) end, "Switch to file 2"}, - ["f"] = {function() require("harpoon.ui").nav_file(3) end, "Switch to file 3"}, - ["g"] = {function() require("harpoon.ui").nav_file(4) end, "Switch to file 4"}, + ["ha"] = {function() require("harpoon.mark").add_file() end, "Add file to Harpoon"}, + ["hs"] = {function() require("harpoon.ui").nav_file(1) end, "Switch to file 1"}, + ["hd"] = {function() require("harpoon.ui").nav_file(2) end, "Switch to file 2"}, + ["hf"] = {function() require("harpoon.ui").nav_file(3) end, "Switch to file 3"}, + ["hg"] = {function() require("harpoon.ui").nav_file(4) end, "Switch to file 4"}, -- navigation [""] = {"zz", "1/2 page down"}, @@ -17,7 +17,6 @@ M.general = { ["n"] = {"nzz", "find next"}, ["N"] = {"Nzz", "find prev"}, - }, } diff --git a/.nvchad-custom/plugins.lua b/.nvchad-custom/plugins.lua index cde8ca6..c42461a 100644 --- a/.nvchad-custom/plugins.lua +++ b/.nvchad-custom/plugins.lua @@ -1,10 +1,16 @@ local overrides = require "custom.configs.overrides" + ---@type NvPluginSpec[] local plugins = { -- Override plugin definition options + { + "hrsh7th/nvim-cmp", + opts = overrides.cmp + }, + { "neovim/nvim-lspconfig", dependencies = { @@ -54,13 +60,24 @@ local plugins = { end, }, + { "nvim-treesitter/nvim-treesitter-context", + lazy = false, + }, + { "theprimeagen/harpoon", }, - { - 'simrat39/rust-tools.nvim' - }, + { + 'simrat39/rust-tools.nvim' + }, + + { + "ellisonleao/glow.nvim", + config = true, + cmd = "Glow", + event = 'BufEnter *.md', + }, -- Disable nvchad plugins @@ -69,7 +86,6 @@ local plugins = { lazy = false, }, - { "NvChad/nvterm", enabled = false }, -- To make a plugin not be loaded diff --git a/.zshrc b/.zshrc index ff792c2..a617b44 100644 --- a/.zshrc +++ b/.zshrc @@ -119,3 +119,40 @@ function work() { } + + +# JINA_CLI_BEGIN + +## autocomplete +if [[ ! -o interactive ]]; then + return +fi + +compctl -K _jina jina + +_jina() { + local words completions + read -cA words + + if [ "${#words}" -eq 2 ]; then + completions="$(jina commands)" + else + completions="$(jina completions ${words[2,-2]})" + fi + + reply=(${(ps: +:)completions}) +} + +# session-wise fix +ulimit -n 4096 +export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES + +# JINA_CLI_END + + + + + + +