From 538746ed2e96d9ae242a59d4cb8d6a9ee85bfcd7 Mon Sep 17 00:00:00 2001 From: Phantop Date: Fri, 26 Jul 2024 13:47:10 -0400 Subject: [PATCH] add some more arista stuff; nvim: split into files --- bin/config.fish | 1 + nvim/init.lua | 134 ++---------------------------------------- nvim/lua/arista.lua | 2 +- nvim/lua/keymap.lua | 19 ++++++ nvim/lua/lsp.lua | 46 +++++++++++++++ nvim/lua/opt.lua | 17 ++++++ nvim/lua/plugins.lua | 39 ++++++++++++ nvim/lua/vimcmd.lua | 6 ++ qutebrowser/arista.py | 3 +- yt-dlp/config | 1 + 10 files changed, 137 insertions(+), 131 deletions(-) create mode 100644 nvim/lua/keymap.lua create mode 100644 nvim/lua/lsp.lua create mode 100644 nvim/lua/opt.lua create mode 100644 nvim/lua/plugins.lua create mode 100644 nvim/lua/vimcmd.lua diff --git a/bin/config.fish b/bin/config.fish index 70efd9c..e99be96 100755 --- a/bin/config.fish +++ b/bin/config.fish @@ -122,6 +122,7 @@ a history_find 'history -p (string sub -s 2 $argv[1]) | head -n1;:' a history_last 'history -n1;:' a amk 'a ws make -p (basename $PWD)' +a lint 'a git lint' for i in (cut -d ' ' -f1 < ~/.config/qutebrowser/quickmarks) a $i "qutebrowser / \":open $i\"" diff --git a/nvim/init.lua b/nvim/init.lua index 0ca69ce..ad68406 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,129 +1,5 @@ -local paq = require "paq" { - 'dense-analysis/ale', - 'dracula/vim', - 'ibhagwan/fzf-lua', - 'kaarmu/typst.vim', - 'lewis6991/gitsigns.nvim', - 'lukas-reineke/indent-blankline.nvim', - 'neovim/nvim-lspconfig', - 'nmac427/guess-indent.nvim', - 'nvim-lua/plenary.nvim', - 'nvimtools/none-ls.nvim', - 'stevearc/aerial.nvim', - - 'vim-airline/vim-airline', - { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' }, - - 'gbprod/none-ls-shellcheck.nvim', - - "L3MON4D3/LuaSnip", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-cmdline", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-nvim-lsp-signature-help", - "hrsh7th/cmp-path", - "hrsh7th/nvim-cmp", - - 'williamboman/mason-lspconfig.nvim', - { 'williamboman/mason.nvim', build = ':MasonUpdate' }, -} - -require("aerial").setup() -require('guess-indent').setup() -require("gitsigns").setup() -require("ibl").setup() -require("mason").setup() -require("mason-lspconfig").setup() -require("nvim-treesitter.configs").setup({highlight = {enable = true}}) - -local null_ls = require("null-ls") -null_ls.setup({sources = { - null_ls.builtins.formatting.phpcbf, - null_ls.builtins.diagnostics.phpcs -}}) -require("null-ls").register(require("none-ls-shellcheck.diagnostics")) -require("null-ls").register(require("none-ls-shellcheck.code_actions")) - --- makes cmp tab functionality work as expected -local has_words_before = function() - unpack = unpack or table.unpack - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil -end - -local cmp = require("cmp") -cmp.setup({ - mapping = { - [""] = cmp.mapping( - function (fallback) - if cmp.visible() then cmp.select_next_item() - elseif has_words_before() then cmp.complete() - else fallback() end - end, {"i"}), - - [""] = cmp.mapping( cmp.mapping.select_prev_item(), {"i"}), - [""] = cmp.mapping( cmp.mapping.confirm({select=true}), {"i"}), - }, - - completion = { autocomplete = false }, - snippet = { expand = function(args) require("luasnip").lsp_expand(args.body) end }, - - sources = cmp.config.sources( - {{name = "nvim_lsp_signature_help"}}, - {{name = "nvim_lsp"}}, - {{name = "buffer"}}, - {{name = "path"}} - ) -}) -local capabilities = require('cmp_nvim_lsp').default_capabilities() -require("lspconfig").clangd.setup{capabilities=capabilities} -require("mason-lspconfig").setup_handlers { - function (server_name) - require("lspconfig")[server_name].setup {capabilities=capabilities} - end -} - -vim.opt.background = "dark" -vim.opt.clipboard = "unnamedplus" -vim.opt.colorcolumn = "85" -vim.opt.mouse = "a" -vim.opt.shiftwidth = 4 -vim.opt.textwidth = 0 -vim.opt.wrapmargin = 0 - -vim.opt.cursorline = true -vim.opt.expandtab = true -vim.opt.ignorecase = true -vim.opt.linebreak = true -vim.opt.number = true -vim.opt.smartcase = true -vim.opt.smartindent = true -vim.opt.termguicolors = true -vim.opt.wrap = false - -vim.keymap.set('', '', 'mzgg=G`z') -vim.keymap.set('', 'r', '"_d') -vim.g.mapleader = " " - -vim.keymap.set("n", "{", "AerialPrev", { buffer = bufnr }) -vim.keymap.set("n", "}", "AerialNext", { buffer = bufnr }) -vim.keymap.set('n', 'a', "AerialToggle!") -vim.keymap.set('n', 'gd', function() vim.lsp.buf.definition() end) -vim.keymap.set('n', 'gD', function() vim.lsp.buf.type_definition() end) -vim.keymap.set('n', 'd', function() vim.lsp.buf.definition() end) -vim.keymap.set('n', 'f', function() vim.lsp.buf.code_action() end) -vim.keymap.set('n', 'h', function() vim.lsp.buf.hover() end) -vim.keymap.set('n', 'r', function() vim.lsp.buf.rename() end) - -vim.keymap.set("n", "", require('fzf-lua').files) -vim.keymap.set("n", "\\", require('fzf-lua').buffers) -vim.keymap.set("n", "k", require('fzf-lua').builtin) -vim.keymap.set("n", "l", require('fzf-lua').live_grep_glob) -vim.keymap.set("n", "g", require('fzf-lua').grep_project) - -vim.cmd [[ -colorscheme dracula -command Q q! -let b:ale_linters = {'c': [''], 'sh': [''], 'php': ['']} -autocmd BufReadPost,FileReadPost *.bz3 call gzip#read("bzip3 -rd") -]] +require('plugins') +require('opt') +require('keymap') +require('vimcmd') +require('arista') diff --git a/nvim/lua/arista.lua b/nvim/lua/arista.lua index 35cd0ba..0ea2875 100644 --- a/nvim/lua/arista.lua +++ b/nvim/lua/arista.lua @@ -15,7 +15,7 @@ vim.api.nvim_create_autocmd('FileType', { name = 'tacc', root_dir = '/src', }) - vim.treesitter.language.add("tac", { path = "/usr/lib64/libtree-sitter-tac.so" }) + vim.treesitter.language.add('tac', { path = '/usr/lib64/libtree-sitter-tac.so' }) vim.treesitter.start() end, }) diff --git a/nvim/lua/keymap.lua b/nvim/lua/keymap.lua new file mode 100644 index 0000000..d115d30 --- /dev/null +++ b/nvim/lua/keymap.lua @@ -0,0 +1,19 @@ +vim.keymap.set('', '', 'mzgg=G`z') +vim.keymap.set('', 'r', '"_d') +vim.g.mapleader = ' ' + +vim.keymap.set('n', '{', 'AerialPrev', { buffer = bufnr }) +vim.keymap.set('n', '}', 'AerialNext', { buffer = bufnr }) +vim.keymap.set('n', 'a', 'AerialToggle!') +vim.keymap.set('n', 'gd', function() vim.lsp.buf.definition() end) +vim.keymap.set('n', 'gD', function() vim.lsp.buf.type_definition() end) +vim.keymap.set('n', 'd', function() vim.lsp.buf.definition() end) +vim.keymap.set('n', 'f', function() vim.lsp.buf.code_action() end) +vim.keymap.set('n', 'h', function() vim.lsp.buf.hover() end) +vim.keymap.set('n', 'r', function() vim.lsp.buf.rename() end) + +vim.keymap.set('n', '', require('fzf-lua').files) +vim.keymap.set('n', '\\', require('fzf-lua').buffers) +vim.keymap.set('n', 'k', require('fzf-lua').builtin) +vim.keymap.set('n', 'l', require('fzf-lua').live_grep_glob) +vim.keymap.set('n', 'g', require('fzf-lua').grep_project) diff --git a/nvim/lua/lsp.lua b/nvim/lua/lsp.lua new file mode 100644 index 0000000..e7a861e --- /dev/null +++ b/nvim/lua/lsp.lua @@ -0,0 +1,46 @@ +local null_ls = require('null-ls') +null_ls.setup({sources = { + null_ls.builtins.formatting.phpcbf, + null_ls.builtins.diagnostics.phpcs +}}) +require('null-ls').register(require('none-ls-shellcheck.diagnostics')) +require('null-ls').register(require('none-ls-shellcheck.code_actions')) + +-- makes cmp tab functionality work as expected +local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil +end + +local cmp = require('cmp') +cmp.setup({ + mapping = { + [''] = cmp.mapping( + function (fallback) + if cmp.visible() then cmp.select_next_item() + elseif has_words_before() then cmp.complete() + else fallback() end + end, {'i'}), + + [''] = cmp.mapping( cmp.mapping.select_prev_item(), {'i'}), + [''] = cmp.mapping( cmp.mapping.confirm({select=true}), {'i'}), + }, + + completion = { autocomplete = false }, + snippet = { expand = function(args) require('luasnip').lsp_expand(args.body) end }, + + sources = cmp.config.sources( + {{name = 'nvim_lsp_signature_help'}}, + {{name = 'nvim_lsp'}}, + {{name = 'buffer'}}, + {{name = 'path'}} + ) +}) +local capabilities = require('cmp_nvim_lsp').default_capabilities() +require('lspconfig').clangd.setup{capabilities=capabilities} +require('mason-lspconfig').setup_handlers { + function (server_name) + require('lspconfig')[server_name].setup {capabilities=capabilities} + end +} diff --git a/nvim/lua/opt.lua b/nvim/lua/opt.lua new file mode 100644 index 0000000..ca16d41 --- /dev/null +++ b/nvim/lua/opt.lua @@ -0,0 +1,17 @@ +vim.opt.background = 'dark' +vim.opt.clipboard = 'unnamedplus' +vim.opt.colorcolumn = '85' +vim.opt.mouse = 'a' +vim.opt.shiftwidth = 4 +vim.opt.textwidth = 0 +vim.opt.wrapmargin = 0 + +vim.opt.cursorline = true +vim.opt.expandtab = true +vim.opt.ignorecase = true +vim.opt.linebreak = true +vim.opt.number = true +vim.opt.smartcase = true +vim.opt.smartindent = true +vim.opt.termguicolors = true +vim.opt.wrap = false diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua new file mode 100644 index 0000000..5e7bb65 --- /dev/null +++ b/nvim/lua/plugins.lua @@ -0,0 +1,39 @@ +local paq = require 'paq' { + 'dense-analysis/ale', + 'dracula/vim', + 'ibhagwan/fzf-lua', + 'kaarmu/typst.vim', + 'lewis6991/gitsigns.nvim', + 'lukas-reineke/indent-blankline.nvim', + 'neovim/nvim-lspconfig', + 'nmac427/guess-indent.nvim', + 'nvim-lua/plenary.nvim', + 'nvimtools/none-ls.nvim', + 'stevearc/aerial.nvim', + + 'vim-airline/vim-airline', + { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' }, + + 'gbprod/none-ls-shellcheck.nvim', + + 'L3MON4D3/LuaSnip', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-cmdline', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-nvim-lsp-signature-help', + 'hrsh7th/cmp-path', + 'hrsh7th/nvim-cmp', + + 'williamboman/mason-lspconfig.nvim', + { 'williamboman/mason.nvim', build = ':MasonUpdate' }, +} + +require('aerial').setup() +require('gitsigns').setup() +require('ibl').setup() +require('mason').setup() +require('mason-lspconfig').setup() +require('nvim-treesitter.configs').setup({highlight = {enable = true}}) +require('guess-indent').setup() + +require('lsp') diff --git a/nvim/lua/vimcmd.lua b/nvim/lua/vimcmd.lua new file mode 100644 index 0000000..1f05417 --- /dev/null +++ b/nvim/lua/vimcmd.lua @@ -0,0 +1,6 @@ +vim.cmd [[ +autocmd BufReadPost,FileReadPost *.bz3 call gzip#read('bzip3 -rd') +colorscheme dracula +command Q q! +let b:ale_linters = {'c': [''], 'sh': [''], 'php': ['']} +]] diff --git a/qutebrowser/arista.py b/qutebrowser/arista.py index 0ceb455..b299f1e 100644 --- a/qutebrowser/arista.py +++ b/qutebrowser/arista.py @@ -1,7 +1,8 @@ c.url.searchengines['aid'] = 'http://aid/{}' c.url.searchengines['go'] = 'http://go/{}' c.url.searchengines['group'] = 'http://groups/{}' -c.url.searchengines['tacnav'] = 'tacnav.infra.corp.arista.io/tacnav?version=eos-trunk&targets={}' +c.url.searchengines['nav'] = 'tacnav.infra.corp.arista.io/tacnav?version=eos-trunk&targets={}' +c.url.searchengines['gcs'] = 'cloudsearch.google.com/cloudsearch?={}' config.bind('A', ':cmd-set-text -s :open -t aid') config.bind('a', ':cmd-set-text -s :open aid') diff --git a/yt-dlp/config b/yt-dlp/config index 912845a..7dce0a8 100644 --- a/yt-dlp/config +++ b/yt-dlp/config @@ -7,3 +7,4 @@ -S lang,quality,res,fps,hdr:12,acodec,size,br,vcodec,asr,proto,ext,hasaud,source,id -o "%(title)s.%(ext)s" --sponsorblock-remove all +--embed-chapters