Merge branch 'main' into patch-1

This commit is contained in:
vlad doster 2021-07-27 16:30:24 -05:00 committed by GitHub
commit e197049a59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 134 additions and 86 deletions

View file

@ -1,26 +1,9 @@
require "options"
local chad_modules = {
"pluginList",
"plugins.bufferline",
"options",
"mappings",
"utils"
}
local async
async =
vim.loop.new_async(
vim.schedule_wrap(
function()
for i = 1, #chad_modules, 1 do
local ok, res = xpcall(require, debug.traceback, chad_modules[i])
if not (ok) then
print("Error loading module : " .. chad_modules[i])
print(res) -- print stack traceback of the error
pcall(require, chad_modules[i])
end
end
async:close()
end
)
)
async:send()

View file

@ -21,7 +21,7 @@ _check_install_dependencies() {
printf "%s\n" "Error: Install ${1} before proceeding."
exit 1
}
_GIT="$(command -v git)" || _error_dependencies git
command -v git 1>/dev/null || _error_dependencies git
_SED="$(command -v sed)" || _error_dependencies sed
return 0
}
@ -71,26 +71,29 @@ _setup_terminal_shell() {
_mappings_file="${_CONFIG_PATH}/lua/mappings.lua"
# only ask for shellname if running in terminal
if [ -t 1 ]; then
if chsh -l 2>/dev/null 1>&2; then
printf "\nAvailable Shells:\n"
chsh -l | nl
printf "\n%s\n" "Which shell do you want to use? (Eg. 2)"
printf "\t%s\n" "[ Enter nothing for current shell ( $_CURRENT_SHELL ) ]"
grep '^/bin/' '/etc/shells' | nl
read -r shellNUM
read -r shellnum
[ "${shellnum}" -gt 0 ] 2>/dev/null && _SHELLPATH="$(chsh -l | sed -n "$shellnum p")"
fi
fi
# don't try to do any changes user wants their default shell in nvim
if [ -n "$shellNUM" ]; then
shellpath=$(grep '^/bin/' '/etc/shells' | sed -n "$shellNUM p")
if [ -n "$_SHELLPATH" ]; then
# Reference: https://stackoverflow.com/a/4247319
# \( & \) will use regex brackets (for later reference with \1)
# ( & ) will match text brackets
if "${_SED}" --posix -i'.bak' -e "s=^\(map(.* \+*terminal\) \(.*)\)=\1$shellpath \2=g" "${_mappings_file}"; then
printf "%s\n" "=> Neovim shell changed to $shellpath successfully!"
if "${_SED}" --posix -i'.bak' -e "s=^\(map(.* \+*terminal\) \(.*)\)=\1$_SHELLPATH \2=g" "${_mappings_file}"; then
printf "%s\n" "=> Neovim shell changed to $_SHELLPATH successfully!"
else
printf "%s\n" "Cannot edit with sed, edit ${_mappings_file} manually to replace bash with $shellpath."
printf "%s\n" "Cannot edit with sed, edit ${_mappings_file} manually to replace bash with $_SHELLPATH."
fi
rm -f "${_mappings_file}".bak # delete backup file created by sed
fi
printf "%s\n\n" "=> Neovim shell will be ${shellpath:-${_CURRENT_SHELL}}"
printf "%s\n" "=> Neovim shell will be ${_SHELLPATH:-${_CURRENT_SHELL}}"
return 0
}
_setup_arguments() {

View file

@ -115,6 +115,5 @@ bg("NormalFloat", black2)
bg("FloatBorder", black2)
fg("FloatBorder", black2)
-- set bg color for nvim ( so nvim wont use terminal bg)
bg("Normal", black)
-- set bg color for nvim
-- bg("Normal", black)

View file

@ -18,24 +18,27 @@ map("v", "x", [=[ "_x ]=], opt)
this line too ]]
--
-- escape with 'jk' mapping
vim.api.nvim_set_keymap("i", "jk", "<esc>", {})
vim.api.nvim_set_keymap("v", "jk", "<esc>", {})
vim.api.nvim_set_keymap("t", "jk", "<esc>", {})
-- Don't copy the replaced text after pasting in visual mode
map("v", "p", '"_dP', opt)
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
-- empty mode is same as using :map
map("", "j", 'v:count ? "j" : "gj"', {expr = true})
map("", "k", 'v:count ? "k" : "gk"', {expr = true})
map("", "<Down>", 'v:count ? "j" : "gj"', {expr = true})
map("", "<Up>", 'v:count ? "k" : "gk"', {expr = true})
-- OPEN TERMINALS --
map("n", "<C-l>", [[<Cmd> vnew +terminal | setlocal nobuflisted <CR>]], opt) -- term over right
map("n", "<C-x>", [[<Cmd> 10new +terminal | setlocal nobuflisted <CR>]], opt) -- term bottom
map("n", "<C-t>t", [[<Cmd> terminal <CR>]], opt) -- term buffer
map("n", "<C-l>", ":vnew +terminal | setlocal nobuflisted <CR>", opt) -- term over right
map("n", "<C-x>", ":10new +terminal | setlocal nobuflisted <CR>", opt) -- term bottom
map("n", "<C-t>t", ":<Cmd> terminal <CR>", opt) -- term buffer
-- copy whole file content
map("n", "<C-a>", [[ <Cmd> %y+<CR>]], opt)
map("n", "<C-a>", ":%y+<CR>", opt)
-- toggle numbers
map("n", "<leader>n", [[ <Cmd> set nu!<CR>]], opt)
map("n", "<leader>n", ":set nu!<CR>", opt)
-- Truezen.nvim
map("n", "<leader>zz", ":TZAtaraxis<CR>", opt)
@ -113,24 +116,24 @@ map("i", "<CR>", "v:lua.completions()", {expr = true})
map("n", "<C-n>", ":NvimTreeToggle<CR>", opt)
-- format code
map("n", "<Leader>fm", [[<Cmd> Neoformat<CR>]], opt)
map("n", "<Leader>fm", ":Neoformat<CR>", opt)
-- dashboard stuff
map("n", "<Leader>fw", [[<Cmd> Telescope live_grep<CR>]], opt)
map("n", "<Leader>db", [[<Cmd> Dashboard<CR>]], opt)
map("n", "<Leader>fn", [[<Cmd> DashboardNewFile<CR>]], opt)
map("n", "<Leader>bm", [[<Cmd> DashboardJumpMarks<CR>]], opt)
map("n", "<C-s>l", [[<Cmd> SessionLoad<CR>]], opt)
map("n", "<C-s>s", [[<Cmd> SessionSave<CR>]], opt)
map("n", "<Leader>db", ":Dashboard<CR>", opt)
map("n", "<Leader>fn", ":DashboardNewFile<CR>", opt)
map("n", "<Leader>bm", ":DashboardJumpMarks<CR>", opt)
map("n", "<C-s>l", ":SessionLoad<CR>", opt)
map("n", "<C-s>s", ":SessionSave<CR>", opt)
-- Telescope
map("n", "<Leader>gt", [[<Cmd> Telescope git_status <CR>]], opt)
map("n", "<Leader>cm", [[<Cmd> Telescope git_commits <CR>]], opt)
map("n", "<Leader>ff", [[<Cmd> Telescope find_files <CR>]], opt)
map("n", "<Leader>fp", [[<Cmd>lua require('telescope').extensions.media_files.media_files()<CR>]], opt)
map("n", "<Leader>fb", [[<Cmd>Telescope buffers<CR>]], opt)
map("n", "<Leader>fh", [[<Cmd>Telescope help_tags<CR>]], opt)
map("n", "<Leader>fo", [[<Cmd>Telescope oldfiles<CR>]], opt)
map("n", "<Leader>fw", ":Telescope live_grep<CR>", opt)
map("n", "<Leader>gt", ":Telescope git_status <CR>", opt)
map("n", "<Leader>cm", ":Telescope git_commits <CR>", opt)
map("n", "<Leader>ff", ":Telescope find_files <CR>", opt)
map("n", "<Leader>fp", ":Telescope media_files <CR>", opt)
map("n", "<Leader>fb", ":Telescope buffers<CR>", opt)
map("n", "<Leader>fh", ":Telescope help_tags<CR>", opt)
map("n", "<Leader>fo", ":Telescope oldfiles<CR>", opt)
-- bufferline tab stuff
map("n", "<S-t>", ":enew<CR>", opt) -- new buffer
@ -138,11 +141,24 @@ map("n", "<C-t>b", ":tabnew<CR>", opt) -- new tab
map("n", "<S-x>", ":bd!<CR>", opt) -- close tab
-- move between tabs
map("n", "<TAB>", [[<Cmd>BufferLineCycleNext<CR>]], opt)
map("n", "<S-TAB>", [[<Cmd>BufferLineCyclePrev<CR>]], opt)
map("n", "<TAB>", ":BufferLineCycleNext<CR>", opt)
map("n", "<S-TAB>", ":BufferLineCyclePrev<CR>", opt)
-- use ESC to turn off search highlighting
map("n", "<Esc>", ":noh<CR>", opt)
-- get out of terminal with jk
map("t", "jk", "<C-\\><C-n>", opt)
-- Packer commands till because we are not loading it at startup
vim.cmd("silent! command PackerCompile lua require 'pluginList' require('packer').compile()")
vim.cmd("silent! command PackerInstall lua require 'pluginList' require('packer').install()")
vim.cmd("silent! command PackerStatus lua require 'pluginList' require('packer').status()")
vim.cmd("silent! command PackerSync lua require 'pluginList' require('packer').sync()")
vim.cmd("silent! command PackerUpdate lua require 'pluginList' require('packer').update()")
-- Vim Fugitive
map("n", "<Leader>gs", ":Git<CR>", opt)
map("n", "<Leader>gh", ":diffget //2<CR>", opt)
map("n", "<Leader>gl", ":diffget //3<CR>", opt)
map("n", "<Leader>gb", ":Git blame<CR>", opt)

View file

@ -1,13 +1,6 @@
local opt = vim.opt
local g = vim.g
-- Turn these off at startup, will be enabled later just before loading the theme
vim.cmd([[
syntax off
filetype off
filetype plugin indent off
]])
opt.ruler = false
opt.hidden = true
opt.ignorecase = true
@ -71,9 +64,5 @@ for _, plugin in pairs(disabled_built_ins) do
vim.g["loaded_" .. plugin] = 1
end
local M = {}
-- file extension specific tabbing
-- vim.cmd([[autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4]])
return M

View file

@ -16,9 +16,20 @@ return packer.startup(
event = "VimEnter"
}
use {
"jdhao/better-escape.vim",
event = "InsertEnter",
config = function()
require "plugins.others".escape()
end
}
use {
"akinsho/nvim-bufferline.lua",
after = "nvim-base16.lua"
after = "nvim-base16.lua",
config = function()
require "plugins.bufferline"
end
}
use {
@ -195,7 +206,7 @@ return packer.startup(
}
use {
"tweekmonster/startuptime.vim",
"dstein64/vim-startuptime",
cmd = "StartupTime"
}
@ -240,5 +251,12 @@ return packer.startup(
require("plugins.others").blankline()
end
}
use {
"tpope/vim-fugitive",
cmd = {
"Git"
}
}
end
)

View file

@ -104,12 +104,14 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] =
vim.lsp.diagnostic.on_publish_diagnostics,
{
virtual_text = {
-- prefix = "",
prefix = "",
spacing = 0
},
signs = true,
underline = true
underline = true,
-- set this to true if you want diagnostics to show in insert mode
update_in_insert = false
}
)

View file

@ -15,6 +15,11 @@ M.comment = function()
end
end
M.escape = function()
vim.g.better_escape_interval = 300
vim.g.better_escape_shortcut = {"jk"}
end
M.lspkind = function()
local present, lspkind = pcall(require, "lspkind")
if present then

View file

@ -117,7 +117,14 @@ gls.right[1] = {
provider = function()
local clients = vim.lsp.get_active_clients()
if next(clients) ~= nil then
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return " " .. "" .. " LSP "
end
end
return ""
else
return ""
end

View file

@ -79,5 +79,6 @@ if
print("After completion of PackerSync, restart neovim.")
-- Trigger packer compile on PackerComplete, so it properly waits for PackerSync
vim.cmd 'autocmd User PackerComplete ++once lua require("packer").compile()'
require "pluginList"
require("packer").sync("telescope-fzf-native.nvim", "telescope-media-files.nvim")
end

View file

@ -3,13 +3,6 @@ vim.g.nvchad_theme = "onedark"
local present, base16 = pcall(require, "base16")
if present then
-- enabled these options, was disabled in options.lua
vim.cmd([[
syntax on
filetype on
filetype plugin indent on
]])
base16(base16.themes["onedark"], true)
require "highlights"
return true

33
lua/themes/javacafe.lua Normal file
View file

@ -0,0 +1,33 @@
local colors = {
white = "#b5bcc9",
darker_black = "#10171e",
black = "#131a21", -- nvim bg
black2 = "#1a2128",
one_bg = "#1e252c",
one_bg2 = "#272e35",
one_bg3 = "#2a3138",
grey = "#363d44",
grey_fg = "#4e555c",
grey_fg2 = "#51585f",
light_grey = "#545b62",
red = "#ef8891",
baby_pink = "#fca2aa",
pink = "#fca2af",
line = "#20272e", -- for lines like vertsplit
green = "#9ce5c0",
vibrant_green = "#a5d4af",
blue = "#99aee5",
nord_blue = "#9aa8cf",
yellow = "#fbdf90",
sun = "#fbdf9a",
purple = "#d7c1ed",
dark_purple = "#ccaced",
teal = "#92dbb6",
orange = "#EDA685",
cyan = "#b5c3ea",
statusline_bg = "#181f26",
lightbg = "#222930",
lightbg2 = "#1d242b"
}
return colors

View file

@ -2,7 +2,6 @@
vim.api.nvim_exec(
[[
au TermOpen term://* setlocal nonumber laststatus=0
au TermClose term://* bd!
au BufEnter,BufWinEnter,WinEnter,CmdwinEnter * if bufname('%') == "NvimTree" | set laststatus=0 | else | set laststatus=2 | endif
]],
false