From a74c0307600212d1eed835952b67540d3888b9d7 Mon Sep 17 00:00:00 2001 From: Hadeed Ahmad Date: Fri, 19 Apr 2024 19:17:03 +0500 Subject: [PATCH] Neovim things --- nvim/init.lua | 3 ++- nvim/lua/filetypes.lua | 4 ++-- nvim/lua/plugins.lua | 37 +++++++++++++++++---------------- nvim/lua/plugins/completion.lua | 8 ++++++- nvim/lua/plugins/lsp.lua | 7 +++++++ nvim/lua/plugins/treesitter.lua | 15 ------------- zsh/dot-zshenv | 3 +++ 7 files changed, 40 insertions(+), 37 deletions(-) delete mode 100644 nvim/lua/plugins/treesitter.lua diff --git a/nvim/init.lua b/nvim/init.lua index dcc5c8c..333aecd 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -9,9 +9,10 @@ if not vim.loop.fs_stat(lazypath) then "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release + "--branch=stable", lazypath, }) end vim.opt.rtp:prepend(lazypath) + require("lazy").setup("plugins") diff --git a/nvim/lua/filetypes.lua b/nvim/lua/filetypes.lua index d5817ed..00c149f 100644 --- a/nvim/lua/filetypes.lua +++ b/nvim/lua/filetypes.lua @@ -5,7 +5,7 @@ vim.filetype.add({ ["gruvbox.conf"] = "kitty", ["keys.conf"] = "kitty", ["kitty.conf"] = "kitty", - ["ssh.conf"] = "kitty", + ["ssh.conf"] = "kitty", ["dot-zshenv"] = "zsh", ["dot-zshrc"] = "zsh" @@ -17,6 +17,6 @@ vim.filetype.add({ vim.api.nvim_create_autocmd('Filetype', { group = vim.api.nvim_create_augroup('setIndent', { clear = true }), - pattern = { "lua", "html" }, + pattern = { "lua", "html", "css", "javascript", "javascriptreact", "typescript", "typescriptreact" }, command = 'setlocal tabstop=2 softtabstop=2 shiftwidth=2' }) diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 2a89221..646ada3 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -22,29 +22,30 @@ return { }, { - "sakhnik/nvim-gdb", - config = function() - vim.api.nvim_create_autocmd("FileType", { - pattern = "nvimgdb", - callback = function() - vim.opt.number = false - vim.opt.relativenumber = false - vim.opt.signcolumn = 'no' - - vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { - command = "startinsert" - }) - end - }) - end + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = "all", + highlight = { + enable = true, + additional_vim_regex_highlighting = false + }, + indent = { + enable = true + } + }, + main = "nvim-treesitter.configs", + build = ":TSUpdate" }, - { "abecodes/tabout.nvim", dependencies = { "nvim-treesitter" }, config = true }, - + { "abecodes/tabout.nvim", config = true }, { "numToStr/Comment.nvim", config = true }, { "nvim-lualine/lualine.nvim", config = true }, { "windwp/nvim-autopairs", config = true }, + "tpope/vim-fugitive", + "tpope/vim-repeat", + "tpope/vim-surround", + "tpope/vim-unimpaired", + "fladson/vim-kitty", - "tpope/vim-unimpaired" } diff --git a/nvim/lua/plugins/completion.lua b/nvim/lua/plugins/completion.lua index 7483843..bb41ba4 100644 --- a/nvim/lua/plugins/completion.lua +++ b/nvim/lua/plugins/completion.lua @@ -4,12 +4,18 @@ return { "hrsh7th/cmp-buffer", "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lua", - "hrsh7th/cmp-path" + "hrsh7th/cmp-path", + "L3MON4D3/LuaSnip" }, config = function() local cmp = require("cmp") cmp.setup { + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end + }, mapping = cmp.mapping.preset.insert { [""] = function(fallback) if cmp.visible() then diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index ece706c..692c208 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -8,6 +8,13 @@ return { lspconfig.clangd.setup {} + local emmet_capabilities = vim.lsp.protocol.make_client_capabilities() + emmet_capabilities.textDocument.completion.completionItem.snippetSupport = true + lspconfig.emmet_ls.setup { + capabilities = emmet_capabilities, + filetypes = { "html", "javascriptreact", "typescriptreact" } + } + vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("UserLspConfig", {}), callback = require("keymaps").lsp diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua deleted file mode 100644 index cc430d4..0000000 --- a/nvim/lua/plugins/treesitter.lua +++ /dev/null @@ -1,15 +0,0 @@ -return { - "nvim-treesitter/nvim-treesitter", - opts = { - ensure_installed = "all", - highlight = { - enable = true, - additional_vim_regex_highlighting = false - }, - indent = { - enable = true - } - }, - main = "nvim-treesitter.configs", - build = ":TSUpdate" -} diff --git a/zsh/dot-zshenv b/zsh/dot-zshenv index bfd056e..39eb639 100644 --- a/zsh/dot-zshenv +++ b/zsh/dot-zshenv @@ -1,9 +1,12 @@ typeset -U path path+="$HOME/bin" +path+="$HOME/.local/npm/bin" export DOTS="$HOME/docs/repos/dots" export VISUAL="nvim" export EDITOR="nvim" +export npm_config_prefix="$HOME/.local/npm" + # vim: filetype=zsh