-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup following Dreams of Code tutorial https://github.com/dreamsofcode-io/neovim-python https://www.youtube.com/watch?v=4BnVeOUeZxc https://github.com/NvChad/NvChad
- Loading branch information
1 parent
eb53460
commit f4037f6
Showing
25 changed files
with
2,413 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
column_width = 120 | ||
line_endings = "Unix" | ||
indent_type = "Spaces" | ||
indent_width = 2 | ||
quote_style = "AutoPreferDouble" | ||
call_parentheses = "None" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require "core" | ||
|
||
local custom_init_path = vim.api.nvim_get_runtime_file("lua/custom/init.lua", false)[1] | ||
|
||
if custom_init_path then | ||
dofile(custom_init_path) | ||
end | ||
|
||
require("core.utils").load_mappings() | ||
|
||
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" | ||
|
||
-- bootstrap lazy.nvim! | ||
if not vim.loop.fs_stat(lazypath) then | ||
require("core.bootstrap").gen_chadrc_template() | ||
require("core.bootstrap").lazy(lazypath) | ||
end | ||
|
||
dofile(vim.g.base46_cache .. "defaults") | ||
vim.opt.rtp:prepend(lazypath) | ||
require "plugins" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
local M = {} | ||
|
||
M.echo = function(str) | ||
vim.cmd "redraw" | ||
vim.api.nvim_echo({ { str, "Bold" } }, true, {}) | ||
end | ||
|
||
M.lazy = function(install_path) | ||
------------- base46 --------------- | ||
local lazy_path = vim.fn.stdpath "data" .. "/lazy/base46" | ||
|
||
M.echo " Compiling base46 theme to bytecode ..." | ||
|
||
local base46_repo = "https://github.com/NvChad/base46" | ||
vim.fn.system { "git", "clone", "--depth", "1", "-b", "v2.0", base46_repo, lazy_path } | ||
vim.opt.rtp:prepend(lazy_path) | ||
|
||
require("base46").compile() | ||
|
||
--------- lazy.nvim --------------- | ||
M.echo " Installing lazy.nvim & plugins ..." | ||
local repo = "https://github.com/folke/lazy.nvim.git" | ||
vim.fn.system { "git", "clone", "--filter=blob:none", "--branch=stable", repo, install_path } | ||
vim.opt.rtp:prepend(install_path) | ||
|
||
-- install plugins | ||
require "plugins" | ||
|
||
-- mason packages & show post_boostrap screen | ||
require "nvchad.post_bootstrap"() | ||
end | ||
|
||
M.gen_chadrc_template = function() | ||
if not vim.api.nvim_get_runtime_file("lua/custom/chadrc.lua", false)[1] then | ||
local path = vim.fn.stdpath "config" .. "/lua/custom/" | ||
local input = vim.fn.input "Do you want to install example custom config? (y/N) : " | ||
|
||
-- clone example_config repo | ||
if input == "y" then | ||
M.echo "cloning example custom config repo ..." | ||
vim.fn.system { "git", "clone", "--depth", "1", "https://github.com/NvChad/example_config", path } | ||
vim.fn.delete(path .. ".git", "rf") | ||
else | ||
-- use very minimal chadrc | ||
vim.fn.mkdir(path, "p") | ||
|
||
local file = io.open(path .. "chadrc.lua", "w") | ||
file:write "---@type ChadrcConfig \n local M = {}\n M.ui = {theme = 'onedark'}\n return M" | ||
file:close() | ||
end | ||
end | ||
end | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
local M = {} | ||
|
||
M.options = { | ||
nvchad_branch = "v2.0", | ||
} | ||
|
||
M.ui = { | ||
------------------------------- base46 ------------------------------------- | ||
-- hl = highlights | ||
hl_add = {}, | ||
hl_override = {}, | ||
changed_themes = {}, | ||
theme_toggle = { "onedark", "one_light" }, | ||
theme = "onedark", -- default theme | ||
transparency = false, | ||
lsp_semantic_tokens = false, -- needs nvim v0.9, just adds highlight groups for lsp semantic tokens | ||
|
||
-- https://github.com/NvChad/base46/tree/v2.0/lua/base46/extended_integrations | ||
extended_integrations = {}, -- these aren't compiled by default, ex: "alpha", "notify" | ||
|
||
-- cmp themeing | ||
cmp = { | ||
icons = true, | ||
lspkind_text = true, | ||
style = "default", -- default/flat_light/flat_dark/atom/atom_colored | ||
border_color = "grey_fg", -- only applicable for "default" style, use color names from base30 variables | ||
selected_item_bg = "colored", -- colored / simple | ||
}, | ||
|
||
telescope = { style = "borderless" }, -- borderless / bordered | ||
|
||
------------------------------- nvchad_ui modules ----------------------------- | ||
statusline = { | ||
theme = "default", -- default/vscode/vscode_colored/minimal | ||
-- default/round/block/arrow separators work only for default statusline theme | ||
-- round and block will work for minimal theme only | ||
separator_style = "default", | ||
overriden_modules = nil, | ||
}, | ||
|
||
-- lazyload it when there are 1+ buffers | ||
tabufline = { | ||
show_numbers = false, | ||
enabled = true, | ||
lazyload = true, | ||
overriden_modules = nil, | ||
}, | ||
|
||
-- nvdash (dashboard) | ||
nvdash = { | ||
load_on_startup = false, | ||
|
||
header = { | ||
" ▄ ▄ ", | ||
" ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ ", | ||
" █ ▄ █▄█ ▄▄▄ █ █▄█ █ █ ", | ||
" ▄▄ █▄█▄▄▄█ █▄█▄█▄▄█▄▄█ █ ", | ||
" ▄ █▄▄█ ▄ ▄▄ ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ", | ||
" █▄▄▄▄ ▄▄▄ █ ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ █ ▄", | ||
"▄ █ █▄█ █▄█ █ █ █▄█ █ █▄█ ▄▄▄ █ █", | ||
"█▄█ ▄ █▄▄█▄▄█ █ ▄▄█ █ ▄ █ █▄█▄█ █", | ||
" █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ █▄█▄▄▄█ ", | ||
}, | ||
|
||
buttons = { | ||
{ " Find File", "Spc f f", "Telescope find_files" }, | ||
{ " Recent Files", "Spc f o", "Telescope oldfiles" }, | ||
{ " Find Word", "Spc f w", "Telescope live_grep" }, | ||
{ " Bookmarks", "Spc m a", "Telescope marks" }, | ||
{ " Themes", "Spc t h", "Telescope themes" }, | ||
{ " Mappings", "Spc c h", "NvCheatsheet" }, | ||
}, | ||
}, | ||
|
||
cheatsheet = { theme = "grid" }, -- simple/grid | ||
|
||
lsp = { | ||
-- show function signatures i.e args as you type | ||
signature = { | ||
disabled = false, | ||
silent = true, -- silences 'no signature help available' message from appearing | ||
}, | ||
}, | ||
} | ||
|
||
M.plugins = "" -- path i.e "custom.plugins", so make custom/plugins.lua file | ||
|
||
M.lazy_nvim = require "plugins.configs.lazy_nvim" -- config for lazy.nvim startup options | ||
|
||
M.mappings = require "core.mappings" | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
local opt = vim.opt | ||
local g = vim.g | ||
local config = require("core.utils").load_config() | ||
|
||
-------------------------------------- globals ----------------------------------------- | ||
g.nvchad_theme = config.ui.theme | ||
g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/" | ||
g.toggle_theme_icon = " " | ||
g.transparency = config.ui.transparency | ||
|
||
-------------------------------------- options ------------------------------------------ | ||
opt.laststatus = 3 -- global statusline | ||
opt.showmode = false | ||
|
||
opt.clipboard = "unnamedplus" | ||
opt.cursorline = true | ||
|
||
-- Indenting | ||
opt.expandtab = true | ||
opt.shiftwidth = 2 | ||
opt.smartindent = true | ||
opt.tabstop = 2 | ||
opt.softtabstop = 2 | ||
|
||
opt.fillchars = { eob = " " } | ||
opt.ignorecase = true | ||
opt.smartcase = true | ||
opt.mouse = "a" | ||
|
||
-- Numbers | ||
opt.number = true | ||
opt.numberwidth = 2 | ||
opt.ruler = false | ||
|
||
-- disable nvim intro | ||
opt.shortmess:append "sI" | ||
|
||
opt.signcolumn = "yes" | ||
opt.splitbelow = true | ||
opt.splitright = true | ||
opt.termguicolors = true | ||
opt.timeoutlen = 400 | ||
opt.undofile = true | ||
|
||
-- interval for writing swap file to disk, also used by gitsigns | ||
opt.updatetime = 250 | ||
|
||
-- go to previous/next line with h,l,left arrow and right arrow | ||
-- when cursor reaches end/beginning of line | ||
opt.whichwrap:append "<>[]hl" | ||
|
||
g.mapleader = " " | ||
|
||
-- disable some default providers | ||
for _, provider in ipairs { "node", "perl", "python3", "ruby" } do | ||
vim.g["loaded_" .. provider .. "_provider"] = 0 | ||
end | ||
|
||
-- add binaries installed by mason.nvim to path | ||
local is_windows = vim.loop.os_uname().sysname == "Windows_NT" | ||
vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH | ||
|
||
-------------------------------------- autocmds ------------------------------------------ | ||
local autocmd = vim.api.nvim_create_autocmd | ||
|
||
-- dont list quickfix buffers | ||
autocmd("FileType", { | ||
pattern = "qf", | ||
callback = function() | ||
vim.opt_local.buflisted = false | ||
end, | ||
}) | ||
|
||
-- reload some chadrc options on-save | ||
vim.api.nvim_create_autocmd("BufWritePost", { | ||
pattern = vim.tbl_map( | ||
vim.fs.normalize, | ||
vim.fn.glob(vim.loop.fs_realpath(vim.fn.stdpath "config" .. "/lua/custom/**/*.lua"), true, true, true) | ||
), | ||
group = vim.api.nvim_create_augroup("ReloadNvChad", {}), | ||
|
||
callback = function(opts) | ||
local fp = vim.fn.fnamemodify(vim.fs.normalize(vim.api.nvim_buf_get_name(opts.buf)), ":r") --[[@as string]] | ||
local app_name = vim.env.NVIM_APPNAME and vim.env.NVIM_APPNAME or "nvim" | ||
local module = string.gsub(fp, "^.*/" .. app_name .. "/lua/", ""):gsub("/", ".") | ||
|
||
require("plenary.reload").reload_module "base46" | ||
require("plenary.reload").reload_module(module) | ||
require("plenary.reload").reload_module "custom.chadrc" | ||
|
||
config = require("core.utils").load_config() | ||
|
||
vim.g.nvchad_theme = config.ui.theme | ||
vim.g.transparency = config.ui.transparency | ||
|
||
-- statusline | ||
require("plenary.reload").reload_module("nvchad_ui.statusline." .. config.ui.statusline.theme) | ||
vim.opt.statusline = "%!v:lua.require('nvchad_ui.statusline." .. config.ui.statusline.theme .. "').run()" | ||
|
||
require("base46").load_all_highlights() | ||
-- vim.cmd("redraw!") | ||
end, | ||
}) | ||
|
||
-------------------------------------- commands ------------------------------------------ | ||
local new_cmd = vim.api.nvim_create_user_command | ||
|
||
new_cmd("NvChadUpdate", function() | ||
require "nvchad.update"() | ||
end, {}) |
Oops, something went wrong.