diff --git a/configfile/nvim/lua/custom/chadrc.lua b/configfile/nvim/lua/custom/chadrc.lua index 0b3cab9..1fffb94 100644 --- a/configfile/nvim/lua/custom/chadrc.lua +++ b/configfile/nvim/lua/custom/chadrc.lua @@ -2,9 +2,7 @@ -- This file is for NvChad options & tools, custom settings are split between here and 'lua/custom/init.lua' local M = {} - --- To use this file, copy the structure of `core/default_config.lua`, --- examples of setting relative number & changing theme: +local userPlugins = require "custom.plugins" M.options = { -- relativenumber = true, @@ -19,7 +17,7 @@ M.ui = { M.plugins = { options = { statusline = { - style = "slant", + separator_style = "slant", } -- lspconfig = { -- path of file containing setups of different lsps (ex : "custom.plugins.lspconfig"), read the docs for more info @@ -33,16 +31,20 @@ M.plugins = { -- use "(custom.configs).my_func()" to call a function -- use "custom.blankline" to call a file --default_plugin_config_replace = {}, + override = {}, + remove = {}, + + user = userPlugins, } M.mappings = { -- custom = {}, -- custom user mappings - misc = { + custom = { cheatsheet = "ch", line_number_toggle = "n", -- toggle line number update_nvchad = "uu", - new_tab = "t", + new_tab = "t", }, } diff --git a/configfile/nvim/lua/custom/init.lua b/configfile/nvim/lua/custom/init.lua new file mode 100644 index 0000000..c2c7090 --- /dev/null +++ b/configfile/nvim/lua/custom/init.lua @@ -0,0 +1,15 @@ +-- AutoCMD: +--vim.cmd([[ +-- stuff +-- stuff +--]]) + +-- Open a file from its last left off position +vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]] + +-- uncomment this if you want to open nvim with a dir +vim.cmd [[ autocmd BufEnter * if &buftype != "terminal" | lcd %:p:h | endif ]] + +-- File extension specific tabbing +vim.cmd [[ autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 ]] + diff --git a/configfile/nvim/lua/custom/plugins/init.lua b/configfile/nvim/lua/custom/plugins/init.lua new file mode 100644 index 0000000..9df92c9 --- /dev/null +++ b/configfile/nvim/lua/custom/plugins/init.lua @@ -0,0 +1,21 @@ +-- Additional Plugins +-- +return { + ['cappyzawa/trim.nvim'] = { + config = function() + require('trim').setup({ + -- if you want to ignore markdown file. + -- you can specify filetypes. + disable = {"markdown"}, + + -- if you want to ignore space of top + patterns = { + [[%s/\s\+$//e]], -- remove unwanted spaces + [[%s/\($\n\s*\)\+\%$//]], -- trim last line + [[%s/\%^\n\+//]], -- trim first line + -- [[%s/\(\n\n\)\n\+/\1/]], -- replace multiple blank lines with a single line + }, + }) + end + } +} diff --git a/configfile/nvim/lua/init.lua b/configfile/nvim/lua/init.lua deleted file mode 100644 index 51abb04..0000000 --- a/configfile/nvim/lua/init.lua +++ /dev/null @@ -1,13 +0,0 @@ --- Please check NvChad docs if you're totally new to nvchad + dont know lua!! --- This is an example init file in /lua/custom/ --- this init.lua can load stuffs etc too so treat it like your ~/.config/nvim/ - --- MAPPINGS -local map = require("core.utils").map - - ---map("n", "cc", ":Telescope ") ---map("n", "q", ":q ") - -vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]] --- NOTE: the 4th argument in the map function is be a table i.e options but its most likely un-needed so dont worry about it diff --git a/dotfiles/gitconfig b/dotfiles/gitconfig index f7df6b3..f32197f 100644 --- a/dotfiles/gitconfig +++ b/dotfiles/gitconfig @@ -44,3 +44,5 @@ prompt = false [difftool] prompt = false +[safe] + directory = /home/nold/git/armbian-build diff --git a/fonts/DejaVu Sans Mono Nerd Font Complete Mono.ttf b/fonts/DejaVu Sans Mono Nerd Font Complete Mono.ttf new file mode 100644 index 0000000..10c879b Binary files /dev/null and b/fonts/DejaVu Sans Mono Nerd Font Complete Mono.ttf differ diff --git a/setup.sh b/setup.sh index 2e7a018..be52ae3 100755 --- a/setup.sh +++ b/setup.sh @@ -2,6 +2,7 @@ set -u mkdir -p ~/.config/homedir-backup 2>/dev/null +# Creates Directories & linkes files to this repo function linkfiles { for file in $@; do name=$(basename $file) @@ -37,32 +38,63 @@ function linkfiles { linkfiles 'dotfiles/*' -#git clone https://github.com/NvChad/NvChad ~/.config/nvim -#nvim -c "autocmd User PackerComplete quitall" -c "PackerSync" -#linkfiles 'config/*' -set -x +# Clones repo to dir, or pulls repo if dir already exists +# Params: +# git-repo-url target-dir [clone options] +function git-sync { + repo=$1 + dir=$2 + shift; shift + + if [ ! -d "$dir" ] ; then + mkdir -p "$dir" + git clone --depth=1 $@ "$repo" "$dir" + return 0 + else + git -C "$dir" pull + return 1 + fi +} + +linkfiles 'dotfiles/*' + +# NeoVIM & NvChad +git-sync https://github.com/NvChad/NvChad ~/.config/nvim +nvim +'hi NormalFloat guibg=#1e222a' +PackerSync + +# Link Config Directories +linkfiles 'config/*' + +# Link Config Files for file in $(find configfile -type f) ; do linkfiles $file done -set +x -exit + # Install powerline if possible -if which pip3 ; then +if type pip3 &>/dev/null ; then pip3 install --user -U -r requirements.txt -else - [ ! -d ~/.bash-git-prompt ] && git clone https://github.com/nold360/bash-git-prompt.git ~/.bash-git-prompt fi # Install vundle plugin manager & plugins mkdir -p ~/.vim/bundle 2>/dev/null -[ ! -d ~/.vim/bundle/Vundle.vim ] && git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim - -vim -c ":PluginInstall" -c ":q" -c ":q" +# Legacy Vim +if git-sync https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim; then + vim -c ":PluginInstall" -c ":q" -c ":q" +else + vim -c ":PluginUpdate" -c ":q" -c ":q" +fi # Tmux Plugin Manager mkdir -p ~/.tmux/plugins 2>/dev/null -git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm +git-sync https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm +# Copy fonts +mkdir -p ~/.fonts/ +cp fonts/* ~/.fonts/ + +# Inject bashrc sourcing grep -qE "^source.*$(pwd)/bashrc" ~/.bashrc || echo "source $(pwd)/bashrc" >> ~/.bashrc -echo Done + +echo +echo All Done. Happy Hacking. diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..68ae9a5 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +echo "Uninstalling NeoVIM - NvChad..." +rm -rf ~/.config/nvim ~/.local/share/nvim ~/.cache/nvim diff --git a/update.sh b/update.sh deleted file mode 100755 index 5f59370..0000000 --- a/update.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -GIT_DIRS=(. ~/.vim/bundle ~/.config/nvim ~/.tmux/plugins/tpm) -for dir in ${GIT_DIRS[@]} ; do - if [ -d "$dir" ] ; then - git -C "$dir" stash - git -C "$dir" pull - git -C "$dir" stash pop - else - echo "Skipping: $dir" - fi -done - -if type nvim &>/dev/null ; then - nvim -c "autocmd User PackerComplete quitall" -c "PackerSync" -fi - -vim -c ":PluginUpdate" -c ":q" -c ":q"