commit 8ffcded80c1a73e53695bd6a3644322b1a692236 Author: Michael Peters Date: Sun Feb 27 21:11:17 2022 -0600 it's starting :) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ + diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..235e0ef --- /dev/null +++ b/init.lua @@ -0,0 +1,4 @@ +require('settings') +require('keybinds') +require('plugins') + diff --git a/lua/configs/bufferline.lua b/lua/configs/bufferline.lua new file mode 100644 index 0000000..1689020 --- /dev/null +++ b/lua/configs/bufferline.lua @@ -0,0 +1,140 @@ +local M = {} +function M.config() + local status_ok, bufferline = pcall(require, "bufferline") + if not status_ok then + return + end + + -- Semantic Colors + local scolors = { + empty_fg = '#adb0b9', + empty_bg = '#242424', + tab_fg = '#adb0b9', + tab_bg = '#282828', + selected_fg = '#adb0b9', + selected_bg = '#323232', + green = '#6a9955', + red = '#d16969', + none = 'NONE', + } + + bufferline.setup { + options = { + close_command = "Bdelete! %d", -- use vim-bbye + right_mouse_command = "Bdelete! %d", -- use vim-bbye + offsets = { { filetype = "NvimTree", text = "", padding = 1 } }, + indicator_icon = '▎', + modified_icon = "", + --buffer_close_icon = "", + show_buffer_close_icons = false, + --close_icon = "", + show_close_icon = false, + left_trunc_marker = "", + right_trunc_marker = "", + max_name_length = 14, + max_prefix_length = 13, + tab_size = 20, + show_tab_indicators = true, + enforce_regular_tabs = false, + view = "multiwindow", + separator_style = "thick", + always_show_bufferline = true, + diagnostics = false, + }, + + highlights = { + background = { + guifg = scolors.tab_fg, + guibg = scolors.tab_bg, + }, + + -- Buffers + buffer_selected = { + guifg = scolors.selected_fg, + guibg = scolors.selected_bg, + --gui = colors.none, + }, + buffer_visible = { + guifg = scolors.selected_fg, + guibg = scolors.selected_bg, + }, + + -- Diagnostics + error = { + guifg = scolors.red, + guibg = scolors.red, + }, + error_diagnostic = { + guifg = scolors.red, + guibg = scolors.red, + }, + + -- Close buttons + close_button = { + guifg = scolors.tab_fg, + guibg = scolors.tab_bg, + }, + close_button_visible = { + guifg = scolors.selected_fg, + guibg = scolors.selected_bg, + }, + close_button_selected = { + guifg = scolors.red, + guibg = scolors.selected_bg, + }, + fill = { + guifg = scolors.empty_fg, + guibg = scolors.empty_bg, + }, + indicator_selected = { + guifg = scolors.green, + guibg = scolors.selected_bg, + }, + + -- Modified + modified = { + guifg = scolors.red, + guibg = scolors.tab_bg, + }, + modified_visible = { + guifg = scolors.tab_fg, + guibg = scolors.tab_bg, + }, + modified_selected = { + guifg = scolors.green, + guibg = scolors.selected_bg, + }, + + -- Separators + separator = { + guifg = scolors.empty_bg, + guibg = scolors.tab_bg, + }, + separator_visible = { + guifg = scolors.empty_bg, + guibg = scolors.selected_bg, + }, + separator_selected = { + guifg = scolors.empty_bg, + guibg = scolors.selected_bg, + }, + + -- Tabs + tab = { + guifg = scolors.tab_fg, + guibg = scolors.tab_bg, + }, + tab_selected = { + guifg = scolors.selected_fg, + guibg = scolors.selected_bg, + }, + tab_close = { + guifg = scolors.selected_fg, + guibg = scolors.selected_bg, + }, + } + } +end + +return M + diff --git a/lua/configs/icons.lua b/lua/configs/icons.lua new file mode 100644 index 0000000..35e8eaf --- /dev/null +++ b/lua/configs/icons.lua @@ -0,0 +1,190 @@ +local M = {} + +function M.config() + local status_ok, icons = pcall(require, "nvim-web-devicons") + if not status_ok then + return + end + + local colors = { + c = "#519aba", + css = "#61afef", + deb = "#a1b7ee", + docker = "#384d54", + html = "#de8c92", + js = "#ebcb8b", + kt = "#7bc99c", + lock = "#c4c720", + lua = "#51a0cf", + mp3 = "#d39ede", + mp4 = "#9ea3de", + out = "#abb2bf", + py = "#a3b8ef", + robot = "#abb2bf", + toml = "#39bf39", + ts = "#519aba", + ttf = "#abb2bf", + rb = "#ff75a0", + rpm = "#fca2aa", + woff = "#abb2bf", + woff2 = "#abb2bf", + zip = "#f9d71c", + jsx = "#519ab8", + vue = "#7bc99c", + rs = "#dea584", + png = "#c882e7", + jpeg = "#c882e7", + jpg = "#c882e7", + } + + icons.set_icon { + c = { + icon = "", + color = colors.c, + name = "c", + }, + css = { + icon = "", + color = colors.css, + name = "css", + }, + deb = { + icon = "", + color = colors.deb, + name = "deb", + }, + Dockerfile = { + icon = "", + color = colors.docker, + name = "Dockerfile", + }, + html = { + icon = "", + color = colors.html, + name = "html", + }, + js = { + icon = "", + color = colors.js, + name = "js", + }, + kt = { + icon = "󱈙", + color = colors.kt, + name = "kt", + }, + lock = { + icon = "", + color = colors.lock, + name = "lock", + }, + lua = { + icon = "", + color = colors.lua, + name = "lua", + }, + mp3 = { + icon = "", + color = colors.mp3, + name = "mp3", + }, + mp4 = { + icon = "", + color = colors.mp4, + name = "mp4", + }, + out = { + icon = "", + color = colors.out, + name = "out", + }, + py = { + icon = "", + color = colors.py, + name = "py", + }, + ["robots.txt"] = { + icon = "ﮧ", + color = colors.robot, + name = "robots", + }, + toml = { + icon = "", + color = colors.toml, + name = "toml", + }, + ts = { + icon = "", + color = colors.ts, + name = "ts", + }, + ttf = { + icon = "", + color = colors.ttf, + name = "TrueTypeFont", + }, + rb = { + icon = "", + color = colors.rb, + name = "rb", + }, + rpm = { + icon = "", + color = colors.rpm, + name = "rpm", + }, + vue = { + icon = "﵂", + color = colors.vue, + name = "vue", + }, + woff = { + icon = "", + color = colors.woff, + name = "WebOpenFontFormat", + }, + woff2 = { + icon = "", + color = colors.woff2, + name = "WebOpenFontFormat2", + }, + xz = { + icon = "", + color = colors.zip, + name = "xz", + }, + zip = { + icon = "", + color = colors.zip, + name = "zip", + }, + jsx = { + icon = "ﰆ", + color = colors.jsx, + name = "jsx", + }, + rust = { + icon = "", + color = colors.rs, + name = "rs", + }, + jpg = { + icon = "", + color = colors.jpg, + name = "jpg", + }, + png = { + icon = "", + color = colors.png, + name = "png", + }, + jpeg = { + icon = "", + color = colors.jpeg, + name = "jpeg", + }, + } +end + +return M + diff --git a/lua/configs/lualine.lua b/lua/configs/lualine.lua new file mode 100644 index 0000000..7af7ca5 --- /dev/null +++ b/lua/configs/lualine.lua @@ -0,0 +1,233 @@ +local M = {} + +function M.config() + local status_ok, lualine = pcall(require, "lualine") + if not status_ok then + return + end + + local scolors = { + fg = '#adb0b9', + bg = '#242424', + + inset = '#569cd6', + + error = '#d16969', + warn = '#eed94e', + info = '#569cd6', + + added = '#6a9955', + modified = '#db812e', + removed = '#d16969', + + branch = '#dcdcaa', + + filetype = '#c5a6c0', + + treesitter = '#6a9955', + + scroll = '#dcdcaa', + } + local colors = { + yellow = "#ecbe7b", + yellow_1 = "#ff9640", + grey = "#2c323c", + white = "#bbc2cf", + cyan = "#008080", + darkblue = "#081633", + green = "#98be65", + orange = "#ff8800", + violet = "#a9a1e1", + magenta = "#c678dd", + blue = "#51afef", + red = "#ec5f67", + } + + local conditions = { + buffer_not_empty = function() + return vim.fn.empty(vim.fn.expand "%:t") ~= 1 + end, + hide_in_width = function() + return vim.fn.winwidth(0) > 80 + end, + check_git_workspace = function() + local filepath = vim.fn.expand "%:p:h" + local gitdir = vim.fn.finddir(".git", filepath .. ";") + return gitdir and #gitdir > 0 and #gitdir < #filepath + end, + } + + local config = { + options = { + disabled_filetypes = { "NvimTree", "dashboard", "Outline" }, + component_separators = "", + section_separators = "", + theme = { + normal = { c = { fg = scolors.fg, bg = scolors.bg } }, + inactive = { c = { fg = scolors.fg, bg = scolors.bg } }, + }, + }, + sections = { + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + lualine_x = {}, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + lualine_x = {}, + }, + } + + local function ins_left(component) + table.insert(config.sections.lualine_c, component) + end + + local function ins_right(component) + table.insert(config.sections.lualine_x, component) + end + + ins_left { + function() + return "▊" + end, + color = { fg = colors.blue }, + padding = { left = 0, right = 0 }, + } + + ins_left { + "branch", + icon = "", + color = { fg = scolors.branch, gui = "bold" }, + padding = { left = 2, right = 1 }, + } + + ins_left { + "filetype", + cond = conditions.buffer_not_empty, + color = { fg = scolors.filetype, gui = "bold" }, + padding = { left = 2, right = 1 }, + } + + ins_left { + "diff", + symbols = { added = " ", modified = "柳", removed = " " }, + diff_color = { + added = { fg = scolors.added }, + modified = { fg = scolors.modified }, + removed = { fg = scolors.removed }, + }, + cond = conditions.hide_in_width, + padding = { left = 2, right = 1 }, + } + + ins_left { + "diagnostics", + sources = { "nvim_diagnostic" }, + symbols = { error = " ", warn = " ", info = " ", hint = " " }, + diagnostics_color = { + color_error = { fg = scolors.error }, + color_warn = { fg = scolors.warn }, + color_info = { fg = scolors.info }, + }, + padding = { left = 2, right = 1 }, + } + + ins_left { + function() + return "%=" + end, + } + + ins_right { + function(msg) + msg = msg or "Inactive" + local buf_clients = vim.lsp.buf_get_clients() + if next(buf_clients) == nil then + if type(msg) == "boolean" or #msg == 0 then + return "Inactive" + end + return msg + end + local buf_ft = vim.bo.filetype + local buf_client_names = {} + + for _, client in pairs(buf_clients) do + if client.name ~= "null-ls" then + table.insert(buf_client_names, client.name) + end + end + + local formatters = require "core.utils" + local supported_formatters = formatters.list_registered_formatters(buf_ft) + vim.list_extend(buf_client_names, supported_formatters) + + local linters = require "core.utils" + local supported_linters = linters.list_registered_linters(buf_ft) + vim.list_extend(buf_client_names, supported_linters) + + return table.concat(buf_client_names, ", ") + end, + icon = " ", + color = { gui = "none" }, + padding = { left = 0, right = 1 }, + cond = conditions.hide_in_width, + } + + ins_right { + function() + local b = vim.api.nvim_get_current_buf() + if next(vim.treesitter.highlighter.active[b]) then + return " 綠S" + end + return "" + end, + color = { fg = scolors.treesitter }, + padding = { left = 1, right = 0 }, + cond = conditions.hide_in_width, + } + + ins_right { + "location", + padding = { left = 1, right = 1 }, + } + + ins_right { + "progress", + color = { gui = "none" }, + padding = { left = 0, right = 0 }, + } + + ins_right { + function() + local current_line = vim.fn.line "." + local total_lines = vim.fn.line "$" + local chars = { "__", "▁▁", "▂▂", "▃▃", "▄▄", "▅▅", "▆▆", "▇▇", "██" } + local line_ratio = current_line / total_lines + local index = math.ceil(line_ratio * #chars) + return chars[index] + end, + padding = { left = 1, right = 1 }, + color = { fg = scolors.scroll }, + cond = nil, + } + + ins_right { + function() + return "▊" + end, + color = { fg = scolors.inset }, + padding = { left = 1, right = 0 }, + } + + lualine.setup(config) +end + +return M + diff --git a/lua/keybinds.lua b/lua/keybinds.lua new file mode 100644 index 0000000..1fd59c5 --- /dev/null +++ b/lua/keybinds.lua @@ -0,0 +1,19 @@ +local opts = { noremap = true, silent = true } +local map = vim.api.nvim_set_keymap + +map("", "", "", opts) +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +-- Window Navigation without needing first +map("n", "", "h", opts) +map("n", "", "j", opts) +map("n", "", "k", opts) +map("n", "", "l", opts) + +-- Resize with C-arrow +map("n", "", "resize -2", opts) +map("n", "", "resize +2", opts) +map("n", "", "vertical resize -2", opts) +map("n", "", "vertical resize +2", opts) + diff --git a/lua/plugins.lua b/lua/plugins.lua new file mode 100644 index 0000000..07d41f1 --- /dev/null +++ b/lua/plugins.lua @@ -0,0 +1,51 @@ +local packer_status_ok, packer = pcall(require, "packer") +if not packer_status_ok then + return +end + +vim.cmd [[packadd packer.nvim]] + +packer.startup { + function(use) + -- General Lua functions + use { 'nvim-lua/plenary.nvim' } + use { 'nvim-lua/popup.nvim' } + + -- General optimizations + use { 'lewis6991/impatient.nvim' } + use { 'nathom/filetype.nvim', config = function() vim.g.did_load_filetypes = 1 end } + + -- General Assets/Resources + use { 'kyazdani42/nvim-web-devicons', config = function() require'configs.icons'.config() end } + + -- Colorscheme (see autocommand below) + use { 'lunarvim/darkplus.nvim' } + + -- Buffer Line + use { 'moll/vim-bbye' } -- Close buffers softly + use { + 'akinsho/bufferline.nvim', + after = { 'nvim-web-devicons', 'vim-bbye' }, + config = function() require'configs.bufferline'.config() end + } + + -- Status Line + use { 'nvim-lualine/lualine.nvim', config = function() require'configs.lualine'.config() end } + end, + config = { + display = { + open_fn = function() + return require'packer.util'.float { border = 'rounded' } + end + } + } +} + +-- For some reason, setting the color scheme has to be in an autocommand +vim.cmd([[ + augroup colorscheme + autocmd! + autocmd VimEnter * colorscheme darkplus + augroup end +]]) + diff --git a/lua/settings.lua b/lua/settings.lua new file mode 100644 index 0000000..10d0055 --- /dev/null +++ b/lua/settings.lua @@ -0,0 +1,12 @@ +local set = vim.opt + +set.scrolloff = 6 +set.sidescrolloff = 8 + +set.pumheight = 10 -- popup menu height + +set.number = true +set.expandtab = false +set.shiftwidth = 4 +set.tabstop = 4 + diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua new file mode 100644 index 0000000..1958443 --- /dev/null +++ b/plugin/packer_compiled.lua @@ -0,0 +1,153 @@ +-- Automatically generated packer.nvim plugin loader code + +if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then + vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') + return +end + +vim.api.nvim_command('packadd packer.nvim') + +local no_errors, error_msg = pcall(function() + + local time + local profile_info + local should_profile = false + if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end + else + time = function(chunk, start) end + end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + + _G._packer = _G._packer or {} + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/home/michael/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/michael/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/michael/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/michael/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/michael/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" +if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str +end + +if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern +end + +time([[Luarocks path setup]], false) +time([[try_loadstring definition]], true) +local function try_loadstring(s, component, name) + local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) + if not success then + vim.schedule(function() + vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) + end) + end + return result +end + +time([[try_loadstring definition]], false) +time([[Defining packer_plugins]], true) +_G.packer_plugins = { + ["bufferline.nvim"] = { + config = { "\27LJ\2\nA\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\vconfig\23configs.bufferline\frequire\0" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/michael/.local/share/nvim/site/pack/packer/opt/bufferline.nvim", + url = "https://github.com/akinsho/bufferline.nvim" + }, + ["darkplus.nvim"] = { + loaded = true, + path = "/home/michael/.local/share/nvim/site/pack/packer/start/darkplus.nvim", + url = "https://github.com/lunarvim/darkplus.nvim" + }, + ["filetype.nvim"] = { + config = { "\27LJ\2\n4\0\0\2\0\3\0\0056\0\0\0009\0\1\0)\1\1\0=\1\2\0K\0\1\0\23did_load_filetypes\6g\bvim\0" }, + loaded = true, + path = "/home/michael/.local/share/nvim/site/pack/packer/start/filetype.nvim", + url = "https://github.com/nathom/filetype.nvim" + }, + ["impatient.nvim"] = { + loaded = true, + path = "/home/michael/.local/share/nvim/site/pack/packer/start/impatient.nvim", + url = "https://github.com/lewis6991/impatient.nvim" + }, + ["lualine.nvim"] = { + config = { "\27LJ\2\n>\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\vconfig\20configs.lualine\frequire\0" }, + loaded = true, + path = "/home/michael/.local/share/nvim/site/pack/packer/start/lualine.nvim", + url = "https://github.com/nvim-lualine/lualine.nvim" + }, + ["nvim-web-devicons"] = { + after = { "bufferline.nvim" }, + loaded = true, + only_config = true + }, + ["plenary.nvim"] = { + loaded = true, + path = "/home/michael/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + ["popup.nvim"] = { + loaded = true, + path = "/home/michael/.local/share/nvim/site/pack/packer/start/popup.nvim", + url = "https://github.com/nvim-lua/popup.nvim" + }, + ["vim-bbye"] = { + loaded = true, + path = "/home/michael/.local/share/nvim/site/pack/packer/start/vim-bbye", + url = "https://github.com/moll/vim-bbye" + } +} + +time([[Defining packer_plugins]], false) +-- Config for: nvim-web-devicons +time([[Config for nvim-web-devicons]], true) +try_loadstring("\27LJ\2\n<\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\vconfig\18configs.icons\frequire\0", "config", "nvim-web-devicons") +time([[Config for nvim-web-devicons]], false) +-- Config for: lualine.nvim +time([[Config for lualine.nvim]], true) +try_loadstring("\27LJ\2\n>\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\vconfig\20configs.lualine\frequire\0", "config", "lualine.nvim") +time([[Config for lualine.nvim]], false) +-- Config for: filetype.nvim +time([[Config for filetype.nvim]], true) +try_loadstring("\27LJ\2\n4\0\0\2\0\3\0\0056\0\0\0009\0\1\0)\1\1\0=\1\2\0K\0\1\0\23did_load_filetypes\6g\bvim\0", "config", "filetype.nvim") +time([[Config for filetype.nvim]], false) +-- Load plugins in order defined by `after` +time([[Sequenced loading]], true) +vim.cmd [[ packadd vim-bbye ]] +vim.cmd [[ packadd bufferline.nvim ]] + +-- Config for: bufferline.nvim +try_loadstring("\27LJ\2\nA\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\vconfig\23configs.bufferline\frequire\0", "config", "bufferline.nvim") + +time([[Sequenced loading]], false) +if should_profile then save_profiles() end + +end) + +if not no_errors then + error_msg = error_msg:gsub('"', '\\"') + vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') +end diff --git a/todo.txt b/todo.txt new file mode 100644 index 0000000..ce8e507 --- /dev/null +++ b/todo.txt @@ -0,0 +1,48 @@ + +[x] Package Manager + [x] Packer + +[x] Theme + [x] VSCode Dark + +[ ] File Explorer + [ ] NvimTree + +[ ] Status Line + [ ] lualine + +[x] Tabs + [x] Bufferline + [x] vim-bbye + +[ ] Language Processing + [ ] Treesitter + [ ] nvim-ts-autotag + [ ] indent-blankline.nvim + [ ] comment + [ ] norcalli/nvim-colorizer.lua + [ ] nvim-ts-context-commentstring + [ ] nvim-autopairs + [ ] nvim-lsp-installer + [ ] Native LSP + [ ] lspsaga + [ ] symbols-outline + [ ] Null-LS + [ ] SchemaStore + +[ ] Autocompletion + [ ] LuaSnip + [ ] nvim-cmp + +[ ] Git Integration + [ ] Gitsigns + +[ ] Find Files + [ ] Telescope + [ ] ff + [ ] fw + [ ] telescope-fzf-native.nvim + +[ ] which-key + +