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',
})
-- Fix Undefined global 'vim'
lsp.configure('sumneko_lua', {
settings = {
@ -40,6 +41,8 @@ lsp.setup_nvim_cmp({
mapping = cmp_mappings
})
lsp.set_preferences({
suggest_lsp_servers = false,
sign_icons = {
@ -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({})

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 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({}),
},
})

View File

@ -4,3 +4,4 @@ vim.keymap.set('n', '<C-p>', builtin.git_files, {})
vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") });
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
additional_vim_regex_highlighting = false,
},
autotag = {
enable = true,
},
}

View File

@ -24,9 +24,9 @@ return require('packer').startup(function(use)
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/playground')
@ -54,6 +54,7 @@ return require('packer').startup(function(use)
{ 'neovim/nvim-lspconfig' },
{ 'williamboman/mason.nvim' },
{ 'williamboman/mason-lspconfig.nvim' },
{ 'jay-babu/mason-null-ls.nvim' },
-- Autocompletion
{ 'hrsh7th/nvim-cmp' },
{ 'hrsh7th/cmp-buffer' },
@ -77,26 +78,58 @@ return require('packer').startup(function(use)
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"
-- 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
-- })
--
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 <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.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("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("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.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