Skip to content

Commit d826bcf

Browse files
committed
refactor: use nvchad for neovim
1 parent 6c143ec commit d826bcf

File tree

6 files changed

+51
-163
lines changed

6 files changed

+51
-163
lines changed

README.adoc

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ My cross-platform dotfiles (works on MacOS/Windows) that configures ZSH and neov
2020

2121

2222
== Run Setup Script
23-
Open a shell and execute the following command:
23+
Open a shell and execute the following commands:
2424
.Execute this
2525
[source,shell]
2626
----
27-
curl -sfL https://raw.github.com/lenkite/dotfiles/master/setup.sh | bash
27+
git clone https://github.com/lenkite/dotfiles ~/dotfiles
28+
cd ~/dotfiles
29+
./setup.sh
2830
----
2931

3032

ideavimrc

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ nmap <A-W> :action CloseContent<CR>
2424
map <Leader>u :action SurroundWith<CR>
2525
nmap <A-CR> :action ShowIntentionActions<CR>
2626
nmap <M-CR> :action ShowIntentionActions<CR>
27+
set ideajoin "https://github.com/JetBrains/ideavim/blob/master/doc/ideajoin-examples.md
2728

2829

2930
"Navigation
@@ -61,4 +62,6 @@ nmap <Leader>Gc :action GenerateConstructor<CR>
6162
"surround
6263
set surround
6364

64-
autocmd FileType css,html set iskeyword+=-
65+
autocmd FileType css,html set iskeyword+=-
66+
67+
packadd matchit

nvimcfg

-1
This file was deleted.

scripts/cfpgweb

-70
This file was deleted.

scripts/obj-store-creds

-58
This file was deleted.

setup.sh

+43-31
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
# Supported OS'es are Windows/Cygwin, Windows/WSL, MacOS and Linux
44
# Dev Note: Some funcs here are duplicated in zshcfg/0.zsh. This is by design
55

6+
set -euo pipefail # See https://bertvv.github.io/cheat-sheets/Bash.html
7+
declare codeSetup golibsSetup pkgSetup miscSetup sdkSetup viSetup zshSetup settingsSetup utilSetup allSetup
8+
declare done_detect_os done_set_uservars done_set_homevars
9+
declare isCygwin isWsl isLinux
10+
declare trueHome dotfilesDir
11+
612
usage() {
713
echo "Usage: $0 [-c] [-g] [-p] [-v] [-t] [-u] [-z]" 1>&2
814
exit 1
@@ -129,12 +135,13 @@ detect_dotfilesdir() {
129135
}
130136

131137
detect_util() {
138+
local hasCurl hasZip hasUnzip hasGit hasGo
139+
132140
hasCurl=$(command -v curl)
133141
hasZip=$(command -v zip)
134142
hasUnzip=$(command -v unzip)
135143
hasGit=$(command -v git)
136144
hasGo=$(command -v go)
137-
ctags --help >/dev/null 2>&1
138145
[[ $? -ge 0 ]] && hasCtags=false || hasCtags=true
139146
[[ hasCurl ]] || echo "WARN: 'curl' not found. Setup may be incomplete"
140147
[[ hasCtags ]] || echo "WARN: 'ctags' not found or GNU version not installed"
@@ -245,7 +252,9 @@ gh_download_linux_release() {
245252
install_pkgs() {
246253
echo "- (install_pkgs) Installing packages..."
247254
if [[ $isMacos == true ]]; then
248-
brew install coreutils parallel iproute2mac gnu-sed gnu-tar grep gzip fd jq ctags the_silver_searcher fortune cowsay node go rlwrap yarn neovim skim cmake deno ripgrep delve kubectl krew kube-ps1 gardener/tap/gardenctl-v2 docker openvpn
255+
brew install coreutils parallel iproute2mac gnu-sed gnu-tar grep gzip fd jq ctags the_silver_searcher fortune cowsay node go rlwrap yarn neovim skim cmake deno ripgrep delve kubectl krew kube-ps1 gardener/tap/gardenctl-v2 docker openvpn lazygit k9s
256+
brew tap johanhaleby/kubetail && brew install kubetail
257+
brew tap homebrew/cask-fonts && brew install --cask font-jetbrains-mono-nerd-font --cask font-symbols-only-nerd-font
249258
elif [[ $isLinux == true ]]; then
250259
if [[ $isRedhat == true ]]; then
251260
install_pkgs_redhat
@@ -366,23 +375,31 @@ setup_vim() {
366375
initialize_vars
367376
echo "-- setup_vim"
368377

369-
nvimConfigDotfiles=$dotfilesDir/nvimcfg
378+
local nvimConfigDotfiles=$dotfilesDir/nvimcfg
370379

371-
nvimConfig=$trueHome/.config/nvim
372-
rm $vimConfig 2>/dev/null
380+
local nvimConfig=$trueHome/.config/nvim
381+
local nvimShare=$trueHome/.local/share/nvim
382+
local nvimState=$trueHome/.local/state/nvim
383+
local nvimCache=$trueHome/.cache/nvim
373384

374-
rm $trueHome/.vimrc 2>/dev/null
375-
rm $trueHome/_vimrc 2>/dev/null
376-
rm $trueHome/.ideavimrc 2>/dev/null
377-
rm $nvimConfig 2>/dev/null
385+
[[ -e "$trueHome/.vimrc" ]] && rm "$trueHome/.vimrc"
386+
[[ -e "$trueHome/_vimrc" ]] && rm "$trueHome/_vimrc"
387+
[[ -e "$trueHome/.ideavimrc" ]] && rm $trueHome/.ideavimrc
378388

379389
echo "Linking ideavimrc"
380390
ln $dotfilesDir/ideavimrc $trueHome/.ideavimrc
381391

382-
echo "Cloning LazyVim..."
383-
rm -rf $trueHome/.config/nvim
384-
git clone https://github.com/LazyVim/starter ~/.config/nvim
385-
ln -sf $nvimConfigDotfiles/customize.lua $nvimConfig/lua/plugins/customize.lua
392+
echo "Deleting (if present) $nvimConfig, $nvimShare, $nvimState, $nvimCache"
393+
[[ -d $nvimConfig ]] && echo "deleing $nvimConfig.." && rm -rf $nvimConfig
394+
[[ -d $nvimShare ]] && echo "deleing $nvimShare.." && rm -rf $nvimShare
395+
[[ -d $nvimState ]] && echo "deleing $nvimState.." && rm -rf $nvimState
396+
[[ -d $nvimCache ]] && echo "deleing $nvimCache.." && rm -rf $nvimCache
397+
398+
echo "Installing nvchad.."
399+
git clone https://github.com/NvChad/NvChad ~/.config/nvim --depth 1
400+
git clone https://github.com/lenkite/nvchad_custom_config ~/.config/nvim/lua/custom
401+
NVCHAD_EXAMPLE_CONFIG=n nvim --headless +"TSUpdate vimdoc" +"q"
402+
386403
}
387404

388405
setup_misc() {
@@ -422,7 +439,7 @@ setup_util() {
422439
}
423440

424441
setup_settings() {
425-
echo "- setup_settings"
442+
echo "- setup_settings (OS settings)"
426443
hasTmux=$(command -v tmux)
427444
if [[ $isMacos ]]; then
428445
[[ $hasTmux ]] && brew install tmux
@@ -451,13 +468,15 @@ setup_sdk() {
451468
setup_zsh() {
452469
initialize_vars
453470
echo "- setup_zsh"
471+
echo "Copying zsh history to /tmp..."
472+
cp $trueHome/.zsh_history /tmp
454473
echo "Deleting all existing .z* files from home directory.."
455-
rm $trueHome/.zshrc 2>/dev/null
456-
rm $trueHome/.zprofile 2>/dev/null
457-
rm $trueHome/.zshenv 2>/dev/null
458-
rm $trueHome/.zlogin 2>/dev/null
459-
rm $trueHome/.zlogout 2>/dev/null
460-
rm $trueHome/.zpreztorc 2>/dev/null
474+
[[ -f "$trueHome/.zshrc" ]] && rm $trueHome/.zshrc
475+
[[ -f "$trueHome/.zprofile" ]] && rm $trueHome/.zprofile 2>/dev/null
476+
[[ -f "$trueHome/.zshenv" ]] && rm $trueHome/.zshenv 2>/dev/null
477+
[[ -f "$trueHome/.zlogin" ]] && rm $trueHome/.zlogin 3>/dev/null
478+
[[ -f "$trueHome/.zlogout" ]] && rm $trueHome/.zlogout 2>/dev/null
479+
[[ -f "$trueHome/.zpreztorc" ]] && rm $trueHome/.zpreztorc 2>/dev/null
461480
echo "Deleted all existing .z* files from home directory.."
462481

463482
zshCfgDir=$dotfilesDir/zshcfg
@@ -486,23 +505,16 @@ setup_zsh() {
486505
rm -rf $trueHome/.zgen
487506
fi
488507

489-
# if [[ $hasCurl ]]; then
490-
# echo "Installing antigen"
491-
# local antigenDir=$trueHome/.antigen
492-
# [[ -d $antigenDir ]] || mkdir -p $antigenDir
493-
# local antigenLoc=$antigenDir/antigen.zsh
494-
# [[ -f $antigenLoc ]] && rm -f $antigenLoc
495-
# curl -L git.io/antigen > $antigenLoc
496-
# else
497-
# echo "ERROR: Could not find git and hence couldn't clone zgen :("
498-
# fi
499-
500508
if [ -d $trueHome/.zgen -a -d $trueHome/.zgen/.git ]; then
501509
git -C $trueHome/.zgen reset --hard
502510
git -C $trueHome/.zgen pull
503511
else
504512
git clone https://github.com/tarjoilija/zgen.git "${trueHome}/.zgen"
505513
fi
514+
echo "Coping back .zsh_history to $trueHome..."
515+
cp /tmp/.zsh_history $trueHome/
516+
517+
echo "--setup_zsh is done"
506518

507519
}
508520

0 commit comments

Comments
 (0)