diff --git a/init.lua b/init.lua index 3990ab8..549f746 100644 --- a/init.lua +++ b/init.lua @@ -49,28 +49,22 @@ require('lazy').setup({ -- Useful status updates for LSP -- 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! '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. { '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 @@ -151,7 +97,7 @@ require('lazy').setup({ opts = { options = { icons_enabled = false, - theme = 'onedark', + theme = 'ayu_dark', component_separators = '|', section_separators = '', }, @@ -200,8 +146,8 @@ require('lazy').setup({ -- 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. -- Uncomment any of the lines below to enable them. - -- require 'kickstart.plugins.autoformat', - -- require 'kickstart.plugins.debug', + require 'kickstart.plugins.autoformat', + require 'kickstart.plugins.debug', -- 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 @@ -209,7 +155,7 @@ require('lazy').setup({ -- 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 - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, {}) -- [[ Setting options ]] @@ -439,7 +385,7 @@ local servers = { -- pyright = {}, -- rust_analyzer = {}, -- tsserver = {}, - -- html = { filetypes = { 'html', 'twig', 'hbs'} }, + html = { provideFormatter = false }, lua_ls = { Lua = { @@ -455,6 +401,7 @@ require('neodev').setup() -- nvim-cmp supports additional completion capabilities, so broadcast that to servers local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) +capabilities.textDocument.completion.completionItem.snippetSupport = true -- Ensure the servers above are installed local mason_lspconfig = require 'mason-lspconfig' @@ -474,57 +421,7 @@ mason_lspconfig.setup_handlers { end } --- [[ Configure nvim-cmp ]] --- 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 { - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete {}, - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - [''] = 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' }), - [''] = 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 +require("jabuxas") -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/plugins/autopairs.lua b/lua/custom/plugins/autopairs.lua new file mode 100644 index 0000000..6f09fbe --- /dev/null +++ b/lua/custom/plugins/autopairs.lua @@ -0,0 +1,7 @@ +-- autotag and autopairs plugins +return { + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = { + disable_filetype = { "TelescopePrompt", "vim" }, }, +} diff --git a/lua/custom/plugins/cmp.lua b/lua/custom/plugins/cmp.lua new file mode 100644 index 0000000..2b31db4 --- /dev/null +++ b/lua/custom/plugins/cmp.lua @@ -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 { + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete {}, + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [''] = 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' }), + [''] = 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, +} diff --git a/lua/custom/plugins/colorizer.lua b/lua/custom/plugins/colorizer.lua new file mode 100644 index 0000000..414e837 --- /dev/null +++ b/lua/custom/plugins/colorizer.lua @@ -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, + } + }, +} diff --git a/lua/custom/plugins/emmet.lua b/lua/custom/plugins/emmet.lua new file mode 100644 index 0000000..ae2ed68 --- /dev/null +++ b/lua/custom/plugins/emmet.lua @@ -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", "e", function() + vim.cmd(string.format("Emmet %s", vim.fn.input("Emmet: "))) + end) + end +} diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 0000000..f8a837b --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,4 @@ +return { + "ThePrimeagen/harpoon", + opts = {}, +} diff --git a/lua/custom/plugins/null-ls.lua b/lua/custom/plugins/null-ls.lua new file mode 100644 index 0000000..139552e --- /dev/null +++ b/lua/custom/plugins/null-ls.lua @@ -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 + } + } +} diff --git a/lua/custom/plugins/nvim-tmux.lua b/lua/custom/plugins/nvim-tmux.lua new file mode 100644 index 0000000..d54d182 --- /dev/null +++ b/lua/custom/plugins/nvim-tmux.lua @@ -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', "", nvim_tmux_nav.NvimTmuxNavigateLeft) + vim.keymap.set('n', "", nvim_tmux_nav.NvimTmuxNavigateDown) + vim.keymap.set('n', "", nvim_tmux_nav.NvimTmuxNavigateUp) + vim.keymap.set('n', "", nvim_tmux_nav.NvimTmuxNavigateRight) + vim.keymap.set('n', "", nvim_tmux_nav.NvimTmuxNavigateLastActive) + vim.keymap.set('n', "", nvim_tmux_nav.NvimTmuxNavigateNext) + end +} diff --git a/lua/custom/plugins/solarized.lua b/lua/custom/plugins/solarized.lua new file mode 100644 index 0000000..7b380f4 --- /dev/null +++ b/lua/custom/plugins/solarized.lua @@ -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 diff --git a/lua/custom/plugins/transparent.lua b/lua/custom/plugins/transparent.lua new file mode 100644 index 0000000..122a39e --- /dev/null +++ b/lua/custom/plugins/transparent.lua @@ -0,0 +1,5 @@ +return { + "xiyaowong/transparent.nvim", + lazy = false, + opts = {}, +} diff --git a/lua/custom/plugins/zen.lua b/lua/custom/plugins/zen.lua new file mode 100644 index 0000000..5aea49d --- /dev/null +++ b/lua/custom/plugins/zen.lua @@ -0,0 +1,13 @@ +return { + "folke/zen-mode.nvim", + opts = { + tmux = { enabled = true }, + kitty = { + enabled = true, + font = "+5", + } + }, + config = function() + vim.keymap.set("n", "z", "ZenMode", { silent = true }) + end +} diff --git a/lua/jabuxas/init.lua b/lua/jabuxas/init.lua new file mode 100644 index 0000000..438e9ff --- /dev/null +++ b/lua/jabuxas/init.lua @@ -0,0 +1,2 @@ +require("jabuxas.remap") +require("jabuxas.set") diff --git a/lua/jabuxas/remap.lua b/lua/jabuxas/remap.lua new file mode 100644 index 0000000..8b0e1e9 --- /dev/null +++ b/lua/jabuxas/remap.lua @@ -0,0 +1,55 @@ +local keymap = vim.keymap + +keymap.set("n", "pv", vim.cmd.Ex) +keymap.set("n", "sf", vim.cmd.Ex) + +keymap.set("v", "J", ":m '>+1gv=gv") +keymap.set("v", "K", ":m '<-2gv=gv") + +keymap.set("n", "J", "mzJ`z") +keymap.set("n", "", "zz") +keymap.set("n", "", "zz") +keymap.set("n", "n", "nzzzv") +keymap.set("n", "N", "Nzzzv") + +keymap.set("x", "p", [["_dP]]) +keymap.set({ "n", "v" }, "yy", [["+y]]) +keymap.set("n", "Y", [["+Y]]) +keymap.set({ "n", "v" }, "dd", [["_d]]) +keymap.set("i", "", "") + +keymap.set("n", "Q", "") +keymap.set("n", "", "silent !tmux neww tmux-sessionizer") +keymap.set("n", "f", vim.lsp.buf.format) + +keymap.set("n", "", "cnextzz") +keymap.set("n", "", "cprevzz") +keymap.set("n", "k", "lnextzz") +keymap.set("n", "j", "lprevzz") + +keymap.set("n", "rr", [[:%s/\<\>//gI]]) +keymap.set("n", "x", "!chmod +x %", { silent = true }) + +keymap.set("t", "", [[]]) + +keymap.set("n", "Sv", "v") +keymap.set("n", "Sh", "s") +keymap.set("n", "Se", "=") +keymap.set("n", "Sx", ":close") +keymap.set("n", "S=", "+") +keymap.set("n", "S-", "-") + +-- keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateLeft) +-- keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateDown) +-- keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateUp) +-- keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateRight) +-- keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateLastActive) +-- keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateNext) +keymap.set("n", "sm", "lua require('maximize').toggle()") + +keymap.set("n", "+", "") +keymap.set("n", "-", "") +keymap.set("n", "", "<") +keymap.set("n", "", ">") +keymap.set("n", "", "+") +keymap.set("n", "", "-") diff --git a/lua/jabuxas/set.lua b/lua/jabuxas/set.lua new file mode 100644 index 0000000..e72f923 --- /dev/null +++ b/lua/jabuxas/set.lua @@ -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"