add the rest of my config

pretty much all of it, i just need to probably add some sort of barbar.nvim thingy or bufferline, idk.
This commit is contained in:
Lucas Barbieri 2023-08-01 20:43:02 -03:00
parent 0a69a17d9f
commit 6afe9d61c3
14 changed files with 380 additions and 120 deletions

137
init.lua
View File

@ -49,28 +49,22 @@ require('lazy').setup({
-- Useful status updates for LSP -- Useful status updates for LSP
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, {
'j-hui/fidget.nvim',
tag = 'legacy',
opts = {
window = {
blend = 0,
border = "rounded",
},
},
},
-- Additional lua configuration, makes nvim stuff amazing! -- Additional lua configuration, makes nvim stuff amazing!
'folke/neodev.nvim', 'folke/neodev.nvim',
}, },
}, },
{
-- Autocompletion
'hrsh7th/nvim-cmp',
dependencies = {
-- Snippet Engine & its associated nvim-cmp source
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
-- Adds LSP completion capabilities
'hrsh7th/cmp-nvim-lsp',
-- Adds a number of user-friendly snippets
'rafamadriz/friendly-snippets',
},
},
-- Useful plugin to show you pending keybinds. -- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} }, { 'folke/which-key.nvim', opts = {} },
@ -95,54 +89,6 @@ require('lazy').setup({
}, },
}, },
{
'svrana/neosolarized.nvim',
priority = 1000,
dependencies = {
"tjdevries/colorbuddy.nvim"
},
config = function()
local status, n = pcall(require, "neosolarized")
if (not status) then return end
n.setup({
comment_italics = true,
-- background_set = 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('white', '#ffffff')
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)
Group.new("Macro", groups.PreProc, colors.none, styles.italic + styles.bold)
Group.link("Function", groups.Function, colors.none, styles.italic)
Group.new("Conditional", groups.Statement, colors.none, styles.italic)
Group.new("Boolean", groups.Constant, colors.none, styles.bold)
Group.new("HoverBorder", colors.yellow, colors.none, styles.NONE)
end,
},
{ {
-- Set lualine as statusline -- Set lualine as statusline
@ -151,7 +97,7 @@ require('lazy').setup({
opts = { opts = {
options = { options = {
icons_enabled = false, icons_enabled = false,
theme = 'onedark', theme = 'ayu_dark',
component_separators = '|', component_separators = '|',
section_separators = '', section_separators = '',
}, },
@ -200,8 +146,8 @@ require('lazy').setup({
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
-- These are some example plugins that I've included in the kickstart repository. -- These are some example plugins that I've included in the kickstart repository.
-- Uncomment any of the lines below to enable them. -- Uncomment any of the lines below to enable them.
-- require 'kickstart.plugins.autoformat', require 'kickstart.plugins.autoformat',
-- require 'kickstart.plugins.debug', require 'kickstart.plugins.debug',
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
@ -209,7 +155,7 @@ require('lazy').setup({
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- --
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
-- { import = 'custom.plugins' }, { import = 'custom.plugins' },
}, {}) }, {})
-- [[ Setting options ]] -- [[ Setting options ]]
@ -439,7 +385,7 @@ local servers = {
-- pyright = {}, -- pyright = {},
-- rust_analyzer = {}, -- rust_analyzer = {},
-- tsserver = {}, -- tsserver = {},
-- html = { filetypes = { 'html', 'twig', 'hbs'} }, html = { provideFormatter = false },
lua_ls = { lua_ls = {
Lua = { Lua = {
@ -455,6 +401,7 @@ require('neodev').setup()
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers -- nvim-cmp supports additional completion capabilities, so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
capabilities.textDocument.completion.completionItem.snippetSupport = true
-- Ensure the servers above are installed -- Ensure the servers above are installed
local mason_lspconfig = require 'mason-lspconfig' local mason_lspconfig = require 'mason-lspconfig'
@ -474,57 +421,7 @@ mason_lspconfig.setup_handlers {
end end
} }
-- [[ Configure nvim-cmp ]] require("jabuxas")
-- See `:help cmp`
local cmp = require 'cmp'
local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {}
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {},
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
}
for _, group in ipairs(vim.fn.getcompletion("@lsp", "highlight")) do
vim.api.nvim_set_hl(0, group, {})
end
-- The line beneath this is called `modeline`. See `:help modeline` -- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et -- vim: ts=2 sts=2 sw=2 et

View File

@ -0,0 +1,7 @@
-- autotag and autopairs plugins
return {
"windwp/nvim-autopairs",
event = "InsertEnter",
opts = {
disable_filetype = { "TelescopePrompt", "vim" }, },
}

151
lua/custom/plugins/cmp.lua Normal file
View File

@ -0,0 +1,151 @@
return {
'hrsh7th/nvim-cmp',
dependencies = {
-- Snippet Engine & its associated nvim-cmp source
'L3MON4D3/LuaSnip',
{
'onsails/lspkind.nvim',
config = function()
require('lspkind').init({
mode = "symbol",
preset = "default",
symbol_map = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
-- Snippet = " ",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = ""
},
})
end
},
'saadparwaiz1/cmp_luasnip',
-- Adds LSP completion capabilities
'hrsh7th/cmp-nvim-lsp',
-- Adds a number of user-friendly snippets
'rafamadriz/friendly-snippets',
},
config = function()
local cmp = require 'cmp'
local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {}
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
sorting = {
-- TODO: Would be cool to add stuff like "See variable names before method names" in rust, or something like that.
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
-- copied from cmp-under, but I don't think I need the plugin for this.
-- I might add some more of my own.
function(entry1, entry2)
local _, entry1_under = entry1.completion_item.label:find("^_+")
local _, entry2_under = entry2.completion_item.label:find("^_+")
entry1_under = entry1_under or 0
entry2_under = entry2_under or 0
if entry1_under > entry2_under then
return false
elseif entry1_under < entry2_under then
return true
end
end,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
mapping = cmp.mapping.preset.insert {
['<C-p>'] = cmp.mapping.select_next_item(),
['<C-n>'] = cmp.mapping.select_prev_item(),
['<C-k>'] = cmp.mapping.scroll_docs(-4),
['<C-j>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {},
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'buffer' },
{ name = 'path' },
},
formatting = {
fields = { "menu", "abbr", "kind" },
format = function(entry, item)
local menu_icon = {
nvim_lsp = "",
luasnip = "",
buffer = 'Ω ',
path = "",
}
item.menu = menu_icon[entry.source.name]
item.kind = " " .. item.kind
return item
end,
},
window = {
completion = cmp.config.window.bordered({}),
documentation = cmp.config.window.bordered({}),
},
}
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
end,
}

View File

@ -0,0 +1,15 @@
return {
"norcalli/nvim-colorizer.lua",
opts = {
'*',
css = {
RGB = true,
RRGGB = true,
names = true,
rgb_fn = true,
hsl_fn = true,
css = true,
css_fn = true,
}
},
}

View File

@ -0,0 +1,15 @@
return {
"mattn/emmet-vim",
config = function()
vim.g.user_emmet_leader_key = ","
vim.g.user_emmet_install_global = 0
local autocmd = vim.api.nvim_create_autocmd
autocmd("FileType", { pattern = "html", command = [[EmmetInstall]] })
autocmd("FileType", { pattern = "css", command = [[EmmetInstall]] })
vim.keymap.set("n", "<leader>e", function()
vim.cmd(string.format("Emmet %s", vim.fn.input("Emmet: ")))
end)
end
}

View File

@ -0,0 +1,4 @@
return {
"ThePrimeagen/harpoon",
opts = {},
}

View File

@ -0,0 +1,11 @@
return {
"jose-elias-alvarez/null-ls.nvim",
opts = {
sources = {
require("null-ls").builtins.formatting.black.with({
extra_args = { "--line-length=80" }
}),
require("null-ls").builtins.formatting.prettierd
}
}
}

View File

@ -0,0 +1,17 @@
return {
"alexghergh/nvim-tmux-navigation",
config = function()
local nvim_tmux_nav = require('nvim-tmux-navigation')
nvim_tmux_nav.setup {
disable_when_zoomed = true -- defaults to false
}
vim.keymap.set('n', "<C-h>", nvim_tmux_nav.NvimTmuxNavigateLeft)
vim.keymap.set('n', "<C-j>", nvim_tmux_nav.NvimTmuxNavigateDown)
vim.keymap.set('n', "<C-k>", nvim_tmux_nav.NvimTmuxNavigateUp)
vim.keymap.set('n', "<C-l>", nvim_tmux_nav.NvimTmuxNavigateRight)
vim.keymap.set('n', "<C-\\>", nvim_tmux_nav.NvimTmuxNavigateLastActive)
vim.keymap.set('n', "<C-Space>", nvim_tmux_nav.NvimTmuxNavigateNext)
end
}

View File

@ -0,0 +1,18 @@
return {
'maxmx03/solarized.nvim',
lazy = false,
priority = 1000,
config = function()
vim.o.background = 'dark' -- or 'light'
require('solarized').setup({
transparent = true,
theme = 'neo',
styles = {
functions = { bold = true, italic = false }
},
})
vim.cmd.colorscheme 'solarized'
end,
}
-- vim: sw=2 ts=2 sts=2 et

View File

@ -0,0 +1,5 @@
return {
"xiyaowong/transparent.nvim",
lazy = false,
opts = {},
}

View File

@ -0,0 +1,13 @@
return {
"folke/zen-mode.nvim",
opts = {
tmux = { enabled = true },
kitty = {
enabled = true,
font = "+5",
}
},
config = function()
vim.keymap.set("n", "<leader>z", "<cmd>ZenMode<CR>", { silent = true })
end
}

2
lua/jabuxas/init.lua Normal file
View File

@ -0,0 +1,2 @@
require("jabuxas.remap")
require("jabuxas.set")

55
lua/jabuxas/remap.lua Normal file
View File

@ -0,0 +1,55 @@
local keymap = vim.keymap
keymap.set("n", "<leader>pv", vim.cmd.Ex)
keymap.set("n", "sf", vim.cmd.Ex)
keymap.set("v", "J", ":m '>+1<CR>gv=gv")
keymap.set("v", "K", ":m '<-2<CR>gv=gv")
keymap.set("n", "J", "mzJ`z")
keymap.set("n", "<C-d>", "<C-d>zz")
keymap.set("n", "<C-u>", "<C-u>zz")
keymap.set("n", "n", "nzzzv")
keymap.set("n", "N", "Nzzzv")
keymap.set("x", "<leader>p", [["_dP]])
keymap.set({ "n", "v" }, "<leader>yy", [["+y]])
keymap.set("n", "<leader>Y", [["+Y]])
keymap.set({ "n", "v" }, "<leader>dd", [["_d]])
keymap.set("i", "<C-c>", "<Esc>")
keymap.set("n", "Q", "<nop>")
keymap.set("n", "<C-f>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
keymap.set("n", "<leader>f", vim.lsp.buf.format)
keymap.set("n", "<A-k>", "<cmd>cnext<CR>zz")
keymap.set("n", "<A-j>", "<cmd>cprev<CR>zz")
keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
keymap.set("n", "<leader>rr", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
keymap.set("t", "<leader><Esc>", [[<C-\><C-n>]])
keymap.set("n", "<leader>Sv", "<C-w>v")
keymap.set("n", "<leader>Sh", "<C-w>s")
keymap.set("n", "<leader>Se", "<C-w>=")
keymap.set("n", "<leader>Sx", ":close<CR>")
keymap.set("n", "<leader>S=", "<C-w>+")
keymap.set("n", "<leader>S-", "<C-w>-")
-- keymap.set("n", "<C-h>", nvim_tmux_nav.NvimTmuxNavigateLeft)
-- keymap.set("n", "<C-j>", nvim_tmux_nav.NvimTmuxNavigateDown)
-- keymap.set("n", "<C-k>", nvim_tmux_nav.NvimTmuxNavigateUp)
-- keymap.set("n", "<C-l>", nvim_tmux_nav.NvimTmuxNavigateRight)
-- keymap.set("n", "<C-\\>", nvim_tmux_nav.NvimTmuxNavigateLastActive)
-- keymap.set("n", "<C-Space>", nvim_tmux_nav.NvimTmuxNavigateNext)
keymap.set("n", "<leader>sm", "<Cmd>lua require('maximize').toggle()<CR>")
keymap.set("n", "+", "<C-a>")
keymap.set("n", "-", "<C-x>")
keymap.set("n", "<left>", "<C-w><")
keymap.set("n", "<right>", "<C-w>>")
keymap.set("n", "<up>", "<C-w>+")
keymap.set("n", "<down>", "<C-w>-")

50
lua/jabuxas/set.lua Normal file
View File

@ -0,0 +1,50 @@
-- vim.opt.guicursor = ""
vim.opt.mouse = "a"
vim.opt.nu = true
vim.opt.relativenumber = true
vim.opt.clipboard:append({ "unnamedplus" })
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = false
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
-- vim.opt.colorcolumn = "80"
vim.g.mapleader = " "
-- Case insensitive searching UNLESS /C or capital in search
vim.opt.ignorecase = true
vim.opt.completeopt = "menuone,noselect"
vim.opt.smartcase = true
vim.opt.splitright = true
vim.opt.splitbelow = true
vim.opt.termguicolors = true
vim.cmd([[let &t_Cs = "\e[4:3m"]])
vim.cmd([[let &t_Ce = "\e[4:0m"]])
vim.g.netrw_browse_split = 0
vim.g.netrw_banner = 0
vim.g.netrw_winsize = 25
vim.g.python3_host_prog = "/usr/bin/python3"