From d0228fb089c4d0dd83e14f10bc3198232eb93217 Mon Sep 17 00:00:00 2001 From: Tobias Sachs Date: Mon, 25 Sep 2023 13:15:29 +0200 Subject: [PATCH] .. --- stow/bin/.bin/passfind.sh | 8 ++++++ stow/nvim/.config/nvim/init.lua | 48 +++++++++++---------------------- 2 files changed, 24 insertions(+), 32 deletions(-) create mode 100755 stow/bin/.bin/passfind.sh diff --git a/stow/bin/.bin/passfind.sh b/stow/bin/.bin/passfind.sh new file mode 100755 index 0000000..f07e7b6 --- /dev/null +++ b/stow/bin/.bin/passfind.sh @@ -0,0 +1,8 @@ +#!/bin/sh +query=$1 +p=$(find .password-store -type f -not -path "*.git/*" | sed 's/^.password-store\///' | sed 's/\.gpg$//' | fzf --query="$query") + +if [ -n "$p" ];then + echo "'$p'" + pass show "$p" +fi diff --git a/stow/nvim/.config/nvim/init.lua b/stow/nvim/.config/nvim/init.lua index bfc6ee3..66c87ef 100644 --- a/stow/nvim/.config/nvim/init.lua +++ b/stow/nvim/.config/nvim/init.lua @@ -32,6 +32,7 @@ require('lazy').setup({ -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', + -- NOTE: This is where your plugins related to LSP can be installed. -- The configuration is done below. Search for lspconfig to find it below. { @@ -56,7 +57,7 @@ require('lazy').setup({ 'hrsh7th/nvim-cmp', dependencies = { 'hrsh7th/cmp-nvim-lsp', - {'L3MON4D3/LuaSnip', version = "2.*", build = "make install_jsregexp"}, + { 'L3MON4D3/LuaSnip', version = "2.*", build = "make install_jsregexp" }, 'saadparwaiz1/cmp_luasnip', 'rafamadriz/friendly-snippets' }, @@ -336,7 +337,6 @@ 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' }) @@ -344,9 +344,13 @@ vim.keymap.set('n', '', vim.diagnostic.goto_prev, { desc = 'Go to previous 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' }) + +vim.keymap.set("n", "f", function() + vim.lsp.buf.format({ timeout = 10000, bufnr = vim.api.nvim_get_current_buf() }) +end) -- LSP settings. -- This function gets run when an LSP connects to a particular buffer. -local on_attach = function(_, bufnr) +local on_attach = function(client, bufnr) -- NOTE: Remember that lua is a real programming language, and as such it is possible -- to define small helper and utility functions so you don't have to repeat yourself -- many times. @@ -354,9 +358,10 @@ local on_attach = function(_, bufnr) local nmap = function(keys, func, desc) if desc then desc = 'LSP: ' .. desc + vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) + else + vim.keymap.set('n', keys, func, { buffer = bufnr }) end - - vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) end nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') @@ -369,6 +374,8 @@ local on_attach = function(_, bufnr) nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- See `:help K` for why this keymap nmap('K', vim.lsp.buf.hover, 'Hover Documentation') nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') @@ -398,6 +405,8 @@ local servers = { -- pyright = {}, -- rust_analyzer = {}, tsserver = {}, + eslint = {}, + tailwindcss = {}, lua_ls = { Lua = { workspace = { checkThirdParty = false }, @@ -478,9 +487,6 @@ cmp.setup { } - - - local null_ls = require("null-ls") local group = vim.api.nvim_create_augroup("lsp_format_on_save", { clear = false }) @@ -488,30 +494,8 @@ 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, + timeout = 2000, + on_attach = on_attach }) -- 2.39.2