From f68da6c2b68eed166cb29078ea29fd5a19768439 Mon Sep 17 00:00:00 2001 From: Tovi Jaeschke-Rogers Date: Wed, 28 Dec 2022 18:52:05 +1030 Subject: [PATCH] Wed 28 Dec 2022 18:52:05 ACDT --- .config/aliasrc | 6 +- .config/nvim/lua/config/general/autocmd.lua | 5 +- .../nvim/lua/config/general/colorscheme.lua | 2 +- .config/nvim/lua/config/general/options.lua | 54 ++++++++------ .config/nvim/lua/config/general/remaps.lua | 46 ++++++++++-- .config/nvim/lua/config/lsp/init.lua | 41 ++++++----- .config/nvim/lua/config/telescope.lua | 4 + .config/nvim/lua/packer-plugins.lua | 73 +++++-------------- .local/bin/dwm-sss | 6 +- .zshrc | 6 +- 10 files changed, 136 insertions(+), 107 deletions(-) diff --git a/.config/aliasrc b/.config/aliasrc index f6a7d86..8903303 100644 --- a/.config/aliasrc +++ b/.config/aliasrc @@ -42,4 +42,8 @@ alias \ tinker="docker-compose exec fpm php artisan tinker" \ phpunit="docker-compose exec fpm ./vendor/bin/phpunit" \ jsonlint="python -m json.tool" \ - migseed="docker-compose exec fpm php artisan migrate --seed" + migseed="docker-compose exec fpm php artisan migrate --seed" \ + dsa="docker kill $(docker ps -q)" + +alias thermoview-run='docker-compose -f docker-compose.yml run desktop bash -c "/opt/local-electron.sh" ; rm -rf desktop/pulse-*' +alias thermoview-build-run='dce node gulp && docker-compose -f docker-compose.yml run desktop bash -c "/opt/build/build-local.sh && /opt/local-electron.sh" ; rm -rf desktop/pulse-*' diff --git a/.config/nvim/lua/config/general/autocmd.lua b/.config/nvim/lua/config/general/autocmd.lua index 368587c..dd54427 100644 --- a/.config/nvim/lua/config/general/autocmd.lua +++ b/.config/nvim/lua/config/general/autocmd.lua @@ -2,11 +2,14 @@ local aucmd_dict = { FileType = { { - pattern = "dart,vue,js", + pattern = "dart,vue,javascript,typescript,json", callback = function() vim.opt_local.tabstop = 2 vim.opt_local.softtabstop = 2 vim.opt_local.shiftwidth = 2 + -- vim.bo.tabstop = 2 -- size of a hard tabstop (ts). + -- vim.bo.shiftwidth = 2 -- size of an indentation (sw). + -- vim.bo.softtabstop = 2 -- number of spaces a counts for. When 0, feature is off (sts). end, }, }, diff --git a/.config/nvim/lua/config/general/colorscheme.lua b/.config/nvim/lua/config/general/colorscheme.lua index b5eff4c..2f05510 100644 --- a/.config/nvim/lua/config/general/colorscheme.lua +++ b/.config/nvim/lua/config/general/colorscheme.lua @@ -1,3 +1,3 @@ -vim.cmd [[colorscheme moonfly]] +vim.cmd [[colorscheme gruvbox]] diff --git a/.config/nvim/lua/config/general/options.lua b/.config/nvim/lua/config/general/options.lua index ff60060..326f293 100644 --- a/.config/nvim/lua/config/general/options.lua +++ b/.config/nvim/lua/config/general/options.lua @@ -1,33 +1,43 @@ vim.g.mapleader = ' ' -vim.o.clipboard = 'unnamedplus' +vim.opt.clipboard = 'unnamedplus' -vim.o.nohlsearch = true -vim.o.incsearch = true -vim.o.ignorecase = true +vim.opt.hlsearch = false +vim.opt.incsearch = true +vim.opt.ignorecase = true -vim.o.mouse = 'a' -vim.o.smartcase = true -vim.o.linebreak = true +vim.opt.mouse = 'a' +vim.opt.smartcase = true +vim.opt.linebreak = true -vim.o.noswapfile = true -vim.o.nobackup = true -vim.o.undodir = vim.fn.expand('~/.cache/nvim/undodir') -vim.o.undofile = true +vim.opt.smartindent = true -vim.o.encoding = 'utf-8' -vim.o.number = true -vim.o.relativenumber = true +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = vim.fn.expand('~/.cache/nvim/undodir') +vim.opt.undofile = true -vim.o.tabstop = 4 -vim.o.softtabstop = 4 -vim.o.expandtab = true -vim.o.shiftwidth = 4 -vim.o.smarttab = true +vim.opt.encoding = 'utf-8' +vim.opt.number = true +vim.opt.relativenumber = true -vim.o.formatoptions = 'tqj' +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.expandtab = true +vim.opt.shiftwidth = 4 +vim.opt.smarttab = true + +vim.opt.scrolloff = 8 +vim.opt.signcolumn = 'yes' +vim.opt.isfname:append('@-@') + +vim.opt.updatetime = 50 + +vim.opt.colorcolumn = "80" + +vim.opt.formatoptions = 'tqj' vim.cmd[[let g:pdv_cfg_autoEndFunction = 0]] -vim.o.splitbelow = true -vim.o.splitright = true +vim.opt.splitbelow = true +vim.opt.splitright = true diff --git a/.config/nvim/lua/config/general/remaps.lua b/.config/nvim/lua/config/general/remaps.lua index bce62c6..b5b6f10 100644 --- a/.config/nvim/lua/config/general/remaps.lua +++ b/.config/nvim/lua/config/general/remaps.lua @@ -1,7 +1,11 @@ local options = { noremap = true } -- Source init.lua -vim.api.nvim_set_keymap('n', 'so', 'source ~/.config/nvim/init.lua', options) +vim.api.nvim_set_keymap('n', + 'so', + 'source ~/.config/nvim/init.lua', + options +) -- Don't copy "c" changes to primary register vim.api.nvim_set_keymap('n', 'c', '"_c', options) @@ -14,22 +18,44 @@ vim.api.nvim_set_keymap('n', 'vs', 'vsplit', options) vim.api.nvim_set_keymap('n', 'y', 'ggyG', options) -- Manually store session -vim.api.nvim_set_keymap('n', '', 'mksession! ~/.cache//nvim/session/manual_session.vim', options) +vim.api.nvim_set_keymap( + 'n', + '', + 'mksession! ~/.cache//nvim/session/manual_session.vim', + options +) -- Restore manually stored session -vim.api.nvim_set_keymap('n', '', 'source ~/.cache/nvim/session/manual_session.vim', options) +vim.api.nvim_set_keymap('n', + '', + 'source ~/.cache/nvim/session/manual_session.vim', + options +) -- Restore auto saved session created on exit -vim.api.nvim_set_keymap('n', '', 'source ~/.cache/nvim/session/shutdown_session.vim', options) +vim.api.nvim_set_keymap('n', + '', + 'source ~/.cache/nvim/session/shutdown_session.vim', + options + ) -- Replace all is aliased to S. vim.api.nvim_set_keymap('n', '', '%s//g', options) -- Navigating with guides -vim.api.nvim_set_keymap('n', '', '/<++>"_c4l', options) --- vim.api.nvim_set_keymap('i', '', '/<++>"_c4l', options) -vim.api.nvim_set_keymap('v', '', '/<++>"_c4l', options) +vim.api.nvim_set_keymap('n', + '', + '/<++>"_c4l', + options +) +vim.api.nvim_set_keymap('v', + '', + '/<++>"_c4l', + options) -- Spell-check -vim.api.nvim_set_keymap('n', 'o', 'setlocal spell! spelllang=en_au', options) +vim.api.nvim_set_keymap('n', + 'o', + 'setlocal spell! spelllang=en_au', + options) -- Keep highlight when indenting vim.api.nvim_set_keymap('v', '<', 'ga', 'Git add .', options) vim.api.nvim_set_keymap('n', 'gA', 'Git add', options) vim.api.nvim_set_keymap('n', 'gc', 'Git commit', options) vim.api.nvim_set_keymap('n', 'gC', 'Git commit -a', options) + +vim.api.nvim_set_keymap("x", "p", "\"_dP", options) +vim.api.nvim_set_keymap("n", "d", "\"_d", options) +vim.api.nvim_set_keymap("v", "d", "\"_d", options) diff --git a/.config/nvim/lua/config/lsp/init.lua b/.config/nvim/lua/config/lsp/init.lua index e810983..333267c 100644 --- a/.config/nvim/lua/config/lsp/init.lua +++ b/.config/nvim/lua/config/lsp/init.lua @@ -1,19 +1,5 @@ local M = {} -local servers = { - 'gopls', - 'html', - 'jsonls', - 'pyright', - 'tsserver', - 'vimls', - 'dartls', - 'dockerls', - 'intelephense', - 'sqlls', - 'vuels', -} - local function on_attach(client, bufnr) -- Enable completion triggered by -- See `:help omnifunc` and `:help ins-completion` for more information. @@ -35,7 +21,7 @@ lsp_signature.setup { }, } -local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) +local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) local opts = { on_attach = on_attach, @@ -43,11 +29,32 @@ local opts = { flags = { debounce_text_changes = 150, }, +}; + +local servers = { + gopls = opts, + html = opts, + jsonls = opts, + pyright = opts, + tsserver = opts, + vimls = opts, + dartls = opts, + dockerls = opts, + intelephense = opts, + sqlls = opts, + volar = { + filetypes = {'typescript', 'javascript', 'vue', 'json'}, + init_options = { + typescript = { + tsdk = '/usr/lib/node_modules/typescript/lib' + } + } + } } function M.setup() - for _, server_name in ipairs(servers) do - require('lspconfig')[server_name].setup(opts) + for server_name, o in pairs(servers) do + require('lspconfig')[server_name].setup(o) end end diff --git a/.config/nvim/lua/config/telescope.lua b/.config/nvim/lua/config/telescope.lua index e29e10c..e625a40 100644 --- a/.config/nvim/lua/config/telescope.lua +++ b/.config/nvim/lua/config/telescope.lua @@ -57,6 +57,10 @@ vim.keymap.set('n', '', function() end end, options) +vim.keymap.set('n', '', function() + require('telescope.builtin').find_files() +end, options) + vim.keymap.set('n', 'df', function() require("telescope.builtin").find_files({ prompt_title = "< VimRC >", diff --git a/.config/nvim/lua/packer-plugins.lua b/.config/nvim/lua/packer-plugins.lua index 2b8eea7..f545c32 100644 --- a/.config/nvim/lua/packer-plugins.lua +++ b/.config/nvim/lua/packer-plugins.lua @@ -6,56 +6,32 @@ return require('packer').startup(function() use 'gruvbox-community/gruvbox' use 'bluz71/vim-moonfly-colors' - use { 'neoclide/coc.nvim', run = 'yarn install', disable = true } - use { 'SirVer/ultisnips' } - use { 'rcarriga/nvim-notify' } - use { - "neovim/nvim-lspconfig", - event = "BufReadPre", - wants = { "cmp-nvim-lsp", "nvim-lsp-installer", "lsp_signature.nvim" }, - config = function() - require("config.lsp").setup() - end, + 'VonHeikemen/lsp-zero.nvim', requires = { - "williamboman/nvim-lsp-installer", - "ray-x/lsp_signature.nvim", + -- LSP Support + {'neovim/nvim-lspconfig'}, + {'williamboman/mason.nvim'}, + {'williamboman/mason-lspconfig.nvim'}, + + -- Autocompletion + {'hrsh7th/nvim-cmp'}, + {'hrsh7th/cmp-buffer'}, + {'hrsh7th/cmp-path'}, + {'saadparwaiz1/cmp_luasnip'}, + {'hrsh7th/cmp-nvim-lsp'}, + {'hrsh7th/cmp-nvim-lua'}, + + -- Snippets + {'L3MON4D3/LuaSnip'}, + {'rafamadriz/friendly-snippets'}, }, - } - - use { - "ray-x/lsp_signature.nvim", - } - use { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - requires = { - { "hrsh7th/cmp-nvim-lsp", after = "nvim-cmp" }, - { "f3fora/cmp-spell", after = "nvim-cmp" }, - { "hrsh7th/cmp-path", after = "nvim-cmp" }, - { "hrsh7th/cmp-buffer", after = "nvim-cmp" }, - { "hrsh7th/cmp-calc", after = "nvim-cmp" }, - { "quangnguyen30192/cmp-nvim-ultisnips", after = "nvim-cmp" }, - { - "L3MON4D3/LuaSnip", - -- after = 'nvim-cmp', - wants = "friendly-snippets", - requires = { - { "rafamadriz/friendly-snippets", after = 'nvim-cmp' }, - }, - config = function() - require("config.luasnip").setup() - end, - }, - - }, config = function() - require("config.cmp").setup() - end, - disable = false, + require('config.lsp') + end } use { @@ -83,14 +59,6 @@ return require('packer').startup(function() use { 'nvim-treesitter/nvim-treesitter' } - -- use { - -- 'romgrk/barbar.nvim', - -- requires = {'kyazdani42/nvim-web-devicons'}, - -- config = function() - -- require('config.barbar') - -- end - -- } - use { 'lewis6991/gitsigns.nvim', config = function() @@ -133,7 +101,4 @@ return require('packer').startup(function() require('config.nvim-neo-tree') end } - - -- Local nvim plugin development - -- use '~/Software/nvim-phpdoc/phpdoc.nvim' end) diff --git a/.local/bin/dwm-sss b/.local/bin/dwm-sss index e1aba39..d03316f 100755 --- a/.local/bin/dwm-sss +++ b/.local/bin/dwm-sss @@ -3,11 +3,13 @@ while true; do f=$(cat /sys/class/thermal/thermal_zone0/temp) - t=$(echo $f | cut -b -2).$(echo $f | cut -b 3-)°C + t=$(echo $f | cut -b -2).$(echo $f | cut -b 2-)°C d=$(date '+%a %b %d, %H:%M') p=$(pacman -Qu | grep -v "\[ignored\]" | wc -l) pi=$(pacman -Q | wc -l) + c=$(docker ps -q | wc -l) + n=$(cat /sys/class/net/eno1/operstate) s=$(df -h / | tail -n 1 | awk '{ print $4 }') - xsetroot -name " /: ${s} | Pkgs: ${p}/${pi} | ${t} | ${d} " + xsetroot -name " D: ${c} | /: ${s} | Pkgs: ${p}/${pi} | Net: ${n} | ${t} | ${d} " sleep 60; done; diff --git a/.zshrc b/.zshrc index 7f06d1d..4d24083 100644 --- a/.zshrc +++ b/.zshrc @@ -178,10 +178,14 @@ lfcd () { } bindkey -s '^o' 'lfcd\n' -cdv () { +function cdv () { cd $(xclip -selection clipboard -o) } +function cdf () { + cd $(find . -type d -print | fzf) +} + function chpwd() { print -n "\e]2;st - $(whoami)@$(hostname) - $(pwd | sed 's/\/home\/tovi/~/g')\a" }