From 445e8a8835afad299c5a5b19da48ba059daa04d6 Mon Sep 17 00:00:00 2001 From: asif Date: Fri, 23 May 2025 23:12:01 +0530 Subject: [PATCH] configurations for fish, nvim, tmux and starship --- fish/.config/fish/conf.d/fnm.fish | 21 ++ fish/.config/fish/config.fish | 100 ++++++++ fish/.config/fish/fish_variables | 34 +++ nvim/.config/nvim/after/plugin/lualine.lua | 111 ++++++++ nvim/.config/nvim/after/plugin/telescope.lua | 81 ++++++ nvim/.config/nvim/after/plugin/treesitter.lua | 69 +++++ nvim/.config/nvim/init.lua | 1 + nvim/.config/nvim/lazy-lock.json | 35 +++ nvim/.config/nvim/lua/config.lua | 3 + nvim/.config/nvim/lua/core/keymaps.lua | 63 +++++ nvim/.config/nvim/lua/core/options.lua | 17 ++ nvim/.config/nvim/lua/plugins/init.lua | 242 ++++++++++++++++++ nvim/.config/nvim/lua/plugins/lsp.lua | 54 ++++ starship/.config/starship.toml | 83 ++++++ starship/.config/starship.toml_bkp | 85 ++++++ tmux/.config/tmux/tmux.conf | 78 ++++++ 16 files changed, 1077 insertions(+) create mode 100644 fish/.config/fish/conf.d/fnm.fish create mode 100644 fish/.config/fish/config.fish create mode 100644 fish/.config/fish/fish_variables create mode 100644 nvim/.config/nvim/after/plugin/lualine.lua create mode 100755 nvim/.config/nvim/after/plugin/telescope.lua create mode 100644 nvim/.config/nvim/after/plugin/treesitter.lua create mode 100755 nvim/.config/nvim/init.lua create mode 100644 nvim/.config/nvim/lazy-lock.json create mode 100755 nvim/.config/nvim/lua/config.lua create mode 100755 nvim/.config/nvim/lua/core/keymaps.lua create mode 100755 nvim/.config/nvim/lua/core/options.lua create mode 100644 nvim/.config/nvim/lua/plugins/init.lua create mode 100644 nvim/.config/nvim/lua/plugins/lsp.lua create mode 100644 starship/.config/starship.toml create mode 100644 starship/.config/starship.toml_bkp create mode 100644 tmux/.config/tmux/tmux.conf diff --git a/fish/.config/fish/conf.d/fnm.fish b/fish/.config/fish/conf.d/fnm.fish new file mode 100644 index 0000000..6b1ae40 --- /dev/null +++ b/fish/.config/fish/conf.d/fnm.fish @@ -0,0 +1,21 @@ + +# fnm +set FNM_PATH "/home/asif/.local/share/fnm" +if [ -d "$FNM_PATH" ] + set PATH "$FNM_PATH" $PATH + fnm env | source +end + +# fnm +set FNM_PATH "/home/asif/.local/share/fnm" +if [ -d "$FNM_PATH" ] + set PATH "$FNM_PATH" $PATH + fnm env | source +end + +# fnm +set FNM_PATH "/home/asif/.local/share/fnm" +if [ -d "$FNM_PATH" ] + set PATH "$FNM_PATH" $PATH + fnm env | source +end diff --git a/fish/.config/fish/config.fish b/fish/.config/fish/config.fish new file mode 100644 index 0000000..9d2c850 --- /dev/null +++ b/fish/.config/fish/config.fish @@ -0,0 +1,100 @@ +set -x TMUX_CONF $HOME/.config/tmux/.tmux.conf + +# search and edit files +function f + set dir (count $argv) > /dev/null; and set dir $argv[1]; or set dir . + set selected (fd --type f --hidden --exclude .git . $dir | fzf --tmux --reverse) + + if test -n "$selected" + nvim $selected + end +end + +# initiate starship +starship init fish | source + +# initiate fzf +fzf --fish | source +set -gx FZF_DEFAULT_COMMAND 'rg --files --hidden --follow --glob "!.git/*"' +set -gx FZF_CTRL_T_COMMAND 'fd --type f --hidden --follow --exclude .git' +set -gx FZF_ALT_C_COMMAND 'fd --type d --hidden --follow --exclude .git' +set -gx FZF_DEFAULT_OPTS '--tmux --layout=reverse --border --preview "bat --color=always --style=numbers {}"' + +# color setting for fish prompt +set -g fish_color_command green +set -g fish_color_param cyan +set -g fish_color_error red +set -g fish_color_comment brblack +set -g fish_color_quote yellow + +# neovim as editor +set -gx EDITOR nvim +set -gx VISUAL nvim + +# aliases +alias v='nvim' +alias vi='nvim' +alias vim='nvim' + +alias t='tmux' +alias ta='tmux attach || tmux new' +alias tl='tmux list-sessions' + +alias gs='git status' +alias ga='git add' +alias gl='git log --oneline --graph --all' +alias gd='git diff' +alias gc='git commit -m' +alias gp='git push' +alias gpl='git pull' +alias gsw='git switch' + +alias ls='eza --icons --group-directories-first' +alias ll='eza -l --icons --group-directories-first' +alias lt='eza -T --icons' + +alias cat='bat --style=auto' +alias less='bat --style=auto --paging=always' + +alias c='clear' +alias h='history' +alias df='df -h' +alias du='du -h' +alias mkdir='mkdir -p' + +# quick cd to git repository root +function cdr -d "Jump to git repository root" + set -l git_root (git rev-parse --show-toplevel 2> /dev/null) + if test -n "$git_root" + cd "$git_root" + else + echo "Not in a git repository" + end +end + +# quickly find and edit a file in neovim +function f -d "Search and open files in Neovim" + set -l file (rg --files --hidden --follow --glob "!.git/*" | fzf --tmux --preview "bat --color=always --style=numbers {}") + if test -n "$file" + nvim "$file" + end +end + +# tmux session based on workspace directory +function tms -d "Tmux sessionizer" + set -l dir (fd --type d --hidden --follow --exclude .git | fzf --prompt="Select directory: ") + if test -n "$dir" + set -l session_name (basename "$dir" | tr . _) + if not tmux has-session -t "$session_name" 2> /dev/null + tmux new-session -d -s "$session_name" -c "$dir" + end + if test -n "$TMUX" + tmux switch-client -t "$session_name" + else + tmux attach-session -t "$session_name" + end + end +end + +# disable fish greeting +set -g fish_greeting diff --git a/fish/.config/fish/fish_variables b/fish/.config/fish/fish_variables new file mode 100644 index 0000000..1400508 --- /dev/null +++ b/fish/.config/fish/fish_variables @@ -0,0 +1,34 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR Z_DATA_DIR:/home/asif/\x2elocal/share/z +SETUVAR __fish_initialized:3800 +SETUVAR _fisher_upgraded_to_4_4:\x1d +SETUVAR fish_color_autosuggestion:brblack +SETUVAR fish_color_cancel:\x2dr +SETUVAR fish_color_command:normal +SETUVAR fish_color_comment:red +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:green +SETUVAR fish_color_error:brred +SETUVAR fish_color_escape:brcyan +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:normal +SETUVAR fish_color_host_remote:yellow +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:brcyan +SETUVAR fish_color_param:cyan +SETUVAR fish_color_quote:yellow +SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold +SETUVAR fish_color_search_match:white\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_status:red +SETUVAR fish_color_user:brgreen +SETUVAR fish_color_valid_path:\x2d\x2dunderline +SETUVAR fish_key_bindings:fish_default_key_bindings +SETUVAR fish_pager_color_completion:normal +SETUVAR fish_pager_color_description:yellow\x1e\x2di +SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan +SETUVAR fish_pager_color_selected_background:\x2dr +SETUVAR fish_user_paths:/home/asif/\x2esdkman/candidates/java/current/bin diff --git a/nvim/.config/nvim/after/plugin/lualine.lua b/nvim/.config/nvim/after/plugin/lualine.lua new file mode 100644 index 0000000..f53fb9c --- /dev/null +++ b/nvim/.config/nvim/after/plugin/lualine.lua @@ -0,0 +1,111 @@ +local lualine = require("lualine") + +local colors = { + aqua = "#89B482", + green = "#A9B665", + blue = "#7DAEA3", + violet = "#D3869B", + yellow = "#D8A657", + red = "#Ea6962", + cream = "#DDC7A1", + bg1 = "#3C3836", + bg2 = "#32302F", + bg_dim = "#252423", +} + +local gruv_material = { + normal = { + a = { bg = colors.aqua, fg = colors.bg_dim, gui = "bold" }, + b = { bg = colors.bg1, fg = colors.cream, gui = "bold" }, + c = { bg = colors.bg2, fg = colors.cream, gui = "bold" }, + }, + insert = { + a = { bg = colors.blue, fg = colors.bg_dim, gui = "bold" }, + c = { bg = colors.bg2, fg = colors.cream, gui = "bold" }, + }, + visual = { + a = { bg = colors.violet, fg = colors.black, gui = "bold" }, + c = { bg = colors.bg2, fg = colors.cream, gui = "bold" }, + }, + command = { + a = { bg = colors.aqua, fg = colors.black, gui = "bold" }, + c = { bg = colors.bg2, fg = colors.cream, gui = "bold" }, + }, + terminal = { + a = { bg = colors.red, fg = colors.black, gui = "bold" }, + c = { bg = colors.bg2, fg = colors.cream, gui = "bold" }, + }, + replace = { + a = { bg = colors.blue, fg = colors.black, gui = "bold" }, + c = { bg = colors.bg2, fg = colors.cream, gui = "bold" }, + }, + inactive = { + a = { bg = colors.green, fg = colors.black, gui = "bold" }, + c = { bg = colors.bg_dim, fg = colors.cream, gui = "bold" }, + }, +} + +lualine.setup({ + options = { + icons_enabled = true, + theme = gruv_material, + section_separators = "", + component_separators = "", -- { left = "│", right = "│" }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + -- ignore_focus = {}, + -- always_divide_middle = true, + globalstatus = true, + always_show_tabline = true, + refresh = { + statusline = 100, + tabline = 100, + winbar = 100, + }, + }, + sections = { + lualine_a = { { "mode", icon = "" } }, + lualine_b = { + { + "buffers", + show_filename_only = true, + show_modified_status = true, + mode = 0, + max_length = vim.o.columns * 2 / 3, + filetype_names = { + TelescopePrompt = "Telescope", + dashboard = "Dashboard", + packer = "Packer", + fzf = "FZF", + alpha = "Alpha", + }, + buffers_color = { + active = { bg = colors.yellow, fg = colors.bg_dim }, + inactive = { bg = colors.bg1, fg = colors.cream }, + }, + symbols = { + alternate_file = "", + directory = "", + }, + }, + }, + lualine_c = { + { + "filename", + file_status = true, + path = 3, + shorting_target = 0, + }, + }, + lualine_x = {}, + lualine_y = { "searchcount", "selectioncount", "encoding", "filetpe" }, + lualine_z = { "progress", "location" }, + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {}, +}) +vim.opt.laststatus = 3 diff --git a/nvim/.config/nvim/after/plugin/telescope.lua b/nvim/.config/nvim/after/plugin/telescope.lua new file mode 100755 index 0000000..8f3e477 --- /dev/null +++ b/nvim/.config/nvim/after/plugin/telescope.lua @@ -0,0 +1,81 @@ +local telescope = require("telescope") +local builtin = require("telescope.builtin") +local actions = require("telescope.actions") +local map = vim.keymap.set + +telescope.setup({ + defaults = { + prompt_prefix = " ", + selection_caret = " ", + sorting_strategy = "ascending", + layout_strategy = "flex", + layout_config = { + horizontal = { + prompt_position = "top", + }, + }, + file_ignore_patterns = { + "^%.git/", + "^%.git$", + ".DS_Store", + }, + mappings = { + n = { + [""] = "select_horizontal", + }, + }, + border = true, + borderchars = { " ", " ", " ", " ", " ", " ", " ", " " }, + color_devicons = true, + }, + pickers = { + find_files = { + hidden = true, + }, + live_grep = { + additional_args = { "--hidden" }, + }, + buffers = { + sort_mru = true, + }, + oldfiles = { + cwd_only = true, + }, + lsp_document_symbol = { + symbol_width = 40, + }, + }, + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = "smart_case", + }, + + extensions = { + ["ui-select"] = { + layout_config = { + width = 100, + height = 30, + }, + }, + }, +}) + +vim.api.nvim_set_hl(0, "TelescopeNormal", { bg = "#3c3836" }) +vim.api.nvim_set_hl(0, "TelescopeBorder", { bg = "#3c3836", fg = "#3c3836" }) +vim.api.nvim_set_hl(0, "TelescopePromptNormal", { bg = "#3c3836" }) + +telescope.load_extension("fzf") +telescope.load_extension("ui-select") + +map("n", "", ":Telescope") +map("n", "fb", builtin.buffers) +map("n", "ff", builtin.find_files) +map("n", "fg", builtin.live_grep) +map("n", "f/", "Telescope current_buffer_fuzzy_find fuzzy=false case_mode=smart_case") +map("n", "fk", "Telescope quickfix") +map("n", "fd", "Telescope diagnostics bufnr=0 sort_by=severity") diff --git a/nvim/.config/nvim/after/plugin/treesitter.lua b/nvim/.config/nvim/after/plugin/treesitter.lua new file mode 100644 index 0000000..970a39f --- /dev/null +++ b/nvim/.config/nvim/after/plugin/treesitter.lua @@ -0,0 +1,69 @@ +require("nvim-treesitter.configs").setup({ + ensure_installed = { + "c", + "javascript", + "python", + "lua", + "vim", + "markdown", + }, + sync_install = false, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + indent = { + enable = true, + }, + + incremental_selection = { + enable = true, + keymaps = { + init_selection = "i", + node_incremental = "i", + scope_incremental = "", + node_decremental = "", + }, + }, + + textobjects = { + select = { + enable = true, + lookahead = true, + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + ["a="] = "@assignment.outer", + ["i="] = "@assignment.inner", + ["al"] = "@loop.outer", + ["il"] = "@loop.inner", + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + ["]f"] = "@function.outer", + ["]c"] = "@class.outer", + }, + goto_next_end = { + ["]F"] = "@function.outer", + ["]C"] = "@class.outer", + }, + goto_previous_start = { + ["[f"] = "@function.outer", + ["[c"] = "@class.outer", + }, + goto_previous_end = { + ["[F"] = "@function.outer", + ["[C"] = "@class.outer", + }, + }, + }, + autotag = { + enable = true, + }, +}) diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua new file mode 100755 index 0000000..8d3f0dd --- /dev/null +++ b/nvim/.config/nvim/init.lua @@ -0,0 +1 @@ +require('config') diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..88459dd --- /dev/null +++ b/nvim/.config/nvim/lazy-lock.json @@ -0,0 +1,35 @@ +{ + "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, + "blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" }, + "conform.nvim": { "branch": "master", "commit": "a4bb5d6c4ae6f32ab13114e62e70669fa67745b9" }, + "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "gruvbox-material": { "branch": "master", "commit": "f5f912fbc7cf2d45da6928b792d554f85c7aa89a" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, + "lspsaga.nvim": { "branch": "main", "commit": "920b1253e1a26732e53fac78412f6da7f674671d" }, + "lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" }, + "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "75d60a8f928decd8b38897f80849768b7c540a5b" }, + "mason.nvim": { "branch": "main", "commit": "888d6ee499d8089a3a4be4309d239d6be1c1e6c0" }, + "mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" }, + "nui.nvim": { "branch": "main", "commit": "f535005e6ad1016383f24e39559833759453564e" }, + "nvim-dap": { "branch": "master", "commit": "8df427aeba0a06c6577dc3ab82de3076964e3b8d" }, + "nvim-java": { "branch": "main", "commit": "f92cadf7bdd01f5cfe383c8e725a283ffcc3685d" }, + "nvim-java-core": { "branch": "main", "commit": "401bf7683012a25929a359deec418f36beb876e2" }, + "nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" }, + "nvim-java-refactor": { "branch": "main", "commit": "b51a57d862338999059e1d1717df3bc80a3a15c0" }, + "nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" }, + "nvim-lspconfig": { "branch": "master", "commit": "ac1dfbe3b60e5e23a2cff90e3bd6a3bc88031a57" }, + "nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "b0debd5c424969b4baeabdc8f54db3036c691732" }, + "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, + "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, + "oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" } +} diff --git a/nvim/.config/nvim/lua/config.lua b/nvim/.config/nvim/lua/config.lua new file mode 100755 index 0000000..f7ae1df --- /dev/null +++ b/nvim/.config/nvim/lua/config.lua @@ -0,0 +1,3 @@ +require('core.options') +require('core.keymaps') +require('plugins.init') diff --git a/nvim/.config/nvim/lua/core/keymaps.lua b/nvim/.config/nvim/lua/core/keymaps.lua new file mode 100755 index 0000000..f6c8e66 --- /dev/null +++ b/nvim/.config/nvim/lua/core/keymaps.lua @@ -0,0 +1,63 @@ +local function map(mode, lhs, rhs, opts) + local options = { noremap = true, silent = true } + if opts then + options = vim.tbl_extend("force", options, opts) + end + vim.keymap.set(mode, lhs, rhs, options) +end + +-- leader and localleader setup +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- jj for normal mode +map({ "i", "v" }, "jj", "", { desc = "return to normal mode" }) + +-- window navigation +map("n", "", "h") +map("n", "", "j") +map("n", "", "k") +map("n", "", "l") + +-- buffer navigation +map("n", "", ":bnext") +map("n", "", ":bprevious") + +-- clear highlights +map("n", "h", ":nohlsearch") + +-- indentations +map("v", "<", "", ">gv") + +-- move text up down +map("v", "J", ":m '>+1gv=gv") +map("v", "K", ":m '<-2gv=gv") + +-- cusor centered when jumping +map("n", "n", "nzzzv") + +-- save and quit +map("n", "w", ":w", { desc = "save file" }) +map("n", "q", ":q", { desc = "quit window" }) +map("n", "Q", ":qa", { desc = "quit neovim" }) +map("n", "bd", ":bd", { desc = "close buffer" }) +-- map("n", "gf", ":lua OpenFile()", { desc = "Open or create file under cursor" }) + +-- others +map("n", "S", ":source %", { desc = "source buffer" }) +map("n", "j", "gj", { desc = "down in wrapped line" }) +map("n", "k", "gk", { desc = "up in wrapped line" }) +map("n", "", "3>", { desc = "Resize Left" }) +map("n", "", "3-", { desc = "Resize Right" }) +map("n", "", "3+", { desc = "Resize Up" }) +map("n", "", "3<", { desc = "Resize Down" }) + +vim.keymap.set("n", "f", function() + vim.lsp.buf.format({ + async = true, + filter = function(client) + return client.name == "null-ls" + end, + }) +end, { desc = "Format with null-ls" }) diff --git a/nvim/.config/nvim/lua/core/options.lua b/nvim/.config/nvim/lua/core/options.lua new file mode 100755 index 0000000..5879f86 --- /dev/null +++ b/nvim/.config/nvim/lua/core/options.lua @@ -0,0 +1,17 @@ +-- appearance +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.cursorline = true +vim.opt.signcolumn = "yes" +vim.opt.scrolloff = 8 +vim.opt.sidescrolloff = 8 +vim.opt.termguicolors = true +vim.opt.cmdheight = 0 +vim.opt.pumheight = 10 +vim.opt.wrap = false + +-- editing +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true +vim.opt.smartindent = true diff --git a/nvim/.config/nvim/lua/plugins/init.lua b/nvim/.config/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..11a9b4c --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/init.lua @@ -0,0 +1,242 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = { + -- colorscheme + { + "sainnhe/gruvbox-material", + priroty = 1000, + config = function() + vim.cmd([[colorscheme gruvbox-material]]) + end, + }, + -- lualine + { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + }, + -- telescope + { + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope-ui-select.nvim", + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + }, + }, + -- treesitter + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", + "windwp/nvim-ts-autotag", + }, + }, + -- LSP + { + "neovim/nvim-lspconfig", + dependencies = { + { "mason-org/mason.nvim", opts = {} }, + "mason-org/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + { "j-hui/fidget.nvim", opts = {} }, + "saghen/blink.cmp", + }, + }, + { + "nvim-java/nvim-java", + }, + { -- Autoformat + "stevearc/conform.nvim", + event = { "BufWritePre" }, + cmd = { "ConformInfo" }, + keys = { + { + "f", + function() + require("conform").format({ async = true, lsp_format = "fallback" }) + end, + mode = "", + desc = "[F]ormat buffer", + }, + }, + opts = { + notify_on_error = false, + format_on_save = function(bufnr) + -- Disable "format_on_save lsp_fallback" for languages that don't + -- have a well standardized coding style. You can add additional + -- languages here or re-enable it for the disabled ones. + local disable_filetypes = { c = true, cpp = true } + if disable_filetypes[vim.bo[bufnr].filetype] then + return nil + else + return { + timeout_ms = 500, + lsp_format = "fallback", + } + end + end, + formatters_by_ft = { + lua = { "stylua" }, + -- Conform can also run multiple formatters sequentially + -- python = { "isort", "black" }, + -- + -- You can use 'stop_after_first' to run the first available formatter from the list + -- javascript = { "prettierd", "prettier", stop_after_first = true }, + }, + }, + }, + + { -- Autocompletion + "saghen/blink.cmp", + event = "VimEnter", + version = "1.*", + dependencies = { + -- Snippet Engine + { + "L3MON4D3/LuaSnip", + version = "2.*", + build = (function() + -- Build Step is needed for regex support in snippets. + -- This step is not supported in many windows environments. + -- Remove the below condition to re-enable on windows. + if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then + return + end + return "make install_jsregexp" + end)(), + dependencies = { + { + "rafamadriz/friendly-snippets", + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + end, + }, + }, + opts = {}, + }, + "folke/lazydev.nvim", + }, + --- @module 'blink.cmp' + --- @type blink.cmp.Config + opts = { + keymap = { + -- 'default' (recommended) for mappings similar to built-in completions + -- to accept ([y]es) the completion. + -- This will auto-import if your LSP supports it. + -- This will expand snippets if the LSP sent a snippet. + -- 'super-tab' for tab to accept + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- For an understanding of why the 'default' preset is recommended, + -- you will need to read `:help ins-completion` + -- + -- No, but seriously. Please read `:help ins-completion`, it is really good! + -- + -- All presets have the following mappings: + -- /: move to right/left of your snippet expansion + -- : Open menu or open docs if already open + -- / or /: Select next/previous item + -- : Hide menu + -- : Toggle signature help + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + preset = "default", + + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: + -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps + }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + }, + + completion = { + -- By default, you may press `` to show the documentation. + -- Optionally, set `auto_show = true` to show the documentation after a delay. + documentation = { auto_show = false, auto_show_delay_ms = 500 }, + }, + + sources = { + default = { "lsp", "path", "snippets", "lazydev" }, + providers = { + lazydev = { module = "lazydev.integrations.blink", score_offset = 100 }, + }, + }, + + snippets = { preset = "luasnip" }, + + -- Blink.cmp includes an optional, recommended rust fuzzy matcher, + -- which automatically downloads a prebuilt binary when enabled. + -- + -- By default, we use the Lua implementation instead, but you may enable + -- the rust implementation via `'prefer_rust_with_warning'` + -- + -- See :h blink-cmp-config-fuzzy for more information + fuzzy = { implementation = "lua" }, + + -- Shows a signature help window while you type arguments for a function + signature = { enabled = true }, + }, + }, + { + "nvimdev/lspsaga.nvim", + event = "LspAttach", + config = function() + require("lspsaga").setup({}) + end, + }, + { + "stevearc/oil.nvim", + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + -- Optional dependencies + dependencies = { { "echasnovski/mini.icons", opts = {} } }, + -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons + -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. + lazy = false, + config = function() + require("oil").setup({ + default_file_explorer = true, + }) + vim.keymap.set("n", "-", "Oil", { desc = "open parent directory" }) + end, + }, + }, + defaults = { + lazy = false, + version = false, + }, + checker = { enbaled = true }, + performance = { + rtp = { + disabled_plugins = { + "gzip", + "matchit", + "matchparen", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) + +require("plugins.lsp") diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..7501e1a --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,54 @@ +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }), + callback = function(event) + local map = function(keys, func, desc, mode) + mode = mode or "n" + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) + end + + map("rn", "Lspsaga rename", "rename") + map("ca", "Lspsaga code_action", "goto code action", { "n", "x" }) + map("gd", "Lspsaga peek_definition", "goto definition") + map("K", "Lspsaga hover_doc", "hover doc") + map("]d", "Lspsaga diagnostic_jump_next", "diagnostic jump next") + map("[d", "Lspsaga diagnostic_jump_prev", "diagnostic jump prev") + end, +}) + +local capabilities = require("blink.cmp").get_lsp_capabilities() + +local servers = { + lua_ls = { + settings = { + Lua = { + completion = { + callSnippet = "Replace", + }, + diagnostics = { + globals = { "vim" }, + }, + }, + }, + }, + ts_ls = {}, +} + +local ensure_installed = vim.tbl_keys(servers or {}) +vim.list_extend(ensure_installed, { "stylua", "prettier", "eslint" }) + +require("mason-tool-installer").setup({ ensure_installed = ensure_installed }) + +require("mason-lspconfig").setup({ + ensure_installed = {}, + automatic_installation = false, + handlers = { + function(server_name) + local server = servers[server_name] or {} + server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {}) + if server_name == "jdtls" then + require("java").setup() + end + require("lspconfig")[server_name].setup(server) + end, + }, +}) diff --git a/starship/.config/starship.toml b/starship/.config/starship.toml new file mode 100644 index 0000000..f04467a --- /dev/null +++ b/starship/.config/starship.toml @@ -0,0 +1,83 @@ +format = """ +$username\ +$hostname\ +$directory\ +$git_branch\ +$git_state\ +$git_status\ +$git_metrics\ +$fill\ +$cmd_duration $jobs\ +$line_break\ +$character\ +""" +add_newline = false + +[fill] +symbol = " " + +[directory] +style = "blue" +read_only = " " +truncation_length = 4 +truncate_to_repo = false + +[character] +success_symbol = "[~> ](bold yellow)" +error_symbol = "[~> ](bold red)" +vicmd_symbol = "[~> ](bold green)" + +[git_branch] +symbol = " " +format = 'on [$symbol$branch(:$remote_branch)]($style) ' +ignore_branches=[] +style = "bold purple" + + +[git_status] +format = '([\[$all_status$ahead_behind\]]($style) )' +style = "cyan" + +[git_state] +format = '\([$state( $progress_current/$progress_total)]($style)\) ' +style = "bright-black" + +[git_metrics] +disabled = false + +[jobs] +symbol = "" +style = "bold red" +number_threshold = 1 +format = "[$symbol]($style)" + +[cmd_duration] +format = "[$duration]($style)" +style = "yellow" + +[memory_usage] +symbol = " " + +[python] +symbol="󰌠" + +[c] +symbol="" + +[lua] +symbol="󰢱" + +[rust] +symbol = "" + +[time] +disabled = false +style = "bold yellow" +format = "[$time]($style)" + +[custom.stunnel] +when = "ps aux | grep stunnel | grep -v grep" +command = "ps -o etime= -p $(ps aux | grep stunnel | grep -v grep | awk '{print $2}')" +style = "red" +format = "[TUNNEL OPEN for $output]($style)" + diff --git a/starship/.config/starship.toml_bkp b/starship/.config/starship.toml_bkp new file mode 100644 index 0000000..4d1730d --- /dev/null +++ b/starship/.config/starship.toml_bkp @@ -0,0 +1,85 @@ +# ~/.config/starship.toml + +add_newline = false +format = """ +$username$directory$git_branch$git_status$nodejs$rust$java$python$time$character +""" + +# PROMPT CHARACTER +[character] +success_symbol = "[ ~>](bold #b8bb26)" +error_symbol = "[ ~>](bold #fb4934)" +vicmd_symbol = "[ ~<](bold #83a598)" + +# DIRECTORY +[directory] +style = "bold #83a598" +format = "[$path]($style) " + +# GIT BRANCH +[git_branch] +symbol = " " +style = "bold #fe8019" +format = "[$symbol$branch]($style) " + +# GIT STATUS +[git_status] +style = "#fabd2f" +format = '([$all_status]($style) )' +ahead = "⇡${count}" +behind = "⇣${count}" +diverged = "⇕⇡${ahead_count}⇣${behind_count}" +staged = "+${count}" +conflicted = "✖${count}" +deleted = "-${count}" +modified = "~${count}" +untracked = "?${count}" +stashed = "💾${count}" + +# NODEJS +[nodejs] +symbol = " " +style = "#b8bb26" +format = "[$symbol($version)]($style) " + +# RUST +[rust] +symbol = " " +style = "#d3869b" +format = "[$symbol($version)]($style) " + +# JAVA +[java] +symbol = " " +style = "#fabd2f" +format = "[$symbol($version)]($style) " + +# PYTHON +[python] +symbol = " " +style = "#8ec07c" +format = "[$symbol$virtualenv]($style) " + +# TIME (24hr) +[time] +disabled = false +format = "[$time]($style) " +style = "#928374" +time_format = "%H:%M" + +# CLEANUP +[aws] +disabled = true +[gcloud] +disabled = true +[azure] +disabled = true +[helm] +disabled = true +[kubernetes] +disabled = true + +[username] +show_always = true +style_user = "bold #d3869b" +format = "[$user]($style) " diff --git a/tmux/.config/tmux/tmux.conf b/tmux/.config/tmux/tmux.conf new file mode 100644 index 0000000..8f9ce97 --- /dev/null +++ b/tmux/.config/tmux/tmux.conf @@ -0,0 +1,78 @@ +##### Enable true colors ##### +set -g default-terminal "tmux-256color" +set -ga terminal-overrides ",*256col*:Tc" + +##### Leader Key ##### +unbind C-b +set -g prefix , +bind , send-prefix + +##### Basics ##### +set -g mouse on +set -g history-limit 10000 +set -g renumber-windows on +setw -g base-index 1 +setw -g pane-base-index 1 +set -s escape-time 0 +set -g repeat-time 500 + +##### Status bar ##### +set-option -g status on +set-option -g status-position top +set -g status-style 'bg=#3C3836,fg=#DDC7A1' +set-option -g status-left '#[fg=colour233,bg=#89B482] #S ' +set -g status-left-length 50 +set-option -g status-right '#[fg=colour233,bg=colour241,bold] %H:%M #[fg=#45403D,bg=#FE8019,bold] #h' +set -g status-right-length 50 + +set -g window-status-format " #I:#W " +set -g window-status-current-format "#[fg=#3C3836, bg=#D8A657, italics, bold] #I:#W " + +##### Pane Borders ##### +set -g pane-border-style fg=#DDC7A1 +set -g pane-active-border-style fg=#D8A657 + +##### Copy Mode & Messages ##### +setw -g mode-style bg=colour237,fg=colour109 +set -g message-style bg=colour237,fg=colour109 +setw -g mode-keys vi +bind -T copy-mode-vi v send-keys -X begin-selection +bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel +bind -T copy-mode-vi Escape send-keys -X cancel + +##### Vim-style Pane Movement ##### +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R +bind -r C-h resize-pane -L 5 +bind -r C-j resize-pane -D 5 +bind -r C-k resize-pane -U 5 +bind -r C-l resize-pane -R 5 + +##### Splitting Panes ##### +bind '|' split-window -h -c "#{pane_current_path}" +bind '-' split-window -v -c "#{pane_current_path}" +unbind '"' +unbind % + +##### Windows ##### +bind c new-window +bind X kill-window +bind n next-window +bind p previous-window +bind w choose-window +bind r command-prompt -I "#W" "rename-window '%%'" + +##### Panes ##### +bind x kill-pane +bind z resize-pane -Z +bind q display-panes + +##### Sessions ##### +bind s choose-session +bind d detach-client + +##### Reload Config ##### +bind R source-file ~/.config/tmux/tmux.conf \; display "Config Reloaded!" +