giving up on autopair

This commit is contained in:
Lucas Barbieri 2023-01-10 10:07:38 -03:00
parent 8c86699468
commit 8b57b65974
12 changed files with 223 additions and 107 deletions

View File

@ -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 = "<M-e>",
-- chars = { "{", "[", "(", '"', "'" },
-- pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
-- offset = 0, -- Offset from pattern match
-- end_key = "$",
-- keys = "qwertyuiopzxcvbnmasdfghjkl",
-- check_comma = true,
-- highlight = "PmenuSel",
-- highlight_grey = "LineNr",
-- },
-- })
--

View File

@ -0,0 +1,4 @@
local status, autotag = pcall(require, 'nvim-ts-autotag')
if (not status) then return end
autotag.setup()

View File

@ -0,0 +1,4 @@
local status, colorizer = pcall(require, 'colorizer')
if (not status) then return end
colorizer.setup()

View File

@ -10,6 +10,7 @@ lsp.ensure_installed({
'rust_analyzer', 'rust_analyzer',
}) })
-- Fix Undefined global 'vim' -- Fix Undefined global 'vim'
lsp.configure('sumneko_lua', { lsp.configure('sumneko_lua', {
settings = { settings = {
@ -23,7 +24,7 @@ lsp.configure('sumneko_lua', {
local cmp = require('cmp') 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({ local cmp_mappings = lsp.defaults.cmp_mappings({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select), ['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
@ -40,6 +41,8 @@ lsp.setup_nvim_cmp({
mapping = cmp_mappings mapping = cmp_mappings
}) })
lsp.set_preferences({ lsp.set_preferences({
suggest_lsp_servers = false, suggest_lsp_servers = false,
sign_icons = { sign_icons = {
@ -51,7 +54,7 @@ lsp.set_preferences({
}) })
lsp.on_attach(function(client, bufnr) lsp.on_attach(function(client, bufnr)
local opts = {buffer = bufnr, remap = false} local opts = { buffer = bufnr, remap = false }
if client.name == "eslint" then if client.name == "eslint" then
vim.cmd.LspStop('eslint') vim.cmd.LspStop('eslint')
@ -76,12 +79,9 @@ vim.diagnostic.config({
virtual_text = true, virtual_text = true,
}) })
local null_ls = require("null-ls") local mason_nullls = require("mason-null-ls")
mason_nullls.setup({
null_ls.setup({ automatic_installation = true,
sources = { automatic_setup = true,
null_ls.builtins.formatting.stylua,
null_ls.builtins.diagnostics.eslint,
null_ls.builtins.completion.spell,
},
}) })
mason_nullls.setup_handlers({})

View File

@ -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)

View File

@ -1,30 +1,17 @@
local null_ls = require("null-ls") local null_ls_status_ok, null_ls = pcall(require, "null-ls")
local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) if not null_ls_status_ok then
local format = null_ls.builtins.formatting return
end
local formatting = null_ls.builtins.formatting
local diagnostics = null_ls.builtins.diagnostics
null_ls.setup({ null_ls.setup({
on_attach = function(client, bufnr) debug = false,
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,
sources = { sources = {
format.stylua, formatting.prettier.with({ extra_args = {"--no-semi"}}),
format.rustfmt, formatting.black.with({ extra_args = {"--fast"}}),
format.autopep8, -- formatting.rustfmt({}),
format.fourmolu,
null_ls.builtins.diagnostics.eslint,
null_ls.builtins.completion.spell,
}, },
}) })

View File

@ -4,3 +4,4 @@ vim.keymap.set('n', '<C-p>', builtin.git_files, {})
vim.keymap.set('n', '<leader>ps', function() vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") }); builtin.grep_string({ search = vim.fn.input("Grep > ") });
end) end)
vim.keymap.set('n', '<leader>pz', builtin.live_grep, {})

View File

@ -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,
},
})

View File

@ -18,4 +18,8 @@ require'nvim-treesitter.configs'.setup {
-- Instead of true it can also be a list of languages -- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false, additional_vim_regex_highlighting = false,
}, },
autotag = {
enable = true,
},
} }

View File

@ -1,8 +1,8 @@
local ensure_packer = function() local ensure_packer = function()
local fn = vim.fn local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
vim.cmd [[packadd packer.nvim]] vim.cmd [[packadd packer.nvim]]
return true return true
end end
@ -19,16 +19,16 @@ return require('packer').startup(function(use)
use { use {
'nvim-telescope/telescope.nvim', tag = '0.1.0', 'nvim-telescope/telescope.nvim', tag = '0.1.0',
-- or , branch = '0.1.x', -- or , branch = '0.1.x',
requires = { {'nvim-lua/plenary.nvim'} } requires = { { 'nvim-lua/plenary.nvim' } }
} }
use({ use({
'rose-pine/neovim', 'rose-pine/neovim',
as = 'rose-pine', as = 'rose-pine',
config = function() -- config = function()
vim.cmd('colorscheme rose-pine') -- vim.cmd('colorscheme rose-pine')
end -- end
}) })
use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'}) use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' })
use('nvim-treesitter/playground') use('nvim-treesitter/playground')
use('theprimeagen/harpoon') use('theprimeagen/harpoon')
use('mbbill/undotree') use('mbbill/undotree')
@ -51,20 +51,21 @@ return require('packer').startup(function(use)
'VonHeikemen/lsp-zero.nvim', 'VonHeikemen/lsp-zero.nvim',
requires = { requires = {
-- LSP Support -- LSP Support
{'neovim/nvim-lspconfig'}, { 'neovim/nvim-lspconfig' },
{'williamboman/mason.nvim'}, { 'williamboman/mason.nvim' },
{'williamboman/mason-lspconfig.nvim'}, { 'williamboman/mason-lspconfig.nvim' },
{ 'jay-babu/mason-null-ls.nvim' },
-- Autocompletion -- Autocompletion
{'hrsh7th/nvim-cmp'}, { 'hrsh7th/nvim-cmp' },
{'hrsh7th/cmp-buffer'}, { 'hrsh7th/cmp-buffer' },
{'hrsh7th/cmp-path'}, { 'hrsh7th/cmp-path' },
{'saadparwaiz1/cmp_luasnip'}, { 'saadparwaiz1/cmp_luasnip' },
{'hrsh7th/cmp-nvim-lsp'}, { 'hrsh7th/cmp-nvim-lsp' },
{'hrsh7th/cmp-nvim-lua'}, { 'hrsh7th/cmp-nvim-lua' },
-- Snippets -- Snippets
{'L3MON4D3/LuaSnip'}, { 'L3MON4D3/LuaSnip' },
-- Snippet Collection (Optional) -- Snippet Collection (Optional)
{'rafamadriz/friendly-snippets'}, { 'rafamadriz/friendly-snippets' },
} }
} }
use { use {
@ -74,29 +75,61 @@ return require('packer').startup(function(use)
end end
} }
use 'nvim-tree/nvim-web-devicons' 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 'feline-nvim/feline.nvim'
use 'xiyaowong/nvim-transparent' use 'xiyaowong/nvim-transparent'
use 'windwp/nvim-autopairs' -- use {
-- use({ -- "windwp/nvim-autopairs",
-- 'nyoom-engineering/oxocarbon.nvim', -- config = function() require("nvim-autopairs").setup ({}) end
-- as = 'oxocarbon', -- }
-- config = function() use({
-- vim.opt.background = "dark" 'nyoom-engineering/oxocarbon.nvim',
as = 'oxocarbon',
config = function()
vim.opt.background = "dark"
-- vim.cmd('colorscheme oxocarbon') -- vim.cmd('colorscheme oxocarbon')
-- end 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 if packer_bootstrap then
require('packer').sync() require('packer').sync()
end end
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 <afile> | silent! LspStop | silent! LspStart | PackerCompile',
-- group = packer_group,
-- pattern = vim.fn.expand '$MYVIMRC',
-- })

View File

@ -2,7 +2,7 @@ vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
vim.keymap.set("i", "jk", "<Esc>") vim.keymap.set("i", "jk", "<Esc>")
vim.g.mapleader = " " vim.g.mapleader = " "
-- vim.keymap.set("n", "<leader>pv", vim.cmd.Ex) vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
vim.keymap.set("n", "<leader>e", vim.cmd.NvimTreeToggle) vim.keymap.set("n", "<leader>e", vim.cmd.NvimTreeToggle)
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
@ -33,3 +33,6 @@ vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true }) vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
vim.keymap.set("t", "<leader><Esc>", [[<C-\><C-n>]]) vim.keymap.set("t", "<leader><Esc>", [[<C-\><C-n>]])
vim.keymap.set("n", "<C-f>", "ysst")
vim.keymap.set("v", "<C-f>", "gSt")

View File

@ -4,6 +4,7 @@ vim.opt.mouse = 'a'
vim.opt.nu = true vim.opt.nu = true
vim.opt.relativenumber = true vim.opt.relativenumber = true
vim.opt.clipboard:append { 'unnamedplus' }
vim.opt.tabstop = 4 vim.opt.tabstop = 4
vim.opt.softtabstop = 4 vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4 vim.opt.shiftwidth = 4
@ -33,8 +34,8 @@ vim.opt.updatetime = 50
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.loaded_netrw = 1 -- vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1 -- vim.g.loaded_netrwPlugin = 1
-- Case insensitive searching UNLESS /C or capital in search -- Case insensitive searching UNLESS /C or capital in search
vim.o.ignorecase = true vim.o.ignorecase = true