aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2024-08-10 14:29:20 -0400
committerEugene Triguba <eugenetriguba@gmail.com>2024-08-10 14:29:20 -0400
commitb6a2bf5a81c659aa4f42c87ee97c4198890a6711 (patch)
tree2caa05a42398eea5a3537b2dbc8900401d81fdab
parentAdd two small scripts (diff)
downloaddotfiles-b6a2bf5a81c659aa4f42c87ee97c4198890a6711.zip
Update vim config
-rw-r--r--.config/nvim/init.lua163
-rw-r--r--.config/nvim/init.vim86
-rw-r--r--.config/nvim/plugin/packer_compiled.lua189
-rwxr-xr-x.zshrc29
-rwxr-xr-x[-rw-r--r--]bin/gh-clone-all0
-rw-r--r--homebrew/Brewfile2
-rwxr-xr-xinstall.sh28
7 files changed, 394 insertions, 103 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
new file mode 100644
index 0000000..17ede2c
--- /dev/null
+++ b/.config/nvim/init.lua
@@ -0,0 +1,163 @@
+-- Flash screen instead of beep sound
+vim.opt.visualbell = true
+vim.opt.encoding = 'utf-8'
+vim.opt.fileencoding = 'utf-8'
+vim.opt.number = true
+vim.opt.linebreak = true
+vim.opt.splitbelow = true
+vim.opt.splitright = true
+vim.opt.shiftwidth = 4
+vim.opt.backspace = { 'indent', 'eol', 'start' }
+vim.cmd('filetype plugin indent on')
+
+-- Whitespace settings per filetype
+vim.api.nvim_create_autocmd('FileType', {
+ pattern = 'python',
+ command = 'setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4'
+})
+
+vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, {
+ pattern = '*.go',
+ command = 'setlocal noet tabstop=4 shiftwidth=4 softtabstop=4'
+})
+
+vim.api.nvim_create_autocmd('FileType', {
+ pattern = {'javascript', 'typescript', 'java', 'rust', 'c', 'cpp'},
+ command = 'setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2'
+})
+
+-- Automatically install packer.nvim if not installed
+local ensure_packer = function()
+ local fn = vim.fn
+ local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
+ if fn.empty(fn.glob(install_path)) > 0 then
+ fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
+ vim.cmd [[packadd packer.nvim]]
+ return true
+ end
+ return false
+end
+
+local packer_bootstrap = ensure_packer()
+
+-- Autocommand to reload Neovim whenever you save the init.lua
+vim.cmd([[
+ augroup packer_user_config
+ autocmd!
+ autocmd BufWritePost init.lua source <afile> | PackerSync
+ augroup end
+]])
+
+-- Plugin manager setup using packer.nvim
+require('packer').startup(function(use)
+ -- Packer can manage itself
+ use 'wbthomason/packer.nvim'
+
+ -- Auto complete
+ use 'neovim/nvim-lspconfig'
+ use 'hrsh7th/nvim-cmp'
+ use 'hrsh7th/cmp-nvim-lsp'
+ use 'hrsh7th/cmp-buffer'
+ use 'hrsh7th/cmp-path'
+ use 'hrsh7th/cmp-cmdline'
+
+ -- Fuzzy finder
+ use { 'junegunn/fzf', run = 'fzf#install()' }
+ use 'junegunn/fzf.vim'
+
+ -- Git gutter
+ use 'airblade/vim-gitgutter'
+
+ -- Status bar
+ use 'nvim-lualine/lualine.nvim'
+
+ -- Git wrapper with :G
+ use 'tpope/vim-fugitive'
+
+ -- Editorconfig file support
+ use 'editorconfig/editorconfig-vim'
+
+ -- Theme
+ use 'sainnhe/everforest'
+
+ -- Go support
+ use { 'fatih/vim-go', run = ':GoUpdateBinaries' }
+
+ -- Treesitter for better syntax highlighting
+ use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
+
+ -- File explorer
+ use 'kyazdani42/nvim-tree.lua'
+
+ -- LSP Installer
+ use 'williamboman/mason.nvim'
+ use 'williamboman/mason-lspconfig.nvim'
+
+ -- Automatically set up your configuration after cloning packer.nvim
+ -- Put this at the end after all plugins
+ if packer_bootstrap then
+ require('packer').sync()
+ end
+end)
+
+-- Setup LSP for C/C++ with clangd
+local status_ok_mason, mason = pcall(require, "mason")
+if status_ok_mason then
+ mason.setup()
+end
+
+local status_ok_mason_lspconfig, mason_lspconfig = pcall(require, "mason-lspconfig")
+if status_ok_mason_lspconfig then
+ mason_lspconfig.setup()
+end
+
+local status_ok_lspconfig, lspconfig = pcall(require, "lspconfig")
+if status_ok_lspconfig then
+ lspconfig.clangd.setup{}
+end
+
+-- Treesitter setup
+require'nvim-treesitter.configs'.setup {
+ ensure_installed = {
+ "c", "cpp", "go", "python", "javascript", "typescript", "java", "rust"
+ },
+ highlight = {
+ enable = true,
+ },
+}
+
+-- Lualine setup
+require('lualine').setup {
+ options = {
+ theme = 'everforest',
+ section_separators = {'', ''},
+ component_separators = {'', ''},
+ }
+}
+
+-- Nvim-tree setup
+require'nvim-tree'.setup {}
+
+-- Theme setup
+vim.opt.termguicolors = true
+vim.g.everforest_background = 'soft'
+vim.g.everforest_better_performance = 1
+vim.g.everforest_disable_italic_comment = 1
+vim.cmd('colorscheme everforest')
+
+-- Syntax highlighting
+vim.cmd('syntax on')
+
+-- Key mappings
+vim.api.nvim_set_keymap('n', '<leader>ff', ':Files<CR>', { noremap = true, silent = true })
+vim.api.nvim_set_keymap('n', '<leader>fg', ':GFiles<CR>', { noremap = true, silent = true })
+vim.api.nvim_set_keymap('n', '<leader>gs', ':G<CR>', { noremap = true, silent = true })
+vim.api.nvim_set_keymap('n', '<leader>gd', ':Gdiff<CR>', { noremap = true, silent = true })
+vim.api.nvim_set_keymap('n', '<leader>q', ':q<CR>', { noremap = true, silent = true })
+vim.api.nvim_set_keymap('n', '<leader>w', ':w<CR>', { noremap = true, silent = true })
+
+-- Command to run C programs
+vim.api.nvim_create_user_command('RunC', function(opts)
+ vim.cmd('!./' .. vim.fn.expand('%<') .. ' ' .. opts.args)
+end, { nargs = 1 })
+
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim
deleted file mode 100644
index 0f199ca..0000000
--- a/.config/nvim/init.vim
+++ /dev/null
@@ -1,86 +0,0 @@
-" Flash screen instead of beep sound
-set visualbell
-
-" Change how vim represents characters on the screen
-set encoding=utf-8
-
-" Set the encoding of files written
-set fileencoding=utf-8
-
-" Set line numbers
-set number
-
-" don't break up words at end of window width
-set linebreak
-
-" Specify different areas of the screen where splits should occur
-set splitbelow
-set splitright
-
-" Python-specific whitespace file settings
-autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4
-" ts - show existing tab with 4 spaces width
-" sw - when indenting with '>', use 4 spaces width
-" sts - control <tab> and <bs> keys to match tabstop
-
-" Go-specific whitespace file settings
-au BufNewFile,BufRead *.go setlocal noet tabstop=4 shiftwidth=4 softtabstop=4
-
-" General whitespace settings
-set shiftwidth=4
-filetype plugin indent on
-
-" Allow backspace to delete indentation and inserted text
-" i.e. how it works in most programs
-set backspace=indent,eol,start
-" indent allow backspacing over autoindent
-" eol allow backspacing over line breaks (join lines)
-" start allow backspacing over the start of insert; CTRL-W and CTRL-U
-" stop once at the start of insert.
-
-
-call plug#begin("$HOME/.config/nvim/plugged")
-
-" Auto complete
-Plug 'Valloric/YouCompleteMe'
-
-" Fuzzy finder
-Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
-
-" Git gutter
-Plug 'airblade/vim-gitgutter'
-
-" Status bar
-Plug 'vim-airline/vim-airline'
-
-" Git wrapper with :G
-Plug 'tpope/vim-fugitive'
-
-" Editorconfig file support
-Plug 'editorconfig/editorconfig-vim'
-
-" Theme
-Plug 'sainnhe/everforest'
-
-" Terraform
-Plug 'hashivim/vim-terraform'
-
-" Go support
-Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
-
-call plug#end()
-
-if has('termguicolors')
- set termguicolors
-endif
-
-set background=dark
-
-let g:everforest_background = 'soft'
-let g:everforest_better_performance = 1
-let g:everforest_disable_italic_comment = 1
-let g:airline_theme = 'everforest'
-
-syntax on
-colorscheme everforest
-
diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua
new file mode 100644
index 0000000..5160679
--- /dev/null
+++ b/.config/nvim/plugin/packer_compiled.lua
@@ -0,0 +1,189 @@
+-- Automatically generated packer.nvim plugin loader code
+
+if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
+ vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
+ return
+end
+
+vim.api.nvim_command('packadd packer.nvim')
+
+local no_errors, error_msg = pcall(function()
+
+_G._packer = _G._packer or {}
+_G._packer.inside_compile = true
+
+local time
+local profile_info
+local should_profile = false
+if should_profile then
+ local hrtime = vim.loop.hrtime
+ profile_info = {}
+ time = function(chunk, start)
+ if start then
+ profile_info[chunk] = hrtime()
+ else
+ profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
+ end
+ end
+else
+ time = function(chunk, start) end
+end
+
+local function save_profiles(threshold)
+ local sorted_times = {}
+ for chunk_name, time_taken in pairs(profile_info) do
+ sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
+ end
+ table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
+ local results = {}
+ for i, elem in ipairs(sorted_times) do
+ if not threshold or threshold and elem[2] > threshold then
+ results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
+ end
+ end
+ if threshold then
+ table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
+ end
+
+ _G._packer.profile_output = results
+end
+
+time([[Luarocks path setup]], true)
+local package_path_str = "/Users/eugene/.cache/nvim/packer_hererocks/2.1.1720049189/share/lua/5.1/?.lua;/Users/eugene/.cache/nvim/packer_hererocks/2.1.1720049189/share/lua/5.1/?/init.lua;/Users/eugene/.cache/nvim/packer_hererocks/2.1.1720049189/lib/luarocks/rocks-5.1/?.lua;/Users/eugene/.cache/nvim/packer_hererocks/2.1.1720049189/lib/luarocks/rocks-5.1/?/init.lua"
+local install_cpath_pattern = "/Users/eugene/.cache/nvim/packer_hererocks/2.1.1720049189/lib/lua/5.1/?.so"
+if not string.find(package.path, package_path_str, 1, true) then
+ package.path = package.path .. ';' .. package_path_str
+end
+
+if not string.find(package.cpath, install_cpath_pattern, 1, true) then
+ package.cpath = package.cpath .. ';' .. install_cpath_pattern
+end
+
+time([[Luarocks path setup]], false)
+time([[try_loadstring definition]], true)
+local function try_loadstring(s, component, name)
+ local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
+ if not success then
+ vim.schedule(function()
+ vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
+ end)
+ end
+ return result
+end
+
+time([[try_loadstring definition]], false)
+time([[Defining packer_plugins]], true)
+_G.packer_plugins = {
+ ["cmp-buffer"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/cmp-buffer",
+ url = "https://github.com/hrsh7th/cmp-buffer"
+ },
+ ["cmp-cmdline"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/cmp-cmdline",
+ url = "https://github.com/hrsh7th/cmp-cmdline"
+ },
+ ["cmp-nvim-lsp"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
+ url = "https://github.com/hrsh7th/cmp-nvim-lsp"
+ },
+ ["cmp-path"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/cmp-path",
+ url = "https://github.com/hrsh7th/cmp-path"
+ },
+ ["editorconfig-vim"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/editorconfig-vim",
+ url = "https://github.com/editorconfig/editorconfig-vim"
+ },
+ everforest = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/everforest",
+ url = "https://github.com/sainnhe/everforest"
+ },
+ fzf = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/fzf",
+ url = "https://github.com/junegunn/fzf"
+ },
+ ["fzf.vim"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/fzf.vim",
+ url = "https://github.com/junegunn/fzf.vim"
+ },
+ ["lualine.nvim"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/lualine.nvim",
+ url = "https://github.com/nvim-lualine/lualine.nvim"
+ },
+ ["mason-lspconfig.nvim"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
+ url = "https://github.com/williamboman/mason-lspconfig.nvim"
+ },
+ ["mason.nvim"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/mason.nvim",
+ url = "https://github.com/williamboman/mason.nvim"
+ },
+ ["nvim-cmp"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/nvim-cmp",
+ url = "https://github.com/hrsh7th/nvim-cmp"
+ },
+ ["nvim-lspconfig"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
+ url = "https://github.com/neovim/nvim-lspconfig"
+ },
+ ["nvim-tree.lua"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
+ url = "https://github.com/kyazdani42/nvim-tree.lua"
+ },
+ ["nvim-treesitter"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
+ url = "https://github.com/nvim-treesitter/nvim-treesitter"
+ },
+ ["packer.nvim"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/packer.nvim",
+ url = "https://github.com/wbthomason/packer.nvim"
+ },
+ ["vim-fugitive"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/vim-fugitive",
+ url = "https://github.com/tpope/vim-fugitive"
+ },
+ ["vim-gitgutter"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/vim-gitgutter",
+ url = "https://github.com/airblade/vim-gitgutter"
+ },
+ ["vim-go"] = {
+ loaded = true,
+ path = "/Users/eugene/.local/share/nvim/site/pack/packer/start/vim-go",
+ url = "https://github.com/fatih/vim-go"
+ }
+}
+
+time([[Defining packer_plugins]], false)
+
+_G._packer.inside_compile = false
+if _G._packer.needs_bufread == true then
+ vim.cmd("doautocmd BufRead")
+end
+_G._packer.needs_bufread = false
+
+if should_profile then save_profiles() end
+
+end)
+
+if not no_errors then
+ error_msg = error_msg:gsub('"', '\\"')
+ vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
+end
diff --git a/.zshrc b/.zshrc
index 9cc9ea6..690692d 100755
--- a/.zshrc
+++ b/.zshrc
@@ -65,6 +65,9 @@ alias l="ls -alG"
alias vi="nvim"
alias vim="nvim"
+alias vicfg="nvim ~/.config/nvim/init.lua"
+
+alias python="python3"
# "Compile C Program"
#
@@ -73,12 +76,12 @@ alias vim="nvim"
# $3: C Standard (default: c11)
#
# Example: ccp main.c main c99
-ccp() {
- local prog_name=$1
- local output_file=${2:a.out}
- local std=${3:c11}
+function ccp() {
+ local prog_name=${1:?"Please provide the path to the program to compile"}
+ local output_file=${2:-${prog_name:r}}
+ local std=${3:-c11}
- cc -Wall -W -pedantic -ansi -std=$std -o $output_file $prog_name
+ gcc -Wall -W -pedantic -ansi -std=$std -o $output_file $prog_name
}
memcheck() {
@@ -89,3 +92,19 @@ gocover() {
t="/tmp/go-cover.$$.tmp"
go test -coverprofile=$t $@ && go tool cover -html=$t && unlink $t
}
+
+# pnpm
+export PNPM_HOME="/Users/eugene/Library/pnpm"
+case ":$PATH:" in
+ *":$PNPM_HOME:"*) ;;
+ *) export PATH="$PNPM_HOME:$PATH" ;;
+esac
+# pnpm end
+
+# bat
+export BAT_THEME="gruvbox-dark"
+#
+
+export CPPFLAGS="-I/usr/local/opt/readline/include"
+export LDFLAGS="-L/usr/local/opt/readline/lib"
+export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"
diff --git a/bin/gh-clone-all b/bin/gh-clone-all
index 742189b..742189b 100644..100755
--- a/bin/gh-clone-all
+++ b/bin/gh-clone-all
diff --git a/homebrew/Brewfile b/homebrew/Brewfile
index abe14a3..c45c5f2 100644
--- a/homebrew/Brewfile
+++ b/homebrew/Brewfile
@@ -1,6 +1,7 @@
tap "homebrew/cask-fonts"
tap "neovim/neovim"
+brew "ansible"
brew "ca-certificates"
brew "curl"
brew "ffmpeg"
@@ -29,6 +30,7 @@ brew "ripgrep"
brew "rsync"
brew "speedtest-cli"
brew "tldr"
+brew "vagrant"
brew "wget"
brew "xz"
brew "yt-dlp"
diff --git a/install.sh b/install.sh
index 658c55a..df09f8f 100755
--- a/install.sh
+++ b/install.sh
@@ -50,7 +50,7 @@ ensure_symlink_exists() {
prompt_for_confirmation "Delete and relink?"
answer=$?
if [ $answer -eq 0 ]; then
- rm "$link_path" || exit 1
+ rm -r "$link_path" || exit 1
ln -s "$source_path" "$link_path" || exit 1
echo "Successfully created link to '$link_path'"
else
@@ -62,7 +62,7 @@ ensure_symlink_exists() {
prompt_for_confirmation "Delete and relink?"
answer=$?
if [ $answer -eq 0 ]; then
- rm "$link_path" || exit 1
+ rm -r "$link_path" || exit 1
ln -s "$source_path" "$link_path" || exit 1
echo "Successfully created link to '$link_path'"
else
@@ -74,6 +74,16 @@ ensure_symlink_exists() {
fi
}
+install_packer() {
+ echo "Installing packer.nvim.."
+ if [ ! -d "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" ]; then
+ git clone --depth 1 https://github.com/wbthomason/packer.nvim \
+ "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim"
+ else
+ echo "packer.nvim is already installed."
+ fi
+}
+
main() {
has_homebrew=$(command -v brew)
if test -z "$has_homebrew"; then
@@ -106,17 +116,11 @@ main() {
echo "Linking vim config.."
mkdir -p $HOME/.config/nvim
- ensure_symlink_exists "$PWD/.config/nvim/init.vim" "$HOME/.config/nvim/init.vim"
+ ensure_symlink_exists "$PWD/.config/nvim/init.lua" "$HOME/.config/nvim/init.lua"
- echo "Checking vim-plug installation.."
- if [ -e "$HOME/.config/nvim/plugged" ]; then
- echo "vim-plug already installed"
- else
- echo "Installing vim-plug.."
- sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
- https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
- nvim +PlugInstall +qall --headless
- fi
+ install_packer
+ echo "Running PackerSync to install plugins.."
+ nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
}
main