From a6a978410d0daecff139a3ab971dc94c75427eb7 Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 14 Aug 2022 20:10:20 -0400 Subject: start using more ide plugins --- .config/git/config | 2 + .config/nvim/coc-settings.json | 18 ----- .config/nvim/init.lua | 13 ++-- .config/nvim/init.vim.bak | 60 ---------------- .config/nvim/lua/getchoo/lsp.lua | 134 ++++++++++++++++++----------------- .config/nvim/lua/getchoo/plugins.lua | 102 +++++++++++++++----------- .config/shell/profile | 2 - .config/zsh/.zshrc | 7 ++ 8 files changed, 145 insertions(+), 193 deletions(-) delete mode 100755 .config/nvim/coc-settings.json delete mode 100644 .config/nvim/init.vim.bak diff --git a/.config/git/config b/.config/git/config index d6f6f5a..2617443 100644 --- a/.config/git/config +++ b/.config/git/config @@ -6,3 +6,5 @@ gpgsign = true [gpg] program = gpg +[init] + defaultBranch = main diff --git a/.config/nvim/coc-settings.json b/.config/nvim/coc-settings.json deleted file mode 100755 index 22e27a8..0000000 --- a/.config/nvim/coc-settings.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "languageserver": { - "bash": { - "command": "bash-language-server", - "args": [ - "start" - ], - "filetypes": [ - "sh", - "PKGBUILD" - ] - } - }, - "python.linting.flake8Enabled": true, - "coc.preferences.formatOnSaveFiletypes": [ - "json" - ] -} diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 78cac9a..1385b04 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -2,12 +2,11 @@ -- getchoo's neovim config (but in lua :p) -- -local fn = vim.fn local cmd = vim.cmd local opt = vim.opt -require('getchoo.plugins') -require('getchoo.lsp') +require("getchoo.plugins") +require("getchoo.lsp") -- options opt.tabstop = 2 @@ -17,7 +16,7 @@ opt.smartindent = true opt.wrap = false opt.termguicolors = true --- apperance -cmd[[syntax on]] -cmd[[filetype plugin indent on]] -cmd[[colorscheme nord]] +-- appearance +cmd([[syntax on]]) +cmd([[filetype plugin indent on]]) +cmd([[colorscheme nord]]) diff --git a/.config/nvim/init.vim.bak b/.config/nvim/init.vim.bak deleted file mode 100644 index ed3883e..0000000 --- a/.config/nvim/init.vim.bak +++ /dev/null @@ -1,60 +0,0 @@ -" -" getchoo's neovim config -" - -set nocompatible - -set runtimepath+=/home/seth/.local/share/dein/repos/github.com/Shougo/dein.vim -call dein#begin('~/.local/share/dein') - -call dein#add('~/.local/share/dein/repos/github.com/Shougo/dein.vim') -call dein#add('wsdjeg/dein-ui.vim') -call dein#add('itchyny/lightline.vim') -call dein#add('joshdick/onedark.vim') -call dein#add('arcticicestudio/nord-vim') -call dein#add('rose-pine/neovim', {'name': 'rose-pine'}) -call dein#add('neoclide/coc.nvim', { 'merged': 0, 'rev': 'release' }) - -call dein#end() - -" coc settings -"" use for trigger completion and navigate to the next complete item -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~ '\s' -endfunction - -"" for lightline.vim -function! CocCurrentFunction() - return get(b:, 'coc_current_function', '') -endfunction - -inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() - -inoremap pumvisible() ? "\" : "\" - -" options -set tabstop=2 -set shiftwidth=2 -set expandtab -set smartindent - -" apperance -syntax on -filetype plugin indent on -set termguicolors -colorscheme nord -let g:lightline = { - \ 'colorscheme': 'nord', - \ 'active': { - \ 'left': [ [ 'mode', 'paste' ], - \ [ 'cocstatus', 'currentfunction', 'readonly', 'filename', 'modified' ] ] - \ }, - \ 'component_function': { - \ 'cocstatus': 'coc#status', - \ 'currentfunction': 'CocCurrentFunction' - \ }, - \ } diff --git a/.config/nvim/lua/getchoo/lsp.lua b/.config/nvim/lua/getchoo/lsp.lua index 7bd16ce..980d77e 100644 --- a/.config/nvim/lua/getchoo/lsp.lua +++ b/.config/nvim/lua/getchoo/lsp.lua @@ -1,80 +1,82 @@ -- --- lsp settings using nvim-lspconfig & coq-nvim +-- lsp settings using coq-nvim, null-ls, bufferline, nvim-tree, trouble, & telescope -- -local fn = vim.fn -local cmd = vim.cmd -local opt = vim.opt +--- 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" } -vim.g.coq_settings = { auto_start = 'shut-up' } +--- mappings +local opts = { noremap = true, silent = true } +vim.keymap.set("n", "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", "q", vim.diagnostic.setloclist, opts) ---- Mappings. ---- See `:help vim.diagnostic.*` for documentation on any of the below functions -local opts = { noremap=true, silent=true } -vim.keymap.set('n', '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', '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 ---- Use an on_attach function to only map the following keys ---- after the language server attaches to the current buffer -local on_attach = function(client, bufnr) - ---- Enable completion triggered by - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - - ---- Mappings. - ---- See `:help vim.lsp.*` for documentation on any of the below functions - local bufopts = { noremap=true, silent=true, buffer=bufnr } - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) - vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) - vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) - vim.keymap.set('n', 'wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, bufopts) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) - vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) - vim.keymap.set('n', 'f', vim.lsp.buf.formatting, bufopts) -end +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, +} -local servers = { 'rust_analyzer', 'pyright', 'bashls' } for _, lsp in ipairs(servers) do - require('lspconfig')[lsp].setup(require('coq').lsp_ensure_capabilities({ - on_attach = on_attatch, - flags = lsp_flags - })) + lspconfig[lsp].setup(require("coq").lsp_ensure_capabilities({})) end -require('lspconfig')['sumneko_lua'].setup(require('coq').lsp_ensure_capabilities({ - on_attatch = on_attatch, - flags = lsp_flags, - settings = { - Lua = { - runtime = { - version = 'LuaJIT', - }, - diagnostics = { - globals = {'vim'}, - }, - workspace = { - library = vim.api.nvim_get_runtime_file("", true), - } - }, - }, +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), + }, + }, + }, })) -require('lint').linters_by_ft = { - python = {'flake8',} -} - -vim.api.nvim_create_autocmd({ "BufWritePost" }, { - callback = function() - require('lint').try_lint() - end, +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/plugins.lua b/.config/nvim/lua/getchoo/plugins.lua index 756a983..9c77dc2 100644 --- a/.config/nvim/lua/getchoo/plugins.lua +++ b/.config/nvim/lua/getchoo/plugins.lua @@ -4,52 +4,74 @@ local fn = vim.fn local cmd = vim.cmd -local opt = vim.opt - -local packer_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' +local packer_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" if fn.empty(fn.glob(packer_path)) > 0 then - packer_bootstrap = fn.system({ - 'git', - 'clone', - '--depth', '1', - 'https://github.com/wbthomason/packer.nvim', - packer_path - }) - cmd [[packadd packer.nvim]] + Packer_bootstrap = fn.system({ + "git", + "clone", + "--depth", + "1", + "https://github.com/wbthomason/packer.nvim", + packer_path, + }) + cmd([[packadd packer.nvim]]) end -require('packer').startup(function(use) - use 'wbthomason/packer.nvim' - use { - 'nvim-treesitter/nvim-treesitter', - run = function() require('nvim-treesitter.install').update({ with_sync = true }) end, - } - use 'neovim/nvim-lspconfig' - use { 'ms-jpq/coq_nvim', run = 'python3 -m coq deps' } - use 'ms-jpq/coq.artifacts' - use 'ms-jpq/coq.thirdparty' - use 'mfussenegger/nvim-lint' - use { - 'nvim-lualine/lualine.nvim', - requires = { 'kyazdani42/nvim-web-devicons', opt = true } - } - use 'arcticicestudio/nord-vim' - use {'rose-pine/neovim', as = 'rose-pine'} +require("packer").startup(function(use) + use("wbthomason/packer.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.artifacts") + use("ms-jpq/coq.thirdparty") + use({ + "jose-elias-alvarez/null-ls.nvim", + requires = { "nvim-lua/plenary.nvim" }, + }) + use({ + "folke/trouble.nvim", + requires = { "kyazdani42/nvim-web-devicons" }, + }) + use({ + "akinsho/bufferline.nvim", + tag = "v2.*", + requires = { "kyazdani42/nvim-web-devicons" }, + }) + use({ + "nvim-telescope/telescope.nvim", + branch = "0.1.x", + requires = { "nvim-lua/plenary.nvim" }, + }) + 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 + if Packer_bootstrap then + require("packer").sync() + end end) -require('nvim-treesitter.configs').setup { - auto_install = true -} +require("nvim-treesitter.configs").setup({ + auto_install = true, +}) -require('lualine').setup { - options = { - theme = 'nord' - }, - extensions = {'nvim-tree'} -} +require("lualine").setup({ + options = { + theme = "nord", + }, + extensions = { "nvim-tree" }, +}) diff --git a/.config/shell/profile b/.config/shell/profile index e8d80d7..dd8a3ab 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -16,5 +16,3 @@ 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" -export ZPLUG_HOME="$XDG_DATA_HOME/zplug" -#source "$CARGO_HOME/env" diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 25be2d1..e63eed6 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,3 +1,10 @@ +# 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 # -- cgit v1.2.3