Fix nvim; New nvim features; unified setup.sh & update.sh; added nerd font

This commit is contained in:
nold 2022-05-01 19:47:29 +02:00
parent a92b6b21de
commit 146a0abe2f
9 changed files with 96 additions and 51 deletions

View file

@ -2,9 +2,7 @@
-- This file is for NvChad options & tools, custom settings are split between here and 'lua/custom/init.lua' -- This file is for NvChad options & tools, custom settings are split between here and 'lua/custom/init.lua'
local M = {} local M = {}
local userPlugins = require "custom.plugins"
-- To use this file, copy the structure of `core/default_config.lua`,
-- examples of setting relative number & changing theme:
M.options = { M.options = {
-- relativenumber = true, -- relativenumber = true,
@ -19,7 +17,7 @@ M.ui = {
M.plugins = { M.plugins = {
options = { options = {
statusline = { statusline = {
style = "slant", separator_style = "slant",
} }
-- lspconfig = { -- lspconfig = {
-- path of file containing setups of different lsps (ex : "custom.plugins.lspconfig"), read the docs for more info -- path of file containing setups of different lsps (ex : "custom.plugins.lspconfig"), read the docs for more info
@ -33,12 +31,16 @@ M.plugins = {
-- use "(custom.configs).my_func()" to call a function -- use "(custom.configs).my_func()" to call a function
-- use "custom.blankline" to call a file -- use "custom.blankline" to call a file
--default_plugin_config_replace = {}, --default_plugin_config_replace = {},
override = {},
remove = {},
user = userPlugins,
} }
M.mappings = { M.mappings = {
-- custom = {}, -- custom user mappings -- custom = {}, -- custom user mappings
misc = { custom = {
cheatsheet = "<leader>ch", cheatsheet = "<leader>ch",
line_number_toggle = "<leader>n", -- toggle line number line_number_toggle = "<leader>n", -- toggle line number
update_nvchad = "<leader>uu", update_nvchad = "<leader>uu",

View file

@ -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 ]]

View file

@ -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
}
}

View file

@ -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", "<leader>cc", ":Telescope <CR>")
--map("n", "<leader>q", ":q <CR>")
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

View file

@ -44,3 +44,5 @@
prompt = false prompt = false
[difftool] [difftool]
prompt = false prompt = false
[safe]
directory = /home/nold/git/armbian-build

Binary file not shown.

View file

@ -2,6 +2,7 @@
set -u set -u
mkdir -p ~/.config/homedir-backup 2>/dev/null mkdir -p ~/.config/homedir-backup 2>/dev/null
# Creates Directories & linkes files to this repo
function linkfiles { function linkfiles {
for file in $@; do for file in $@; do
name=$(basename $file) name=$(basename $file)
@ -37,32 +38,63 @@ function linkfiles {
linkfiles 'dotfiles/*' linkfiles 'dotfiles/*'
#git clone https://github.com/NvChad/NvChad ~/.config/nvim # Clones repo to dir, or pulls repo if dir already exists
#nvim -c "autocmd User PackerComplete quitall" -c "PackerSync" # Params:
#linkfiles 'config/*' # git-repo-url target-dir [clone options]
set -x 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 for file in $(find configfile -type f) ; do
linkfiles $file linkfiles $file
done done
set +x
exit
# Install powerline if possible # Install powerline if possible
if which pip3 ; then if type pip3 &>/dev/null ; then
pip3 install --user -U -r requirements.txt 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 fi
# Install vundle plugin manager & plugins # Install vundle plugin manager & plugins
mkdir -p ~/.vim/bundle 2>/dev/null 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 # Tmux Plugin Manager
mkdir -p ~/.tmux/plugins 2>/dev/null 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 grep -qE "^source.*$(pwd)/bashrc" ~/.bashrc || echo "source $(pwd)/bashrc" >> ~/.bashrc
echo Done
echo
echo All Done. Happy Hacking.

4
uninstall.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
echo "Uninstalling NeoVIM - NvChad..."
rm -rf ~/.config/nvim ~/.local/share/nvim ~/.cache/nvim

View file

@ -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"