diff --git a/configs/nvim/after/plugin/auto-pair.lua b/configs/nvim/after/plugin/auto-pair.lua index 4de6add..1e64d6b 100644 --- a/configs/nvim/after/plugin/auto-pair.lua +++ b/configs/nvim/after/plugin/auto-pair.lua @@ -1 +1,28 @@ -require("nvim-autopairs").setup() +-- -- -- Setup nvim-cmp. +-- local status_ok, npairs = pcall(require, "nvim-autopairs") +-- if not status_ok then +-- return +-- end +-- +-- npairs.setup({ +-- check_ts = true, -- treesitter integration +-- disable_filetype = { "TelescopePrompt" }, +-- ts_config = { +-- lua = { "string", "source" }, +-- javascript = { "string", "template_string" }, +-- java = false, +-- }, +-- +-- 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", +-- }, +-- }) +-- diff --git a/configs/nvim/after/plugin/autotag.lua b/configs/nvim/after/plugin/autotag.lua new file mode 100644 index 0000000..d77a4e8 --- /dev/null +++ b/configs/nvim/after/plugin/autotag.lua @@ -0,0 +1,4 @@ +local status, autotag = pcall(require, 'nvim-ts-autotag') +if (not status) then return end + +autotag.setup() diff --git a/configs/nvim/after/plugin/colorizer.lua b/configs/nvim/after/plugin/colorizer.lua new file mode 100644 index 0000000..277b9b3 --- /dev/null +++ b/configs/nvim/after/plugin/colorizer.lua @@ -0,0 +1,4 @@ +local status, colorizer = pcall(require, 'colorizer') +if (not status) then return end + +colorizer.setup() diff --git a/configs/nvim/after/plugin/lsp.lua b/configs/nvim/after/plugin/lsp.lua index dd78ff6..81a413e 100644 --- a/configs/nvim/after/plugin/lsp.lua +++ b/configs/nvim/after/plugin/lsp.lua @@ -3,13 +3,14 @@ local lsp = require('lsp-zero') lsp.preset('recommended') lsp.ensure_installed({ - 'tsserver', - 'eslint', - 'pyright', - 'sumneko_lua', - 'rust_analyzer', + 'tsserver', + 'eslint', + 'pyright', + 'sumneko_lua', + 'rust_analyzer', }) + -- Fix Undefined global 'vim' lsp.configure('sumneko_lua', { settings = { @@ -23,12 +24,12 @@ lsp.configure('sumneko_lua', { local cmp = require('cmp') -local cmp_select = {behavior = cmp.SelectBehavior.Select} +local cmp_select = { behavior = cmp.SelectBehavior.Select } local cmp_mappings = lsp.defaults.cmp_mappings({ - [''] = cmp.mapping.select_prev_item(cmp_select), - [''] = cmp.mapping.select_next_item(cmp_select), - [''] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.complete(), + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), }) -- disable completion with tab @@ -37,9 +38,11 @@ cmp_mappings[''] = nil cmp_mappings[''] = nil lsp.setup_nvim_cmp({ - mapping = cmp_mappings + mapping = cmp_mappings }) + + lsp.set_preferences({ suggest_lsp_servers = false, sign_icons = { @@ -51,23 +54,23 @@ lsp.set_preferences({ }) lsp.on_attach(function(client, bufnr) - local opts = {buffer = bufnr, remap = false} + local opts = { buffer = bufnr, remap = false } - if client.name == "eslint" then - vim.cmd.LspStop('eslint') - return - end + if client.name == "eslint" then + vim.cmd.LspStop('eslint') + return + end - vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) - vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) - vim.keymap.set("n", "vws", vim.lsp.buf.workspace_symbol, opts) - vim.keymap.set("n", "vd", vim.diagnostic.open_float, opts) - vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts) - vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts) - vim.keymap.set("n", "vca", vim.lsp.buf.code_action, opts) - vim.keymap.set("n", "vrr", vim.lsp.buf.references, opts) - vim.keymap.set("n", "vrn", vim.lsp.buf.rename, opts) - vim.keymap.set("i", "", vim.lsp.buf.signature_help, opts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) + vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) + vim.keymap.set("n", "vws", vim.lsp.buf.workspace_symbol, opts) + vim.keymap.set("n", "vd", vim.diagnostic.open_float, opts) + vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts) + vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts) + vim.keymap.set("n", "vca", vim.lsp.buf.code_action, opts) + vim.keymap.set("n", "vrr", vim.lsp.buf.references, opts) + vim.keymap.set("n", "vrn", vim.lsp.buf.rename, opts) + vim.keymap.set("i", "", vim.lsp.buf.signature_help, opts) end) lsp.setup() @@ -76,12 +79,9 @@ vim.diagnostic.config({ virtual_text = true, }) -local null_ls = require("null-ls") - -null_ls.setup({ - sources = { - null_ls.builtins.formatting.stylua, - null_ls.builtins.diagnostics.eslint, - null_ls.builtins.completion.spell, - }, +local mason_nullls = require("mason-null-ls") +mason_nullls.setup({ + automatic_installation = true, + automatic_setup = true, }) +mason_nullls.setup_handlers({}) diff --git a/configs/nvim/after/plugin/neosolarized.lua b/configs/nvim/after/plugin/neosolarized.lua new file mode 100644 index 0000000..3cbd397 --- /dev/null +++ b/configs/nvim/after/plugin/neosolarized.lua @@ -0,0 +1,32 @@ +local status, n = pcall(require, "neosolarized") +if (not status) then return end + +n.setup({ + comment_italics = true, +}) + +local cb = require('colorbuddy.init') +local Color = cb.Color +local colors = cb.colors +local Group = cb.Group +local groups = cb.groups +local styles = cb.styles + +Color.new('black', '#000000') +Group.new('CursorLine', colors.none, colors.base03, styles.NONE, colors.base1) +Group.new('CursorLineNr', colors.yellow, colors.black, styles.NONE, colors.base1) +Group.new('Visual', colors.none, colors.base03, styles.reverse) + +local cError = groups.Error.fg +local cInfo = groups.Information.fg +local cWarn = groups.Warning.fg +local cHint = groups.Hint.fg + +Group.new("DiagnosticVirtualTextError", cError, cError:dark():dark():dark():dark(), styles.NONE) +Group.new("DiagnosticVirtualTextInfo", cInfo, cInfo:dark():dark():dark(), styles.NONE) +Group.new("DiagnosticVirtualTextWarn", cWarn, cWarn:dark():dark():dark(), styles.NONE) +Group.new("DiagnosticVirtualTextHint", cHint, cHint:dark():dark():dark(), styles.NONE) +Group.new("DiagnosticUnderlineError", colors.none, colors.none, styles.undercurl, cError) +Group.new("DiagnosticUnderlineWarn", colors.none, colors.none, styles.undercurl, cWarn) +Group.new("DiagnosticUnderlineInfo", colors.none, colors.none, styles.undercurl, cInfo) +Group.new("DiagnosticUnderlineHint", colors.none, colors.none, styles.undercurl, cHint) diff --git a/configs/nvim/after/plugin/null.lua b/configs/nvim/after/plugin/null.lua index eb80271..a8c7948 100644 --- a/configs/nvim/after/plugin/null.lua +++ b/configs/nvim/after/plugin/null.lua @@ -1,30 +1,17 @@ -local null_ls = require("null-ls") -local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) -local format = null_ls.builtins.formatting +local null_ls_status_ok, null_ls = pcall(require, "null-ls") +if not null_ls_status_ok then + return +end + +local formatting = null_ls.builtins.formatting +local diagnostics = null_ls.builtins.diagnostics null_ls.setup({ - on_attach = function(client, bufnr) - if client.supports_method("textDocument/formatting") then - vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = function() - -- on 0.8, you should use vim.lsp.buf.format({ bufnr = bufnr }) instead - vim.lsp.buf.format({ bufnr = bufnr}) - end, - }) - end - end, + debug = false, sources = { - format.stylua, - format.rustfmt, - format.autopep8, - format.fourmolu, - null_ls.builtins.diagnostics.eslint, - null_ls.builtins.completion.spell, + formatting.prettier.with({ extra_args = {"--no-semi"}}), + formatting.black.with({ extra_args = {"--fast"}}), + -- formatting.rustfmt({}), }, }) - - diff --git a/configs/nvim/after/plugin/telescope.lua b/configs/nvim/after/plugin/telescope.lua index 4806008..fe38c06 100644 --- a/configs/nvim/after/plugin/telescope.lua +++ b/configs/nvim/after/plugin/telescope.lua @@ -4,3 +4,4 @@ vim.keymap.set('n', '', builtin.git_files, {}) vim.keymap.set('n', 'ps', function() builtin.grep_string({ search = vim.fn.input("Grep > ") }); end) +vim.keymap.set('n', 'pz', builtin.live_grep, {}) diff --git a/configs/nvim/after/plugin/tree.lua b/configs/nvim/after/plugin/tree.lua index df3b05c..8bfbe61 100644 --- a/configs/nvim/after/plugin/tree.lua +++ b/configs/nvim/after/plugin/tree.lua @@ -1 +1,21 @@ -require("nvim-tree").setup() +require("nvim-tree").setup({ + sort_by = "case_sensitive", + view = { + adaptive_size = true, + prefer_startup_root = true, + update_focused_file = { + { update_root = true }, + }, + mappings = { + list = { + { key = "u", action = "dir_up" }, + }, + }, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = true, + }, +}) diff --git a/configs/nvim/after/plugin/treesitter.lua b/configs/nvim/after/plugin/treesitter.lua index 47aac7e..fbecef1 100644 --- a/configs/nvim/after/plugin/treesitter.lua +++ b/configs/nvim/after/plugin/treesitter.lua @@ -18,4 +18,8 @@ require'nvim-treesitter.configs'.setup { -- Instead of true it can also be a list of languages additional_vim_regex_highlighting = false, }, + + autotag = { + enable = true, + }, } diff --git a/configs/nvim/lua/jabuxas/packer.lua b/configs/nvim/lua/jabuxas/packer.lua index d7d2290..9ef70b9 100644 --- a/configs/nvim/lua/jabuxas/packer.lua +++ b/configs/nvim/lua/jabuxas/packer.lua @@ -1,12 +1,12 @@ local ensure_packer = function() - local fn = vim.fn - local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' - if fn.empty(fn.glob(install_path)) > 0 then - fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) - vim.cmd [[packadd packer.nvim]] - return true - end - return false + local fn = vim.fn + local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' + if fn.empty(fn.glob(install_path)) > 0 then + fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }) + vim.cmd [[packadd packer.nvim]] + return true + end + return false end local packer_bootstrap = ensure_packer() @@ -19,16 +19,16 @@ return require('packer').startup(function(use) use { 'nvim-telescope/telescope.nvim', tag = '0.1.0', -- or , branch = '0.1.x', - requires = { {'nvim-lua/plenary.nvim'} } + requires = { { 'nvim-lua/plenary.nvim' } } } use({ 'rose-pine/neovim', as = 'rose-pine', - config = function() - vim.cmd('colorscheme rose-pine') - end + -- config = function() + -- vim.cmd('colorscheme rose-pine') + -- end }) - use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'}) + use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' }) use('nvim-treesitter/playground') use('theprimeagen/harpoon') use('mbbill/undotree') @@ -51,20 +51,21 @@ return require('packer').startup(function(use) 'VonHeikemen/lsp-zero.nvim', requires = { -- LSP Support - {'neovim/nvim-lspconfig'}, - {'williamboman/mason.nvim'}, - {'williamboman/mason-lspconfig.nvim'}, + { 'neovim/nvim-lspconfig' }, + { 'williamboman/mason.nvim' }, + { 'williamboman/mason-lspconfig.nvim' }, + { 'jay-babu/mason-null-ls.nvim' }, -- Autocompletion - {'hrsh7th/nvim-cmp'}, - {'hrsh7th/cmp-buffer'}, - {'hrsh7th/cmp-path'}, - {'saadparwaiz1/cmp_luasnip'}, - {'hrsh7th/cmp-nvim-lsp'}, - {'hrsh7th/cmp-nvim-lua'}, + { 'hrsh7th/nvim-cmp' }, + { 'hrsh7th/cmp-buffer' }, + { 'hrsh7th/cmp-path' }, + { 'saadparwaiz1/cmp_luasnip' }, + { 'hrsh7th/cmp-nvim-lsp' }, + { 'hrsh7th/cmp-nvim-lua' }, -- Snippets - {'L3MON4D3/LuaSnip'}, + { 'L3MON4D3/LuaSnip' }, -- Snippet Collection (Optional) - {'rafamadriz/friendly-snippets'}, + { 'rafamadriz/friendly-snippets' }, } } use { @@ -74,29 +75,61 @@ return require('packer').startup(function(use) end } use 'nvim-tree/nvim-web-devicons' - use {'romgrk/barbar.nvim', wants = 'nvim-web-devicons'} + use { 'romgrk/barbar.nvim', wants = 'nvim-web-devicons' } use 'feline-nvim/feline.nvim' use 'xiyaowong/nvim-transparent' - use 'windwp/nvim-autopairs' - -- use({ - -- 'nyoom-engineering/oxocarbon.nvim', - -- as = 'oxocarbon', - -- config = function() - -- vim.opt.background = "dark" - -- vim.cmd('colorscheme oxocarbon') - -- end - -- }) - -- + -- use { + -- "windwp/nvim-autopairs", + -- config = function() require("nvim-autopairs").setup ({}) end + -- } + use({ + 'nyoom-engineering/oxocarbon.nvim', + as = 'oxocarbon', + config = function() + vim.opt.background = "dark" + -- vim.cmd('colorscheme oxocarbon') + end + }) + use({ + "neanias/everforest-nvim", + -- Optional; default configuration will be used if setup isn't called. + config = function() + -- vim.cmd('colorscheme everforest') + require("everforest").setup() + end, + }) + + use({ + "svrana/neosolarized.nvim", + requires = { + 'tjdevries/colorbuddy.nvim' + } + }) + + use({ + "aurum77/live-server.nvim", + run = function() + require "live_server.util".install() + end, + cmd = { "LiveServer", "LiveServerStart", "LiveServerStop" }, + }) + + use({ + "kylechui/nvim-surround", + tag = "*", -- Use for stability; omit to use `main` branch for the latest features + config = function() + require("nvim-surround").setup({ + -- Configuration here, or leave empty to use defaults + }) + end + }) + + use 'windwp/nvim-ts-autotag' + + use 'norcalli/nvim-colorizer.lua' + use 'ThePrimeagen/vim-be-good' + if packer_bootstrap then require('packer').sync() end end) - - --- -- Automatically source and re-compile packer whenever you save this init.lua --- local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true }) --- vim.api.nvim_create_autocmd('BufWritePost', { --- command = 'source | silent! LspStop | silent! LspStart | PackerCompile', --- group = packer_group, --- pattern = vim.fn.expand '$MYVIMRC', --- }) diff --git a/configs/nvim/lua/jabuxas/remap.lua b/configs/nvim/lua/jabuxas/remap.lua index 4c48138..7abdbfb 100644 --- a/configs/nvim/lua/jabuxas/remap.lua +++ b/configs/nvim/lua/jabuxas/remap.lua @@ -2,7 +2,7 @@ vim.keymap.set("n", "pv", vim.cmd.Ex) vim.keymap.set("i", "jk", "") vim.g.mapleader = " " --- vim.keymap.set("n", "pv", vim.cmd.Ex) +vim.keymap.set("n", "pv", vim.cmd.Ex) vim.keymap.set("n", "e", vim.cmd.NvimTreeToggle) vim.keymap.set("v", "J", ":m '>+1gv=gv") @@ -33,3 +33,6 @@ vim.keymap.set("n", "s", [[:%s/\<\>//gI< vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) vim.keymap.set("t", "", [[]]) + +vim.keymap.set("n", "", "ysst") +vim.keymap.set("v", "", "gSt") diff --git a/configs/nvim/lua/jabuxas/set.lua b/configs/nvim/lua/jabuxas/set.lua index 654df4d..1a5eab2 100644 --- a/configs/nvim/lua/jabuxas/set.lua +++ b/configs/nvim/lua/jabuxas/set.lua @@ -4,6 +4,7 @@ vim.opt.mouse = 'a' vim.opt.nu = true vim.opt.relativenumber = true +vim.opt.clipboard:append { 'unnamedplus' } vim.opt.tabstop = 4 vim.opt.softtabstop = 4 vim.opt.shiftwidth = 4 @@ -33,8 +34,8 @@ vim.opt.updatetime = 50 vim.g.mapleader = " " -vim.g.loaded_netrw = 1 -vim.g.loaded_netrwPlugin = 1 +-- vim.g.loaded_netrw = 1 +-- vim.g.loaded_netrwPlugin = 1 -- Case insensitive searching UNLESS /C or capital in search vim.o.ignorecase = true