From 62c3c3dc07cdcd09f1712f6eb4eb658c8be6bf01 Mon Sep 17 00:00:00 2001 From: Tobias Sachs Date: Sat, 5 Aug 2023 12:53:35 +0200 Subject: [PATCH] .. --- stow/mako/.config/mako/config | 2 + .../nvim/.config/nvim/ftplugin/typescript.vim | 3 + .../.config/nvim/ftplugin/typescriptreact.vim | 1 + stow/nvim/.config/nvim/init.lua | 81 +++++++++++++++++-- stow/oh-my-zsh/.oh-my-zsh | 2 +- stow/sway/.config/sway/config | 11 +-- 6 files changed, 89 insertions(+), 11 deletions(-) create mode 100644 stow/mako/.config/mako/config create mode 100644 stow/nvim/.config/nvim/ftplugin/typescript.vim create mode 120000 stow/nvim/.config/nvim/ftplugin/typescriptreact.vim diff --git a/stow/mako/.config/mako/config b/stow/mako/.config/mako/config new file mode 100644 index 0000000..6ace371 --- /dev/null +++ b/stow/mako/.config/mako/config @@ -0,0 +1,2 @@ +on-button-middle=dismiss-group +default-timeout=10000 diff --git a/stow/nvim/.config/nvim/ftplugin/typescript.vim b/stow/nvim/.config/nvim/ftplugin/typescript.vim new file mode 100644 index 0000000..528addf --- /dev/null +++ b/stow/nvim/.config/nvim/ftplugin/typescript.vim @@ -0,0 +1,3 @@ +let b:auto_save = 1 +":AutoSaveToggle +let g:auto_save_silent = 1 " do not display the auto-save notification diff --git a/stow/nvim/.config/nvim/ftplugin/typescriptreact.vim b/stow/nvim/.config/nvim/ftplugin/typescriptreact.vim new file mode 120000 index 0000000..8653162 --- /dev/null +++ b/stow/nvim/.config/nvim/ftplugin/typescriptreact.vim @@ -0,0 +1 @@ +typescript.vim \ No newline at end of file diff --git a/stow/nvim/.config/nvim/init.lua b/stow/nvim/.config/nvim/init.lua index 9cf6399..bfc6ee3 100644 --- a/stow/nvim/.config/nvim/init.lua +++ b/stow/nvim/.config/nvim/init.lua @@ -20,6 +20,11 @@ vim.opt.rtp:prepend(lazypath) require('lazy').setup({ -- NOTE: First, some plugins that don't require any configuration + 'jose-elias-alvarez/null-ls.nvim', + 'MunifTanjim/prettier.nvim', + + '907th/vim-auto-save', + -- Git related plugins 'tpope/vim-fugitive', 'tpope/vim-rhubarb', @@ -39,7 +44,7 @@ require('lazy').setup({ -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {}, tag = 'legacy' }, + { 'j-hui/fidget.nvim', opts = {}, tag = 'legacy' }, -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', @@ -49,8 +54,12 @@ require('lazy').setup({ { -- Autocompletion 'hrsh7th/nvim-cmp', - dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', - 'rafamadriz/friendly-snippets' }, + dependencies = { + 'hrsh7th/cmp-nvim-lsp', + {'L3MON4D3/LuaSnip', version = "2.*", build = "make install_jsregexp"}, + 'saadparwaiz1/cmp_luasnip', + 'rafamadriz/friendly-snippets' + }, }, -- Useful plugin to show you pending keybinds. @@ -132,7 +141,7 @@ require('lazy').setup({ -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. -- Uncomment any of the lines below to enable them. - require 'autoformat', + -- require 'autoformat', -- require 'kickstart.plugins.debug', -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` @@ -154,6 +163,7 @@ vim.o.hlsearch = false -- Make line numbers default vim.wo.relativenumber = true +vim.wo.number = true -- Enable mouse mode vim.o.mouse = 'a' @@ -330,9 +340,10 @@ require('nvim-treesitter.configs').setup { -- Diagnostic keymaps vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) +vim.keymap.set('n', '', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) +vim.keymap.set('n', '', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) - -- LSP settings. -- This function gets run when an LSP connects to a particular buffer. local on_attach = function(_, bufnr) @@ -466,5 +477,65 @@ cmp.setup { }, } + + + + +local null_ls = require("null-ls") + +local group = vim.api.nvim_create_augroup("lsp_format_on_save", { clear = false }) +local event = "BufWritePre" -- or "BufWritePost" +local async = event == "BufWritePost" + +null_ls.setup({ + on_attach = function(client, bufnr) + if client.supports_method("textDocument/formatting") then + vim.keymap.set("n", "f", function() + vim.lsp.buf.format({ timeout = 10000, bufnr = vim.api.nvim_get_current_buf() }) + end, { buffer = bufnr, desc = "[lsp] format" }) + + -- -- format on save + -- vim.api.nvim_clear_autocmds({ buffer = bufnr, group = group }) + -- vim.api.nvim_create_autocmd(event, { + -- buffer = bufnr, + -- group = group, + -- callback = function() + -- vim.lsp.buf.format({ bufnr = bufnr, async = async }) + -- end, + -- desc = "[lsp] format on save", + -- }) + end + + if client.supports_method("textDocument/rangeFormatting") then + vim.keymap.set("x", "f", function() + vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() }) + end, { buffer = bufnr, desc = "[lsp] format" }) + end + end, +}) + + +local prettier = require("prettier") + +prettier.setup({ + bin = 'prettierd', -- or `'prettierd'` (v0.23.3+) + filetypes = { + "css", + "graphql", + "html", + "javascript", + "javascriptreact", + "json", + "less", + "markdown", + "scss", + "typescript", + "typescriptreact", + "yaml", + }, +}) + +vim.opt.diffopt = vim.opt.diffopt + "vertical" + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/stow/oh-my-zsh/.oh-my-zsh b/stow/oh-my-zsh/.oh-my-zsh index b5be2d3..4188b22 160000 --- a/stow/oh-my-zsh/.oh-my-zsh +++ b/stow/oh-my-zsh/.oh-my-zsh @@ -1 +1 @@ -Subproject commit b5be2d39e2d2a598f7bba26d0bae2cce8c7d3d64 +Subproject commit 4188b22aea3356a02768505103e42a96d18547a3 diff --git a/stow/sway/.config/sway/config b/stow/sway/.config/sway/config index 07feb0f..da8fae4 100644 --- a/stow/sway/.config/sway/config +++ b/stow/sway/.config/sway/config @@ -18,8 +18,8 @@ set $term ~/.bin/sensible-terminal.sh # Your preferred application launcher # Note: pass the final command to swaymsg so that the resulting window can be opened # on the original workspace that the command was run on. -set $menu dmenu_path | dmenu | xargs swaymsg exec -- - +#set $menu dmenu_path | dmenu | xargs swaymsg exec -- +set $menu /usr/bin/ulauncher include /etc/sway/config-vars.d/* ### Output configuration @@ -38,8 +38,8 @@ include /etc/sway/config-vars.d/* # Example configuration: # exec swayidle -w \ - timeout 300 'swaylock -f -c 000000' \ - timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ + timeout 1200 'swaylock -f -c 000000' \ + timeout 1201 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ before-sleep 'swaylock -f -c 000000' # # This will lock your screen after 300 seconds of inactivity, then turn off @@ -225,7 +225,8 @@ bar { include /etc/sway/config.d/* # custom... -exec dunst +# mako for notifications +exec mako exec pasystray exec sleep 3 && nextcloud --background exec pass git pull -- 2.39.2