Cleaning up.

This commit is contained in:
Bartek Stalewski 2024-06-19 23:26:17 +02:00
parent 0762c38b50
commit f26274aeae
No known key found for this signature in database
19 changed files with 2 additions and 2 deletions

19
config/fd/ignore Normal file
View file

@ -0,0 +1,19 @@
*~
autoload
.cache
.git*
.*history*
.known_hosts
modules
.netrwhist
repos
*/share/nvim
*/share/zsh
*state
*.swp
*tig
.vim
vim-plugins
.zcomp*
zsh_modules
.zsh_sessions

6
config/nvim/.stylua.toml Normal file
View file

@ -0,0 +1,6 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
call_parentheses = "None"

39
config/nvim/init.lua Normal file
View file

@ -0,0 +1,39 @@
vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
vim.g.mapleader = " "
-- bootstrap lazy and all plugins
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
local repo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath }
end
vim.opt.rtp:prepend(lazypath)
local lazy_config = require "configs.lazy"
-- load plugins
require("lazy").setup({
{
"NvChad/NvChad",
lazy = false,
branch = "v2.5",
import = "nvchad.plugins",
config = function()
require "options"
end,
},
{ import = "plugins" },
}, lazy_config)
-- load theme
dofile(vim.g.base46_cache .. "defaults")
dofile(vim.g.base46_cache .. "statusline")
require "nvchad.autocmds"
vim.schedule(function()
require "mappings"
end)

View file

@ -0,0 +1,30 @@
-- This file needs to have same structure as nvconfig.lua
-- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvconfig.lua
---@type ChadrcConfig
local M = {}
M.ui = {
theme = "monekai",
hl_override = {
ColorColumn = { bg = "#770000" },
Comment = { italic = true, },
DiffChange = { bg = "NONE", fg = "#e7c547" },
DiffText = { bg = "NONE", fg = "#ff8700" },
FoldColumn = { bg = "NONE" },
NonText = { bg = "NONE" },
Normal = { bg = "NONE" },
NormalFloat = { bg = "NONE" },
SignColumn = { bg = "NONE" },
SpellBad = { bg = "#770000", fg = "#ffffff" },
TelescopeNormal = { bg = "NONE" },
Visual = { bg = "#0094d8", fg = "#ffffff" },
},
statusline = {
theme = "vscode_colored",
}
}
return M

View file

@ -0,0 +1,15 @@
local options = {
formatters_by_ft = {
lua = { "stylua" },
-- css = { "prettier" },
-- html = { "prettier" },
},
-- format_on_save = {
-- -- These options will be passed to conform.format()
-- timeout_ms = 500,
-- lsp_fallback = true,
-- },
}
require("conform").setup(options)

View file

@ -0,0 +1,47 @@
return {
defaults = { lazy = true },
install = { colorscheme = { "nvchad" } },
ui = {
icons = {
ft = "",
lazy = "󰂠 ",
loaded = "",
not_loaded = "",
},
},
performance = {
rtp = {
disabled_plugins = {
"2html_plugin",
"tohtml",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
"tutor",
"rplugin",
"syntax",
"synmenu",
"optwin",
"compiler",
"bugreport",
"ftplugin",
},
},
},
}

View file

@ -0,0 +1,23 @@
-- EXAMPLE
local on_attach = require("nvchad.configs.lspconfig").on_attach
local on_init = require("nvchad.configs.lspconfig").on_init
local capabilities = require("nvchad.configs.lspconfig").capabilities
local lspconfig = require "lspconfig"
local servers = {}
-- lsps with default config
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = on_attach,
on_init = on_init,
capabilities = capabilities,
}
end
-- typescript
lspconfig.tsserver.setup {
on_attach = on_attach,
on_init = on_init,
capabilities = capabilities,
}

View file

@ -0,0 +1,20 @@
require "nvchad.mappings"
-- add yours here
local map = vim.keymap.set
map("i", "jk", "<ESC>")
map("i", "<C-a>", "<esc>I" )
map("i", "<C-e>", "<esc>A" )
map("n", ";", ":", { desc = "CMD enter command mode" })
map("n", "<esc><cr>", "<esc><cmd>wq!<cr>", { desc = "Save and Exit" })
map("n", "<leader>m", '<cmd>execute "set colorcolumn=" . (&colorcolumn == "" ? "80,120" : "")<cr>', { desc = "Toggle Column" })
map("n", "<leader>h", "<cmd>set hlsearch!<cr>", { desc = "Toggle hlsearch" })
map("n", "<leader>j", "<cmd>bprevious<cr>", { desc = "Buffer Previous" })
map("n", "<leader>k", "<cmd>bnext<cr>", { desc = "Buffer Next" })
map("n", "<leader>n", '<cmd>set number!<cr><cmd>IBLToggle<cr><cmd>execute "set signcolumn=" . (&signcolumn == "yes" ? "no" : "yes")<cr>', { desc = "Toggle Decorations" })
map("n", "<leader>w", "<cmd>lua require('whitespace-nvim').trim()<cr>", { desc = "Trim Trailing Whitespaces" })
map("n", "<leader>x", "<cmd>bd<cr>", { desc = "Buffer Close" })
map("n", "<tab>", "<C-w>w", { desc = "Switch buffer" })

View file

@ -0,0 +1,27 @@
require "nvchad.options"
-- add yours here!
local o = vim.o
-- o.cursorlineopt ='both' -- to enable cursorline!
o.gdefault = true
o.hlsearch = false
o.shiftround = true
o.relativenumber = false
o.wrap = true
o.writebackup = false
o.clipboard = ""
o.foldcolumn = "0"
o.mouse = ""
o.whichwrap = ''
local autocmd = vim.api.nvim_create_autocmd
autocmd("BufRead", {
pattern = "*.gotmpl",
command = "set filetype=yaml",
})
autocmd("BufNewFile", {
pattern = "*.gotmpl",
command = "set filetype=yaml",
})

View file

@ -0,0 +1,72 @@
return {
{
"stevearc/conform.nvim",
-- event = 'BufWritePre', -- uncomment for format on save
config = function()
require "configs.conform"
end,
},
-- These are some examples, uncomment them if you want to see them work!
-- {
-- "neovim/nvim-lspconfig",
-- config = function()
-- require("nvchad.configs.lspconfig").defaults()
-- require "configs.lspconfig"
-- end,
-- },
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"lua-language-server",
},
},
},
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"lua",
"markdown",
"markdown_inline",
"python",
"terraform",
"vim",
},
},
},
{
"kdheepak/lazygit.nvim",
keys = {
{ "<leader>lg", "<cmd>LazyGit<cr>", desc = "LazyGit" },
},
}
-- Install a plugin
-- {
-- "max397574/better-escape.nvim",
-- event = "InsertEnter",
-- config = function()
-- require("better_escape").setup()
-- end
-- },
-- To make a plugin not be loaded
-- {
-- "NvChad/nvim-colorizer.lua",
-- enabled = 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,
-- }
}

69
config/starship.toml Normal file
View file

@ -0,0 +1,69 @@
add_newline = false
format="""
$python\
$username\
$hostname\
$directory\
$git_branch\
$git_status\
$jobs\
$character
"""
right_format="""
$cmd_duration
"""
[python]
format = '[(${symbol} $virtualenv)]($style) '
style = '15'
symbol = ''
[username]
format = '[$user]($style)'
style_user = 'normal'
style_root = 'bold 196'
[hostname]
format = '([@$hostname]($style) )'
style = 'normal'
[directory]
format = '[($read_only )]($read_only_style)[$path]($style) '
style = '37'
read_only_style = '37'
read_only = ''
truncation_length = 0
[git_state]
format = '\([$state( $progress_current/$progress_total)]($style)\) '
style = 'bright-black'
[git_branch]
format = '[$symbol$branch]($style)'
style = '246'
symbol = ' '
[git_status]
format = '[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218)($ahead_behind$stashed) ]($style)'
style = 'green'
conflicted = ''
untracked = ''
modified = ''
staged = ''
renamed = ''
deleted = ''
stashed = '≡'
[jobs]
style = '70'
symbol = '⇶'
[character]
success_symbol = '[](76)'
error_symbol = '[](196)'
[cmd_duration]
format = '[$duration]($style)'
style = '220'

32
config/tmux/tmux.conf Normal file
View file

@ -0,0 +1,32 @@
set -g mouse off
set -g set-titles on
set -g default-terminal "xterm-256color"
set -g terminal-overrides ",xterm-256color:Tc"
set -g renumber-windows on
setw -g aggressive-resize on
setw -g automatic-rename on
# binds
unbind-key S
set -g prefix C-a
bind a send-prefix
bind c new-window
bind d detach
bind ^C new-window
bind ^D detach
bind : command-prompt
bind " " next-window
bind | split-window -h
bind - split-window -v
# status line
set -g status "on"
set -g status-position top
set -g status-style "bg=default"
set -g message-style "fg=default,bg=default"
set -g message-command-style "fg=default,bg=default"
set -g status-left ""
set -g status-right "#[fg=color4] #h "
setw -g window-status-separator ""
setw -g window-status-format "#[fg=color242,bg=default] #W "
setw -g window-status-current-format "#[fg=color15,bg=color12] #W "

8
config/zsh/.zshenv Normal file
View file

@ -0,0 +1,8 @@
skip_global_compinit=1
export XDG_CACHE_HOME=/tmp/${USER}-cache
export XDG_CONFIG_HOME=$HOME/.config
export XDG_DATA_HOME=$HOME/.local/share
export XDG_STATE_HOME=$HOME/.local/state
export HISTFILE=$XDG_DATA_HOME/zsh/history
export HISTSIZE=10000
export SAVEHIST=$HISTSIZE

68
config/zsh/.zshrc Normal file
View file

@ -0,0 +1,68 @@
# mac specific configuration
touch $HOME/.hushlogin
eval "$(/opt/homebrew/bin/brew shellenv)"
# prepare directories
mkdir -p $XDG_CACHE_HOME/zsh
mkdir -p $XDG_DATA_HOME/zsh
# global exports and options
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_SAVE_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt SHARE_HISTORY
setopt INC_APPEND_HISTORY
# set path
path=(~/.local/bin "$path[@]")
# source configuration
source $ZDOTDIR/aliases.zsh
source $ZDOTDIR/cleanhome.zsh
source $ZDOTDIR/fzf.zsh
source $ZDOTDIR/keys.zsh
# source modules
source ~/.local/git/zsh_modules/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
source ~/.local/git/zsh_modules/wd/wd.plugin.zsh
export WD_CONFIG=$XDG_CONFIG_HOME/wd_list
# set fpath
fpath=(~/.local/git/zsh_modules/wd $fpath)
# theme and colors
if [[ $(command -v vivid) ]]; then
export LS_COLORS=$(vivid generate molokai)
else
unset LS_COLORS
fi
tabs 2
export STARSHIP_CACHE="$XDG_CACHE_HOME"/starship
eval "$(STARSHIP_CACHE="$XDG_CACHE_HOME"/starship starship init zsh)"
# completion
zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors ''
autoload -Uz compinit
if [ ! -e $XDG_DATA_HOME/zsh/zcompdump.zwc ]; then
autoload -Uz zrecompile
zrecompile -p -R $XDG_DATA_HOME/zsh/zcompdump
fi
if [[ -n $XDG_DATA_HOME/zsh/zcompdump(#qN.mh+24) ]]; then
compinit -d $XDG_DATA_HOME/zsh/zcompdump
else
compinit -C -d $XDG_DATA_HOME/zsh/zcompdump
fi
# quick note functionality
if [[ -f ~/.note ]]; then
echo
cat ~/.note
echo
fi
# local settings
if [[ -f ~/.local/config/zsh ]]; then
source ~/.local/config/zsh
fi

50
config/zsh/aliases.zsh Normal file
View file

@ -0,0 +1,50 @@
LOCAL_GIT_DIR=${HOME}/.local/git
alias ga='git add .; git commit --no-edit --amend; git push --force-with-lease'
alias gae='git add .; git commit --amend; git push --force-with-lease'
alias less='less -R'
if [[ $(command -v bat) ]]; then
alias cat='bat -pp --color=always --tabs=2 --theme=Monokai\ Extended\ Bright'
fi
if [[ $(command -v eza) ]]; then
alias ls='eza --git --octal-permissions --no-permissions --group-directories-first'
alias ll='eza --git --octal-permissions --no-permissions --group-directories-first -l'
else
case $(uname -s) in;
Darwin) alias ls='ls -G';;
Linux) alias ls='ls --color';;
esac
alias ll='ls -l'
fi
if [[ $(command -v fd) ]]; then
if [[ -f ~/.local/config/fd ]]; then
alias fd='fd -H -L --ignore-file ~/.local/config/fd'
else
alias fd='fd -H -L'
fi
fi
if [ $(command -v nvim) ]; then
export EDITOR=nvim
export MANPAGER="nvim +Man!"
alias vim=nvim
alias vimdiff="nvim -d"
elif [ $(command -v vim) ] ; then
export EDITOR=vim
else
export EDITOR=vi
fi
if [[ $(command -v rg) ]]; then
alias grep='rg -i'
else
alias grep='grep --color'
fi
function ud() {
for i in ${LOCAL_GIT_DIR}/dotfiles ${LOCAL_GIT_DIR}/zsh_modules/*; do git -C ${i} pull; done
nvim -c "lua require('lazy').sync({wait = true})"
}

2
config/zsh/cleanhome.zsh Normal file
View file

@ -0,0 +1,2 @@
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
export LESSHISTFILE='/dev/null'

13
config/zsh/fzf.zsh Normal file
View file

@ -0,0 +1,13 @@
if [[ $(command -v fzf) ]]; then
source <(fzf --zsh)
export FZF_DEFAULT_COMMAND='fd -H -L --ignore-file ~/.local/config/fd'
export FZF_CTRL_T_COMMAND='fd -H -L --ignore-file ~/.local/config/fd'
export FZF_DEFAULT_OPTS="--multi -e --ansi --layout=reverse --preview='bat --color=always --tabs=2 --style=plain --theme=Monokai\ Extended\ Bright {}'"
export FZF_CTRL_R_OPTS="-e --ansi --layout=reverse --preview=''"
_fzf_compgen_path() {
fd -H -L --ignore-file ~/.local/config/fd . "$1"
}
_fzf_compgen_dir() {
fd -H -L --ignore-file ~/.local/config/fd --type d . "$1"
}
fi

22
config/zsh/keys.zsh Normal file
View file

@ -0,0 +1,22 @@
# key mode
bindkey -e
# proudly stolen from oh-my-zsh
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
function zle-line-init() {
echoti smkx
}
function zle-line-finish() {
echoti rmkx
}
zle -N zle-line-init
zle -N zle-line-finish
fi
if [[ -n "${terminfo[kcuu1]}" ]]; then
autoload -U up-line-or-beginning-search
zle -N up-line-or-beginning-search
bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search
bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search
bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search
fi