From f555d223d3833cc4c72a415d360a046f06743c91 Mon Sep 17 00:00:00 2001 From: Hirad Date: Mon, 8 Jul 2024 07:37:54 +0330 Subject: [PATCH] initial commit --- config/environment.d/git_askpass.conf | 1 + config/environment.d/ssh_askpass.conf | 2 + config/nvim/init.lua | 28 ++ config/nvim/lua/configs/filetypes.lua | 4 + config/nvim/lua/configs/keymaps.lua | 70 +++++ config/nvim/lua/configs/options.lua | 50 ++++ config/nvim/lua/configs/plugins.lua | 99 +++++++ config/nvim/lua/configs/tabout.lua | 22 ++ config/nvim/lua/lsp/handlers.lua | 91 ++++++ config/nvim/lua/lsp/init.lua | 8 + config/nvim/lua/lsp/mason.lua | 52 ++++ config/nvim/lua/lsp/null-ls.lua | 19 ++ config/nvim/lua/lsp/settings/jsonls.lua | 197 +++++++++++++ config/nvim/lua/lsp/settings/pyright.lua | 9 + config/nvim/lua/lsp/settings/sumneko_lua.lua | 16 + config/nvim/lua/plugins/alpha.lua | 42 +++ config/nvim/lua/plugins/autocommands.lua | 37 +++ config/nvim/lua/plugins/autopairs.lua | 59 ++++ config/nvim/lua/plugins/bufferline.lua | 166 +++++++++++ config/nvim/lua/plugins/cmp.lua | 135 +++++++++ config/nvim/lua/plugins/comment.lua | 32 ++ config/nvim/lua/plugins/gitsigns.lua | 48 +++ config/nvim/lua/plugins/impatient.lua | 6 + config/nvim/lua/plugins/indentline.lua | 24 ++ config/nvim/lua/plugins/lualine.lua | 93 ++++++ config/nvim/lua/plugins/neoscroll.lua | 20 ++ config/nvim/lua/plugins/nvim-tree.lua | 26 ++ config/nvim/lua/plugins/nvim-tree.lua.bak | 67 +++++ config/nvim/lua/plugins/project.lua | 48 +++ config/nvim/lua/plugins/telescope.lua | 96 ++++++ config/nvim/lua/plugins/toggleterm.lua | 70 +++++ config/nvim/lua/plugins/treesitter.lua | 41 +++ config/nvim/lua/plugins/whichkey.lua | 187 ++++++++++++ config/nvim/lua/ui/bluloco.lua | 5 + config/nvim/lua/ui/colorscheme.lua | 6 + config/nvim/lua/ui/dracula.lua | 52 ++++ config/nvim/lua/ui/onedark.lua | 33 +++ config/nvim/lua/ui/tokyonight.lua | 35 +++ config/nvim/plugin/packer_compiled.lua | 279 ++++++++++++++++++ .../51-disable-suspension.conf | 39 +++ 40 files changed, 2314 insertions(+) create mode 100644 config/environment.d/git_askpass.conf create mode 100644 config/environment.d/ssh_askpass.conf create mode 100644 config/nvim/init.lua create mode 100644 config/nvim/lua/configs/filetypes.lua create mode 100644 config/nvim/lua/configs/keymaps.lua create mode 100644 config/nvim/lua/configs/options.lua create mode 100644 config/nvim/lua/configs/plugins.lua create mode 100644 config/nvim/lua/configs/tabout.lua create mode 100644 config/nvim/lua/lsp/handlers.lua create mode 100644 config/nvim/lua/lsp/init.lua create mode 100644 config/nvim/lua/lsp/mason.lua create mode 100644 config/nvim/lua/lsp/null-ls.lua create mode 100644 config/nvim/lua/lsp/settings/jsonls.lua create mode 100644 config/nvim/lua/lsp/settings/pyright.lua create mode 100644 config/nvim/lua/lsp/settings/sumneko_lua.lua create mode 100644 config/nvim/lua/plugins/alpha.lua create mode 100644 config/nvim/lua/plugins/autocommands.lua create mode 100644 config/nvim/lua/plugins/autopairs.lua create mode 100644 config/nvim/lua/plugins/bufferline.lua create mode 100644 config/nvim/lua/plugins/cmp.lua create mode 100644 config/nvim/lua/plugins/comment.lua create mode 100644 config/nvim/lua/plugins/gitsigns.lua create mode 100644 config/nvim/lua/plugins/impatient.lua create mode 100644 config/nvim/lua/plugins/indentline.lua create mode 100644 config/nvim/lua/plugins/lualine.lua create mode 100644 config/nvim/lua/plugins/neoscroll.lua create mode 100644 config/nvim/lua/plugins/nvim-tree.lua create mode 100644 config/nvim/lua/plugins/nvim-tree.lua.bak create mode 100644 config/nvim/lua/plugins/project.lua create mode 100644 config/nvim/lua/plugins/telescope.lua create mode 100644 config/nvim/lua/plugins/toggleterm.lua create mode 100644 config/nvim/lua/plugins/treesitter.lua create mode 100644 config/nvim/lua/plugins/whichkey.lua create mode 100644 config/nvim/lua/ui/bluloco.lua create mode 100644 config/nvim/lua/ui/colorscheme.lua create mode 100644 config/nvim/lua/ui/dracula.lua create mode 100644 config/nvim/lua/ui/onedark.lua create mode 100644 config/nvim/lua/ui/tokyonight.lua create mode 100644 config/nvim/plugin/packer_compiled.lua create mode 100644 config/wireplumber/wireplumber.conf.d/51-disable-suspension.conf diff --git a/config/environment.d/git_askpass.conf b/config/environment.d/git_askpass.conf new file mode 100644 index 0000000..0d3cf4f --- /dev/null +++ b/config/environment.d/git_askpass.conf @@ -0,0 +1 @@ +GIT_ASKPASS=/usr/bin/ksshaskpass diff --git a/config/environment.d/ssh_askpass.conf b/config/environment.d/ssh_askpass.conf new file mode 100644 index 0000000..e0f6af6 --- /dev/null +++ b/config/environment.d/ssh_askpass.conf @@ -0,0 +1,2 @@ +SSH_ASKPASS=/usr/bin/ksshaskpass +SSH_ASKPASS_REQUIRE=prefer diff --git a/config/nvim/init.lua b/config/nvim/init.lua new file mode 100644 index 0000000..615442e --- /dev/null +++ b/config/nvim/init.lua @@ -0,0 +1,28 @@ +require "configs.options" +require "configs.keymaps" +require "configs.filetypes" +require "configs.plugins" +require "configs.tabout" + +require "plugins.cmp" +require "plugins.telescope" +require "plugins.treesitter" +require "plugins.autopairs" +require "plugins.nvim-tree" +require "plugins.bufferline" +require "plugins.lualine" +require "plugins.neoscroll" +require "plugins.toggleterm" +require "plugins.project" +require "plugins.impatient" +require "plugins.indentline" +require "plugins.alpha" +require "plugins.whichkey" +require "plugins.autocommands" +require "plugins.comment" +require "plugins.gitsigns" +require "lsp" + +require "ui.colorscheme" +require "ui.onedark" + diff --git a/config/nvim/lua/configs/filetypes.lua b/config/nvim/lua/configs/filetypes.lua new file mode 100644 index 0000000..d88260c --- /dev/null +++ b/config/nvim/lua/configs/filetypes.lua @@ -0,0 +1,4 @@ +vim.api.nvim_create_autocmd('FileType', { + pattern = 'sh', + command = 'setlocal shiftwidth=4 tabstop=4' +}) diff --git a/config/nvim/lua/configs/keymaps.lua b/config/nvim/lua/configs/keymaps.lua new file mode 100644 index 0000000..7d777ca --- /dev/null +++ b/config/nvim/lua/configs/keymaps.lua @@ -0,0 +1,70 @@ +local opts = { noremap = true, silent = true } + +local term_opts = { silent = true } + +-- Shorten function name +local keymap = vim.api.nvim_set_keymap + +--Remap space as leader key +keymap("", "", "", opts) +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +-- Modes +-- normal_mode = "n", +-- insert_mode = "i", +-- visual_mode = "v", +-- visual_block_mode = "x", +-- term_mode = "t", +-- command_mode = "c", + +-- Normal -- +-- Better window navigation +keymap("n", "", "h", opts) +keymap("n", "", "j", opts) +keymap("n", "", "k", opts) +keymap("n", "", "l", opts) + +-- Resize with arrows +keymap("n", "", ":resize -2", opts) +keymap("n", "", ":resize +2", opts) +keymap("n", "", ":vertical resize -2", opts) +keymap("n", "", ":vertical resize +2", opts) + +-- Navigate buffers +keymap("n", "", ":bnext", opts) +keymap("n", "", ":bprevious", opts) + +-- Move text up and down +keymap("n", "", ":m .+1==gi", opts) +keymap("n", "", ":m .-2==gi", opts) + +-- Insert -- +-- Press jk fast to exit insert mode +keymap("i", "jk", "", opts) +keymap("i", "kj", "", opts) + +-- Visual -- +-- Stay in indent mode +keymap("v", "<", "", ">gv", opts) + +-- Move text up and down +keymap("v", "", ":m .+1==", opts) +keymap("v", "", ":m .-2==", opts) +keymap("v", "p", '"_dP', opts) + +-- Visual Block -- +-- Move text up and down +keymap("x", "J", ":move '>+1gv-gv", opts) +keymap("x", "K", ":move '<-2gv-gv", opts) +keymap("x", "", ":move '>+1gv-gv", opts) +keymap("x", "", ":move '<-2gv-gv", opts) + +-- Terminal -- +-- Better terminal navigation +-- keymap("t", "", "h", term_opts) +-- keymap("t", "", "j", term_opts) +-- keymap("t", "", "k", term_opts) +-- keymap("t", "", "l", term_opts) + diff --git a/config/nvim/lua/configs/options.lua b/config/nvim/lua/configs/options.lua new file mode 100644 index 0000000..a8c40f4 --- /dev/null +++ b/config/nvim/lua/configs/options.lua @@ -0,0 +1,50 @@ +local options = { + backup = false, + clipboard = "unnamedplus", + cmdheight = 2, + completeopt = { "menuone", "noselect" }, + conceallevel = 0, + fileencoding = "utf-8", + hlsearch = true, + ignorecase = true, + mouse = "a", + pumheight = 10, + showmode = false, + showtabline = 2, + smartcase = true, + smartindent = true, + splitbelow = true, + splitright = true, + swapfile = true, + -- termguicolors = true, + timeoutlen = 300, + undofile = true, + updatetime = 300, + writebackup = false, + expandtab = true, + shiftwidth = 2, + tabstop = 2, + cursorline = true, + number = true, + relativenumber = false, + numberwidth = 4, + + signcolumn = "yes", + wrap = false, + linebreak = true, + scrolloff = 8, + sidescrolloff = 8, + guifont = "Hirad Iosevka:h17", + whichwrap = "bs<>[]hl", +} + +for k, v in pairs(options) do + vim.opt[k] = v +end + +-- vim.opt.shortmess = "ilmnrx" -- flags to shorten vim messages, see :help 'shortmess' +vim.opt.shortmess:append "c" -- don't give |ins-completion-menu| messages +vim.opt.iskeyword:append "-" -- hyphenated words recognized by searches +vim.opt.formatoptions:remove({ "c", "r", "o" }) -- don't insert the current comment leader automatically for auto-wrapping comments using 'textwidth', hitting in insert mode, or hitting 'o' or 'O' in normal mode. +vim.opt.runtimepath:remove("/usr/share/vim/vimfiles") -- separate vim plugins from neovim in case vim still in use + diff --git a/config/nvim/lua/configs/plugins.lua b/config/nvim/lua/configs/plugins.lua new file mode 100644 index 0000000..5fbe69e --- /dev/null +++ b/config/nvim/lua/configs/plugins.lua @@ -0,0 +1,99 @@ +local fn = vim.fn + +-- Automatically install packer +local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" +if fn.empty(fn.glob(install_path)) > 0 then + PACKER_BOOTSTRAP = fn.system({ + "git", + "clone", + "--depth", + "1", + "https://github.com/wbthomason/packer.nvim", + install_path, + }) + print("Installing packer close and reopen NeoVIM...") + vim.cmd([[packadd packer.nvim]]) +end + +-- Autocommand that reloads neovim whenever you save the plugins.lua file +vim.cmd([[ + augroup packer_user_config + autocmd! + autocmd BufWritePost plugins.lua source | PackerSync + augroup end +]]) + +-- Use a protected call so we don't error out on first use +local status_ok, packer = pcall(require, "packer") +if not status_ok then + return +end + +-- Have packer use a popup window +packer.init({ + display = { + open_fn = function() + return require("packer.util").float({ border = "rounded" }) + end, + }, + }) + +-- Install plugins here +return packer.startup(function(use) + use { "wbthomason/packer.nvim" } + use { "nvim-lua/plenary.nvim" } + use { "windwp/nvim-autopairs" } + use { "numToStr/Comment.nvim" } + use { "JoosepAlviste/nvim-ts-context-commentstring" } + use { "kyazdani42/nvim-web-devicons" } + use { "kyazdani42/nvim-tree.lua" } + use { "akinsho/bufferline.nvim" } + use { "moll/vim-bbye" } + use { "nvim-lualine/lualine.nvim" } + use { "akinsho/toggleterm.nvim" } + use { "ahmedkhalf/project.nvim" } + use { "lewis6991/impatient.nvim" } + use { "lukas-reineke/indent-blankline.nvim" } + use { "goolord/alpha-nvim" } + use { "folke/which-key.nvim" } + use { "karb94/neoscroll.nvim" } + + -- Colorschemes + use { "folke/tokyonight.nvim" } + use { "lunarvim/darkplus.nvim" } + use { "navarasu/onedark.nvim" } + use { "Mofiqul/dracula.nvim" } + + -- cmp + use { "hrsh7th/nvim-cmp" } + use { "hrsh7th/cmp-buffer" } + use { "hrsh7th/cmp-path" } + use { "saadparwaiz1/cmp_luasnip" } + use { "hrsh7th/cmp-nvim-lsp" } + use { "hrsh7th/cmp-nvim-lua" } + + -- Snippets + use { "L3MON4D3/LuaSnip" } + use { "rafamadriz/friendly-snippets" } + + -- LSP + use { "neovim/nvim-lspconfig" } + use { "williamboman/mason.nvim" } + use { "williamboman/mason-lspconfig.nvim" } + use { "jose-elias-alvarez/null-ls.nvim" } + use { "RRethy/vim-illuminate" } + + -- Telescope + use { "nvim-telescope/telescope.nvim" } + + -- Treesitter + use { "nvim-treesitter/nvim-treesitter" } + + -- Git + use { "lewis6991/gitsigns.nvim" } + + --Automatically setup configuration after cleaning packer.nvim + if PACKER_BOOTSTRAP then + require("packer").sync() + end +end) diff --git a/config/nvim/lua/configs/tabout.lua b/config/nvim/lua/configs/tabout.lua new file mode 100644 index 0000000..8866530 --- /dev/null +++ b/config/nvim/lua/configs/tabout.lua @@ -0,0 +1,22 @@ +function EscapePair() + local closers = {")", "]", "}", ">", "'", '"', "`", ","} + local line = vim.api.nvim_get_current_line() + local row, col = unpack(vim.api.nvim_win_get_cursor(0)) + local after = line:sub(col + 1, -1) + local closer_col = #after + 1 + local closer_i = nil + for i, closer in ipairs(closers) do + local cur_index, _ = after:find(closer) + if cur_index and (cur_index < closer_col) then + closer_col = cur_index + closer_i = i + end + end + if closer_i then + vim.api.nvim_win_set_cursor(0, {row, col + closer_col}) + else + vim.api.nvim_win_set_cursor(0, {row, col + 1}) + end +end + +vim.api.nvim_set_keymap('i', '', 'lua EscapePair()', { noremap = true, silent = true}) diff --git a/config/nvim/lua/lsp/handlers.lua b/config/nvim/lua/lsp/handlers.lua new file mode 100644 index 0000000..b540d09 --- /dev/null +++ b/config/nvim/lua/lsp/handlers.lua @@ -0,0 +1,91 @@ +local M = {} + +local status_cmp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") +if not status_cmp_ok then + return +end + +M.capabilities = vim.lsp.protocol.make_client_capabilities() +M.capabilities.textDocument.completion.completionItem.snippetSupport = true +M.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities) + +M.setup = function() + local signs = { + + { name = "DiagnosticSignError", text = "" }, + { name = "DiagnosticSignWarn", text = "" }, + { name = "DiagnosticSignHint", text = "" }, + { name = "DiagnosticSignInfo", text = "" }, + } + + for _, sign in ipairs(signs) do + vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) + end + + local config = { + virtual_text = false, -- disable virtual text + signs = { + active = signs, -- show signs + }, + update_in_insert = true, + underline = true, + severity_sort = true, + float = { + focusable = true, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + }, + } + + vim.diagnostic.config(config) + + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { + border = "rounded", + }) + + vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { + border = "rounded", + }) +end + +local function lsp_keymaps(bufnr) + local opts = { noremap = true, silent = true } + local keymap = vim.api.nvim_buf_set_keymap + keymap(bufnr, "n", "gD", "lua vim.lsp.buf.declaration()", opts) + keymap(bufnr, "n", "gd", "lua vim.lsp.buf.definition()", opts) + keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opts) + keymap(bufnr, "n", "gI", "lua vim.lsp.buf.implementation()", opts) + keymap(bufnr, "n", "gr", "lua vim.lsp.buf.references()", opts) + keymap(bufnr, "n", "gl", "lua vim.diagnostic.open_float()", opts) + keymap(bufnr, "n", "lf", "lua vim.lsp.buf.format{ async = true }", opts) + keymap(bufnr, "n", "li", "LspInfo", opts) + keymap(bufnr, "n", "lI", "LspInstallInfo", opts) + keymap(bufnr, "n", "la", "lua vim.lsp.buf.code_action()", opts) + keymap(bufnr, "n", "lj", "lua vim.diagnostic.goto_next({buffer=0})", opts) + keymap(bufnr, "n", "lk", "lua vim.diagnostic.goto_prev({buffer=0})", opts) + keymap(bufnr, "n", "lr", "lua vim.lsp.buf.rename()", opts) + keymap(bufnr, "n", "ls", "lua vim.lsp.buf.signature_help()", opts) + keymap(bufnr, "n", "lq", "lua vim.diagnostic.setloclist()", opts) +end + +M.on_attach = function(client, bufnr) + if client.name == "tsserver" then + client.server_capabilities.documentFormattingProvider = false + end + + if client.name == "sumneko_lua" then + client.server_capabilities.documentFormattingProvider = false + end + + lsp_keymaps(bufnr) + local status_ok, illuminate = pcall(require, "illuminate") + if not status_ok then + return + end + illuminate.on_attach(client) +end + +return M diff --git a/config/nvim/lua/lsp/init.lua b/config/nvim/lua/lsp/init.lua new file mode 100644 index 0000000..ad67ba2 --- /dev/null +++ b/config/nvim/lua/lsp/init.lua @@ -0,0 +1,8 @@ +local status_ok, _ = pcall(require, "lspconfig") +if not status_ok then + return +end + +require "lsp.mason" +require("lsp.handlers").setup() +require "lsp.null-ls" diff --git a/config/nvim/lua/lsp/mason.lua b/config/nvim/lua/lsp/mason.lua new file mode 100644 index 0000000..b983836 --- /dev/null +++ b/config/nvim/lua/lsp/mason.lua @@ -0,0 +1,52 @@ +local servers = { + "lua_ls", + -- "cssls", + -- "html", + -- "tsserver", + "pyright", + -- "bashls", + "jsonls", + -- "yamlls", +} + +local settings = { + ui = { + border = "none", + icons = { + package_installed = "◍", + package_pending = "◍", + package_uninstalled = "◍", + }, + }, + log_level = vim.log.levels.INFO, + max_concurrent_installers = 4, +} + +require("mason").setup(settings) +require("mason-lspconfig").setup({ + ensure_installed = servers, + automatic_installation = true, +}) + +local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig") +if not lspconfig_status_ok then + return +end + +local opts = {} + +for _, server in pairs(servers) do + opts = { + on_attach = require("lsp.handlers").on_attach, + capabilities = require("lsp.handlers").capabilities, + } + + server = vim.split(server, "@")[1] + + local require_ok, conf_opts = pcall(require, "lsp.settings." .. server) + if require_ok then + opts = vim.tbl_deep_extend("force", conf_opts, opts) + end + + lspconfig[server].setup(opts) +end diff --git a/config/nvim/lua/lsp/null-ls.lua b/config/nvim/lua/lsp/null-ls.lua new file mode 100644 index 0000000..874e19c --- /dev/null +++ b/config/nvim/lua/lsp/null-ls.lua @@ -0,0 +1,19 @@ +local null_ls_status_ok, null_ls = pcall(require, "null-ls") +if not null_ls_status_ok then + return +end + +-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting +local formatting = null_ls.builtins.formatting +-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics +local diagnostics = null_ls.builtins.diagnostics + +null_ls.setup({ + debug = false, + sources = { + formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }), + formatting.black.with({ extra_args = { "--fast" } }), + formatting.stylua, + -- diagnostics.flake8 + }, +}) diff --git a/config/nvim/lua/lsp/settings/jsonls.lua b/config/nvim/lua/lsp/settings/jsonls.lua new file mode 100644 index 0000000..e202e1e --- /dev/null +++ b/config/nvim/lua/lsp/settings/jsonls.lua @@ -0,0 +1,197 @@ +local default_schemas = nil +local status_ok, jsonls_settings = pcall(require, "nlspsettings.jsonls") +if status_ok then + default_schemas = jsonls_settings.get_default_schemas() +end + +local schemas = { + { + description = "TypeScript compiler configuration file", + fileMatch = { + "tsconfig.json", + "tsconfig.*.json", + }, + url = "https://json.schemastore.org/tsconfig.json", + }, + { + description = "Lerna config", + fileMatch = { "lerna.json" }, + url = "https://json.schemastore.org/lerna.json", + }, + { + description = "Babel configuration", + fileMatch = { + ".babelrc.json", + ".babelrc", + "babel.config.json", + }, + url = "https://json.schemastore.org/babelrc.json", + }, + { + description = "ESLint config", + fileMatch = { + ".eslintrc.json", + ".eslintrc", + }, + url = "https://json.schemastore.org/eslintrc.json", + }, + { + description = "Bucklescript config", + fileMatch = { "bsconfig.json" }, + url = "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/8.2.0/docs/docson/build-schema.json", + }, + { + description = "Prettier config", + fileMatch = { + ".prettierrc", + ".prettierrc.json", + "prettier.config.json", + }, + url = "https://json.schemastore.org/prettierrc", + }, + { + description = "Vercel Now config", + fileMatch = { "now.json" }, + url = "https://json.schemastore.org/now", + }, + { + description = "Stylelint config", + fileMatch = { + ".stylelintrc", + ".stylelintrc.json", + "stylelint.config.json", + }, + url = "https://json.schemastore.org/stylelintrc", + }, + { + description = "A JSON schema for the ASP.NET LaunchSettings.json files", + fileMatch = { "launchsettings.json" }, + url = "https://json.schemastore.org/launchsettings.json", + }, + { + description = "Schema for CMake Presets", + fileMatch = { + "CMakePresets.json", + "CMakeUserPresets.json", + }, + url = "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json", + }, + { + description = "Configuration file as an alternative for configuring your repository in the settings page.", + fileMatch = { + ".codeclimate.json", + }, + url = "https://json.schemastore.org/codeclimate.json", + }, + { + description = "LLVM compilation database", + fileMatch = { + "compile_commands.json", + }, + url = "https://json.schemastore.org/compile-commands.json", + }, + { + description = "Config file for Command Task Runner", + fileMatch = { + "commands.json", + }, + url = "https://json.schemastore.org/commands.json", + }, + { + description = "AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.", + fileMatch = { + "*.cf.json", + "cloudformation.json", + }, + url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/cloudformation.schema.json", + }, + { + description = "The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.", + fileMatch = { + "serverless.template", + "*.sam.json", + "sam.json", + }, + url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/sam.schema.json", + }, + { + description = "Json schema for properties json file for a GitHub Workflow template", + fileMatch = { + ".github/workflow-templates/**.properties.json", + }, + url = "https://json.schemastore.org/github-workflow-template-properties.json", + }, + { + description = "golangci-lint configuration file", + fileMatch = { + ".golangci.toml", + ".golangci.json", + }, + url = "https://json.schemastore.org/golangci-lint.json", + }, + { + description = "JSON schema for the JSON Feed format", + fileMatch = { + "feed.json", + }, + url = "https://json.schemastore.org/feed.json", + versions = { + ["1"] = "https://json.schemastore.org/feed-1.json", + ["1.1"] = "https://json.schemastore.org/feed.json", + }, + }, + { + description = "Packer template JSON configuration", + fileMatch = { + "packer.json", + }, + url = "https://json.schemastore.org/packer.json", + }, + { + description = "NPM configuration file", + fileMatch = { + "package.json", + }, + url = "https://json.schemastore.org/package.json", + }, + { + description = "JSON schema for Visual Studio component configuration files", + fileMatch = { + "*.vsconfig", + }, + url = "https://json.schemastore.org/vsconfig.json", + }, + { + description = "Resume json", + fileMatch = { "resume.json" }, + url = "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json", + }, +} + +local function extend(tab1, tab2) + for _, value in ipairs(tab2 or {}) do + table.insert(tab1, value) + end + return tab1 +end + +local extended_schemas = extend(schemas, default_schemas) + +local opts = { + settings = { + json = { + schemas = extended_schemas, + }, + }, + setup = { + commands = { + Format = { + function() + vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 }) + end, + }, + }, + }, +} + +return opts diff --git a/config/nvim/lua/lsp/settings/pyright.lua b/config/nvim/lua/lsp/settings/pyright.lua new file mode 100644 index 0000000..c2a518d --- /dev/null +++ b/config/nvim/lua/lsp/settings/pyright.lua @@ -0,0 +1,9 @@ +return { + settings = { + python = { + analysis = { + typeCheckingMode = "off", + }, + }, + }, +} diff --git a/config/nvim/lua/lsp/settings/sumneko_lua.lua b/config/nvim/lua/lsp/settings/sumneko_lua.lua new file mode 100644 index 0000000..0ac454a --- /dev/null +++ b/config/nvim/lua/lsp/settings/sumneko_lua.lua @@ -0,0 +1,16 @@ +return { + settings = { + + Lua = { + diagnostics = { + globals = { "vim" }, + }, + workspace = { + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.stdpath("config") .. "/lua"] = true, + }, + }, + }, + }, +} diff --git a/config/nvim/lua/plugins/alpha.lua b/config/nvim/lua/plugins/alpha.lua new file mode 100644 index 0000000..a398936 --- /dev/null +++ b/config/nvim/lua/plugins/alpha.lua @@ -0,0 +1,42 @@ +local status_ok, alpha = pcall(require, "alpha") +if not status_ok then + return +end + +local dashboard = require("alpha.themes.dashboard") +dashboard.section.header.val = { + [[ __ ]], + [[ ___ ___ ___ __ __ /\_\ ___ ___ ]], + [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]], + [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]], + [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]], + [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]], +} +dashboard.section.buttons.val = { + dashboard.button("f", " Find file", ":Telescope find_files "), + dashboard.button("e", " New file", ":ene startinsert "), + dashboard.button("p", " Find project", ":Telescope projects "), + dashboard.button("r", " Recently used files", ":Telescope oldfiles "), + dashboard.button("t", "󱎸 Find text", ":Telescope live_grep "), + dashboard.button("c", " Configuration", ":e $MYVIMRC "), + dashboard.button("q", " Quit Neovim", ":qa"), +} + +local function footer() +-- NOTE: requires the fortune-mod package to work + -- local handle = io.popen("fortune") + -- local fortune = handle:read("*a") + -- handle:close() + -- return fortune + return "chrisatmachine.com" +end + +dashboard.section.footer.val = footer() + +dashboard.section.footer.opts.hl = "Type" +dashboard.section.header.opts.hl = "Include" +dashboard.section.buttons.opts.hl = "Keyword" + +dashboard.opts.opts.noautocmd = true +-- vim.cmd([[autocmd User AlphaReady echo 'ready']]) +alpha.setup(dashboard.opts) diff --git a/config/nvim/lua/plugins/autocommands.lua b/config/nvim/lua/plugins/autocommands.lua new file mode 100644 index 0000000..c438738 --- /dev/null +++ b/config/nvim/lua/plugins/autocommands.lua @@ -0,0 +1,37 @@ +vim.cmd [[ + augroup _general_settings + autocmd! + autocmd FileType qf,help,man,lspinfo nnoremap q :close + autocmd TextYankPost * silent!lua require('vim.highlight').on_yank({higroup = 'Visual', timeout = 200}) + autocmd BufWinEnter * :set formatoptions-=cro + autocmd FileType qf set nobuflisted + augroup end + + augroup _git + autocmd! + autocmd FileType gitcommit setlocal wrap + autocmd FileType gitcommit setlocal spell + augroup end + + augroup _markdown + autocmd! + autocmd FileType markdown setlocal wrap + autocmd FileType markdown setlocal spell + augroup end + + augroup _auto_resize + autocmd! + autocmd VimResized * tabdo wincmd = + augroup end + + augroup _alpha + autocmd! + autocmd User AlphaReady set showtabline=0 | autocmd BufUnload set showtabline=2 + augroup end +]] + +-- Autoformat +-- augroup _lsp +-- autocmd! +-- autocmd BufWritePre * lua vim.lsp.buf.formatting() +-- augroup end diff --git a/config/nvim/lua/plugins/autopairs.lua b/config/nvim/lua/plugins/autopairs.lua new file mode 100644 index 0000000..c7e441a --- /dev/null +++ b/config/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,59 @@ +-- Setup nvim-cmp. +local status_ok, npairs = pcall(require, "nvim-autopairs") +if not status_ok then + return +end + +npairs.setup { + check_ts = true, + ts_config = { + lua = { "string", "source" }, + javascript = { "string", "template_string" }, + java = false, + }, + disable_filetype = { "TelescopePrompt", "spectre_panel" }, + fast_wrap = { + map = "", + chars = { "{", "[", "(", '"', "'" }, + pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), + offset = 0, -- Offset from pattern match + end_key = "$", + keys = "qwertyuiopzxcvbnmasdfghjkl", + check_comma = true, + highlight = "PmenuSel", + highlight_grey = "LineNr", + }, +} + +local cmp_autopairs = require "nvim-autopairs.completion.cmp" +local cmp_status_ok, cmp = pcall(require, "cmp") +if not cmp_status_ok then + return +end +cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } }) + +local npairs = require'nvim-autopairs' +local Rule = require'nvim-autopairs.rule' + +local brackets = { { '(', ')' }, { '[', ']' }, { '{', '}' } } +npairs.add_rules { + Rule(' ', ' ') + :with_pair(function (opts) + local pair = opts.line:sub(opts.col - 1, opts.col) + return vim.tbl_contains({ + brackets[1][1]..brackets[1][2], + brackets[2][1]..brackets[2][2], + brackets[3][1]..brackets[3][2], + }, pair) + end) +} +for _,bracket in pairs(brackets) do + npairs.add_rules { + Rule(bracket[1]..' ', ' '..bracket[2]) + :with_pair(function() return false end) + :with_move(function(opts) + return opts.prev_char:match('.%'..bracket[2]) ~= nil + end) + :use_key(bracket[2]) + } +end diff --git a/config/nvim/lua/plugins/bufferline.lua b/config/nvim/lua/plugins/bufferline.lua new file mode 100644 index 0000000..0e851bc --- /dev/null +++ b/config/nvim/lua/plugins/bufferline.lua @@ -0,0 +1,166 @@ +local status_ok, bufferline = pcall(require, "bufferline") +if not status_ok then + return +end + +bufferline.setup { + options = { + numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string, + close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" + right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" + left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" + middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" + -- NOTE: this plugin is designed with this icon in mind, + -- and so changing this is NOT recommended, this is intended + -- as an escape hatch for people who cannot bear it for whatever reason + indicator_icon = nil, + indicator = { style = "icon", icon = "▎"}, + buffer_close_icon = '', + modified_icon = "●", + close_icon = "", + left_trunc_marker = "", + right_trunc_marker = "", + --- name_formatter can be used to change the buffer's label in the bufferline. + --- Please note some names can/will break the + --- bufferline so use this at your discretion knowing that it has + --- some limitations that will *NOT* be fixed. + -- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr" + -- -- remove extension from markdown files for example + -- if buf.name:match('%.md') then + -- return vim.fn.fnamemodify(buf.name, ':t:r') + -- end + -- end, + max_name_length = 30, + max_prefix_length = 30, -- prefix used when a buffer is de-duplicated + tab_size = 21, + diagnostics = false, -- | "nvim_lsp" | "coc", + diagnostics_update_in_insert = false, + -- diagnostics_indicator = function(count, level, diagnostics_dict, context) + -- return "("..count..")" + -- end, + -- NOTE: this will be called a lot so don't do any heavy processing here + -- custom_filter = function(buf_number) + -- -- filter out filetypes you don't want to see + -- if vim.bo[buf_number].filetype ~= "" then + -- return true + -- end + -- -- filter out by buffer name + -- if vim.fn.bufname(buf_number) ~= "" then + -- return true + -- end + -- -- filter out based on arbitrary rules + -- -- e.g. filter out vim wiki buffer from tabline in your work repo + -- if vim.fn.getcwd() == "" and vim.bo[buf_number].filetype ~= "wiki" then + -- return true + -- end + -- end, + offsets = { { filetype = "NvimTree", text = "", padding = 1 } }, + show_buffer_icons = true, + show_buffer_close_icons = true, + show_close_icon = true, + show_tab_indicators = true, + persist_buffer_sort = true, -- whether or not custom sorted buffers should persist + -- can also be a table containing 2 custom separators + -- [focused and unfocused]. eg: { '|', '|' } + separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' }, + enforce_regular_tabs = true, + always_show_bufferline = true, + -- sort_by = 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b) + -- -- add custom logic + -- return buffer_a.modified > buffer_b.modified + -- end + }, + highlights = { + fill = { + fg = { attribute = "fg", highlight = "Visual" }, + bg = { attribute = "bg", highlight = "TabLine" }, + }, + background = { + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + }, + + -- buffer_selected = { + -- fg = {attribute='fg',highlight='#ff0000'}, + -- bg = {attribute='bg',highlight='#0000ff'}, + -- gui = 'none' + -- }, + buffer_visible = { + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + }, + + close_button = { + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + }, + close_button_visible = { + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + }, + -- close_button_selected = { + -- fg = {attribute='fg',highlight='TabLineSel'}, + -- bg ={attribute='bg',highlight='TabLineSel'} + -- }, + + tab_selected = { + fg = { attribute = "fg", highlight = "Normal" }, + bg = { attribute = "bg", highlight = "Normal" }, + }, + tab = { + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + }, + tab_close = { + -- fg = {attribute='fg',highlight='LspDiagnosticsDefaultError'}, + fg = { attribute = "fg", highlight = "TabLineSel" }, + bg = { attribute = "bg", highlight = "Normal" }, + }, + + duplicate_selected = { + fg = { attribute = "fg", highlight = "TabLineSel" }, + bg = { attribute = "bg", highlight = "TabLineSel" }, + underline = true, + }, + duplicate_visible = { + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + underline = true, + }, + duplicate = { + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + underline = true, + }, + + modified = { + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + }, + modified_selected = { + fg = { attribute = "fg", highlight = "Normal" }, + bg = { attribute = "bg", highlight = "Normal" }, + }, + modified_visible = { + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + }, + + separator = { + fg = { attribute = "bg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + }, + separator_selected = { + fg = { attribute = "bg", highlight = "Normal" }, + bg = { attribute = "bg", highlight = "Normal" }, + }, + -- separator_visible = { + -- fg = {attribute='bg',highlight='TabLine'}, + -- bg = {attribute='bg',highlight='TabLine'} + -- }, + indicator_selected = { + fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" }, + bg = { attribute = "bg", highlight = "Normal" }, + }, + }, +} diff --git a/config/nvim/lua/plugins/cmp.lua b/config/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..3c11b14 --- /dev/null +++ b/config/nvim/lua/plugins/cmp.lua @@ -0,0 +1,135 @@ +local cmp_status_ok, cmp = pcall(require, "cmp") +if not cmp_status_ok then + return +end + +local snip_status_ok, luasnip = pcall(require, "luasnip") +if not snip_status_ok then + return +end + +require("luasnip/loaders/from_vscode").lazy_load() + +local check_backspace = function() + local col = vim.fn.col "." - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" +end + +--   פּ ﯟ   some other good icons +--   פּ ﯟ   some other good icons +local kind_icons = { + Text = "󰊄", + Method = "m", + Function = "󰊕", + Constructor = "", + Field = "", + Variable = "󰫧", + Class = "", + Interface = "", + Module = "", + Property = "", + Unit = "", + Value = "", + Enum = "", + Keyword = "󰌆", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "󰉺", +} +-- find more here: https://www.nerdfonts.com/cheat-sheet + +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + [""] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. + [""] = cmp.mapping { + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }, + -- Accept currently selected item. If none selected, `select` first item. + -- Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping.confirm { select = true }, + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif check_backspace() then + fallback() + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { + "i", + "s", + }), + }, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + -- Kind icons + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind + vim_item.menu = ({ + nvim_lsp = "[LSP]", + luasnip = "[Snippet]", + buffer = "[Buffer]", + path = "[Path]", + })[entry.source.name] + return vim_item + end, + }, + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }, + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }, + window = { + completion = cmp.config.window.bordered({ + winhighlight = "Normal:Normal,FloatBorder:BorderBG,CursorLine:PmenuSel,Search:None", + }), + documentation = { + border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, + }, + }, + experimental = { + ghost_text = false, + native_menu = false, + }, +} diff --git a/config/nvim/lua/plugins/comment.lua b/config/nvim/lua/plugins/comment.lua new file mode 100644 index 0000000..3315496 --- /dev/null +++ b/config/nvim/lua/plugins/comment.lua @@ -0,0 +1,32 @@ +local status_ok, comment = pcall(require, "Comment") +if not status_ok then + return +end + +comment.setup { + pre_hook = function(ctx) + local U = require "Comment.utils" + + local status_utils_ok, utils = pcall(require, "ts_context_commentstring.utils") + if not status_utils_ok then + return + end + + local location = nil + if ctx.ctype == U.ctype.block then + location = utils.get_cursor_location() + elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then + location = utils.get_visual_start_location() + end + + local status_internals_ok, internals = pcall(require, "ts_context_commentstring.internals") + if not status_internals_ok then + return + end + + return internals.calculate_commentstring { + key = ctx.ctype == U.ctype.line and "__default" or "__multiline", + location = location, + } + end, +} diff --git a/config/nvim/lua/plugins/gitsigns.lua b/config/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..6d16a2b --- /dev/null +++ b/config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,48 @@ +local status_ok, gitsigns = pcall(require, "gitsigns") +if not status_ok then + return +end + +gitsigns.setup { + signs = { + add = { hl = "GitSignsAdd", text = " ", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, + change = { hl = "GitSignsChange", text = " ", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, + delete = { hl = "GitSignsDelete", text = " ", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, + topdelete = { hl = "GitSignsDelete", text = "󱅁 ", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, + changedelete = { hl = "GitSignsChange", text = "󰍷 ", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + interval = 1000, + follow_files = true, + }, + attach_to_untracked = true, + current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + }, + current_line_blame_formatter_opts = { + relative_time = false, + }, + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, + preview_config = { + -- Options passed to nvim_open_win + border = "single", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, + yadm = { + enable = false, + }, +} diff --git a/config/nvim/lua/plugins/impatient.lua b/config/nvim/lua/plugins/impatient.lua new file mode 100644 index 0000000..84419e0 --- /dev/null +++ b/config/nvim/lua/plugins/impatient.lua @@ -0,0 +1,6 @@ +local status_ok, impatient = pcall(require, "impatient") +if not status_ok then + return +end + +impatient.enable_profile() diff --git a/config/nvim/lua/plugins/indentline.lua b/config/nvim/lua/plugins/indentline.lua new file mode 100644 index 0000000..114d6c3 --- /dev/null +++ b/config/nvim/lua/plugins/indentline.lua @@ -0,0 +1,24 @@ +local highlight = { + "RainbowRed", + "RainbowYellow", + "RainbowBlue", + "RainbowOrange", + "RainbowGreen", + "RainbowViolet", + "RainbowCyan", +} + +local hooks = require "ibl.hooks" +-- create the highlight groups in the highlight setup hook, so they are reset +-- every time the colorscheme changes +hooks.register(hooks.type.HIGHLIGHT_SETUP, function() + vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) + vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) + vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" }) + vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" }) + vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" }) + vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) + vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) +end) + +require("ibl").setup { indent = { highlight = highlight } } diff --git a/config/nvim/lua/plugins/lualine.lua b/config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..e457629 --- /dev/null +++ b/config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,93 @@ +local status_ok, lualine = pcall(require, "lualine") +if not status_ok then + return +end + +local hide_in_width = function() + return vim.fn.winwidth(0) > 80 +end + +local diagnostics = { + "diagnostics", + sources = { "nvim_diagnostic" }, + sections = { "error", "warn" }, + symbols = { error = " ", warn = " " }, + colored = false, + update_in_insert = false, + always_visible = true, +} + +local diff = { + "diff", + colored = false, + symbols = { added = " ", modified = " ", removed = " " }, -- changes diff symbols + cond = hide_in_width +} + +local mode = { + "mode", + fmt = function(str) + return "-- " .. str .. " --" + end, +} + +local filetype = { + "filetype", + icons_enabled = false, + icon = nil, +} + +local branch = { + "branch", + icons_enabled = true, + icon = "", +} + +local location = { + "location", + padding = 0, +} + +-- cool function for progress +local progress = function() + local current_line = vim.fn.line(".") + local total_lines = vim.fn.line("$") + local chars = { "__", "▁▁", "▂▂", "▃▃", "▄▄", "▅▅", "▆▆", "▇▇", "██" } + local line_ratio = current_line / total_lines + local index = math.ceil(line_ratio * #chars) + return chars[index] +end + +local spaces = function() + return "spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") +end + +lualine.setup({ + options = { + icons_enabled = true, + theme = "auto", + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = { "alpha", "dashboard", "NvimTree", "Outline" }, + always_divide_middle = true, + }, + sections = { + lualine_a = { branch, diagnostics }, + lualine_b = { mode }, + lualine_c = {}, + -- lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_x = { diff, spaces, "encoding", filetype }, + lualine_y = { location }, + lualine_z = { progress }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + extensions = {}, +}) diff --git a/config/nvim/lua/plugins/neoscroll.lua b/config/nvim/lua/plugins/neoscroll.lua new file mode 100644 index 0000000..f09f765 --- /dev/null +++ b/config/nvim/lua/plugins/neoscroll.lua @@ -0,0 +1,20 @@ +require('neoscroll').setup({ + ease_function = "quadratic", + -- Set any options as needed + pre_hook = function(info) if info == "cursorline" then vim.wo.cursorline = false end end, + post_hook = function(info) if info == "cursorline" then vim.wo.cursorline = true end end +}) + +local t = {} +-- Syntax: t[keys] = {function, {function arguments}} +t[''] = {'scroll', {'-vim.wo.scroll', 'true', '250', 'sine', [['cursorline']]}} +t[''] = {'scroll', { 'vim.wo.scroll', 'true', '250', 'sine', [['cursorline']]}} +t[''] = {'scroll', {'-vim.api.nvim_win_get_height(0)', 'true', '450'}} +t[''] = {'scroll', { 'vim.api.nvim_win_get_height(0)', 'true', '450'}} +t[''] = {'scroll', {'-0.10', 'false', '100'}} +t[''] = {'scroll', { '0.10', 'false', '100'}} +t['zt'] = {'zt', {'250'}} +t['zz'] = {'zz', {'250'}} +t['zb'] = {'zb', {'250'}} + +require('neoscroll.config').set_mappings(t) diff --git a/config/nvim/lua/plugins/nvim-tree.lua b/config/nvim/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..6849c26 --- /dev/null +++ b/config/nvim/lua/plugins/nvim-tree.lua @@ -0,0 +1,26 @@ + +-- disable netrw at the very start of your init.lua +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +-- optionally enable 24-bit colour +vim.opt.termguicolors = true + +-- empty setup using defaults +require("nvim-tree").setup() + +-- OR setup with some options +require("nvim-tree").setup({ + sort = { + sorter = "case_sensitive", + }, + view = { + width = 30, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = true, + }, +}) diff --git a/config/nvim/lua/plugins/nvim-tree.lua.bak b/config/nvim/lua/plugins/nvim-tree.lua.bak new file mode 100644 index 0000000..d4d813e --- /dev/null +++ b/config/nvim/lua/plugins/nvim-tree.lua.bak @@ -0,0 +1,67 @@ +local status_ok, nvim_tree = pcall(require, "nvim-tree") +if not status_ok then + return +end + +local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") +if not config_status_ok then + return +end + +local tree_cb = nvim_tree_config.nvim_tree_callback + +nvim_tree.setup { + update_focused_file = { + enable = true, + update_cwd = true, + }, + renderer = { + root_folder_modifier = ":t", + icons = { + glyphs = { + default = "", + symlink = "", + folder = { + arrow_open = "", + arrow_closed = "", + default = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + symlink_open = "", + }, + git = { + unstaged = "", + staged = "S", + unmerged = "", + renamed = "➜", + untracked = "U", + deleted = "", + ignored = "◌", + }, + }, + }, + }, + diagnostics = { + enable = true, + show_on_dirs = true, + icons = { + hint = "", + info = "", + warning = "", + error = "", + }, + }, + view = { + width = 30, + side = "left", + -- mappings = { + -- list = { + -- { key = { "l", "", "o" }, cb = tree_cb "edit" }, + -- { key = "h", cb = tree_cb "close_node" }, + -- { key = "v", cb = tree_cb "vsplit" }, + -- }, + -- }, + }, +} diff --git a/config/nvim/lua/plugins/project.lua b/config/nvim/lua/plugins/project.lua new file mode 100644 index 0000000..27a1329 --- /dev/null +++ b/config/nvim/lua/plugins/project.lua @@ -0,0 +1,48 @@ +local status_ok, project = pcall(require, "project_nvim") +if not status_ok then + return +end +project.setup({ + ---@usage set to false to disable project.nvim. + --- This is on by default since it's currently the expected behavior. + active = true, + + on_config_done = nil, + + ---@usage set to true to disable setting the current-woriking directory + --- Manual mode doesn't automatically change your root directory, so you have + --- the option to manually do so using `:ProjectRoot` command. + manual_mode = false, + + ---@usage Methods of detecting the root directory + --- Allowed values: **"lsp"** uses the native neovim lsp + --- **"pattern"** uses vim-rooter like glob pattern matching. Here + --- order matters: if one is not detected, the other is used as fallback. You + --- can also delete or rearangne the detection methods. + -- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project + detection_methods = { "pattern" }, + + ---@usage patterns used to detect root dir, when **"pattern"** is in detection_methods + patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" }, + + ---@ Show hidden files in telescope when searching for files in a project + show_hidden = false, + + ---@usage When set to false, you will get a message when project.nvim changes your directory. + -- When set to false, you will get a message when project.nvim changes your directory. + silent_chdir = true, + + ---@usage list of lsp client names to ignore when using **lsp** detection. eg: { "efm", ... } + ignore_lsp = {}, + + ---@type string + ---@usage path to store the project history for use in telescope + datapath = vim.fn.stdpath("data"), +}) + +local tele_status_ok, telescope = pcall(require, "telescope") +if not tele_status_ok then + return +end + +telescope.load_extension('projects') diff --git a/config/nvim/lua/plugins/telescope.lua b/config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..0706b51 --- /dev/null +++ b/config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,96 @@ +local status_ok, telescope = pcall(require, "telescope") +if not status_ok then + return +end + +local actions = require "telescope.actions" + +telescope.setup { + defaults = { + + prompt_prefix = " ", + selection_caret = " ", + path_display = { "smart" }, + + mappings = { + i = { + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.close, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + [""] = actions.complete_tag, + [""] = actions.which_key, -- keys from pressing + }, + + n = { + [""] = actions.close, + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + + ["j"] = actions.move_selection_next, + ["k"] = actions.move_selection_previous, + ["H"] = actions.move_to_top, + ["M"] = actions.move_to_middle, + ["L"] = actions.move_to_bottom, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + ["gg"] = actions.move_to_top, + ["G"] = actions.move_to_bottom, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + + ["?"] = actions.which_key, + }, + }, + }, + pickers = { + -- Default configuration for builtin pickers goes here: + -- picker_name = { + -- picker_config_key = value, + -- ... + -- } + -- Now the picker_config_key will be applied every time you call this + -- builtin picker + }, + extensions = { + -- Your extension configuration goes here: + -- extension_name = { + -- extension_config_key = value, + -- } + -- please take a look at the readme of the extension you want to configure + }, +} diff --git a/config/nvim/lua/plugins/toggleterm.lua b/config/nvim/lua/plugins/toggleterm.lua new file mode 100644 index 0000000..cecbd99 --- /dev/null +++ b/config/nvim/lua/plugins/toggleterm.lua @@ -0,0 +1,70 @@ +local status_ok, toggleterm = pcall(require, "toggleterm") +if not status_ok then + return +end + +toggleterm.setup({ + size = 20, + open_mapping = [[]], + hide_numbers = true, + shade_filetypes = {}, + shade_terminals = true, + shading_factor = 2, + start_in_insert = true, + insert_mappings = true, + persist_size = true, + direction = "float", + close_on_exit = true, + shell = vim.o.shell, + float_opts = { + border = "curved", + winblend = 0, + highlights = { + border = "Normal", + background = "Normal", + }, + }, +}) + +function _G.set_terminal_keymaps() + local opts = {noremap = true} + vim.api.nvim_buf_set_keymap(0, 't', '', [[]], opts) + vim.api.nvim_buf_set_keymap(0, 't', 'jk', [[]], opts) + vim.api.nvim_buf_set_keymap(0, 't', '', [[h]], opts) + vim.api.nvim_buf_set_keymap(0, 't', '', [[j]], opts) + vim.api.nvim_buf_set_keymap(0, 't', '', [[k]], opts) + vim.api.nvim_buf_set_keymap(0, 't', '', [[l]], opts) +end + +vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()') + +local Terminal = require("toggleterm.terminal").Terminal +local lazygit = Terminal:new({ cmd = "lazygit", hidden = true }) + +function _LAZYGIT_TOGGLE() + lazygit:toggle() +end + +local node = Terminal:new({ cmd = "node", hidden = true }) + +function _NODE_TOGGLE() + node:toggle() +end + +local ncdu = Terminal:new({ cmd = "ncdu", hidden = true }) + +function _NCDU_TOGGLE() + ncdu:toggle() +end + +local htop = Terminal:new({ cmd = "htop", hidden = true }) + +function _HTOP_TOGGLE() + htop:toggle() +end + +local python = Terminal:new({ cmd = "python", hidden = true }) + +function _PYTHON_TOGGLE() + python:toggle() +end diff --git a/config/nvim/lua/plugins/treesitter.lua b/config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..5ece94c --- /dev/null +++ b/config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,41 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "python", "lua", "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, + + -- List of parsers to ignore installing (for "all") + ignore_install = { }, + + ---- 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, + + -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to + -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is + -- the name of the parser) + -- list of language that will be disabled + disable = { }, + -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files + disable = function(lang, buf) + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, + + -- 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, + }, +} diff --git a/config/nvim/lua/plugins/whichkey.lua b/config/nvim/lua/plugins/whichkey.lua new file mode 100644 index 0000000..0e410d1 --- /dev/null +++ b/config/nvim/lua/plugins/whichkey.lua @@ -0,0 +1,187 @@ +local status_ok, which_key = pcall(require, "which-key") +if not status_ok then + return +end + +local setup = { + plugins = { + marks = true, -- shows a list of your marks on ' and ` + registers = true, -- shows your registers on " in NORMAL or in INSERT mode + spelling = { + enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions + suggestions = 20, -- how many suggestions should be shown in the list? + }, + -- the presets plugin, adds help for a bunch of default keybindings in Neovim + -- No actual key bindings are created + presets = { + operators = false, -- adds help for operators like d, y, ... and registers them for motion / text object completion + motions = true, -- adds help for motions + text_objects = true, -- help for text objects triggered after entering an operator + windows = true, -- default bindings on + nav = true, -- misc bindings to work with windows + z = true, -- bindings for folds, spelling and others prefixed with z + g = true, -- bindings for prefixed with g + }, + }, + -- add operators that will trigger motion and text object completion + -- to enable all native operators, set the preset / operators plugin above + -- operators = { gc = "Comments" }, + key_labels = { + -- override the label used to display some keys. It doesn't effect WK in any other way. + -- For example: + -- [""] = "SPC", + -- [""] = "RET", + -- [""] = "TAB", + }, + icons = { + breadcrumb = "»", -- symbol used in the command line area that shows your active key combo + separator = "➜", -- symbol used between a key and it's label + group = "+", -- symbol prepended to a group + }, + popup_mappings = { + scroll_down = "", -- binding to scroll down inside the popup + scroll_up = "", -- binding to scroll up inside the popup + }, + window = { + border = "rounded", -- none, single, double, shadow + position = "bottom", -- bottom, top + margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] + padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left] + winblend = 0, + }, + layout = { + height = { min = 4, max = 25 }, -- min and max height of the columns + width = { min = 20, max = 50 }, -- min and max width of the columns + spacing = 3, -- spacing between columns + align = "left", -- align columns left, center or right + }, + ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label + hidden = { "", "", "", "", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate + show_help = true, -- show help message on the command line when the popup is visible + triggers = "auto", -- automatically setup triggers + -- triggers = {""} -- or specify a list manually + triggers_blacklist = { + -- list of mode / prefixes that should never be hooked by WhichKey + -- this is mostly relevant for key maps that start with a native binding + -- most people should not need to change this + i = { "j", "k" }, + v = { "j", "k" }, + }, +} + +local opts = { + mode = "n", -- NORMAL mode + prefix = "", + buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings + silent = true, -- use `silent` when creating keymaps + noremap = true, -- use `noremap` when creating keymaps + nowait = true, -- use `nowait` when creating keymaps +} + +local mappings = { + ["a"] = { "Alpha", "Alpha" }, + ["b"] = { + "lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{previewer = false})", + "Buffers", + }, + ["e"] = { "NvimTreeToggle", "Explorer" }, + ["w"] = { "w!", "Save" }, + ["q"] = { "q!", "Quit" }, + ["c"] = { "Bdelete!", "Close Buffer" }, + ["h"] = { "nohlsearch", "No Highlight" }, + ["f"] = { + "lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})", + "Find files", + }, + ["F"] = { "Telescope live_grep theme=ivy", "Find Text" }, + ["P"] = { "lua require('telescope').extensions.projects.projects()", "Projects" }, + + p = { + name = "Packer", + c = { "PackerCompile", "Compile" }, + i = { "PackerInstall", "Install" }, + s = { "PackerSync", "Sync" }, + S = { "PackerStatus", "Status" }, + u = { "PackerUpdate", "Update" }, + }, + + g = { + name = "Git", + g = { "lua _LAZYGIT_TOGGLE()", "Lazygit" }, + j = { "lua require 'gitsigns'.next_hunk()", "Next Hunk" }, + k = { "lua require 'gitsigns'.prev_hunk()", "Prev Hunk" }, + l = { "lua require 'gitsigns'.blame_line()", "Blame" }, + p = { "lua require 'gitsigns'.preview_hunk()", "Preview Hunk" }, + r = { "lua require 'gitsigns'.reset_hunk()", "Reset Hunk" }, + R = { "lua require 'gitsigns'.reset_buffer()", "Reset Buffer" }, + s = { "lua require 'gitsigns'.stage_hunk()", "Stage Hunk" }, + u = { + "lua require 'gitsigns'.undo_stage_hunk()", + "Undo Stage Hunk", + }, + o = { "Telescope git_status", "Open changed file" }, + b = { "Telescope git_branches", "Checkout branch" }, + c = { "Telescope git_commits", "Checkout commit" }, + d = { + "Gitsigns diffthis HEAD", + "Diff", + }, + }, + + l = { + name = "LSP", + a = { "lua vim.lsp.buf.code_action()", "Code Action" }, + d = { + "Telescope diagnostics bufnr=0", + "Document Diagnostics", + }, + w = { + "Telescope diagnostics", + "Workspace Diagnostics", + }, + f = { "lua vim.lsp.buf.format{async=true}", "Format" }, + i = { "LspInfo", "Info" }, + I = { "LspInstallInfo", "Installer Info" }, + j = { + "lua vim.lsp.diagnostic.goto_next()", + "Next Diagnostic", + }, + k = { + "lua vim.lsp.diagnostic.goto_prev()", + "Prev Diagnostic", + }, + l = { "lua vim.lsp.codelens.run()", "CodeLens Action" }, + q = { "lua vim.diagnostic.setloclist()", "Quickfix" }, + r = { "lua vim.lsp.buf.rename()", "Rename" }, + s = { "Telescope lsp_document_symbols", "Document Symbols" }, + S = { + "Telescope lsp_dynamic_workspace_symbols", + "Workspace Symbols", + }, + }, + s = { + name = "Search", + b = { "Telescope git_branches", "Checkout branch" }, + c = { "Telescope colorscheme", "Colorscheme" }, + h = { "Telescope help_tags", "Find Help" }, + M = { "Telescope man_pages", "Man Pages" }, + r = { "Telescope oldfiles", "Open Recent File" }, + R = { "Telescope registers", "Registers" }, + k = { "Telescope keymaps", "Keymaps" }, + C = { "Telescope commands", "Commands" }, + }, + + t = { + name = "Terminal", + n = { "lua _NODE_TOGGLE()", "Node" }, + u = { "lua _NCDU_TOGGLE()", "NCDU" }, + t = { "lua _HTOP_TOGGLE()", "Htop" }, + p = { "lua _PYTHON_TOGGLE()", "Python" }, + f = { "ToggleTerm direction=float", "Float" }, + h = { "ToggleTerm size=10 direction=horizontal", "Horizontal" }, + v = { "ToggleTerm size=80 direction=vertical", "Vertical" }, + }, +} + +which_key.setup(setup) +which_key.register(mappings, opts) diff --git a/config/nvim/lua/ui/bluloco.lua b/config/nvim/lua/ui/bluloco.lua new file mode 100644 index 0000000..c28971e --- /dev/null +++ b/config/nvim/lua/ui/bluloco.lua @@ -0,0 +1,5 @@ +require("bluloco").setup({ + style = "auto", + transparent = false, + italics = true, +}) diff --git a/config/nvim/lua/ui/colorscheme.lua b/config/nvim/lua/ui/colorscheme.lua new file mode 100644 index 0000000..64832a4 --- /dev/null +++ b/config/nvim/lua/ui/colorscheme.lua @@ -0,0 +1,6 @@ +local colorscheme = "tokyonight" + +local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) +if not status_ok then + return +end diff --git a/config/nvim/lua/ui/dracula.lua b/config/nvim/lua/ui/dracula.lua new file mode 100644 index 0000000..f6d7b2d --- /dev/null +++ b/config/nvim/lua/ui/dracula.lua @@ -0,0 +1,52 @@ +local dracula = require("dracula") +dracula.setup({ + -- customize dracula color palette + colors = { + bg = "#282A36", + fg = "#F8F8F2", + selection = "#44475A", + comment = "#6272A4", + red = "#FF5555", + orange = "#FFB86C", + yellow = "#F1FA8C", + green = "#50fa7b", + purple = "#BD93F9", + cyan = "#8BE9FD", + pink = "#FF79C6", + bright_red = "#FF6E6E", + bright_green = "#69FF94", + bright_yellow = "#FFFFA5", + bright_blue = "#D6ACFF", + bright_magenta = "#FF92DF", + bright_cyan = "#A4FFFF", + bright_white = "#FFFFFF", + menu = "#21222C", + visual = "#3E4452", + gutter_fg = "#4B5263", + nontext = "#3B4048", + white = "#ABB2BF", + black = "#191A21", + }, + -- show the '~' characters after the end of buffers + show_end_of_buffer = true, -- default false + -- use transparent background + transparent_bg = true, -- default false + -- set custom lualine background color + lualine_bg_color = "#44475a", -- default nil + -- set italic comment + italic_comment = true, -- default false + -- overrides the default highlights with table see `:h synIDattr` + overrides = {}, + -- You can use overrides as table like this + -- overrides = { + -- NonText = { fg = "white" }, -- set NonText fg to white + -- NvimTreeIndentMarker = { link = "NonText" }, -- link to NonText highlight + -- Nothing = {} -- clear highlight of Nothing + -- }, + -- Or you can also use it like a function to get color from theme + -- overrides = function (colors) + -- return { + -- NonText = { fg = colors.white }, -- set NonText fg to white of theme + -- } + -- end, +}) diff --git a/config/nvim/lua/ui/onedark.lua b/config/nvim/lua/ui/onedark.lua new file mode 100644 index 0000000..cfb7122 --- /dev/null +++ b/config/nvim/lua/ui/onedark.lua @@ -0,0 +1,33 @@ +require('onedark').setup { + style = 'cool', + transparent = false, + term_colors = true, + ending_tildes = true, + cmp_itemkind_reverse = false, + + -- toggle theme style -- + toggle_style_key = nil, + toggle_style_list = {'dark', 'darker', 'cool', 'deep', 'warm', 'warmer', 'light'}, + + -- change code style -- + code_style = { + comments = 'italic', + keywords = 'italic', + functions = 'italic', + strings = 'italic', + variables = 'italic' + }, + lualine = { + transparent = false, + }, + + colors = {}, + highlights = {}, + + diagnostics = { + darker = true, + undercurl = true, + background = true, + }, +} +require('onedark').load() diff --git a/config/nvim/lua/ui/tokyonight.lua b/config/nvim/lua/ui/tokyonight.lua new file mode 100644 index 0000000..1a48cbb --- /dev/null +++ b/config/nvim/lua/ui/tokyonight.lua @@ -0,0 +1,35 @@ +require("tokyonight").setup({ + -- your configuration comes here + -- or leave it empty to use the default settings + style = "storm", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day` + light_style = "day", -- The theme is used when the background is set to light + transparent = false, -- Enable this to disable setting the background color + terminal_colors = true, -- Configure the colors used when opening a `:terminal` in [Neovim](https://github.com/neovim/neovim) + styles = { + -- Style to be applied to different syntax groups + -- Value is any valid attr-list value for `:help nvim_set_hl` + comments = { italic = true }, + keywords = { italic = true }, + functions = { italic = true }, + variables = { italic = true }, + -- Background styles. Can be "dark", "transparent" or "normal" + sidebars = "dark", -- style for sidebars, see below + floats = "dark", -- style for floating windows + }, + sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]` + day_brightness = 0.3, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors + hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**. + dim_inactive = false, -- dims inactive windows + lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold + + --- You can override specific color groups to use other groups or a hex color + --- function will be called with a ColorScheme table + ---@param colors ColorScheme + on_colors = function(colors) end, + + --- You can override specific highlights to use other groups or a hex color + --- function will be called with a Highlights and ColorScheme table + ---@param highlights Highlights + ---@param colors ColorScheme + on_highlights = function(highlights, colors) end, +}) diff --git a/config/nvim/plugin/packer_compiled.lua b/config/nvim/plugin/packer_compiled.lua new file mode 100644 index 0000000..cfe8056 --- /dev/null +++ b/config/nvim/plugin/packer_compiled.lua @@ -0,0 +1,279 @@ +-- Automatically generated packer.nvim plugin loader code + +if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then + vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') + return +end + +vim.api.nvim_command('packadd packer.nvim') + +local no_errors, error_msg = pcall(function() + +_G._packer = _G._packer or {} +_G._packer.inside_compile = true + +local time +local profile_info +local should_profile = false +if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end +else + time = function(chunk, start) end +end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + if threshold then + table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)') + end + + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/home/hirad/.cache/nvim/packer_hererocks/2.1.1702233742/share/lua/5.1/?.lua;/home/hirad/.cache/nvim/packer_hererocks/2.1.1702233742/share/lua/5.1/?/init.lua;/home/hirad/.cache/nvim/packer_hererocks/2.1.1702233742/lib/luarocks/rocks-5.1/?.lua;/home/hirad/.cache/nvim/packer_hererocks/2.1.1702233742/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/hirad/.cache/nvim/packer_hererocks/2.1.1702233742/lib/lua/5.1/?.so" +if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str +end + +if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern +end + +time([[Luarocks path setup]], false) +time([[try_loadstring definition]], true) +local function try_loadstring(s, component, name) + local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) + if not success then + vim.schedule(function() + vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) + end) + end + return result +end + +time([[try_loadstring definition]], false) +time([[Defining packer_plugins]], true) +_G.packer_plugins = { + ["Comment.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/Comment.nvim", + url = "https://github.com/numToStr/Comment.nvim" + }, + LuaSnip = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/LuaSnip", + url = "https://github.com/L3MON4D3/LuaSnip" + }, + ["alpha-nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/alpha-nvim", + url = "https://github.com/goolord/alpha-nvim" + }, + ["bufferline.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/bufferline.nvim", + url = "https://github.com/akinsho/bufferline.nvim" + }, + ["cmp-buffer"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/cmp-buffer", + url = "https://github.com/hrsh7th/cmp-buffer" + }, + ["cmp-nvim-lsp"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + ["cmp-nvim-lua"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua", + url = "https://github.com/hrsh7th/cmp-nvim-lua" + }, + ["cmp-path"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/cmp-path", + url = "https://github.com/hrsh7th/cmp-path" + }, + cmp_luasnip = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/cmp_luasnip", + url = "https://github.com/saadparwaiz1/cmp_luasnip" + }, + ["darkplus.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/darkplus.nvim", + url = "https://github.com/lunarvim/darkplus.nvim" + }, + ["dracula.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/dracula.nvim", + url = "https://github.com/Mofiqul/dracula.nvim" + }, + ["friendly-snippets"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/friendly-snippets", + url = "https://github.com/rafamadriz/friendly-snippets" + }, + ["gitsigns.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/gitsigns.nvim", + url = "https://github.com/lewis6991/gitsigns.nvim" + }, + ["impatient.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/impatient.nvim", + url = "https://github.com/lewis6991/impatient.nvim" + }, + ["indent-blankline.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim", + url = "https://github.com/lukas-reineke/indent-blankline.nvim" + }, + ["lualine.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/lualine.nvim", + url = "https://github.com/nvim-lualine/lualine.nvim" + }, + ["mason-lspconfig.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim", + url = "https://github.com/williamboman/mason-lspconfig.nvim" + }, + ["mason.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/mason.nvim", + url = "https://github.com/williamboman/mason.nvim" + }, + ["neoscroll.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/neoscroll.nvim", + url = "https://github.com/karb94/neoscroll.nvim" + }, + ["null-ls.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/null-ls.nvim", + url = "https://github.com/jose-elias-alvarez/null-ls.nvim" + }, + ["nvim-autopairs"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/nvim-autopairs", + url = "https://github.com/windwp/nvim-autopairs" + }, + ["nvim-cmp"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" + }, + ["nvim-lspconfig"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, + ["nvim-tree.lua"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", + url = "https://github.com/kyazdani42/nvim-tree.lua" + }, + ["nvim-treesitter"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-ts-context-commentstring"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/nvim-ts-context-commentstring", + url = "https://github.com/JoosepAlviste/nvim-ts-context-commentstring" + }, + ["nvim-web-devicons"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", + url = "https://github.com/kyazdani42/nvim-web-devicons" + }, + ["onedark.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/onedark.nvim", + url = "https://github.com/navarasu/onedark.nvim" + }, + ["packer.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + ["plenary.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + ["project.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/project.nvim", + url = "https://github.com/ahmedkhalf/project.nvim" + }, + ["telescope.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/telescope.nvim", + url = "https://github.com/nvim-telescope/telescope.nvim" + }, + ["toggleterm.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/toggleterm.nvim", + url = "https://github.com/akinsho/toggleterm.nvim" + }, + ["tokyonight.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/tokyonight.nvim", + url = "https://github.com/folke/tokyonight.nvim" + }, + ["vim-bbye"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/vim-bbye", + url = "https://github.com/moll/vim-bbye" + }, + ["vim-illuminate"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/vim-illuminate", + url = "https://github.com/RRethy/vim-illuminate" + }, + ["which-key.nvim"] = { + loaded = true, + path = "/home/hirad/.local/share/nvim/site/pack/packer/start/which-key.nvim", + url = "https://github.com/folke/which-key.nvim" + } +} + +time([[Defining packer_plugins]], false) + +_G._packer.inside_compile = false +if _G._packer.needs_bufread == true then + vim.cmd("doautocmd BufRead") +end +_G._packer.needs_bufread = false + +if should_profile then save_profiles() end + +end) + +if not no_errors then + error_msg = error_msg:gsub('"', '\\"') + vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') +end diff --git a/config/wireplumber/wireplumber.conf.d/51-disable-suspension.conf b/config/wireplumber/wireplumber.conf.d/51-disable-suspension.conf new file mode 100644 index 0000000..a317985 --- /dev/null +++ b/config/wireplumber/wireplumber.conf.d/51-disable-suspension.conf @@ -0,0 +1,39 @@ +monitor.alsa.rules = [ + { + matches = [ + { + # Matches all sources + node.name = "~alsa_input.*" + }, + { + # Matches all sinks + node.name = "~alsa_output.*" + } + ] + actions = { + update-props = { + session.suspend-timeout-seconds = 0 + } + } + } +] +# bluetooth devices +monitor.bluez.rules = [ + { + matches = [ + { + # Matches all sources + node.name = "~bluez_input.*" + }, + { + # Matches all sinks + node.name = "~bluez_output.*" + } + ] + actions = { + update-props = { + session.suspend-timeout-seconds = 0 + } + } + } +]