commit d70edfea3ccbda1300ecff977a1080dc49a18e8b Author: azathoth Date: Sun Jul 7 00:57:57 2024 -0400 initial commit diff --git a/.config/.zshenv b/.config/.zshenv new file mode 100644 index 0000000..c30d73a --- /dev/null +++ b/.config/.zshenv @@ -0,0 +1,7 @@ +# vi: ft=zsh + +# move or link this file to ~/.zshenv +# e.g., ln -s ~/.config/home.zshenv ~/.zshenv + +ZDOTDIR=~/.config/zsh +. $ZDOTDIR/.zshenv diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore new file mode 100644 index 0000000..b2ccb21 --- /dev/null +++ b/.config/nvim/.gitignore @@ -0,0 +1 @@ +/lazy-lock.json diff --git a/.config/nvim/.luarc.json b/.config/nvim/.luarc.json new file mode 100644 index 0000000..1e1765c --- /dev/null +++ b/.config/nvim/.luarc.json @@ -0,0 +1,5 @@ +{ + "diagnostics.globals": [ + "vim" + ] +} \ No newline at end of file diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..14cc4a2 --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,4 @@ +require('config.set') +require('config.remap') +require('config.netrw') +require('config.lazy') diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..0b7a769 --- /dev/null +++ b/.config/nvim/lua/config/lazy.lua @@ -0,0 +1,20 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = 'https://github.com/folke/lazy.nvim.git' + vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }) +end +vim.opt.rtp:prepend(lazypath) + +-- Setup lazy.nvim +require('lazy').setup({ + spec = { + -- import your plugins + { import = 'plugins' }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { 'gruvbox' } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/.config/nvim/lua/config/netrw.lua b/.config/nvim/lua/config/netrw.lua new file mode 100644 index 0000000..2f6bf5c --- /dev/null +++ b/.config/nvim/lua/config/netrw.lua @@ -0,0 +1,4 @@ +vim.g.netrw_liststyle = 3 +vim.g.netrw_banner = 0 + +vim.keymap.set('n', 'pv', vim.cmd.Ex) diff --git a/.config/nvim/lua/config/remap.lua b/.config/nvim/lua/config/remap.lua new file mode 100644 index 0000000..a129a59 --- /dev/null +++ b/.config/nvim/lua/config/remap.lua @@ -0,0 +1,6 @@ +vim.g.mapleader = ' ' +vim.g.maplocalleader = '\\' + +vim.keymap.set('n', '', vim.cmd.nohl) +vim.keymap.set('n', 'sh', ':sp') +vim.keymap.set('n', 'sv', ':vsp') diff --git a/.config/nvim/lua/config/set.lua b/.config/nvim/lua/config/set.lua new file mode 100644 index 0000000..e3bcc2c --- /dev/null +++ b/.config/nvim/lua/config/set.lua @@ -0,0 +1,14 @@ +vim.o.number = true +vim.o.relativenumber = true +vim.o.tabstop = 4 +vim.o.shiftwidth = 4 +vim.o.expandtab = false +vim.o.smartindent = true +vim.o.wrap = false +vim.o.list = true +vim.o.listchars = 'tab:| ,trail:_' +vim.o.foldlevelstart = 1 +vim.o.splitbelow = true +vim.o.splitright = true +vim.o.mouse = '' +vim.o.cursorline = true diff --git a/.config/nvim/lua/plugins/completion.lua b/.config/nvim/lua/plugins/completion.lua new file mode 100644 index 0000000..eea099c --- /dev/null +++ b/.config/nvim/lua/plugins/completion.lua @@ -0,0 +1,68 @@ +return { + { + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + dependencies = { + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-cmdline', + { + 'L3MON4D3/LuaSnip', + version = 'v2.*', + build = 'make install_jsregexp' + }, + 'saadparwaiz1/cmp_luasnip', + 'rafamadriz/friendly-snippets', + 'onsails/lspkind.nvim' + }, + config = function() + local cmp = require('cmp') + local luasnip = require('luasnip') + local lspkind = require('lspkind') + + require('luasnip.loaders.from_vscode').lazy_load() + + cmp.setup({ + completion = { + completeopt = 'menu,menuon,preview,noselect' + }, + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end + }, + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'buffer' }, + { name = 'path' } + }), + formatting = { + format = lspkind.cmp_format({ + maxwidth = 50, + ellipsis_char = '...', + }) + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then cmp.select_next_item() + elseif luasnip.expandable() then luasnip.expand() + elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() + else fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then cmp.select_prev_item() + elseif luasnip.jumpable(-1) then luasnip.jump(-1) + else fallback() + end + end, { 'i', 's' }) + }) + }) + end + } +} diff --git a/.config/nvim/lua/plugins/git.lua b/.config/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..841da74 --- /dev/null +++ b/.config/nvim/lua/plugins/git.lua @@ -0,0 +1,12 @@ +return { + { + 'tpope/vim-fugitive' + }, + { + 'lewis6991/gitsigns.nvim', + opts = { + current_line_blame = true + }, + config = true + }, +} diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..7dc4df8 --- /dev/null +++ b/.config/nvim/lua/plugins/init.lua @@ -0,0 +1,141 @@ +return { + { + 'ellisonleao/gruvbox.nvim', + priority = 1000, + config = function() + vim.cmd('colorscheme gruvbox') + vim.o.background = 'dark' + vim.cmd('hi Normal guibg=None') + end + }, + { + 'folke/todo-comments.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = true + }, + { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + dependencies = { 'hrsh7th/nvim-cmp' }, + opts = { + check_ts = true, + -- ts_config = { + -- lua = { 'string' } + -- } + }, + config = function(_, opts) + require('nvim-autopairs').setup(opts) + require('cmp').event:on('confirm_done', require('nvim-autopairs.completion.cmp').on_confirm_done()) + end + }, + { + 'prichrd/netrw.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = true + }, + -- { + -- 'norcalli/nvim-colorizer.lua', + -- opts = { "*" }, + -- config = function(_, opts) + -- require('colorizer').setup(opts) + -- end + -- }, + { + 'brenoprata10/nvim-highlight-colors', + event = { 'BufReadPre', 'BufNewFile' }, + opts = { + render = 'virtual', + virtual_symbol_position = 'eol', + virtual_symbol_suffix = '', + virtual_symbol = '' + }, + config = function(_, opts) + vim.opt.termguicolors = true + require('nvim-highlight-colors').setup(opts) + end + }, + { + 'numToStr/Comment.nvim', + event = { 'BufReadPre', 'BufNewFile' }, + dependencies = { + 'JoosepAlviste/nvim-ts-context-commentstring' + }, + config = function(_, opts) + require('Comment').setup(vim.tbl_deep_extend('force', opts, { + pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook() + })) + end + }, + ( + 'tpope/vim-vinegar' + ), + { + 'tpope/vim-surround' + }, + { + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons' + }, + config = function(_, opts) + require('telescope').setup(opts) + + local builtin = require('telescope.builtin') + vim.keymap.set('n', 'ff', builtin.find_files, {}) + vim.keymap.set('n', 'fg', builtin.live_grep, {}) + vim.keymap.set('n', 'fb', builtin.buffers, {}) + vim.keymap.set('n', 'fh', builtin.help_tags, {}) + end + }, + { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + event = 'VeryLazy', + opts = { + theme = 'lualine.themes.gruvbox' + }, + config = true + }, + { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + opts = { + highlight = { enable = true }, + indent = { enable = true }, + ensure_installed = { + 'bash', + 'html', + 'json', + 'lua', + 'markdown', + 'markdown_inline', + 'python', + 'regex', + 'vim', + 'vimdoc', + 'yaml', + 'terraform', + }, + }, + config = function(_, opts) + require('nvim-treesitter.configs').setup(opts) + end + }, + { + 'stsewd/isort.nvim', + ft = 'python', + build = { ':MasonInstall isort', ':UpdateRemotePlugins' } + }, + { + 'vimwiki/vimwiki', + init = function() + vim.g.vimwiki_list = { + { + path = '~/.local/share/nvim/vimwiki/' + } + } + end + } +} diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..44490b6 --- /dev/null +++ b/.config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,111 @@ +return { + { + 'williamboman/mason.nvim', + dependencies = { + 'williamboman/mason-lspconfig.nvim' + }, + opts = { + mason = { + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗" + } + } + }, + masonlsp = { + ensure_installed = { + 'basedpyright', + 'lua_ls', + 'terraformls', + 'tflint', + }, + } + }, + config = function(_, opts) + require('mason').setup(opts.mason) + require('mason-lspconfig').setup(opts.masonlsp) + end + }, + { + 'folke/trouble.nvim', + cmd = 'Trouble', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = true, + keys = { + { 'xx', 'Trouble diagnostics toggle', desc = 'Diagnostics (Trouble)' }, + { 'xX', 'Trouble diagnostics toggle filter.buf=0', desc = 'Buffer Diagnostics (Trouble)' }, + { 'xQ', 'Trouble qflist toggle', desc = 'Quickfix List (Trouble)' }, + { 'xL', 'Trouble loclist toggle', desc = 'Location List (Trouble)' }, + { 'xt', 'Trouble todo', desc = 'Open TODOs in trouble' } + } + }, + { + 'neovim/nvim-lspconfig', + event = { 'BufReadPre', 'BufNewFile' }, + dependencies = { + 'hrsh7th/cmp-nvim-lsp', + { 'antosha417/nvim-lsp-file-operations', config = true }, + }, + config = function() + local lsp = require('lspconfig') + local cap = require('cmp_nvim_lsp').default_capabilities() + + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(e) + local _opts = { buffer = e.buf, silent = true } + local keymap = vim.keymap + + _opts.desc = "Show LSP references" + keymap.set('n', 'gR', 'Telescope lsp_references', _opts) + + _opts.desc = "Go to declaration" + keymap.set('n', 'gD', vim.lsp.buf.declaration, _opts) + + _opts.desc = "Show LSP definitions" + keymap.set('n', 'gd', 'Telescope lsp_definitions', _opts) + + _opts.desc = "Show LSP implementations" + keymap.set('n', 'gi', 'Telescope lsp_implementations', _opts) + + _opts.desc = 'Show LSP type definitions' + keymap.set('n', 'gt', 'Telescope lsp_type_definitions', _opts) + + _opts.desc = 'See available code actions' + keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, _opts) + + _opts.desc = 'Smart rename' + keymap.set('n', 'rn', vim.lsp.buf.rename, _opts) + + _opts.desc = 'Show buffer diagnostics' + keymap.set('n', 'D', 'Telescope diagnostics bufnr=0', _opts) + + _opts.desc = 'Show line diagnostics' + keymap.set('n', 'd', vim.diagnostic.open_float, _opts) + + _opts.desc = 'Go to previous diagnostic' + keymap.set('n', '[d', vim.diagnostic.goto_prev, _opts) + + _opts.desc = 'Go to next diagnostic' + keymap.set('n', ']d', vim.diagnostic.goto_next, _opts) + + _opts.desc = 'Show documentation for what is under cursor' + keymap.set('n', 'K', vim.lsp.buf.hover, _opts) + + _opts.desc = 'Restart LSP' + keymap.set('n', 'rs', ':LspRestart', _opts) + end + }) + + require('mason-lspconfig').setup_handlers({ + function(server_name) + lsp[server_name].setup({ + capabilities = cap + }) + end, + }) + end + } +} diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv new file mode 100644 index 0000000..bee4c42 --- /dev/null +++ b/.config/zsh/.zshenv @@ -0,0 +1,16 @@ +typeset -U path +path=(~/.local/bin $path) + +export XDG_CONFIG_HOME=~/.config +export XDG_CACHE_HOME=~/.cache +export XDG_DATA_HOME=~/.local/share +export XDG_STATE_HOME=~/.local/state +source $XDG_CONFIG_HOME/user-dirs.dirs + +export GNUPGHOME=${XDG_CONFIG_HOME}/gnupg + +export PASSWORD_STORE_DIR=${XDG_DATA_HOME}/pass + +export BROWSER=librewolf-wayland + +export EDITOR=nvim diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc new file mode 100644 index 0000000..5e0e9e9 --- /dev/null +++ b/.config/zsh/.zshrc @@ -0,0 +1,21 @@ +autoload -U colors && colors + +setopt AUTO_CD +setopt MARK_DIRS + +mkdir -p ~/.cache/zsh +HISTFILE=~/.cache/zsh/history +HISTSIZE=1000 +SAVEHIST=1000 +setopt SHARE_HISTORY +setopt HIST_LEX_WORDS +setopt HIST_IGNORE_ALL_DUPS +setopt HIST_NO_STORE + +eval $(dircolors) + +setopt PROMPT_SUBST + +for f in ${ZDOTDIR}/include/*(.); source $f + +PROMPT='%F{cyan}%n%f@%F{green}%m%f:${vcs_info_msg_0_}%F{yellow}%~%f > ' diff --git a/.config/zsh/include/10-alias b/.config/zsh/include/10-alias new file mode 100644 index 0000000..a43e587 --- /dev/null +++ b/.config/zsh/include/10-alias @@ -0,0 +1,2 @@ +# vim: ft=zsh +alias ls="ls --color=always" diff --git a/.config/zsh/include/10-vcs_info b/.config/zsh/include/10-vcs_info new file mode 100644 index 0000000..7498b23 --- /dev/null +++ b/.config/zsh/include/10-vcs_info @@ -0,0 +1,9 @@ +# vim: ft=zsh +autoload -Uz add-zsh-hook vcs_info +add-zsh-hook precmd vcs_info + +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:*' unstagedstr ' %F{red}*' +zstyle ':vcs_info:*' stagedstr ' %F{red}+' +zstyle ':vcs_info:git:*' formats '%F{blue}%b%u%c%f:' +zstyle ':vcs_info:git:*' actionformats '%F{blue}%b$f:|%a%u%c%f:' diff --git a/.config/zsh/include/99-zsh-syntax-highlighting b/.config/zsh/include/99-zsh-syntax-highlighting new file mode 100644 index 0000000..6e18a7c --- /dev/null +++ b/.config/zsh/include/99-zsh-syntax-highlighting @@ -0,0 +1,2 @@ +# vim: ft=zsh +source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e033bc6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +lazy-lock.json diff --git a/.stow-local-ignore b/.stow-local-ignore new file mode 100644 index 0000000..e033bc6 --- /dev/null +++ b/.stow-local-ignore @@ -0,0 +1 @@ +lazy-lock.json diff --git a/.zshenv b/.zshenv new file mode 100644 index 0000000..9f19904 --- /dev/null +++ b/.zshenv @@ -0,0 +1,4 @@ +# vim: ft=zsh + +ZDOTDIR=~/.config/zsh +. $ZDOTDIR/.zshenv diff --git a/README.md b/README.md new file mode 100644 index 0000000..b301229 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +Assuming this repo is in ~/git/dotfiles + +`stow -t ~ .`