From 918bf561195a48b2d12f19be8d1cbd0d83acddb9 Mon Sep 17 00:00:00 2001 From: MCorange Date: Thu, 8 Aug 2024 16:15:44 +0300 Subject: [PATCH] update --- .config/nvim/.luarc.json | 13 +++ .config/nvim/lazy-lock.json | 3 +- .config/nvim/lua/plugins/lsp-zero.lua | 107 +++++++++++++++++++++++++ .config/nvim/lua/plugins/telescope.lua | 12 +++ .dwm/autostart.sh | 4 +- .zshrc | 3 + 6 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 .config/nvim/.luarc.json create mode 100644 .config/nvim/lua/plugins/lsp-zero.lua create mode 100644 .config/nvim/lua/plugins/telescope.lua diff --git a/.config/nvim/.luarc.json b/.config/nvim/.luarc.json new file mode 100644 index 0000000..af7a43e --- /dev/null +++ b/.config/nvim/.luarc.json @@ -0,0 +1,13 @@ +{ + "runtime.version": "LuaJIT", + "runtime.path": [ + "lua/?.lua", + "lua/?/init.lua" + ], + "diagnostics.globals": ["vim"], + "workspace.checkThirdParty": false, + "workspace.library": [ + "$VIMRUNTIME", + "${3rd}/luv/library" + ] +} diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 9e38234..21142dd 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -22,5 +22,6 @@ "nvim-treesitter": { "branch": "master", "commit": "979beffc1a86e7ba19bd6535c0370d8e1aaaad3c" }, "nvim-treesitter-context": { "branch": "master", "commit": "f62bfe19e0fbc13ae95649dfb3cf22f4ff85b683" }, "nvim-web-devicons": { "branch": "master", "commit": "b77921fdc44833c994fdb389d658ccbce5490c16" }, - "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" } + "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" } } \ No newline at end of file diff --git a/.config/nvim/lua/plugins/lsp-zero.lua b/.config/nvim/lua/plugins/lsp-zero.lua new file mode 100644 index 0000000..3722066 --- /dev/null +++ b/.config/nvim/lua/plugins/lsp-zero.lua @@ -0,0 +1,107 @@ +return { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v1.x', + dependencies = { + -- LSP Support + {'neovim/nvim-lspconfig'}, -- Required + {'williamboman/mason.nvim'}, -- Optional + {'williamboman/mason-lspconfig.nvim'}, -- Optional + {'lvimuser/lsp-inlayhints.nvim'}, + + -- Autocompletion + {'hrsh7th/nvim-cmp'}, -- Required + {'hrsh7th/cmp-nvim-lsp'}, -- Required + {'hrsh7th/cmp-buffer'}, -- Optional + {'hrsh7th/cmp-path'}, -- Optional + {'saadparwaiz1/cmp_luasnip'}, -- Optional + {'hrsh7th/cmp-nvim-lua'}, -- Optional + + -- Snippets + {'L3MON4D3/LuaSnip'}, -- Required + {'rafamadriz/friendly-snippets'}, -- Optional + }, + init = function() + local lsp_zero = require('lsp-zero') + local ih = require('lsp-inlayhints') + ih.setup() + + lsp_zero.on_attach(function(client, bufnr) + -- see :help lsp-zero-keybindings + -- to learn the available actions + lsp_zero.default_keymaps({buffer = bufnr}) + -- ih.on_attach(client, bufnr) + end) + require('mason').setup({}) + local capabilities = require('cmp_nvim_lsp').default_capabilities() + + require('mason-lspconfig').setup({ + ensure_installed = {}, + handlers = { + function(server_name) + require('lspconfig')[server_name].setup({ + capabilities = capabilities, + on_attach = function(client, bufnr) + ih.on_attach(client, bufnr) + end, + }) + end, + }, + }) + local cmp = require("cmp") + + cmp.setup({ + expand = function(args) + vim.snippet.expand(args.body) + end, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + ['/home/yourname/Documents/CC-Tweaked-EmmyLua'] = cmp.mapping.abort(), + -- Accept currently selected item. + -- Set `select` to `false` to only confirm explicitly selected items. + [''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' }, -- For vsnip users. + -- { name = 'luasnip' }, -- For luasnip users. + -- { name = 'ultisnips' }, -- For ultisnips users. + -- { name = 'snippy' }, -- For snippy users. + }, { + { name = 'buffer' }, + }) + }) + + -- require('lspconfig').clangd.setup({}) + + require('lspconfig').lua_ls.setup({ + settings = { + Lua = {} + }, + on_init = function(client) + local uv = vim.uv or vim.loop + local path = client.workspace_folders[1].name + + -- Don't do anything if there is a project local config + if uv.fs_stat(path .. '/.luarc.json') or + uv.fs_stat(path .. '/.luarc.jsonc') then + return + end + + -- Apply neovim specific settings + local lua_opts = lsp_zero.nvim_lua_ls() + + client.config.settings.Lua = vim.tbl_deep_extend( + 'force', + client.config.settings.Lua, + lua_opts.settings.Lua + ) + end + }) + end +}; diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..af28a7d --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,12 @@ +return { + 'nvim-telescope/telescope.nvim', tag = '0.1.8', + init = function () + local builtin = require('telescope.builtin') + vim.keymap.set('n', 'ff', builtin.find_files, {}) + vim.keymap.set('n', 'fg', builtin.live_grep, {}) + vim.keymap.set('n', 'fs', builtin.grep_string, {}) + vim.keymap.set('n', 'fb', builtin.buffers, {}) + vim.keymap.set('n', 'fh', builtin.help_tags, {}) + vim.keymap.set('n', 'ft', builtin.treesitter, {}) + end +} diff --git a/.dwm/autostart.sh b/.dwm/autostart.sh index 5a941a0..c9893c5 100755 --- a/.dwm/autostart.sh +++ b/.dwm/autostart.sh @@ -1,6 +1,8 @@ #!/usr/bin/bash + +sleep 1 pushd ~/.dwm/sources/dim -~/.dwm/sources/dim/dim & +~/.dwm/sources/dim/target/release/dim 2>&1 | tee dim.log & popd /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & dex --autostart --environment dwm & diff --git a/.zshrc b/.zshrc index ce31a6e..fb6009d 100644 --- a/.zshrc +++ b/.zshrc @@ -27,6 +27,8 @@ alias vim="nvim" alias yt-dlp="yt-dlp -o \"%(title)s.%(ext)s\"" alias gpg="gpg --allow-non-selfsigned-uid" alias ysap="curl ysap.daveeddy.com" +alias get_idf='. $HOME/esp/esp-idf/export.sh' +. $HOME/export-esp.sh # Aditional Paths export PATH="$PATH:/usr/lib/ruby/gems/3.0.0/gems" @@ -39,3 +41,4 @@ function displayqr() { # Created by `pipx` on 2024-04-13 08:08:20 export PATH="$PATH:/home/mcorange/.local/bin" +export PATH="$HOME/.cargo/bin:$PATH"