diff --git a/configs/.p10k.zsh b/configs/.p10k.zsh index 2d944d7..47c204b 100644 --- a/configs/.p10k.zsh +++ b/configs/.p10k.zsh @@ -38,6 +38,7 @@ autoload -Uz is-at-least && is-at-least 5.1 || return # Prompt colors. + local main='242' local grey='242' local red='1' local yellow='3' @@ -76,7 +77,7 @@ typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=false # Magenta prompt symbol if the last command succeeded. - typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$grey + typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$main # Red prompt symbol if the last command failed. typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red # Default prompt symbol. diff --git a/configs/init.lua b/configs/init.lua new file mode 100644 index 0000000..e69de29 diff --git a/configs/nvim/init.lua b/configs/nvim/init.lua index 0ce4072..632d7c8 100644 --- a/configs/nvim/init.lua +++ b/configs/nvim/init.lua @@ -10,8 +10,6 @@ local opt = vim.opt require("plugins") if u.has_plugin("cmp") then - vim.g.did_load_filetypes = 150 - -- Global options o.number = true -- show line number o.showmatch = true -- show matching brackets @@ -28,6 +26,7 @@ if u.has_plugin("cmp") then g.hidden = true -- unload buffers when hidden g.filetype = true -- execute autocommands based on filetype o.autoread = true + opt.termguicolors = true -- Search o.inccommand = "nosplit" -- show substitutions incrementally @@ -68,6 +67,31 @@ if u.has_plugin("cmp") then g.ale_fixers = {"prettier", "eslint"} + vim.notify = require("notify") + + require("notify").setup( + { + stages = "fade_in_slide_out", + render = "minimal", + background_colour = "#000000", + icons = { + ERROR = "", + WARN = "", + INFO = "", + DEBUG = "", + TRACE = "✎" + } + } + ) + + require("telescope").setup { + pickers = { + find_files = { + hidden = true + } + } + } + -- Enable Theming / Syntax o.syntax = "enable" o.termguicolors = true @@ -82,10 +106,12 @@ if u.has_plugin("cmp") then } ) - require("transparent").setup({ - enable = true, - extra_groups = "All" - }) + require("transparent").setup( + { + enable = true, + extra_groups = "All" + } + ) -- Remove background color cmd("highlight Normal guibg=none") @@ -169,6 +195,8 @@ if u.has_plugin("cmp") then -- KeyBindings require "keymappings" + require "overlays" + require "nvim-tmux-navigation".setup { keybindings = { left = "", diff --git a/configs/nvim/lua/autocommands.lua b/configs/nvim/lua/autocommands.lua index 57ac743..fc75171 100644 --- a/configs/nvim/lua/autocommands.lua +++ b/configs/nvim/lua/autocommands.lua @@ -1,4 +1,4 @@ -local cmd = vim.cmd; +local cmd = vim.cmd cmd [[ augroup highlight_yank @@ -6,3 +6,8 @@ cmd [[ au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 150 } augroup END ]] + +cmd [[ + au ColorScheme * hi Normal ctermbg=none guibg=none + au ColorScheme myspecialcolors hi Normal ctermbg=red guibg=red +]] diff --git a/configs/nvim/lua/cmp-conf.lua b/configs/nvim/lua/cmp-conf.lua index 16f9888..aad3da2 100644 --- a/configs/nvim/lua/cmp-conf.lua +++ b/configs/nvim/lua/cmp-conf.lua @@ -1,84 +1,99 @@ -- luasnip setup -local cmd = vim.cmd; +local cmd = vim.cmd local luasnip = require "luasnip" local lspkind = require "lspkind" local cmp = require "cmp" -local cmp_autopairs = require('nvim-autopairs.completion.cmp') +local cmp_autopairs = require("nvim-autopairs.completion.cmp") cmp.setup { - formatting = { - format = lspkind.cmp_format({with_text = true, menu = ({ - buffer = "[Buffer]", - nvim_lsp = "[LSP]", - luasnip = "[LuaSnip]", - nvim_lua = "[Lua]", - latex_symbols = "[Latex]", - })}), - }, - experimental = { - ghost_text = true, - }, - completion = { - completeopt = "menu,menuone", - }, - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end - }, - mapping = { - [''] = cmp.mapping.complete(), - [""] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, - [""] = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, - [''] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }), - }, - sources = { - {name = "nvim-lua"}, - {name = "nvim_lsp"}, - {name = "luasnip"}, - {name = "path"}, - {name = "buffer"}, - {name = "calc"} - } + formatting = { + format = lspkind.cmp_format( + { + with_text = true, + menu = ({ + buffer = "[Buffer]", + nvim_lsp = "[LSP]", + luasnip = "[LuaSnip]", + nvim_lua = "[Lua]", + latex_symbols = "[Latex]" + }) + } + ) + }, + experimental = { + ghost_text = true + }, + completion = { + completeopt = "menu,menuone" + }, + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end + }, + mapping = { + [""] = cmp.mapping.complete(), + [""] = function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, + [""] = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, + [""] = cmp.mapping.confirm( + { + behavior = cmp.ConfirmBehavior.Replace, + select = true + } + ) + }, + sources = { + {name = "nvim_lua"}, + {name = "nvim_lsp"}, + {name = "luasnip"}, + {name = "path"}, + {name = "buffer"}, + {name = "calc"} + } } -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline('/', { - sources = { - { name = 'buffer' } - } -}) +cmp.setup.cmdline( + "/", + { + sources = { + {name = "buffer"} + } + } +) -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline(':', { - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } - }) -}) - +cmp.setup.cmdline( + ":", + { + sources = cmp.config.sources( + { + {name = "path"} + }, + { + {name = "cmdline"} + } + ) + } +) -- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers.. -- Setup lspconfig. -local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) -require'lspconfig'.html.setup { - capabilities = capabilities +local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) +require "lspconfig".html.setup { + capabilities = capabilities } -cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } })) +cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({map_char = {tex = ""}})) diff --git a/configs/nvim/lua/formatter-conf.lua b/configs/nvim/lua/formatter-conf.lua index dc597ea..047d669 100644 --- a/configs/nvim/lua/formatter-conf.lua +++ b/configs/nvim/lua/formatter-conf.lua @@ -1,8 +1,59 @@ local cmd = vim.cmd +local util = require "vim.lsp.util" +local utils = require("utils") + +function tablelength(T) + local count = 0 + for _ in pairs(T) do + count = count + 1 + end + return count +end + +local function select_client(method) + local all_clients = vim.tbl_values(vim.lsp.buf_get_clients()) + + local supported_client + local found_client = false + for _, client in ipairs(all_clients) do + local supports = client.supports_method(method) + if supports then + found_client = true + supported_client = client + end + end + + if not found_client then + return nil + end + + return supported_client +end + +function FormattingSync() + vim.cmd("Neoformat") + + -- local client = select_client("textDocument/formatting") + -- if client == nil then + -- vim.notify("No LSP Client with formatting connected") + -- end + + -- vim.notify("Formatting with LSP") + + -- local params = util.make_formatting_params({}) + -- local result, err = client.request_sync("textDocument/formatting", params, 500, vim.api.nvim_get_current_buf()) + -- if result and result.result then + -- util.apply_text_edits(result.result) + -- elseif err then + -- vim.notify("vim.lsp.buf.formatting_sync: " .. err, vim.log.levels.WARN) + -- end +end + +vim.cmd [[command! Format lua FormattingSync()]] cmd [[ augroup auto_format au! - au BufWritePre * Neoformat + au BufWritePre * lua FormattingSync() augroup END ]] diff --git a/configs/nvim/lua/keymappings.lua b/configs/nvim/lua/keymappings.lua index f5504ca..207a9d6 100644 --- a/configs/nvim/lua/keymappings.lua +++ b/configs/nvim/lua/keymappings.lua @@ -1,6 +1,6 @@ local map = vim.api.nvim_set_keymap local g = vim.g -local cmd = vim.cmd; +local cmd = vim.cmd local options = {noremap = true} local remap = {noremap = false} @@ -19,7 +19,7 @@ map("n", "K", "lua vim.lsp.buf.hover()", options) map("n", "e", "lua vim.diagnostic.open_float()", options) map("n", "rn", "lua vim.lsp.buf.rename()", options) map("n", "c", "lua vim.lsp.buf.code_action()", options) -map("n", "", ":Format", options) +map("n", "", ":Neoformat", options) map("n", "[d", "lua vim.lsp.diagnostic.goto_prev()", options) map("n", "]d", "lua vim.lsp.diagnostic.goto_next()", options) map("n", "t", ":TroubleToggle", remap) @@ -31,8 +31,8 @@ map("n", "", "k", options) map("n", "", "l", options) map("n", "Y", "yy", options) -map("n", "k", "{",options) -map("n", "j", "}",options) +map("n", "k", "{", options) +map("n", "j", "}", options) -- Move lines vscode style map("n", "", "move +1", options) @@ -41,8 +41,8 @@ map("i", "", "move +1", options) map("i", "", "move -2", options) map("v", "", ":m '>+1gv=gv", options) map("v", "", ":m '<-2gv=gv", options) -map("n", "", "YP", options); -map("n", "", "Yp", options); +map("n", "", "YP", options) +map("n", "", "Yp", options) -- Faster git merge map("n", "gd", ":Gvdiffsplit!", options) diff --git a/configs/nvim/lua/lsp-conf.lua b/configs/nvim/lua/lsp-conf.lua index 56a8db0..8236864 100644 --- a/configs/nvim/lua/lsp-conf.lua +++ b/configs/nvim/lua/lsp-conf.lua @@ -13,7 +13,6 @@ end -- function to attach completion when setting up lsp local function on_attach() vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") - vim.cmd("command! LspOrganize lua lsp_organize_imports()") vim.api.nvim_buf_map(bufnr, "n", "gs", ":LspOrganize", {silent = true}) end @@ -21,13 +20,13 @@ end local system_name = "" -- Lua Language Server if vim.fn.has("mac") == 1 then - system_name = "macOS" + system_name = "macOS" elseif vim.fn.has("unix") == 1 then - system_name = "Linux" + system_name = "Linux" elseif vim.fn.has("win32") == 1 then - system_name = "Windows" + system_name = "Windows" else - print("Unsupported system for sumneko") + print("Unsupported system for sumneko") end local sumneko_root_path = "/home/jim/.local/share/lua-language-server" @@ -38,31 +37,31 @@ table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?/init.lua") lsp.sumneko_lua.setup { - on_attach = on_attach, - capabilities = lsp_status.capabilities, - 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 = runtime_path - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = {"vim", "bufnr", "use"} - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true) - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false - } - } - } + on_attach = on_attach, + capabilities = lsp_status.capabilities, + 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 = runtime_path + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = {"vim", "bufnr", "use"} + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true) + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false + } + } + } } -- Ltex Language Server @@ -70,120 +69,126 @@ lsp.ltex.setup {} -- Go Language Server lsp.gopls.setup { - on_attach = on_attach, - capabilities = lsp_status.capabilities + on_attach = on_attach, + capabilities = lsp_status.capabilities } -- Html Setup lsp.html.setup { - on_attach = on_attach, - capabilities = lsp_status.capabilities, - filetypes = {"html"} + on_attach = on_attach, + capabilities = lsp_status.capabilities, + filetypes = {"html"} } -- Svelte Language Server lsp.svelte.setup { - on_attach = on_attach, - capabilities = lsp_status.capabilities + on_attach = on_attach, + capabilities = lsp_status.capabilities } -- Typescript Language Server lsp.tsserver.setup { - on_attach = on_attach, - capabilities = lsp_status.capabilities, + on_attach = on_attach, + capabilities = lsp_status.capabilities, + commands = { + OrganizeImports = { + organize_imports, + description = "Organize Imports" + } + } } -- JSON ls setup lsp.jsonls.setup { - on_attach = on_attach, - capabilities = lsp_status.capabilities + on_attach = on_attach, + capabilities = lsp_status.capabilities } -- Setup diagnostics formaters and linters for non LSP provided files lsp.diagnosticls.setup { - on_attach = on_attach, - capabilities = lsp_status.capabilities, - cmd = {"diagnostic-languageserver", "--stdio"}, - filetypes = { - "sh", - "markdown", - "yaml", - "toml" - }, - init_options = { - linters = { - shellcheck = { - command = "shellcheck", - debounce = 100, - args = {"--format", "json", "-"}, - sourceName = "shellcheck", - parseJson = { - line = "line", - column = "column", - endLine = "endLine", - endColumn = "endColumn", - message = "${message} [${code}]", - security = "level" - }, - securities = { - error = "error", - warning = "warning", - info = "info", - style = "hint" - } - }, - markdownlint = { - command = "markdownlint", - isStderr = true, - debounce = 100, - args = {"--stdin"}, - offsetLine = 0, - offsetColumn = 0, - sourceName = "markdownlint", - formatLines = 1, - formatPattern = { - "^.*?:\\s?(\\d+)(:(\\d+)?)?\\s(MD\\d{3}\\/[A-Za-z0-9-/]+)\\s(.*)$", - { - line = 1, - column = 3, - message = {4} - } - } - } - }, - filetypes = { - sh = "shellcheck", - markdown = "markdownlint" - }, - formatters = { - shfmt = { - command = "shfmt", - args = {"-i", "2", "-bn", "-ci", "-sr"} - }, - prettier = { - command = "prettier", - args = {"--stdin-filepath", "%filepath"} - } - }, - formatFiletypes = { - sh = "shfmt", - json = "prettier", - yaml = "prettier", - toml = "prettier", - markdown = "prettier", - lua = "prettier" - } - } + on_attach = on_attach, + capabilities = lsp_status.capabilities, + cmd = {"diagnostic-languageserver", "--stdio"}, + filetypes = { + "sh", + "markdown", + "yaml", + "toml" + }, + init_options = { + linters = { + shellcheck = { + command = "shellcheck", + debounce = 100, + args = {"--format", "json", "-"}, + sourceName = "shellcheck", + parseJson = { + line = "line", + column = "column", + endLine = "endLine", + endColumn = "endColumn", + message = "${message} [${code}]", + security = "level" + }, + securities = { + error = "error", + warning = "warning", + info = "info", + style = "hint" + } + }, + markdownlint = { + command = "markdownlint", + isStderr = true, + debounce = 100, + args = {"--stdin"}, + offsetLine = 0, + offsetColumn = 0, + sourceName = "markdownlint", + formatLines = 1, + formatPattern = { + "^.*?:\\s?(\\d+)(:(\\d+)?)?\\s(MD\\d{3}\\/[A-Za-z0-9-/]+)\\s(.*)$", + { + line = 1, + column = 3, + message = {4} + } + } + } + }, + filetypes = { + sh = "shellcheck", + markdown = "markdownlint" + }, + formatters = { + shfmt = { + command = "shfmt", + args = {"-i", "2", "-bn", "-ci", "-sr"} + }, + prettier = { + command = "prettier", + args = {"--stdin-filepath", "%filepath"} + } + }, + formatFiletypes = { + sh = "shfmt", + json = "prettier", + yaml = "prettier", + toml = "prettier", + markdown = "prettier", + lua = "prettier" + } + } } -- Enable diagnostics vim.lsp.handlers["textDocument/publishDiagnostics"] = - vim.lsp.with( - vim.lsp.diagnostic.on_publish_diagnostics, - { - underline = true, - virtual_text = false, - signs = true, - update_in_insert = true - } + vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, + { + underline = true, + virtual_text = false, + signs = true, + update_in_insert = true + } ) diff --git a/configs/nvim/lua/overlays.lua b/configs/nvim/lua/overlays.lua index 096a5ee..f2d0ff9 100644 --- a/configs/nvim/lua/overlays.lua +++ b/configs/nvim/lua/overlays.lua @@ -1,68 +1,82 @@ local Terminal = require("toggleterm.terminal").Terminal local u = require("utils") local lazygit = - Terminal:new( - { - cmd = "lazygit", - dir = "git_dir", - direction = "float", - float_opts = { - winblend = 0, - border = "shadow" - }, - on_open = function(term) - vim.cmd("startinsert!") - vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "close", {noremap = true, silent = true}) - end, - on_close = function(term) - Terminal:close() - end - } + Terminal:new( + { + cmd = "lazygit", + dir = "git_dir", + direction = "float", + float_opts = { + winblend = 0, + border = "shadow" + }, + on_open = function(term) + vim.cmd("startinsert!") + vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "close", {noremap = true, silent = true}) + end, + on_close = function(term) + Terminal:close() + end + } ) function _lazygit_toggle() - lazygit:toggle() + lazygit:toggle() end vim.api.nvim_set_keymap("n", "", "lua _lazygit_toggle()", {noremap = true, silent = true}) local pnpm = - Terminal:new( - { - cmd = "pnpm dev", - dir = "git_dir", - size = 5, - direction = "vertical", - on_close = function(term) - Terminal:close() - end - } + Terminal:new( + { + cmd = "pnpm dev", + dir = "git_dir", + size = 5, + direction = "vertical", + on_close = function(term) + Terminal:close() + end + } ) function _pnpm_toggle() - pnpm:toggle() + pnpm:toggle() end vim.api.nvim_set_keymap("n", "d", "lua _pnpm_toggle()", {noremap = true, silent = true}) local nvimConfig = - Terminal:new( - { - cmd = "cd $HOME/.dotfiles && nvim configs/init.lua && cd -", - direction = "float", - on_close = function() - Terminal:close() - u.ReloadConfig() - end - } + Terminal:new( + { + cmd = "cd $HOME/.dotfiles && nvim configs/init.lua && cd -", + direction = "float", + on_close = function() + Terminal:close() + u.ReloadConfig() + end + } ) function _nvimConfig_toggle() - nvimConfig:toggle() + nvimConfig:toggle() end vim.api.nvim_set_keymap("n", "", "lua _nvimConfig_toggle()", {noremap = true, silent = true}) +local chtConfig = + Terminal:new( + { + cmd = "cht", + direction = "float" + } +) + +function _chtConfig_toggle() + chtConfig:toggle() +end + +vim.api.nvim_set_keymap("n", "", "lua _chtConfig_toggle()", {noremap = true, silent = true}) + require("toggleterm").setup { - shade_terminals = true + shade_terminals = true } diff --git a/configs/nvim/lua/plugins.lua b/configs/nvim/lua/plugins.lua index 488979d..b907fbe 100644 --- a/configs/nvim/lua/plugins.lua +++ b/configs/nvim/lua/plugins.lua @@ -1,96 +1,89 @@ -return require("packer").startup(function() +return require("packer").startup( + function() + -- Let packer manage itself + use "wbthomason/packer.nvim" - -- Let packer manage itself - use "wbthomason/packer.nvim" + -- General Helper Functions + use "nvim-lua/plenary.nvim" - -- General Helper Functions - use "nvim-lua/plenary.nvim" + -- Faster Filetype Detection + use "nathom/filetype.nvim" + use "alexghergh/nvim-tmux-navigation" - -- Faster Filetype Detection - use "nathom/filetype.nvim" - use "alexghergh/nvim-tmux-navigation" + -- Theming Section + -- use 'folke/tokyonight.nvim' + use "EdenEast/nightfox.nvim" + use "xiyaowong/nvim-transparent" - use 'lervag/vimtex' + -- Layout Plugins + use "kyazdani42/nvim-web-devicons" + use "kyazdani42/nvim-tree.lua" + use "nvim-lua/popup.nvim" + use "mhinz/vim-startify" + use "tpope/vim-fugitive" + use "tpope/vim-commentary" + use "tpope/vim-surround" + use "lambdalisue/suda.vim" + use "windwp/nvim-autopairs" - -- Theming Section - -- use 'folke/tokyonight.nvim' - use 'EdenEast/nightfox.nvim' - use "xiyaowong/nvim-transparent" + -- Code Navigation + use "dense-analysis/ale" + use "nathanmsmith/nvim-ale-diagnostic" + use "junegunn/fzf" + use "nvim-telescope/telescope.nvim" - -- Layout Plugins - use "kyazdani42/nvim-web-devicons" - use "kyazdani42/nvim-tree.lua" - use "nvim-lua/popup.nvim" - use "mhinz/vim-startify" - use "karb94/neoscroll.nvim" + -- Postman like features + use "NTBBloodbath/rest.nvim" - use "tpope/vim-fugitive" - use "tpope/vim-surround" - use "lambdalisue/suda.vim" - use "editorconfig/editorconfig-vim" + -- Obsidian / Roam like features + -- use "lervag/wiki.vim" - -- Code Navigation - use "dense-analysis/ale" - use "nathanmsmith/nvim-ale-diagnostic" - use "junegunn/fzf" - use "nvim-telescope/telescope.nvim" + use "rcarriga/nvim-notify" - -- Postman like features - use "NTBBloodbath/rest.nvim" + -- Lsp Errors + use "folke/lsp-colors.nvim" + use "onsails/lspkind-nvim" + use { + "folke/trouble.nvim", + requires = "kyazdani42/nvim-web-devicons", + config = function() + require("trouble").setup() + end + } - -- Obsidian / Roam like features - -- use "lervag/wiki.vim" + -- Syntax / Autocomplete + use "neovim/nvim-lspconfig" + use "hrsh7th/nvim-cmp" + use "hrsh7th/cmp-nvim-lsp" + use "hrsh7th/cmp-nvim-lua" + use "hrsh7th/cmp-path" + use "hrsh7th/cmp-calc" + use "hrsh7th/cmp-buffer" + use "hrsh7th/cmp-cmdline" + use "L3MON4D3/LuaSnip" + use "saadparwaiz1/cmp_luasnip" + use "rafamadriz/friendly-snippets" + use "williamboman/nvim-lsp-installer" + use "nvim-lua/lsp-status.nvim" + use "neoclide/jsonc.vim" + use { + "nvim-treesitter/nvim-treesitter", + run = ":TSUpdate" + } - -- Lsp Errors - use "folke/lsp-colors.nvim" - use "onsails/lspkind-nvim" - use { - "folke/trouble.nvim", - requires = "kyazdani42/nvim-web-devicons", - config = function() - require("trouble").setup() + -- Language Supports + use "beyondmarc/glsl.vim" -- GLSL + use "ellisonleao/glow.nvim" -- MARKDOWN + + -- Autoformat + use "sbdchd/neoformat" + -- use "lukas-reineke/format.nvim" + + -- General Popup Window + use "akinsho/nvim-toggleterm.lua" + + -- Database Feature + use "tpope/vim-dadbod" + use "kristijanhusak/vim-dadbod-ui" end - } - - -- Syntax / Autocomplete - use "neovim/nvim-lspconfig" - -- use "github/copilot.vim" - use "hrsh7th/nvim-cmp" - use "hrsh7th/cmp-nvim-lsp" - use "hrsh7th/cmp-nvim-lua" - use "hrsh7th/cmp-path" - use "hrsh7th/cmp-calc" - use "hrsh7th/cmp-buffer" - use "hrsh7th/cmp-cmdline" - use "L3MON4D3/LuaSnip" - use "saadparwaiz1/cmp_luasnip" - use "rafamadriz/friendly-snippets" - - use "beyondmarc/glsl.vim" - - use "tpope/vim-commentary" - - use "williamboman/nvim-lsp-installer" - use "nvim-lua/lsp-status.nvim" - use "windwp/nvim-autopairs" - use "neoclide/jsonc.vim" - use { - 'nvim-treesitter/nvim-treesitter', - run = ':TSUpdate' - } - - -- Preview Markdown - use "ellisonleao/glow.nvim" - - -- Autoformat - use "sbdchd/neoformat" - -- use "lukas-reineke/format.nvim" - - -- General Popup Window - use "akinsho/nvim-toggleterm.lua" - - -- Database Feature - use "tpope/vim-dadbod" - use "kristijanhusak/vim-dadbod-ui" - -end) +) diff --git a/configs/nvim/lua/treesitter-conf.lua b/configs/nvim/lua/treesitter-conf.lua index 999c261..07222b9 100644 --- a/configs/nvim/lua/treesitter-conf.lua +++ b/configs/nvim/lua/treesitter-conf.lua @@ -1,34 +1,35 @@ local parser_configs = require("nvim-treesitter.parsers").get_parser_configs() - parser_configs.http = { - install_info = { - url = "https://github.com/NTBBloodbath/tree-sitter-http", - files = {"src/parser.c"}, - branch = "main" - } - } +parser_configs.http = { + install_info = { + url = "https://github.com/NTBBloodbath/tree-sitter-http", + files = {"src/parser.c"}, + branch = "main" + } +} - parser_configs.glsl = { +parser_configs.glsl = { filetype = "vert", - filetypes = {"vert","frag"} - } + filetypes = {"vert", "frag"} +} - require "nvim-treesitter.configs".setup { - indent = { - enable = true +require "nvim-treesitter.configs".setup { + indent = { + enable = true }, - ensure_installed = { - "bash", - "yaml", - "http", - "svelte", - "css", - "svelte", - "typescript", - "javascript", - "go", - "lua", - "yaml" - }, - highlight = {enable = true} - } + ensure_installed = { + "bash", + "yaml", + "http", + "svelte", + "css", + "svelte", + "typescript", + "javascript", + "go", + "lua", + "yaml", + "prisma" + }, + highlight = {enable = true} +} diff --git a/configs/nvim/lua/utils.lua b/configs/nvim/lua/utils.lua index bb7044e..1fb1c3a 100644 --- a/configs/nvim/lua/utils.lua +++ b/configs/nvim/lua/utils.lua @@ -35,6 +35,8 @@ local function dump(o) end end +M.dump = dump + function M.has_plugin(pluginName) local status = pcall(require, pluginName) return status diff --git a/configs/zsh/functions.zsh b/configs/zsh/functions.zsh index f803f5d..cc03150 100644 --- a/configs/zsh/functions.zsh +++ b/configs/zsh/functions.zsh @@ -7,3 +7,4 @@ source $(dirname "$0")/functions/rn.zsh; source $(dirname "$0")/functions/sum.zsh; source $(dirname "$0")/functions/mke.zsh; source $(dirname "$0")/functions/myip.zsh; +source $(dirname "$0")/functions/cht.zsh; diff --git a/configs/zsh/functions/cht.zsh b/configs/zsh/functions/cht.zsh new file mode 100644 index 0000000..16ecab7 --- /dev/null +++ b/configs/zsh/functions/cht.zsh @@ -0,0 +1,13 @@ +languages=`echo "golang lua cpp c typescript nodejs" | tr ' ' '\n'` +core_utils=`echo "xargs find mv sed awk" | tr ' ' '\n'` + +function cht(){ + selected=`printf "$languages\n$core_utils" | fzf` + read query\?"query:" + + if printf $languages | grep -qs $selected; then + curl cht.sh/$selected/`echo $query | tr ' ' '+'` + else + curl cht.sh/$selected~$query + fi +}