Compare commits

..

No commits in common. "1cc9378eca55a45105082de3886e95cd2ada5317" and "e8875ab86bd12013647c3a1fcd79109be269ae1f" have entirely different histories.

7 changed files with 194 additions and 355 deletions

View File

@ -1,9 +1,3 @@
# Complex aliasses
## Open notes folder in nvim then return
function notes() {cd $HOME/Notes; nvim; cd -;};
function sb() {cd $HOME/second-brain/; git pull; nvim; git add .; git commit; git push; cd -;};
# simple
alias clj='rlwrap java -cp ~/Clojure/clojure-1.8.0.jar clojure.main' alias clj='rlwrap java -cp ~/Clojure/clojure-1.8.0.jar clojure.main'
alias ll='ls -l' alias ll='ls -l'
alias la='ls -A' alias la='ls -A'
@ -13,13 +7,34 @@ alias cdclip="cd \$(xclip -o -selection clipboard)"
alias clipi='xclip -i -selection clipboard' alias clipi='xclip -i -selection clipboard'
alias clipo='xclip -o -selection clipboard' alias clipo='xclip -o -selection clipboard'
alias ssh-agent='ssh-agent -t 1h' alias ssh-agent='ssh-agent -t 1h'
alias saa='eval $(ssh-agent) && ssh-add' alias ssh-home='ssh home-server'
alias tm='tmux new -A' alias tmh='ssh home-server -t "tmux new -A -s sys"'
alias tm='tmux new -A -s '
alias tms='tmux new -A -s sys'
alias hsfs='sshfs andrei@home-server:/utility /hsfs'
alias uhsfs='sudo umount /hsfs'
alias exfs='sudo zpool import external' alias exfs='sudo zpool import external'
alias uexfs='sudo zpool export external' alias uexfs='sudo zpool export external'
alias ta-media='rsync -avr /home/andrei/CSCI_4160/ home-server:/home/andrei/backups/school/TA/CSCI_4160_w19;'
alias ta-web='rsync -avr /home/andrei/CSCI_3230/ home-server:/home/andrei/backups/school/TA/CSCI_3230_w19;'
alias photo='rsync -avr /home/andrei/Pictures/* home-server:/utility/Photos/XPS_2018_VACATION/ --exclude="*_CR2_embedded.jpg"'
alias photo-local='rsync -avr ~/Pictures/* /media/andrei/External/Photos --exclude="*_CR2_embedded.jpg"'
alias socks='ssh -D 8081 -C -q -N home-server' alias socks='ssh -D 8081 -C -q -N home-server'
alias gmonitor='while [ true ] ; do nvidia-smi; nvidia-settings -q gpucoretemp | grep gpu; sensors| grep CPU; sleep 1; clear; done' alias gmonitor='while [ true ] ; do nvidia-smi; nvidia-settings -q gpucoretemp | grep gpu; sensors| grep CPU; sleep 1; clear; done'
alias saa='ssh-agent && ssh-add'
alias gssh='gcloud compute ssh'
alias gc='gcloud compute'
alias gci='gcloud compute instances'
alias gcls='gcloud compute instances list'
alias gcstart='gcloud compute instances start'
alias gcstop='gcloud compute instances stop'
alias gcstopall="gcls | grep RUNNING | awk '{print \$1}' | xargs -I{} gcloud compute instances stop {}"
alias gct='gcloud compute tpus'
alias gctls='gcloud compute tpus list'
alias gctstart='gcloud compute tpus start'
alias gctstop='gcloud compute tpus stop'
alias code='code-oss' alias code='code-oss'
alias tf-docker='docker run --runtime=nvidia -it --rm -p 8888:8888 -v $PWD:/tf/local andrei/dev'
alias conda-activate='source /opt/anaconda/bin/activate' alias conda-activate='source /opt/anaconda/bin/activate'
alias conda-deactivete='source /opt/anaconda/bin/deactivate' alias conda-deactivete='source /opt/anaconda/bin/deactivate'
alias venv='python -m venv' alias venv='python -m venv'
@ -29,3 +44,4 @@ alias dotvenv='source .venv/bin/activate'
alias todo='rusty-tasks' alias todo='rusty-tasks'
alias ccat='bat' alias ccat='bat'
alias we='watchexec' alias we='watchexec'

View File

@ -16,7 +16,7 @@
lg = log --pretty=format:'%C(auto) %h,%C(green) \"%s\"%Creset, %aN,%C(blue) %cD' lg = log --pretty=format:'%C(auto) %h,%C(green) \"%s\"%Creset, %aN,%C(blue) %cD'
[core] [core]
editor = nvim editor = vim
autocrlf = input autocrlf = input
[init] [init]
defaultBranch = main defaultBranch = main

View File

@ -1,72 +0,0 @@
local desc = require('utils').plugin_keymap_desc('ufo')
-- Custom fold text handler for ufo showing line count folded
local handler = function(virtText, lnum, endLnum, width, truncate)
local newVirtText = {}
local suffix = (' 󰁂 %d '):format(endLnum - lnum)
local sufWidth = vim.fn.strdisplaywidth(suffix)
local targetWidth = width - sufWidth
local curWidth = 0
for _, chunk in ipairs(virtText) do
local chunkText = chunk[1]
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
if targetWidth > curWidth + chunkWidth then
table.insert(newVirtText, chunk)
else
chunkText = truncate(chunkText, targetWidth - curWidth)
local hlGroup = chunk[2]
table.insert(newVirtText, {chunkText, hlGroup})
chunkWidth = vim.fn.strdisplaywidth(chunkText)
-- str width returned from truncate() may less than 2nd argument, need padding
if curWidth + chunkWidth < targetWidth then
suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth)
end
break
end
curWidth = curWidth + chunkWidth
end
table.insert(newVirtText, {suffix, 'MoreMsg'})
return newVirtText
end
return {
{
'luukvbaal/statuscol.nvim',
config = function()
local builtin = require('statuscol.builtin')
require('statuscol').setup({
segments = {
{text = {builtin.foldfunc}, click = 'v:lua.ScFa'},
{text = {' %s'}, click = 'v:lua.ScSa'},
{text = {builtin.lnumfunc, ' '}, condition = {true, builtin.not_empty}, click = 'v:lua.ScLa'},
},
})
end,
},
{
'kevinhwang91/nvim-ufo',
dependencies = {'kevinhwang91/promise-async'},
opts = {
fold_virt_text_handler = handler,
provider_selector = function(bufnr, filetype, buftype)
return {'treesitter', 'indent'}
end,
},
config = function(_, opts)
local ufo = require('ufo')
ufo.setup(opts)
vim.keymap.set('n', 'zR', ufo.openAllFolds, {desc = desc('Open all folds')})
vim.keymap.set('n', 'zM', ufo.closeAllFolds, {desc = desc('Close all folds')})
vim.keymap.set('n', 'K', function()
local winid = ufo.peekFoldedLinesUnderCursor(true)
if not winid then
vim.lsp.buf.hover()
end
end, {desc = 'LSP: Show hover documentation and folded code'})
end
},
}

View File

@ -12,6 +12,7 @@ vim.opt.expandtab = true
vim.opt.number = true vim.opt.number = true
vim.opt.linebreak = true vim.opt.linebreak = true
vim.opt.showbreak = "+++" vim.opt.showbreak = "+++"
vim.opt.textwidth = 100
vim.opt.showmatch = true vim.opt.showmatch = true
vim.opt.visualbell = true vim.opt.visualbell = true
vim.opt.hlsearch = true vim.opt.hlsearch = true
@ -27,4 +28,4 @@ vim.opt.tabstop = 2
vim.opt.undolevels = 1000 vim.opt.undolevels = 1000
vim.opt.backspace = "indent,eol,start" vim.opt.backspace = "indent,eol,start"
vim.opt.colorcolumn = "80" vim.opt.colorcolumn = "80"
vim.opt.conceallevel = 2

View File

@ -1,84 +1,24 @@
---@type MappingsTable ---@type MappingsTable
local M = {} local M = {}
local function toggle_telescope(harpoon_files)
local conf = require("telescope.config").values
local file_paths = {}
for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value)
end
require("telescope.pickers").new({}, {
prompt_title = "Harpoon",
finder = require("telescope.finders").new_table({
results = file_paths,
}),
previewer = conf.file_previewer({}),
sorter = conf.generic_sorter({}),
}):find()
end
M.general = { M.general = {
n = { n = {
-- harpoon -- harpoon
["H"] = { ["H"] = {function() require("harpoon.ui").toggle_quick_menu() end, "Open Harpoon" },
function() ["<leader>ha"] = {function() require("harpoon.mark").add_file() end, "Add file to Harpoon"},
local harpoon = require("harpoon") ["<leader>hs"] = {function() require("harpoon.ui").nav_file(1) end, "Switch to file 1"},
toggle_telescope(harpoon:list()) ["<leader>hd"] = {function() require("harpoon.ui").nav_file(2) end, "Switch to file 2"},
--harpoon.ui:toggle_quick_menu(harpoon:list()) ["<leader>hf"] = {function() require("harpoon.ui").nav_file(3) end, "Switch to file 3"},
end, ["<leader>hg"] = {function() require("harpoon.ui").nav_file(4) end, "Switch to file 4"},
"Open Harpoon in telescope",
},
["<leader>hh"] = {
function()
local harpoon = require("harpoon")
harpoon.ui:toggle_quick_menu(harpoon:list())
end,
"Open Harpoon",
},
["<leader>ha"] = {
function()
local harpoon = require("harpoon")
harpoon:list():append()
end,
"Add file to Harpoon",
},
["<leader>hs"] = {
function()
local harpoon = require("harpoon")
harpoon:list():select(1)
end,
"Switch to file 1",
},
["<leader>hd"] = {
function()
local harpoon = require("harpoon")
harpoon:list():select(2)
end,
"Switch to file 2",
},
["<leader>hf"] = {
function()
local harpoon = require("harpoon")
harpoon:list():select(3)
end,
"Switch to file 3",
},
["<leader>hg"] = {
function()
local harpoon = require("harpoon")
harpoon:list():select(4)
end,
"Switch to file 4",
},
-- navigation -- navigation
["<C-d>"] = { "<C-d>zz", "1/2 page down" }, ["<C-d>"] = {"<C-d>zz", "1/2 page down"},
["<C-u>"] = { "<C-u>zz", "1/2 page up" }, ["<C-u>"] = {"<C-u>zz", "1/2 page up" },
["n"] = { "nzz", "find next" }, ["n"] = {"nzz", "find next"},
["N"] = { "Nzz", "find prev" }, ["N"] = {"Nzz", "find prev"},
["Zm"] = {":ZenMode<CR>", "Enter ZenMode"}
["Zm"] = { ":ZenMode<CR>", "Enter ZenMode" },
}, },
} }

View File

@ -2,210 +2,164 @@ local overrides = require("custom.configs.overrides")
---@type NvPluginSpec[] ---@type NvPluginSpec[]
local plugins = { local plugins = {
{ {
"folke/twilight.nvim", "folke/twilight.nvim",
opts = { opts = {
context = 20, context = 20,
expand = { expand = {
"function", "function",
}, }, },
}, lazy = false,
lazy = false, },
}, {
{ "folke/zen-mode.nvim",
"folke/zen-mode.nvim", opts = {
opts = { tmux = {
tmux = { enable = false,
enable = false, },
}, },
}, lazy = false,
lazy = false, },
}, {
{ "alexghergh/nvim-tmux-navigation",
"alexghergh/nvim-tmux-navigation", lazy = false,
lazy = false, },
}, -- Override plugin definition options
-- Override plugin definition options
{
"hrsh7th/nvim-cmp",
opts = overrides.cmp,
},
{
"neovim/nvim-lspconfig",
dependencies = {
-- format & linting
{
"jose-elias-alvarez/null-ls.nvim",
config = function()
require("custom.configs.null-ls")
end,
},
},
config = function()
require("plugins.configs.lspconfig")
require("custom.configs.lspconfig")
end, -- Override to setup mason-lspconfig
},
-- override plugin configs
{
"williamboman/mason.nvim",
opts = overrides.mason,
},
{
"williamboman/mason-lspconfig.nvim",
setup = {
ensure_installed = { "jedi" },
},
},
{
"nvim-treesitter/nvim-treesitter",
opts = overrides.treesitter,
},
{
"nvim-tree/nvim-tree.lua",
opts = overrides.nvimtree,
},
-- Install a plugin
{
"max397574/better-escape.nvim",
event = "InsertEnter",
config = function()
require("better_escape").setup()
end,
},
{ "nvim-treesitter/nvim-treesitter-context", lazy = false },
{
"theprimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
config = function(_, opts)
local harpoon = require("harpoon")
harpoon:setup({
settings = {
save_on_toggle = true,
},
})
end,
},
{
"simrat39/rust-tools.nvim",
},
{
"ellisonleao/glow.nvim",
config = true,
cmd = "Glow",
event = "BufEnter *.md",
},
{
"kevinhwang91/nvim-ufo",
requires = "kevinhwang91/promise-async",
lazy = false,
},
{ {
"epwalsh/obsidian.nvim", "hrsh7th/nvim-cmp",
version = "*", -- recommended, use latest release instead of latest commit opts = overrides.cmp,
lazy = true, },
ft = "markdown",
-- ft = { {
-- "BufReadPre ~/Notes/**.md", "neovim/nvim-lspconfig",
-- "BufNewFile ~/Notes/**.md", dependencies = {
-- }, -- format & linting
dependencies = { "nvim-lua/plenary.nvim" }, {
opts = { "jose-elias-alvarez/null-ls.nvim",
workspaces = { config = function()
{ name = "second-brain", path = "~/second-brain" }, require("custom.configs.null-ls")
end,
}, },
new_notes_location = "notes_subdir", },
daily_notes = { folder = "notes/dailies" }, config = function()
require("plugins.configs.lspconfig")
require("custom.configs.lspconfig")
end, -- Override to setup mason-lspconfig
},
-- override plugin configs
{
"williamboman/mason.nvim",
opts = overrides.mason,
},
{
"williamboman/mason-lspconfig.nvim",
setup = {
ensure_installed = { "jedi" },
}, },
}, },
{
"nvim-treesitter/nvim-treesitter",
opts = overrides.treesitter,
},
{
"nvim-tree/nvim-tree.lua",
opts = overrides.nvimtree,
},
-- Install a plugin
{
"max397574/better-escape.nvim",
event = "InsertEnter",
config = function()
require("better_escape").setup()
end,
},
{ "nvim-treesitter/nvim-treesitter-context", lazy = false },
{
"theprimeagen/harpoon",
},
{
"simrat39/rust-tools.nvim",
},
{
"ellisonleao/glow.nvim",
config = true,
cmd = "Glow",
event = "BufEnter *.md",
},
-- Disable nvchad plugins -- Disable nvchad plugins
{
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
lazy = false,
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
},
},
-- Disable nvchad plugins {
"tpope/vim-sleuth",
lazy = false,
},
{ {
"tpope/vim-sleuth", "debugloop/telescope-undo.nvim",
lazy = false, dependencies = { -- note how they're inverted to above example
}, {
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
},
},
keys = {
{ -- lazy style key map
"<leader>u",
"<cmd>Telescope undo<cr>",
desc = "undo history",
},
},
opts = {
-- don't use `defaults = { }` here, do this in the main telescope spec
extensions = {
undo = {
-- telescope-undo.nvim config, see below
},
-- no other extensions here, they can have their own spec too
},
},
config = function(_, opts)
-- Calling telescope's setup from multiple specs does not hurt, it will happily merge the
-- configs for us. We won't use data, as everything is in it's own namespace (telescope
-- defaults, as well as each extension).
require("telescope").setup(opts)
require("telescope").load_extension("undo")
end,
},
{ {
"debugloop/telescope-undo.nvim", "sindrets/diffview.nvim",
dependencies = { -- note how they're inverted to above example lazy = false,
{ },
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
},
},
keys = {
{ -- lazy style key map
"<leader>u",
"<cmd>Telescope undo<cr>",
desc = "undo history",
},
},
opts = {
-- don't use `defaults = { }` here, do this in the main telescope spec
extensions = {
undo = {
-- telescope-undo.nvim config, see below
},
-- no other extensions here, they can have their own spec too
},
},
config = function(_, opts)
-- Calling telescope's setup from multiple specs does not hurt, it will happily merge the
-- configs for us. We won't use data, as everything is in it's own namespace (telescope
-- defaults, as well as each extension).
require("telescope").setup(opts)
require("telescope").load_extension("undo")
end,
},
{ {
"sindrets/diffview.nvim", "NvChad/nvterm",
lazy = false, enabled = false,
}, },
{ -- To make a plugin not be loaded
"NvChad/nvterm", -- {
enabled = false, -- "NvChad/nvim-colorizer.lua",
}, -- enabled = false
-- },
-- To make a plugin not be loaded -- All NvChad plugins are lazy-loaded by default
-- { -- For a plugin to be loaded, you will need to set either `ft`, `cmd`, `keys`, `event`, or set `lazy = false`
-- "NvChad/nvim-colorizer.lua", -- If you want a plugin to load on startup, add `lazy = false` to a plugin spec, for example
-- enabled = false -- {
-- }, -- "mg979/vim-visual-multi",
-- lazy = false,
-- All NvChad plugins are lazy-loaded by default -- }
-- For a plugin to be loaded, you will need to set either `ft`, `cmd`, `keys`, `event`, or set `lazy = false`
-- If you want a plugin to load on startup, add `lazy = false` to a plugin spec, for example
-- {
-- "mg979/vim-visual-multi",
-- lazy = false,
-- }
} }
return plugins return plugins

18
.zshrc
View File

@ -2,7 +2,7 @@
export PATH=$HOME/bin:/usr/local/bin:/usr/lib65/openjdk-17/bin:$PATH export PATH=$HOME/bin:/usr/local/bin:/usr/lib65/openjdk-17/bin:$PATH
# Path to your oh-my-zsh installation. # Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh export ZSH=/home/andrei/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random" # Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded. # it'll load a random theme each time that oh-my-zsh is loaded.
@ -73,11 +73,7 @@ source $ZSH/oh-my-zsh.sh
# Preferred editor for local and remote sessions # Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then # if [[ -n $SSH_CONNECTION ]]; then
if [[ -e /usr/bin/nvim ]]; then export EDITOR='vim'
export EDITOR='nvim'
else
export EDITOR='vim'
fi
# else # else
# export EDITOR='mvim' # export EDITOR='mvim'
# fi # fi
@ -126,6 +122,8 @@ function work() {
} }
# JINA_CLI_BEGIN # JINA_CLI_BEGIN
## autocomplete ## autocomplete
@ -156,6 +154,8 @@ export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
# JINA_CLI_END # JINA_CLI_END
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion