diff options
| author | seth <[email protected]> | 2022-08-17 19:01:57 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2022-08-21 14:15:37 -0400 |
| commit | d99f98423439020e7bd5fdae0493aa5da9d9bf14 (patch) | |
| tree | e25b40d44afe36117a0ceefa603f5b3923a8886e | |
| parent | a6a978410d0daecff139a3ab971dc94c75427eb7 (diff) | |
refactor
| -rw-r--r-- | .bashrc | 7 | ||||
| -rw-r--r-- | .config/nvim/init.lua | 8 | ||||
| -rw-r--r-- | .config/nvim/lua/getchoo/lsp.lua | 82 | ||||
| -rw-r--r-- | .config/nvim/lua/getchoo/lsp/config.lua | 117 | ||||
| -rw-r--r-- | .config/nvim/lua/getchoo/lsp/init.lua | 11 | ||||
| -rw-r--r-- | .config/nvim/lua/getchoo/lsp/keymap.lua | 40 | ||||
| -rw-r--r-- | .config/nvim/lua/getchoo/lsp/server.lua | 18 | ||||
| -rw-r--r-- | .config/nvim/lua/getchoo/plugins.lua | 48 | ||||
| -rw-r--r-- | .config/shell/dir_colors | 256 | ||||
| -rw-r--r-- | .config/shell/profile | 4 | ||||
| -rw-r--r-- | .config/zsh/.zsh_plugins.txt | 3 | ||||
| -rw-r--r-- | .config/zsh/.zshrc | 42 |
12 files changed, 488 insertions, 148 deletions
@@ -15,12 +15,11 @@ shopt -s nocaseglob shopt -s no_empty_cmd_completion export HISTFILE="$XDG_STATE_HOME/bash/history" -export HISTSIZE=200 +export HISTSIZE=100 export HISTFILESIZE=1000 -# aliases -alias ls='exa' -alias dotfiles='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' +# source aliases +source "$XDG_CONFIG_HOME/shell/aliases" # prompt PS1='[\u@\h \W]\$ ' diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 1385b04..3de2473 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -8,15 +8,15 @@ local opt = vim.opt require("getchoo.plugins") require("getchoo.lsp") --- options +-- text options opt.tabstop = 2 opt.shiftwidth = 2 opt.expandtab = true opt.smartindent = true opt.wrap = false -opt.termguicolors = true -- appearance -cmd([[syntax on]]) -cmd([[filetype plugin indent on]]) +opt.syntax = "on" cmd([[colorscheme nord]]) +opt.termguicolors = true +opt.relativenumber = true diff --git a/.config/nvim/lua/getchoo/lsp.lua b/.config/nvim/lua/getchoo/lsp.lua deleted file mode 100644 index 980d77e..0000000 --- a/.config/nvim/lua/getchoo/lsp.lua +++ /dev/null @@ -1,82 +0,0 @@ --- --- lsp settings using coq-nvim, null-ls, bufferline, nvim-tree, trouble, & telescope --- - ---- require lsp plugins -require("nvim-tree").setup() -require("alpha").setup(require("alpha.themes.dashboard").config) -require("bufferline").setup() -require("trouble").setup() -require("telescope").setup() -require("mason").setup() -require("mason-lspconfig").setup() -vim.opt.runtimepath:append("~/.local/share/nvim/mason/bin/") -local lspconfig = require("lspconfig") -local null_ls = require("null-ls") - -vim.g.coq_settings = { auto_start = "shut-up" } - ---- mappings -local opts = { noremap = true, silent = true } -vim.keymap.set("n", "<space>e", vim.diagnostic.open_float, opts) -vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, opts) - ---- setup lsp servers ----- null-ls builtins shorthand -local completion = null_ls.builtins.completion -local diagnostics = null_ls.builtins.diagnostics -local formatting = null_ls.builtins.formatting - -local servers = { "rust_analyzer", "pyright", "bashls" } -- lspconfig servers -local sources = { -- null-ls sources - diagnostics.alex, - diagnostics.codespell, - diagnostics.flake8, - formatting.black, - formatting.codespell, - formatting.prettier, - formatting.rustfmt, - formatting.stylua, -} - -for _, lsp in ipairs(servers) do - lspconfig[lsp].setup(require("coq").lsp_ensure_capabilities({})) -end - -lspconfig["sumneko_lua"].setup(require("coq").lsp_ensure_capabilities({ - settings = { - Lua = { - runtime = { - version = "LuaJIT", - }, - diagnostics = { - globals = { "vim" }, -- ignore regular vim errors - }, - format = { - enable = false, - }, - workspace = { - library = vim.api.nvim_get_runtime_file("", true), - }, - }, - }, -})) - -local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) -null_ls.setup({ - on_attach = function(client, bufnr) - if client.supports_method("textDocument/formatting") then - vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = function() - vim.lsp.buf.formatting_sync() - end, - }) - end - end, - sources = sources, -}) diff --git a/.config/nvim/lua/getchoo/lsp/config.lua b/.config/nvim/lua/getchoo/lsp/config.lua new file mode 100644 index 0000000..857879a --- /dev/null +++ b/.config/nvim/lua/getchoo/lsp/config.lua @@ -0,0 +1,117 @@ +-- +-- config for lsp server +-- +local null_ls = require("null-ls") +local diagnostics = null_ls.builtins.diagnostics +local formatting = null_ls.builtins.formatting + +local M = {} + +vim.g.coq_settings = { auto_start = "shut-up" } + +local sources = { + lsp_servers = { "rust_analyzer", "pyright", "bashls" }, + null_ls = { + diagnostics.alex, + diagnostics.codespell, + diagnostics.flake8, + formatting.black, + formatting.codespell, + formatting.prettier, + formatting.rustfmt, + formatting.stylua, + }, + mason = { + "alex", + "black", + "codespell", + "flake8", + "prettier", + "stylua", + }, +} + +-- configure lsp servers +local all_config = {} +local servers = {} +for _, server in ipairs(sources.lsp_servers) do + servers[server] = all_config +end + +servers["sumneko_lua"] = { + settings = { + Lua = { + runtime = { + version = "LuaJIT", + }, + diagnostics = { + globals = { "vim" }, + }, + workspace = { + library = vim.api.nvim_get_runtime_file("", true), + }, + telemetry = { + enable = false, + }, + }, + }, +} + +M.lsp_servers = servers + +-- only use null-ls for formatting + +--- for neovim >= 8 +--- local lsp_formatting = function(bufnr) +--- vim.lsp.buf.format({ +--- filter = function(client) +--- return client.name == "null-ls" +--- end, +--- bufnr = bufnr, +--- }) +--- end + +local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) +local on_attach = function(client, bufnr) + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + local params = require("vim.lsp.util").make_formatting_params({}) + client.request("textDocument/formatting", params, nil, bufnr) + -- lsp_formatting(bufnr) -- neovim >= 8 + end, + }) + end +end + +M.null_ls = { + on_attach = on_attach, + sources = sources.null_ls, +} + +M.mason_tool_installer = { + ensure_installed = sources.mason, +} + +M.mason_lsp = { + automatic_installation = true, +} + +-- etc plugins +M.bufferline = { + options = { + numbers = "ordinal", + diagnostics = "nvim_lsp", + always_show_bufferline = false, + }, +} +M.tree = {} +M.treesitter = { + auto_install = true, +} +M.trouble = {} + +return M diff --git a/.config/nvim/lua/getchoo/lsp/init.lua b/.config/nvim/lua/getchoo/lsp/init.lua new file mode 100644 index 0000000..b4f61f8 --- /dev/null +++ b/.config/nvim/lua/getchoo/lsp/init.lua @@ -0,0 +1,11 @@ +-- +-- setup lsp environment +-- +require("getchoo.lsp.server") +require("getchoo.lsp.keymap") +local config = require("getchoo.lsp.config") + +require("bufferline").setup(config.bufferline) +require("nvim-tree").setup(config.tree) +require("nvim-treesitter.configs").setup(config.treesitter) +require("trouble").setup(config.trouble) diff --git a/.config/nvim/lua/getchoo/lsp/keymap.lua b/.config/nvim/lua/getchoo/lsp/keymap.lua new file mode 100644 index 0000000..8cb92ac --- /dev/null +++ b/.config/nvim/lua/getchoo/lsp/keymap.lua @@ -0,0 +1,40 @@ +-- +-- keymaps for lsp +-- + +local opts = { noremap = true, silent = true } +local set = function(mode, key, cmd) + vim.keymap.set(mode, key, cmd, opts) +end + +set("n", "<space>e", vim.diagnostic.open_float) +set("n", "[d", vim.diagnostic.goto_prev) +set("n", "]d", vim.diagnostic.goto_next) +set("n", "<space>q", vim.diagnostic.setloclist) + +set("n", "<space>f", function() + vim.cmd([[:Clap]]) +end) + +set("n", "<leader>t", function() + vim.cmd([[:NvimTreeToggle]]) +end) + +set("n", "<space>t", function() + vim.cmd([[:TroubleToggle]]) +end) + +local bufferline = require("bufferline") +for i = 1, 9 do + set("n", "<leader>" .. i, function() + bufferline.go_to_buffer(i, true) + end) +end + +set("n", "<leader>p", function() + bufferline.pick_buffer() +end) + +set("n", "<leader>q", function() + bufferline.close_buffer_with_pick() +end) diff --git a/.config/nvim/lua/getchoo/lsp/server.lua b/.config/nvim/lua/getchoo/lsp/server.lua new file mode 100644 index 0000000..8521801 --- /dev/null +++ b/.config/nvim/lua/getchoo/lsp/server.lua @@ -0,0 +1,18 @@ +-- +-- initialize lsp servers +-- + +local lspconfig = require("lspconfig") +local null_ls = require("null-ls") +local config = require("getchoo.lsp.config") + +require("mason").setup() +require("mason-lspconfig").setup(config.mason_lsp) +require("mason-tool-installer").setup(config.mason_tool_installer) +vim.opt.runtimepath:append("~/.local/share/nvim/mason/bin/") + +for server, settings in pairs(config.lsp_servers) do + lspconfig[server].setup(require("coq").lsp_ensure_capabilities(settings)) +end + +null_ls.setup(config.null_ls) diff --git a/.config/nvim/lua/getchoo/plugins.lua b/.config/nvim/lua/getchoo/plugins.lua index 9c77dc2..8cf0371 100644 --- a/.config/nvim/lua/getchoo/plugins.lua +++ b/.config/nvim/lua/getchoo/plugins.lua @@ -21,54 +21,50 @@ end require("packer").startup(function(use) use("wbthomason/packer.nvim") + -- comsetic plugins + use({ "nvim-lualine/lualine.nvim", requires = { "kyazdani42/nvim-web-devicons", opt = true } }) + use("arcticicestudio/nord-vim") + use({ "rose-pine/neovim", as = "rose-pine" }) + -- lsp plugins + use("neovim/nvim-lspconfig") + use({ + "jose-elias-alvarez/null-ls.nvim", + requires = { "nvim-lua/plenary.nvim" }, + }) + use("williamboman/mason.nvim") + use("williamboman/mason-lspconfig") + use("WhoIsSethDaniel/mason-tool-installer.nvim") use({ "nvim-treesitter/nvim-treesitter", run = function() require("nvim-treesitter.install").update({ with_sync = true }) end, }) - use({ - "goolord/alpha-nvim", - requires = { "kyazdani42/nvim-web-devicons" }, - }) - use("kyazdani42/nvim-tree.lua") - use("williamboman/mason.nvim") - use("williamboman/mason-lspconfig") - use("neovim/nvim-lspconfig") - use({ "ms-jpq/coq_nvim", run = "python3 -m coq deps" }) + use("ms-jpq/coq_nvim") use("ms-jpq/coq.artifacts") use("ms-jpq/coq.thirdparty") + use("kyazdani42/nvim-tree.lua") use({ - "jose-elias-alvarez/null-ls.nvim", - requires = { "nvim-lua/plenary.nvim" }, - }) - use({ - "folke/trouble.nvim", + "akinsho/bufferline.nvim", + tag = "v2.*", requires = { "kyazdani42/nvim-web-devicons" }, }) use({ - "akinsho/bufferline.nvim", - tag = "v2.*", + "folke/trouble.nvim", requires = { "kyazdani42/nvim-web-devicons" }, }) use({ - "nvim-telescope/telescope.nvim", - branch = "0.1.x", - requires = { "nvim-lua/plenary.nvim" }, + "liuchengxu/vim-clap", + run = function() + vim.cmd([[:Clap install-binary!]]) + end, }) - use({ "nvim-lualine/lualine.nvim", requires = { "kyazdani42/nvim-web-devicons", opt = true } }) - use("arcticicestudio/nord-vim") - use({ "rose-pine/neovim", as = "rose-pine" }) if Packer_bootstrap then require("packer").sync() end end) -require("nvim-treesitter.configs").setup({ - auto_install = true, -}) - require("lualine").setup({ options = { theme = "nord", diff --git a/.config/shell/dir_colors b/.config/shell/dir_colors new file mode 100644 index 0000000..658e5b7 --- /dev/null +++ b/.config/shell/dir_colors @@ -0,0 +1,256 @@ +# Copyright (C) 2017-present Arctic Ice Studio <[email protected]> +# Copyright (C) 2017-present Sven Greb <[email protected]> + +# Project: Nord dircolors +# Version: 0.2.0 +# Repository: https://github.com/arcticicestudio/nord-dircolors +# License: MIT + +COLOR tty + +TERM alacritty +TERM alacritty-direct +TERM ansi +TERM *color* +TERM con[0-9]*x[0-9]* +TERM cons25 +TERM console +TERM cygwin +TERM dtterm +TERM dvtm +TERM dvtm-256color +TERM Eterm +TERM eterm-color +TERM fbterm +TERM gnome +TERM gnome-256color +TERM hurd +TERM jfbterm +TERM konsole +TERM konsole-256color +TERM kterm +TERM linux +TERM linux-c +TERM mlterm +TERM putty +TERM putty-256color +TERM rxvt* +TERM rxvt-unicode +TERM rxvt-256color +TERM rxvt-unicode256 +TERM screen* +TERM screen-256color +TERM st +TERM st-256color +TERM terminator +TERM tmux* +TERM tmux-256color +TERM vt100 +TERM xterm* +TERM xterm-color +TERM xterm-88color +TERM xterm-256color +TERM xterm-kitty + +#+-----------------+ +#+ Global Defaults + +#+-----------------+ +NORMAL 00 +RESET 0 + +FILE 00 +DIR 01;34 +LINK 36 +MULTIHARDLINK 04;36 + +FIFO 04;01;36 +SOCK 04;33 +DOOR 04;01;36 +BLK 01;33 +CHR 33 + +ORPHAN 31 +MISSING 01;37;41 + +EXEC 01;36 + +SETUID 01;04;37 +SETGID 01;04;37 +CAPABILITY 01;37 + +STICKY_OTHER_WRITABLE 01;37;44 +OTHER_WRITABLE 01;04;34 +STICKY 04;37;44 + +#+-------------------+ +#+ Extension Pattern + +#+-------------------+ +#+--- Archives ---+ +.7z 01;32 +.ace 01;32 +.alz 01;32 +.arc 01;32 +.arj 01;32 +.bz 01;32 +.bz2 01;32 +.cab 01;32 +.cpio 01;32 +.deb 01;32 +.dz 01;32 +.ear 01;32 +.gz 01;32 +.jar 01;32 +.lha 01;32 +.lrz 01;32 +.lz 01;32 +.lz4 01;32 +.lzh 01;32 +.lzma 01;32 +.lzo 01;32 +.rar 01;32 +.rpm 01;32 +.rz 01;32 +.sar 01;32 +.t7z 01;32 +.tar 01;32 +.taz 01;32 +.tbz 01;32 +.tbz2 01;32 +.tgz 01;32 +.tlz 01;32 +.txz 01;32 +.tz 01;32 +.tzo 01;32 +.tzst 01;32 +.war 01;32 +.xz 01;32 +.z 01;32 +.Z 01;32 +.zip 01;32 +.zoo 01;32 +.zst 01;32 + +#+--- Audio ---+ +.aac 32 +.au 32 +.flac 32 +.m4a 32 +.mid 32 +.midi 32 +.mka 32 +.mp3 32 +.mpa 32 +.mpeg 32 +.mpg 32 +.ogg 32 +.opus 32 +.ra 32 +.wav 32 + +#+--- Customs ---+ +.3des 01;35 +.aes 01;35 +.gpg 01;35 +.pgp 01;35 + +#+--- Documents ---+ +.doc 32 +.docx 32 +.dot 32 +.odg 32 +.odp 32 +.ods 32 +.odt 32 +.otg 32 +.otp 32 +.ots 32 +.ott 32 +.pdf 32 +.ppt 32 +.pptx 32 +.xls 32 +.xlsx 32 + +#+--- Executables ---+ +.app 01;36 +.bat 01;36 +.btm 01;36 +.cmd 01;36 +.com 01;36 +.exe 01;36 +.reg 01;36 + +#+--- Ignores ---+ +*~ 02;37 +.bak 02;37 +.BAK 02;37 +.log 02;37 +.log 02;37 +.old 02;37 +.OLD 02;37 +.orig 02;37 +.ORIG 02;37 +.swo 02;37 +.swp 02;37 + +#+--- Images ---+ +.bmp 32 +.cgm 32 +.dl 32 +.dvi 32 +.emf 32 +.eps 32 +.gif 32 +.jpeg 32 +.jpg 32 +.JPG 32 +.mng 32 +.pbm 32 +.pcx 32 +.pgm 32 +.png 32 +.PNG 32 +.ppm 32 +.pps 32 +.ppsx 32 +.ps 32 +.svg 32 +.svgz 32 +.tga 32 +.tif 32 +.tiff 32 +.xbm 32 +.xcf 32 +.xpm 32 +.xwd 32 +.xwd 32 +.yuv 32 + +#+--- Video ---+ +.anx 32 +.asf 32 +.avi 32 +.axv 32 +.flc 32 +.fli 32 +.flv 32 +.gl 32 +.m2v 32 +.m4v 32 +.mkv 32 +.mov 32 +.MOV 32 +.mp4 32 +.mpeg 32 +.mpg 32 +.nuv 32 +.ogm 32 +.ogv 32 +.ogx 32 +.qt 32 +.rm 32 +.rmvb 32 +.swf 32 +.vob 32 +.webm 32 +.wmv 32 diff --git a/.config/shell/profile b/.config/shell/profile index dd8a3ab..e4ce741 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -16,3 +16,7 @@ export CARGO_HOME="$XDG_DATA_HOME/cargo" export RUSTUP_HOME="$XDG_DATA_HOME/rustup" export LESSHISTFILE="$XDG_STATE_HOME/less/history" export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" + +dir_colors="$XDG_CONFIG_HOME/shell/dir_colors" +[[ -f "$dir_colors" ]] && eval $(dircolors "$dir_colors") +unset dir_colors diff --git a/.config/zsh/.zsh_plugins.txt b/.config/zsh/.zsh_plugins.txt index 70680f0..9f5f59b 100644 --- a/.config/zsh/.zsh_plugins.txt +++ b/.config/zsh/.zsh_plugins.txt @@ -1,4 +1,3 @@ zsh-users/zsh-completions -zdharma-continuum/fast-syntax-highlighting -#zsh-users/zsh-autosuggestions +zsh-users/zsh-syntax-highlighting romkatv/powerlevel10k diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index e63eed6..1b345af 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,43 +1,26 @@ -# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.zshrc. -# Initialization code that may require console input (password prompts, [y/n] -# confirmations, etc.) must go above this block; everything else may go below. -if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then - source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" -fi - # # getchoo's zshrc # +antidote_dir="${ZDOTDIR}/.antidote" # plugins :) -if ! [[ -e ${ZDOTDIR:-~}/.antidote ]]; then - git clone https://github.com/mattmc3/antidote.git ${ZDOTDIR:-~}/.antidote +if [[ ! -d ${antidote_dir} ]] +then + git clone https://github.com/mattmc3/antidote.git ${antidote_dir}/.antidote fi -# source antidote and load plugins from `${ZDOTDIR:-~}/.zsh_plugins.txt` -zhome=${ZDOTDIR:-$HOME} -if [[ ! $zhome/.zsh_plugins.zsh -nt $zhome/.zsh_plugins.txt ]]; then - [[ -e $zhome/.antidote ]] \ - || git clone --depth=1 https://github.com/mattmc3/antidote.git $zhome/.antidote - [[ -e $zhome/.zsh_plugins.txt ]] || touch $zhome/.zsh_plugins.txt - ( - source $zhome/.antidote/antidote.zsh - antidote bundle <$zhome/.zsh_plugins.txt >$zhome/.zsh_plugins.zsh - ) +if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then + source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi -autoload -Uz $zhome/.antidote/functions/antidote - -source $zhome/.zsh_plugins.zsh -unset zhome +source ${antidote_dir}/antidote.zsh && antidote load +unset antidote_dir # zmodules -autoload -U compinit #promptinit +autoload -U compinit zmodload zsh/complist zstyle ':completion:*' menu select reshash true compinit -#promptinit -#prompt walters # options setopt append_history @@ -62,12 +45,11 @@ bindkey '^L' clear-screen-and-scrollback # enable history HISTFILE="$XDG_STATE_HOME/zsh/history" -HISTSIZE=200 +HISTSIZE=100 SAVEHIST=1000 -# aliases -alias ls='exa' -alias dotfiles='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' +# source aliases +source "$XDG_CONFIG_HOME/shell/aliases" # To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh. [[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh |
