diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 363b4f2..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: @@ -7,16 +9,18 @@ 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 + # yamllint disable-line rule:line-length args: --quote-style AutoPreferSingle --indent-type Spaces --indent-width 2 --check . 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/cmp.lua b/nvim/lua/plugins/configs/cmp.lua index f19688f..31d29ef 100644 --- a/nvim/lua/plugins/configs/cmp.lua +++ b/nvim/lua/plugins/configs/cmp.lua @@ -45,14 +45,24 @@ cmp.setup({ [''] = 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' }), }), 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' }, @@ -60,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/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..40ff6a8 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 = { @@ -231,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 = { 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 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]