From f8ca390d0dfac47ee816d969c921a918a7b74252 Mon Sep 17 00:00:00 2001 From: codepuncher Date: Fri, 23 May 2025 09:57:53 +0100 Subject: [PATCH 1/6] update --- nvim/lua/lsp/init.lua | 6 +++--- nvim/lua/lsp/servers/cssls.lua | 6 ++++++ nvim/lua/lsp/servers/ts_ls.lua | 24 ++++++++++++++++++++++++ nvim/lua/lsp/servers/tsserver.lua | 21 --------------------- nvim/lua/plugins/configs/telescope.lua | 12 +++++++----- nvim/lua/plugins/init.lua | 1 - shell/zshrc | 14 ++++++++++++-- 7 files changed, 52 insertions(+), 32 deletions(-) create mode 100644 nvim/lua/lsp/servers/ts_ls.lua delete mode 100644 nvim/lua/lsp/servers/tsserver.lua diff --git a/nvim/lua/lsp/init.lua b/nvim/lua/lsp/init.lua index 458b3a2..1ec443b 100644 --- a/nvim/lua/lsp/init.lua +++ b/nvim/lua/lsp/init.lua @@ -8,7 +8,7 @@ local lsp_formatting = function(bufnr) vim.lsp.buf.format({ bufnr = bufnr, filter = function(client) - return client.name ~= 'tsserver' and client.name ~= 'intelephense' + return client.name == 'null-ls' end, }) end @@ -61,7 +61,7 @@ end local servers = { 'ansiblels', 'bashls', - 'cssls', + -- 'cssls', 'dockerls', 'eslint', 'gopls', @@ -74,7 +74,7 @@ local servers = { 'pyright', 'rust_analyzer', 'stylelint_lsp', - 'tsserver', + 'ts_ls', 'volar', 'yamlls', 'tailwindcss', diff --git a/nvim/lua/lsp/servers/cssls.lua b/nvim/lua/lsp/servers/cssls.lua index 359ce11..11c5ced 100644 --- a/nvim/lua/lsp/servers/cssls.lua +++ b/nvim/lua/lsp/servers/cssls.lua @@ -1,4 +1,7 @@ local _M = {} +--Enable (broadcasting) snippet capability for completion +-- local capabilities = vim.lsp.protocol.make_client_capabilities() +-- capabilities.textDocument.completion.completionItem.snippetSupport = true _M.setup = function(on_attach, capabilities) require('lspconfig').cssls.setup({ @@ -7,6 +10,9 @@ _M.setup = function(on_attach, capabilities) flags = { debounce_text_changes = 150, }, + init_options = { + provideFormatter = false, + }, }) end diff --git a/nvim/lua/lsp/servers/ts_ls.lua b/nvim/lua/lsp/servers/ts_ls.lua new file mode 100644 index 0000000..6b8927c --- /dev/null +++ b/nvim/lua/lsp/servers/ts_ls.lua @@ -0,0 +1,24 @@ +local _M = {} + +_M.setup = function(on_attach, capabilities) + require('lspconfig').ts_ls.setup({ + init_options = { + plugins = { + { + name = '@vue/typescript-plugin', + location = '/usr/local/lib/node_modules/@vue/typescript-plugin', + languages = { 'javascript', 'typescript', 'vue' }, + }, + }, + }, + filetypes = { + 'javascript', + 'typescript', + 'typescriptreact', + 'typescript.tsx', + 'vue', + }, + }) +end + +return _M diff --git a/nvim/lua/lsp/servers/tsserver.lua b/nvim/lua/lsp/servers/tsserver.lua deleted file mode 100644 index 274f93e..0000000 --- a/nvim/lua/lsp/servers/tsserver.lua +++ /dev/null @@ -1,21 +0,0 @@ -local _M = {} - -_M.setup = function(on_attach, capabilities) - require('typescript').setup({ - server = { - on_attach = function(client, bufnr) - client.server_capabilities.documentFormatting = false - on_attach(client, bufnr) - end, - capabilities = capabilities, - filetypes = { - 'javascript', - 'typescript', - 'typescriptreact', - 'typescript.tsx', - }, - }, - }) -end - -return _M diff --git a/nvim/lua/plugins/configs/telescope.lua b/nvim/lua/plugins/configs/telescope.lua index 4ade655..d113de0 100644 --- a/nvim/lua/plugins/configs/telescope.lua +++ b/nvim/lua/plugins/configs/telescope.lua @@ -40,6 +40,13 @@ telescope.setup({ }, }, pickers = { + live_grep = { + theme = 'dropdown', + layout_config = { + prompt_position = 'bottom', + width = 0.75, + }, + }, git_branches = { mappings = { i = { @@ -82,11 +89,6 @@ M.find_files_no_ignore = function() local theme = require('telescope.themes').get_dropdown({ hidden = true, no_ignore = true, - theme = 'dropdown', - layout_config = { - prompt_position = 'bottom', - width = 0.5, - }, }) require('telescope.builtin').find_files(theme) end diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua index 978166e..656177e 100644 --- a/nvim/lua/plugins/init.lua +++ b/nvim/lua/plugins/init.lua @@ -143,7 +143,6 @@ require('lazy').setup({ { 'folke/neodev.nvim', 'neovim/nvim-lspconfig', - 'jose-elias-alvarez/typescript.nvim', { 'jose-elias-alvarez/null-ls.nvim', dependencies = { diff --git a/shell/zshrc b/shell/zshrc index b7fb259..482f480 100644 --- a/shell/zshrc +++ b/shell/zshrc @@ -3,6 +3,8 @@ if [ -f "${HOME}/.shell_variables" ]; then source "${HOME}/.shell_variables" fi +# eval $(ssh-agent) + # Zinit source ~/.zinit/bin/zinit.zsh @@ -117,8 +119,8 @@ spaceship add --before char vi_mode # Setup history HISTFILE=~/.zsh_history -HISTSIZE=10000 -SAVEHIST=1000 +HISTSIZE=100000 +SAVEHIST=10000 setopt SHARE_HISTORY autoload -U compinit && compinit @@ -196,3 +198,11 @@ bindkey -M vicmd 'j' history-substring-search-down export WORDCHARS=${WORDCHARS/\//} export EDITOR=nvim setopt HIST_IGNORE_SPACE + +# Because WSL does not have +# XDG_RUNTIME_DIR unless GUI enabled +# many programs will fail due to +# write permission issues +if is_wsl; then + unset XDG_RUNTIME_DIR +fi From 5d7a4a001dd583f46ef9a7df0da686081190322b Mon Sep 17 00:00:00 2001 From: codepuncher Date: Tue, 17 Jun 2025 14:54:28 +0100 Subject: [PATCH 2/6] try copilot --- nvim/lua/plugins/configs/cmp.lua | 10 +++++++++- nvim/lua/plugins/init.lua | 3 +++ terminals/alacritty.toml | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/nvim/lua/plugins/configs/cmp.lua b/nvim/lua/plugins/configs/cmp.lua index f19688f..c8b5bdc 100644 --- a/nvim/lua/plugins/configs/cmp.lua +++ b/nvim/lua/plugins/configs/cmp.lua @@ -44,7 +44,15 @@ cmp.setup({ [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [''] = cmp.mapping(function(fallback) + local fallback_key = vim.api.nvim_replace_termcodes('', true, true, true) + local resolved_key = vim.fn['copilot#Accept'](fallback) + if fallback_key == resolved_key then + cmp.confirm({ select = true }) + else + vim.api.nvim_feedkeys(resolved_key, 'n', true) + end + end), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. [''] = cmp.mapping(tab, { 'c', 'i', 's' }), [''] = cmp.mapping(shift_tab, { 'c', 'i', 's' }), }), diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua index 656177e..5b97b26 100644 --- a/nvim/lua/plugins/init.lua +++ b/nvim/lua/plugins/init.lua @@ -216,6 +216,9 @@ require('lazy').setup({ -- Dev { + { + 'github/copilot.vim', + }, { 'hrsh7th/nvim-cmp', config = function() diff --git a/terminals/alacritty.toml b/terminals/alacritty.toml index 9eb9ecc..7cea02c 100644 --- a/terminals/alacritty.toml +++ b/terminals/alacritty.toml @@ -49,7 +49,7 @@ family = "JetBrainsMono NFM" decorations_theme_variant = "Dark" dynamic_padding = true dynamic_title = true -opacity = 1 +opacity = 0.75 startup_mode = "Maximized" [window.padding] From 1fdad3a65a2b11f6f4f9a8696c4af06be380b72d Mon Sep 17 00:00:00 2001 From: codepuncher Date: Tue, 1 Jul 2025 12:43:13 +0100 Subject: [PATCH 3/6] better copilot integration --- nvim/lua/plugins/configs/cmp.lua | 31 +++++++++++++++++-------------- nvim/lua/plugins/init.lua | 28 +++++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/nvim/lua/plugins/configs/cmp.lua b/nvim/lua/plugins/configs/cmp.lua index c8b5bdc..d173063 100644 --- a/nvim/lua/plugins/configs/cmp.lua +++ b/nvim/lua/plugins/configs/cmp.lua @@ -44,23 +44,25 @@ cmp.setup({ [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), - [''] = cmp.mapping(function(fallback) - local fallback_key = vim.api.nvim_replace_termcodes('', true, true, true) - local resolved_key = vim.fn['copilot#Accept'](fallback) - if fallback_key == resolved_key then - cmp.confirm({ select = true }) - else - vim.api.nvim_feedkeys(resolved_key, 'n', true) - end - end), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + -- [''] = cmp.mapping(function(fallback) + -- local fallback_key = vim.api.nvim_replace_termcodes('', true, true, true) + -- local resolved_key = vim.fn['copilot#Accept'](fallback) + -- if fallback_key == resolved_key then + -- cmp.confirm({ select = true }) + -- else + -- vim.api.nvim_feedkeys(resolved_key, 'n', true) + -- end + -- end), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. [''] = cmp.mapping(tab, { 'c', 'i', 's' }), [''] = cmp.mapping(shift_tab, { 'c', 'i', 's' }), }), sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'emoji' }, - { name = 'path' }, + { name = 'copilot', group_index = 2 }, + { name = 'nvim_lsp', group_index = 2 }, + { name = 'path', group_index = 2 }, + { name = 'luasnip', group_index = 2 }, + -- { name = 'emoji' }, }, { { name = 'buffer' }, { name = 'emoji' }, @@ -68,8 +70,9 @@ cmp.setup({ }), formatting = { format = lspkind.cmp_format({ - with_text = true, + mode = 'symbol', maxwidth = 50, + symbol_map = { Copilot = "" } }), }, }) diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua index 5b97b26..be123f9 100644 --- a/nvim/lua/plugins/init.lua +++ b/nvim/lua/plugins/init.lua @@ -216,9 +216,6 @@ require('lazy').setup({ -- Dev { - { - 'github/copilot.vim', - }, { 'hrsh7th/nvim-cmp', config = function() @@ -233,6 +230,31 @@ require('lazy').setup({ 'saadparwaiz1/cmp_luasnip', 'petertriho/cmp-git', 'onsails/lspkind-nvim', + { + 'zbirenbaum/copilot-cmp', + dependencies = { + { + 'zbirenbaum/copilot.lua', + config = function() + require("copilot").setup({ + suggestion = { enabled = false }, + panel = { enabled = false }, + }) + end, + }, + }, + config = function() + require('copilot_cmp').setup({ + method = 'getCompletionsCycling', + format = { + before = function(entry, vim_item) + vim_item.kind = require('lspkind').presets.default[vim_item.kind] .. ' Copilot' + return vim_item + end, + }, + }) + end, + }, { 'L3MON4D3/LuaSnip', dependencies = { From d0f3f873ce2aa0cb788d9bd8e5754583c208b65d Mon Sep 17 00:00:00 2001 From: codepuncher Date: Tue, 1 Jul 2025 12:45:31 +0100 Subject: [PATCH 4/6] update actions --- .github/workflows/lint.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 363b4f2..904b316 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,16 +7,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Run Shellcheck uses: azohra/shell-linter@latest lua: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run Stylua - uses: JohnnyMorganz/stylua-action@v1 + uses: JohnnyMorganz/stylua-action@v4 with: token: ${{ secrets.GITHUB_TOKEN }} + version: latest args: --quote-style AutoPreferSingle --indent-type Spaces --indent-width 2 --check . From 22d9bd56f49b99ba6f5abfe6494142d961bd3156 Mon Sep 17 00:00:00 2001 From: codepuncher Date: Tue, 1 Jul 2025 12:46:31 +0100 Subject: [PATCH 5/6] yamllint comments --- .github/workflows/lint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 904b316..a90ee00 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,5 +1,7 @@ +# yamllint disable-line rule:document-start name: Lint +# yamllint disable-line rule:truthy on: push jobs: @@ -20,4 +22,5 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} version: latest + # yamllint disable-line rule:line-length args: --quote-style AutoPreferSingle --indent-type Spaces --indent-width 2 --check . From ec03628e301ec34376632906b8cfd66606ec307d Mon Sep 17 00:00:00 2001 From: codepuncher Date: Tue, 1 Jul 2025 13:03:34 +0100 Subject: [PATCH 6/6] stylua fixes --- nvim/lua/plugins/configs/cmp.lua | 2 +- nvim/lua/plugins/init.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nvim/lua/plugins/configs/cmp.lua b/nvim/lua/plugins/configs/cmp.lua index d173063..31d29ef 100644 --- a/nvim/lua/plugins/configs/cmp.lua +++ b/nvim/lua/plugins/configs/cmp.lua @@ -72,7 +72,7 @@ cmp.setup({ format = lspkind.cmp_format({ mode = 'symbol', maxwidth = 50, - symbol_map = { Copilot = "" } + symbol_map = { Copilot = '' }, }), }, }) diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua index be123f9..40ff6a8 100644 --- a/nvim/lua/plugins/init.lua +++ b/nvim/lua/plugins/init.lua @@ -236,7 +236,7 @@ require('lazy').setup({ { 'zbirenbaum/copilot.lua', config = function() - require("copilot").setup({ + require('copilot').setup({ suggestion = { enabled = false }, panel = { enabled = false }, })