From 9db74a80ffe91052ad8efd3f56f68cef583b9d7c Mon Sep 17 00:00:00 2001 From: Pat Garrity Date: Wed, 24 Apr 2024 22:39:31 -0500 Subject: [PATCH] Several modifications for vim, git, zsh --- .config/nvim/init.lua | 2 -- .config/nvim/lua/colorscheme.lua | 3 +- .config/nvim/lua/general.lua | 13 ++----- .config/nvim/lua/keymap.lua | 3 +- .config/nvim/lua/plugin_management.lua | 35 ++++++++++++++++-- .config/nvim/lua/plugins/lualine.lua | 15 -------- .config/nvim/lua/plugins/metals.lua | 3 ++ .config/nvim/lua/plugins/treesitter.lua | 8 ++--- .gitconfig | 1 + .zshrc | 47 ++++++++++++++++++++----- 10 files changed, 84 insertions(+), 46 deletions(-) delete mode 100644 .config/nvim/lua/plugins/lualine.lua diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 2721131..2410b1c 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -19,5 +19,3 @@ require('plugins/metals') -- Setup treesitter, select the configs to load, etc. require('plugins/treesitter') - -require('plugins/lualine') diff --git a/.config/nvim/lua/colorscheme.lua b/.config/nvim/lua/colorscheme.lua index b7195e6..f442abc 100644 --- a/.config/nvim/lua/colorscheme.lua +++ b/.config/nvim/lua/colorscheme.lua @@ -3,4 +3,5 @@ vim.opt.background = 'dark' --vim.opt.background = 'light' -- Set the color scheme -vim.cmd 'colorscheme gruvbox-material' +--vim.cmd 'colorscheme gruvbox-material' +vim.cmd 'colorscheme melange' diff --git a/.config/nvim/lua/general.lua b/.config/nvim/lua/general.lua index e35f301..acb778a 100644 --- a/.config/nvim/lua/general.lua +++ b/.config/nvim/lua/general.lua @@ -72,23 +72,14 @@ opt.autoindent = true -- I don't use indentation when writing HTML, and autoindentation makes any form -- of editing flat out painful. vim.api.nvim_create_autocmd("FileType", { - pattern = 'html', + pattern = { "*.html" }, callback = function() vim.opt_local.autoindent = false + vim.opt_local.smarttab = false vim.opt_local.indentexpr = '' end, }) ------------------------------------------------------------ --- Custom File Types ------------------------------------------------------------ -vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { - pattern = {'*.aum', '*.aui'}, - callback = function() - vim.bo.filetype = "austral" - end, -}) - ----------------------------------------------------------- -- Memory, CPU ----------------------------------------------------------- diff --git a/.config/nvim/lua/keymap.lua b/.config/nvim/lua/keymap.lua index c0f67e5..c31a48c 100644 --- a/.config/nvim/lua/keymap.lua +++ b/.config/nvim/lua/keymap.lua @@ -48,8 +48,6 @@ map('i', '', 'Ob', { desc = 'Enter the Function Composition ∘ Charac map('n', 'K', vim.lsp.buf.hover, { desc = 'Hover' }) map('n', 'gi', vim.lsp.buf.implementation, { desc = 'Go To Implementation' }) map('n', 'gr', vim.lsp.buf.references, { desc = 'Go To References' }) -map('n', 'gds', vim.lsp.buf.document_symbol, { desc = 'Document Symbol' }) -map('n', 'gws', vim.lsp.buf.workspace_symbol, { desc = 'Workspace Symbol' }) map('n', 'gd', vim.lsp.buf.definition, { desc = 'Go To Definition' }) map('n', 'gD', vim.lsp.buf.type_definition, { desc = 'Go To Type Definition' }) map('n', 'cl', vim.lsp.codelens.run, { desc = 'Code Lens' }) @@ -58,3 +56,4 @@ map('n', 'ca', vim.lsp.buf.code_action, { desc = 'Code Action' }) map('n', '[c', 'lua vim.diagnostic.goto_prev({ wrap = false })', { desc = 'prev diagnostic' }) map('n', ']c', 'lua vim.diagnostic.goto_next({ wrap = false })', { desc = 'next diagnostic' }) map('n', 'ls', ':Telescope lsp_document_symbols', { desc = 'Browse Document Symbols' }) +map('n', 'ld', ':Telescope lsp_dynamic_workspace_symbols', { desc = 'Browse Definitions' }) diff --git a/.config/nvim/lua/plugin_management.lua b/.config/nvim/lua/plugin_management.lua index 91f8f4a..0e9cc54 100644 --- a/.config/nvim/lua/plugin_management.lua +++ b/.config/nvim/lua/plugin_management.lua @@ -16,6 +16,7 @@ require("lazy").setup({ -- ------------------------------------------------------------------------- { 'sainnhe/gruvbox-material', + lazy = true, config = function(_) vim.g.gruvbox_material_palette = 'material' vim.g.gruvbox_material_background = 'hard' @@ -26,6 +27,10 @@ require("lazy").setup({ 'rebelot/kanagawa.nvim', lazy = true, }, + { + 'savq/melange-nvim', + lazy = true, + }, { 'marko-cerovac/material.nvim', lazy = true, @@ -175,9 +180,6 @@ require("lazy").setup({ -- texlab = latex language server lsp.texlab.setup{} - -- terraform-ls = terraform language server (Hashicorp stable) - lsp.terraformls.setup{} - -- tsserver = typescript language server, works for JS as well. lsp.tsserver.setup{} @@ -256,12 +258,30 @@ require("lazy").setup({ { 'nvim-lualine/lualine.nvim', dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + local function metals_status_for_lualine() + return vim.g["metals_status"] or "" + end + + require('lualine').setup { + options = { + theme = 'gruvbox-material' + }, + sections = { + lualine_c = { + 'filename', + metals_status_for_lualine + } + } + } + end }, -- bufferline - shows a bar at the top with open buffers -- ------------------------------------------------------------------------- { 'akinsho/bufferline.nvim', + version = '*', dependencies = { 'nvim-tree/nvim-web-devicons' }, opts = { options = { @@ -327,6 +347,15 @@ require("lazy").setup({ end }, + -- Automatically close pairs such as {} [] () + -- ------------------------------------------------------------------------- + { + 'm4xshen/autoclose.nvim', + config = function(_) + require("autoclose").setup() + end + }, + -- Special highlighting and tracking for certain notable words -- ------------------------------------------------------------------------- { diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua deleted file mode 100644 index c93a5ac..0000000 --- a/.config/nvim/lua/plugins/lualine.lua +++ /dev/null @@ -1,15 +0,0 @@ -local function metals_status_for_lualine() - return vim.g["metals_status"] or "" -end - -require('lualine').setup { - options = { - theme = 'gruvbox-material' - }, - sections = { - lualine_c = { - 'filename', - metals_status_for_lualine - } - } -} diff --git a/.config/nvim/lua/plugins/metals.lua b/.config/nvim/lua/plugins/metals.lua index 8957f43..89d7582 100644 --- a/.config/nvim/lua/plugins/metals.lua +++ b/.config/nvim/lua/plugins/metals.lua @@ -1,6 +1,7 @@ -- Note that Metals _does not use nvim-lspconfig_. -- It still uses the nvim LSP, however. + -- Autocmd that will actually be in charging of starting the whole thing local nvim_metals_group = vim.api.nvim_create_augroup( 'nvim-metals', @@ -13,6 +14,8 @@ vim.api.nvim_create_autocmd('FileType', { local metals_config = require('metals').bare_config() metals_config.settings = { + -- Comment this out to use latest stable. + serverVersion = "latest.snapshot", showImplicitArguments = true, showInferredType = true, superMethodLensesEnabled = false diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua index 47762d2..bafea4a 100644 --- a/.config/nvim/lua/plugins/treesitter.lua +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -1,9 +1,9 @@ require'nvim-treesitter.configs'.setup { -- One of "all", "maintained", or a list of languages ensure_installed = { - "c", "zig", "bash", "scala", "yaml", "css", "javascript", - "latex", "clojure", "lua", "cpp", "hcl", "json", "ocaml", "toml", - "rust", "sql", "python", "gitcommit", "gitignore", "html", "go" + "zig", "bash", "scala", "yaml", "css", "javascript", "clojure", "lua", + "hcl", "json", "toml", "rust", "sql", "python", "gitcommit", + "gitignore", "html", "go" }, -- This will be populated after load. @@ -30,6 +30,6 @@ require'nvim-treesitter.configs'.setup { }, indent = { - enable = true + enable = false } } diff --git a/.gitconfig b/.gitconfig index 531aad3..66c5e69 100644 --- a/.gitconfig +++ b/.gitconfig @@ -21,6 +21,7 @@ log = delta reflog = delta show = delta + tag = false [core] excludesFile = ~/.gitignore [interactive] diff --git a/.zshrc b/.zshrc index 63aa623..ced7fc6 100644 --- a/.zshrc +++ b/.zshrc @@ -1,9 +1,32 @@ -export HISTFILE="$HOME/.zsh_history" -export HISTSIZE=1000 -export SAVEHIST=5000 - local_install_dir="$HOME/.local/install" +# ============================================================================= +# History configuration. +# ============================================================================= +export HISTFILE="$HOME/.zsh_history" +export HISTSIZE=10000 +export SAVEHIST=10000 +export HISTORY_IGNORE="(ls|cd|pwd|exit)*" +export HIST_STAMPS="yyyy-mm-dd" +setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format. +setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits. +setopt SHARE_HISTORY # Share history between all sessions. +setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again. +setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate. +setopt HIST_IGNORE_SPACE # Do not record an event starting with a space. +setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file. +setopt HIST_VERIFY # Do not execute immediately upon history expansion. +setopt APPEND_HISTORY # append to history file (Default) +setopt HIST_NO_STORE # Don't store history commands +setopt HIST_REDUCE_BLANKS # Remove superfluous blanks from each command line being added to the history. + +export FZF_CTRL_R_OPTS=" + --preview 'echo {}' --preview-window up:3:hidden:wrap + --bind 'ctrl-/:toggle-preview' + --bind 'ctrl-y:execute-silent(echo -n {2..} | xclip -selection clipboard)+abort' + --color header:italic + --header 'Press CTRL-Y to copy command into clipboard'" + # ============================================================================= # Allow for menu-style tab completion. # ============================================================================= @@ -99,12 +122,20 @@ fi # ============================================================================= # Aliases # ============================================================================= -if command -v exa > /dev/null 2>&1; then - alias ls='exa' - alias ll='exa -l' +if command -v eza > /dev/null 2>&1; then + alias ls='eza' + alias ll='eza -l' else if $logging_enabled; then - echo "[warn] exa is not setup! Using the system ls" >> "$log_file" + echo "[warn] eza is not setup! Attempting to use exa" >> "$log_file" + fi + if command -v exa > /dev/null 2>&1; then + alias ls='exa' + alias ll='exa -l' + else + if $logging_enabled; then + echo "[warn] exa is not setup! Using the system ls" >> "$log_file" + fi fi fi