feat: refactor

This commit is contained in:
max_richter 2022-04-25 16:23:14 +02:00
parent 4bf6a46a85
commit b0e54888bb
16 changed files with 369 additions and 371 deletions

View File

@ -1,21 +1,21 @@
background #000000 background #f8f8f8
foreground #fffaf3 foreground #2a2b33
cursor #ffffff cursor #bbbbbb
selection_background #002a3a selection_background #ececec
color0 #222222 color0 #000000
color8 #444444 color8 #000000
color1 #ff000f color1 #de3d35
color9 #ff273f color9 #de3d35
color2 #8ce00a color2 #3e953a
color10 #abe05a color10 #3e953a
color3 #ffb900 color3 #d2b67b
color11 #ffd141 color11 #d2b67b
color4 #008df8 color4 #2f5af3
color12 #0092ff color12 #2f5af3
color5 #6c43a5 color5 #950095
color13 #9a5feb color13 #a00095
color6 #00d7eb color6 #3e953a
color14 #67ffef color14 #3e953a
color7 #ffffff color7 #bbbbbb
color15 #ffffff color15 #ffffff
selection_foreground #0d0f18 selection_foreground #f8f8f8

View File

@ -495,7 +495,7 @@ window_padding_width 10
#: Fade the text in inactive windows by the specified amount (a number #: Fade the text in inactive windows by the specified amount (a number
#: between zero and one, with zero being fully faded). #: between zero and one, with zero being fully faded).
# hide_window_decorations no hide_window_decorations yes
#: Hide the window decorations (title-bar and window borders) with #: Hide the window decorations (title-bar and window borders) with
#: yes. On macOS, titlebar-only can be used to only hide the titlebar. #: yes. On macOS, titlebar-only can be used to only hide the titlebar.
@ -1314,6 +1314,6 @@ map kitty_mod+minus change_font_size all -2.0
# BEGIN_KITTY_THEME # BEGIN_KITTY_THEME
# Argonaut # Atom One Light
include current-theme.conf include current-theme.conf
# END_KITTY_THEME # END_KITTY_THEME

View File

@ -495,7 +495,7 @@ window_padding_width 10
#: Fade the text in inactive windows by the specified amount (a number #: Fade the text in inactive windows by the specified amount (a number
#: between zero and one, with zero being fully faded). #: between zero and one, with zero being fully faded).
# hide_window_decorations no hide_window_decorations yes
#: Hide the window decorations (title-bar and window borders) with #: Hide the window decorations (title-bar and window borders) with
#: yes. On macOS, titlebar-only can be used to only hide the titlebar. #: yes. On macOS, titlebar-only can be used to only hide the titlebar.
@ -1314,6 +1314,6 @@ map kitty_mod+minus change_font_size all -2.0
# BEGIN_KITTY_THEME # BEGIN_KITTY_THEME
# Atom One Light # Argonaut
include current-theme.conf include current-theme.conf
# END_KITTY_THEME # END_KITTY_THEME

View File

@ -0,0 +1,4 @@
local map = vim.api.nvim_set_keymap
map("i", "<C-b>", ">a**<esc><i**<esc>", { noremap = true })

View File

@ -1,21 +1,8 @@
require("utils.install-packer") require("utils.install-packer")
local u = require("utils") local u = require("utils")
require("core.plugins") if u.has_plugin("packer") then
local g = vim.g
local cmd = vim.cmd
if u.has_plugin("cmp") then
require "impatient"
require "core.options"
require "core.autocommands"
require "core.keymappings"
local packer = require("packer") local packer = require("packer")
-- Have packer use a popup window
packer.init { packer.init {
display = { display = {
open_fn = function() open_fn = function()
@ -24,69 +11,28 @@ if u.has_plugin("cmp") then
}, },
} }
require "core.plugins"
require "impatient"
require "core.options"
require "core.autocommands"
require "core.keymappings"
require "core.theme"
require "configs.dashboard"
require "configs.command-center" require "configs.command-center"
require "configs.notify" require "configs.notify"
require "configs.lsp" require "configs.lsp"
require "configs.lspinstaller" require "configs.lspinstaller"
require "configs.telescope" require "configs.telescope"
require "configs.tree" require "configs.tree"
require "configs.treesitter"
-- Enable Theming / Syntax require "configs.autocomplete"
require("nightfox").setup({ require "configs.snippets"
options = {
transparent = true
}
})
cmd("colorscheme nightfox")
require "utils.theme-reloader"
require "configs.lualine"
-- Configure Wiki
g.wiki_root = "~/Notes"
g.wiki_filetypes = { "md" }
g.wiki_link_extension = ".md"
require "overlays" require "overlays"
-- require "nvim-tmux-navigation".setup {
-- keybindings = {
-- left = "<C-h>",
-- down = "<C-j>",
-- up = "<C-k>",
-- right = "<C-l>",
-- last_active = "<C-\\>",
-- next = "<C-Space>"
-- }
-- }
require "nvim-autopairs".setup() require "nvim-autopairs".setup()
-- Treesitter config
require "configs.treesitter"
-- Autocompletion Setup
require "snippets"
require "configs.autocomplete"
-- Setup rest.vim
-- require("rest-nvim").setup(
-- {
-- -- Open request results in a horizontal split
-- result_split_horizontal = false,
-- -- Skip SSL verification, useful for unknown certificates
-- skip_ssl_verification = false,
-- -- Highlight request on run
-- highlight = {
-- enabled = true,
-- timeout = 150
-- },
-- -- Jump to request line on run
-- jump_to_request = false
-- }
-- )
-- LSP Config
-- require "lsp-conf"
else else
vim.cmd [[PackerSync]] vim.cmd [[PackerSync]]
vim.cmd [[echo Installed -> Reload]] vim.cmd [[echo Installed -> Reload]]

View File

@ -0,0 +1,56 @@
-----------------------------------
-- Welcome Screen Configuration --
-----------------------------------
-- Call Alpha With A pcall
local status_ok, alpha = pcall(require, "alpha")
if not status_ok then
return
end
-- Enable Alpha Dashboard
local dashboard = require("alpha.themes.dashboard")
-- Remove These ~ ~ ~
vim.opt.fillchars:append { eob = " " }
-- Disable Status Line so that alpha dashboard look nice
vim.cmd [[ au User AlphaReady if winnr('$') == 1 | set laststatus=1 ]]
-- Custom Footer
dashboard.section.footer.val = {
"Write Programs That Do One Thing And Do It Well.",
}
-- Custom Section
dashboard.section.buttons.val = {
dashboard.button("n", " Create New file", ":set laststatus=3 | :ene <BAR> startinsert <CR>"),
dashboard.button("e", " Open File Manager", ":set laststatus=3 | :NvimTreeOpen <CR>"),
dashboard.button("v", " Neovim Settings ", ":set laststatus=3 | e ~/.config/nvim/init.lua <CR>"),
dashboard.button("b", "⟳ Recent Files", ":Telescope oldfiles<CR>"),
dashboard.button("s", " Shell Configuration", ":set laststatus=3 | e ~/.config/zsh/.zshrc <CR>"),
dashboard.button("u", " Update Nvim Plugins", ":PackerUpdate <CR>"),
dashboard.button("q", " Quit Neovim", ":qa<CR>"),
}
-- LuaVim Ascii Art
dashboard.section.header.val = {
[[███╗ ███╗ █████╗ ██╗ ██╗ ███╗ ██╗ ██╗ ██╗██╗███╗ ███╗]],
[[████╗ ████║██╔══██╗╚██╗██╔╝ ████╗ ██║ ██║ ██║██║████╗ ████║]],
[[██╔████╔██║███████║ ╚███╔╝ ██╔██╗ ██║ ██║ ██║██║██╔████╔██║]],
[[██║╚██╔╝██║██╔══██║ ██╔██╗ ██║╚██╗██║ ╚██╗ ██╔╝██║██║╚██╔╝██║]],
[[██║ ╚═╝ ██║██║ ██║██╔╝ ██╗ ██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║]],
[[╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═╝]],
}
-- Layout For Luavim ascii art
dashboard.config.layout = {
{ type = "padding", val = 5 },
dashboard.section.header,
{ type = "padding", val = 2 },
dashboard.section.buttons,
{ type = "padding", val = 1 },
dashboard.section.footer,
}
alpha.setup(dashboard.opts)

View File

@ -2,7 +2,7 @@ local lsp = require "lspconfig"
local lsp_status = require("lsp-status") local lsp_status = require("lsp-status")
-- local ts_utils = require("nvim-lsp-ts-utils") -- local ts_utils = require("nvim-lsp-ts-utils")
require'nvim-lightbulb'.setup { require 'nvim-lightbulb'.setup {
-- LSP client names to ignore -- LSP client names to ignore
-- Example: {"sumneko_lua", "null-ls"} -- Example: {"sumneko_lua", "null-ls"}
ignore = {}, ignore = {},
@ -63,7 +63,7 @@ lsp.sumneko_lua.setup {
}, },
diagnostics = { diagnostics = {
-- Get the language server to recognize the `vim` global -- Get the language server to recognize the `vim` global
globals = {"vim"} globals = { "vim" }
}, },
workspace = { workspace = {
-- Make the server aware of Neovim runtime files -- Make the server aware of Neovim runtime files
@ -79,4 +79,3 @@ lsp.sumneko_lua.setup {
-- Ltex Language Server -- Ltex Language Server
require("grammar-guard").init() require("grammar-guard").init()

View File

@ -0,0 +1,65 @@
local ls = require("luasnip")
-- some shorthands...
local s = ls.snippet
local sn = ls.snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local types = require("luasnip.util.types")
require("luasnip.loaders.from_vscode").load({ include = { "typescript", "javascript", "html" } })
-- Every unspecified option will be set to the default.
ls.config.set_config(
{
history = true,
-- Update more often, :h events for more info.
updateevents = "TextChanged,TextChangedI",
ext_opts = {
[types.choiceNode] = {
active = {
virt_text = { { "choiceNode", "Comment" } }
}
}
},
-- treesitter-hl has 100, use something higher (default is 200).
ext_base_prio = 300,
-- minimal increase in priority.
ext_prio_increase = 1,
enable_autosnippets = true
}
)
ls.add_snippets("all", {
s({ trig = "b(%d)", regTrig = true, wordTrig = true }, {
f(function(args) return { "Captured Text: " .. args[1].captures[1] .. "." } end, {}),
i(0)
})
})
ls.add_snippets("svelte", {
s("slt", {
t('<script lang="ts">', '\t'),
i(0),
t("</script>")
}),
s("sc", {
t('<script context="module" lang="ts">', '\t'),
i(0),
t("</script>")
})
})
ls.add_snippets("typescript", {
s("sget", {
t('export async function get({'),
i(1, "params"),
t("}) {"),
i(2),
t("}"),
})
})

View File

@ -22,10 +22,9 @@ augroup SaveManualFolds
augroup END augroup END
]] ]]
vim.cmd [[autocmd CursorHold,CursorHoldI * lua require'nvim-lightbulb'.update_lightbulb()]]
vim.api.nvim_create_autocmd("BufWritePre", {
vim.api.nvim_create_autocmd("BufWritePre",{
callback = function() callback = function()
vim.lsp.buf.formatting_sync(); vim.lsp.buf.formatting_sync();
end end

View File

@ -1,14 +1,14 @@
local map = vim.api.nvim_set_keymap local map = vim.api.nvim_set_keymap
local g = vim.g local g = vim.g
local options = {noremap = true} local options = { noremap = true }
local remap = {noremap = false} local remap = { noremap = false }
g.mapleader = " " g.mapleader = " "
map("n", "<C-o>", ":Telescope find_files<CR>", options) map("n", "<C-o>", ":Telescope find_files<CR>", options)
map("n", "<C-f>", ":Telescope live_grep<CR>", options) map("n", "<C-f>", ":Telescope live_grep<CR>", options)
map("n","<C-p>",":Telescope command_center<CR>",options) map("n", "<C-p>", ":Telescope command_center<CR>", options)
map("n", "<Shift>", "za", options) map("n", "<Shift>", "za", options)
-- LSP Functionality -- LSP Functionality
@ -32,16 +32,21 @@ map("n", "<C-k>", "<C-w>k", options)
map("n", "<C-l>", "<C-w>l", options) map("n", "<C-l>", "<C-w>l", options)
-- Browser like next/previous -- Browser like next/previous
map("n", "<A-Left>", ":bprevious<CR>",options); map("n", "<A-Left>", ":bprevious<CR>", options);
map("n", "<A-Right>", ":bnext<CR>",options); map("n", "<A-Right>", ":bnext<CR>", options);
-- Backspace Delete like Browser -- Backspace Delete like Browser
map('i', '<C-H>', '<Esc>caw', options) map('i', '<C-H>', '<Esc>caw', options)
map("n", "Y", "yy", options) -- Copy visual selection to keyboard
map("v", "Y", '"+y', options)
map("n", "<Leader>k", "{", options) map("n", "<Leader>k", "{", options)
map("n", "<Leader>j", "}", options) map("n", "<Leader>j", "}", options)
-- Don't accidently create macros when trying to quit
map('n', 'Q', 'q', {})
map('n', 'q', '<nop>', {})
-- Move lines vscode style -- Move lines vscode style
map("n", "<A-j>", "<cmd>move +1<CR>", options) map("n", "<A-j>", "<cmd>move +1<CR>", options)
map("n", "<A-k>", "<cmd>move -2<CR>", options) map("n", "<A-k>", "<cmd>move -2<CR>", options)
@ -60,8 +65,8 @@ map("n", "<Leader>gdh", ":diffget //2<CR>", options)
-- Find file in NvimTree -- Find file in NvimTree
map("n", "<Leader>f", ":NvimTreeFindFile<CR><c-w>", options) map("n", "<Leader>f", ":NvimTreeFindFile<CR><c-w>", options)
map("n", "<C-->",":vsplit<CR>",options); map("n", "<C-->", ":vsplit<CR>", options);
map("n", "<C-|>",":split<CR>",options); map("n", "<C-|>", ":split<CR>", options);
-- I aint no weak boy -- I aint no weak boy
map("n", "<Left>", ":echo 'No Left for you'<CR><i><dw>", options) map("n", "<Left>", ":echo 'No Left for you'<CR><i><dw>", options)

View File

@ -1,12 +1,11 @@
------------- -------------
-- General -- -- General --
------------- -------------
local set = vim.opt local set = vim.opt
set.swapfile = false -- Don't use swapfile set.swapfile = false -- Don't use swapfile
set.updatetime = 0 -- Faster completion set.updatetime = 0 -- Faster completion
set.encoding="utf-8" -- The encoding displayed set.encoding = "utf-8" -- The encoding displayed
set.fileencoding="utf-8" -- The encoding written to file set.fileencoding = "utf-8" -- The encoding written to file
set.smartindent = true -- Makes indenting smart set.smartindent = true -- Makes indenting smart
set.iskeyword:append("-") -- treat dash separated words as a word text object" set.iskeyword:append("-") -- treat dash separated words as a word text object"
set.clipboard = "unnamedplus" -- Copy paste between vim and everything else set.clipboard = "unnamedplus" -- Copy paste between vim and everything else
@ -40,7 +39,7 @@ set.virtualedit = "onemore" -- With This option you can move th
set.ignorecase = true -- ignores case when searching set.ignorecase = true -- ignores case when searching
set.smartcase = true -- turns on case sensitive search when letters are capitalized set.smartcase = true -- turns on case sensitive search when letters are capitalized
set.termguicolors = true -- set term gui colors (most terminals support this) set.termguicolors = true -- set term gui colors (most terminals support this)
set.laststatus=2 -- Always display the status line set.laststatus = 2 -- Always display the status line
set.title = true -- Show current txt that you editing set.title = true -- Show current txt that you editing
set.relativenumber = false -- Vims absolute, relative and hybrid line numbers set.relativenumber = false -- Vims absolute, relative and hybrid line numbers
set.cursorline = false -- Enable highlighting of the current line set.cursorline = false -- Enable highlighting of the current line

View File

@ -2,36 +2,25 @@ return require("packer").startup(
function(use) function(use)
-- Let packer manage itself -- Let packer manage itself
use "wbthomason/packer.nvim" use "wbthomason/packer.nvim"
use 'lewis6991/impatient.nvim' use 'lewis6991/impatient.nvim'
-- General Helper Functions -- General Helper Functions
use "nvim-lua/plenary.nvim" use "nvim-lua/plenary.nvim"
-- Filetype Detection
-- use "nathom/filetype.nvim"
-- Theming Section -- Theming Section
-- use 'folke/tokyonight.nvim'
use "EdenEast/nightfox.nvim" use "EdenEast/nightfox.nvim"
use "nvim-lualine/lualine.nvim" use "nvim-lualine/lualine.nvim"
-- use "xiyaowong/nvim-transparent"
-- Layout Plugins -- Layout Plugins
use "kyazdani42/nvim-web-devicons" use "kyazdani42/nvim-web-devicons"
use "kyazdani42/nvim-tree.lua" use "kyazdani42/nvim-tree.lua"
use "nvim-lua/popup.nvim" use "nvim-lua/popup.nvim"
use "mhinz/vim-startify" -- use "mhinz/vim-startify"
-- use "tpope/vim-fugitive" use 'goolord/alpha-nvim'
use "tpope/vim-commentary" use { "terrortylor/nvim-comment", config = function() require('nvim_comment').setup() end }
-- use "tpope/vim-surround"
-- use "lambdalisue/suda.vim"
use "windwp/nvim-autopairs" use "windwp/nvim-autopairs"
-- Code Navigation -- Code Navigation
-- use "alexghergh/nvim-tmux-navigation"
-- use "dense-analysis/ale"
-- use "nathanmsmith/nvim-ale-diagnostic"
use "junegunn/fzf" use "junegunn/fzf"
use "nvim-telescope/telescope.nvim" use "nvim-telescope/telescope.nvim"
use "gfeiyou/command-center.nvim" use "gfeiyou/command-center.nvim"
@ -47,7 +36,6 @@ return require("packer").startup(
-- Lsp Errors -- Lsp Errors
use "folke/lsp-colors.nvim" use "folke/lsp-colors.nvim"
use "kosayoda/nvim-lightbulb" use "kosayoda/nvim-lightbulb"
-- use "onsails/lspkind-nvim"
use { use {
"folke/trouble.nvim", "folke/trouble.nvim",
requires = "kyazdani42/nvim-web-devicons", requires = "kyazdani42/nvim-web-devicons",
@ -57,7 +45,6 @@ return require("packer").startup(
} }
-- Syntax / Autocomplete -- Syntax / Autocomplete
-- use "terminalnode/sway-vim-syntax" --sway config syntax
use "neovim/nvim-lspconfig" use "neovim/nvim-lspconfig"
use "hrsh7th/nvim-cmp" use "hrsh7th/nvim-cmp"
use "hrsh7th/cmp-nvim-lsp" use "hrsh7th/cmp-nvim-lsp"
@ -71,8 +58,6 @@ return require("packer").startup(
use "saadparwaiz1/cmp_luasnip" use "saadparwaiz1/cmp_luasnip"
use "williamboman/nvim-lsp-installer" use "williamboman/nvim-lsp-installer"
use "nvim-lua/lsp-status.nvim" use "nvim-lua/lsp-status.nvim"
-- use "jose-elias-alvarez/nvim-lsp-ts-utils"
-- use "neoclide/jsonc.vim"
use "brymer-meneses/grammar-guard.nvim" use "brymer-meneses/grammar-guard.nvim"
use { use {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
@ -80,9 +65,7 @@ return require("packer").startup(
} }
-- Autoformat -- Autoformat
-- use "sbdchd/neoformat"
use "lukas-reineke/lsp-format.nvim" use "lukas-reineke/lsp-format.nvim"
-- use "lukas-reineke/format.nvim"
-- General Popup Window -- General Popup Window
use "akinsho/nvim-toggleterm.lua" use "akinsho/nvim-toggleterm.lua"
@ -92,5 +75,5 @@ return require("packer").startup(
-- Database Feature -- Database Feature
use "tpope/vim-dadbod" use "tpope/vim-dadbod"
use "kristijanhusak/vim-dadbod-ui" use "kristijanhusak/vim-dadbod-ui"
end end
) )

View File

@ -0,0 +1,9 @@
-- Enable Theming / Syntax
require("nightfox").setup({
options = {
transparent = true
}
})
vim.cmd("colorscheme nightfox")
require "utils.theme-reloader"
require "configs.lualine"

View File

@ -1,65 +0,0 @@
local ls = require("luasnip")
-- some shorthands...
local s = ls.snippet
local sn = ls.snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local types = require("luasnip.util.types")
require("luasnip.loaders.from_vscode").load({include = {"typescript", "javascript", "html"}})
-- Every unspecified option will be set to the default.
ls.config.set_config(
{
history = true,
-- Update more often, :h events for more info.
updateevents = "TextChanged,TextChangedI",
ext_opts = {
[types.choiceNode] = {
active = {
virt_text = {{"choiceNode", "Comment"}}
}
}
},
-- treesitter-hl has 100, use something higher (default is 200).
ext_base_prio = 300,
-- minimal increase in priority.
ext_prio_increase = 1,
enable_autosnippets = true
}
)
ls.add_snippets("all", {
s({trig = "b(%d)", regTrig = true, wordTrig = true}, {
f(function(args) return {"Captured Text: " .. args[1].captures[1] .. "."} end, {}),
i(0)
})
})
ls.add_snippets("svelte",{
s("slt",{
t('<script lang="ts">','\t'),
i(0),
t("</script>")
}),
s("sc",{
t('<script context="module" lang="ts">','\t'),
i(0),
t("</script>")
})
})
ls.add_snippets("typescript",{
s("sget",{
t('export async function get({'),
i(1,"params"),
t("}) {"),
i(2),
t("}"),
})
})

View File

@ -1,7 +1,5 @@
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 })
end end