this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix errors

+90 -28
+10 -10
lua/user/cmp.lua
··· 6 6 7 7 require("luasnip/loaders/from_vscode").lazy_load() 8 8 9 - -- local check_backspace = function() 10 - -- local col = vim.fn.col "." -1 11 - -- return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" 12 - -- end 9 + local has_words_before = function() 10 + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) 11 + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil 12 + end 13 13 14 14 --   פּ ﯟ   some other good icons 15 15 local kind_icons = { ··· 59 59 ["<Tab>"] = cmp.mapping(function(fallback) 60 60 if cmp.visible() then 61 61 cmp.select_next_item() 62 - elseif luasnip.expandable() then 63 - luasnip.expand() 64 62 elseif luasnip.expand_or_jumpable() then 65 63 luasnip.expand_or_jump() 66 - --elseif check_backspace() then 67 - -- fallback() 64 + elseif has_words_before() then 65 + cmp.complete() 68 66 else 69 67 fallback() 70 68 end ··· 106 104 behavior = cmp.ConfirmBehavior.Replace, 107 105 select = false, 108 106 }, 109 - documentation = { 110 - border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, 107 + window = { 108 + documentation = { 109 + border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, 110 + }, 111 111 }, 112 112 experimental = { 113 113 ghost_text = false,
+12 -8
lua/user/lsp/handlers.lua
··· 59 59 local opts = { noremap = true, silent = true } 60 60 local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end 61 61 62 + -- See `:help vim.lsp.*` for documentation on any of the below functions 62 63 buf_set_keymap('n', 'ga', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) 63 64 buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) 64 65 buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) ··· 71 72 M.on_attach = function(client, bufnr) 72 73 73 74 -- Enable completion triggered by <c-x><c-o> 74 - --vim.api.nvim_buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') 75 + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'lua.vim.lsp.omnifunc') 75 76 76 - if client.name == "tsserver" then 77 - client.resolved_capabilities.document_formatting = false 78 - end 79 77 if client.resolved_capabilities.document_formatting then 80 - vim.api.nvim_command [[augroup Format]] 81 - vim.api.nvim_command [[autocmd! * <buffer>]] 82 - vim.api.nvim_command [[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()]] 83 - vim.api.nvim_command [[augroup END]] 78 + vim.api.nvim_exec( 79 + [[ 80 + augroup Format 81 + autocmd! * <buffer> 82 + autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync() 83 + augroup END 84 + ]], 85 + false 86 + ) 84 87 end 88 + 85 89 lsp_keymaps(bufnr) 86 90 lsp_highlight_document(client) 87 91 end
+1
lua/user/lsp/init.lua
··· 3 3 4 4 require("user.lsp.lsp-installer") 5 5 require("user.lsp.handlers").setup() 6 + require("user.lsp.null-ls")
+13 -1
lua/user/lsp/lsp-installer.lua
··· 1 1 local ok, lsp_installer = pcall(require, "nvim-lsp-installer") 2 2 if not ok then return end 3 3 4 + -- Install loved servers 5 + local servers = {"sumneko_lua", "gopls", "tailwindcss", "tsserver"} 6 + for _, name in pairs(servers) do 7 + local server_is_found, server = lsp_installer.get_server(name) 8 + if server_is_found and not server:is_installed() then 9 + server:install() 10 + end 11 + end 12 + 13 + -- TODO: turn of formatting in htmlls & cssls 14 + 4 15 -- Register a handler that will be called for all installed servers. 5 16 -- Or register handlers on specific server instances. 6 17 lsp_installer.on_server_ready(function(server) ··· 21 32 22 33 if server.name == "tsserver" then 23 34 local tsserver_opts = require("user.lsp.settings.tsserver") 24 - opts = vim.tbl_deep_extend("force", tsserver_opts, opts) 35 + opts = vim.tbl_deep_extend("force", opts, tsserver_opts) 25 36 end 26 37 38 + -- TODO: Remove diagnosticls settings 27 39 if server.name == "diagnosticls" then 28 40 local diagnostics_opts = require("user.lsp.settings.diagnosticls") 29 41 opts = vim.tbl_deep_extend("force", diagnostics_opts, opts)
+37 -8
lua/user/lsp/null-ls.lua
··· 2 2 local ok, null_ls = pcall(require, "null-ls") 3 3 if not ok then return end 4 4 5 - -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting 6 - local formatting = null_ls.builtins.formatting 7 - -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics 8 - -- local diagnostics = null_ls.builtins.diagnostics 5 + local b = null_ls.builtins 6 + 7 + local eslintConfig = { 8 + condition = function (utils) 9 + return utils.root_has_file({ ".eslintrc.json" }) 10 + end 11 + } 9 12 10 13 null_ls.setup({ 11 - debug = false, 14 + debug = true, 12 15 sources = { 13 - formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }), 14 - formatting.stylua, 15 - } 16 + -- stylua (lua) 17 + -- > cargo install stylua 18 + b.formatting.stylua, 19 + 20 + -- eslint_d (js) 21 + -- > npm install -g eslint_d 22 + b.diagnostics.eslint.with(eslintConfig), 23 + b.code_actions.eslint.with(eslintConfig), 24 + 25 + -- prettier_d_slim (js) 26 + -- NOTE: why? : https://www.reddit.com/r/neovim/comments/mrep3l/comment/guuh1p1/?utm_source=share&utm_medium=web2x&context=3 27 + -- > npm install -g prettier_d_slim 28 + -- b.formatting.prettier_d_slim--[[ .with({ 29 + -- extra_args = { '--no-semi', "--single-quote", "--jsx-single-quote" }, 30 + -- }), ]] 31 + b.formatting.prettier.with({ 32 + extra_args = {'--no-semi', '--single-quote', '--jsx-single-quote'} 33 + }) 34 + }, 35 + on_attach = function (client) 36 + if client.resolved_capabilities.document_formatting then 37 + vim.cmd([[ 38 + augroup LspFormatting 39 + autocmd! * <buffer> 40 + autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync() 41 + augroup END 42 + ]]) 43 + end 44 + end, 16 45 })
+16 -1
lua/user/lsp/settings/tsserver.lua
··· 1 + -- local ts_utils = require("nvim-lsp-ts-utils") 2 + local h = require("user.lsp.handlers") 3 + 1 4 return { 2 - filetypes = {"typescript", "typescriptreact", "typescript.tsx"}, 5 + filetypes = { 6 + "javascript", "javascriptreact", "javascript.jsx", 7 + "typescript", "typescriptreact", "typescript.tsx" 8 + }, 9 + on_attach = function (client, bufnr) 10 + client.resolved_capabilities.document_formatting = false 11 + client.resolved_capabilities.document_range_formatting = false 12 + 13 + -- ts_utils.setup({}) 14 + -- ts_utils.setup_client(client) 15 + 16 + h.on_attach(client,bufnr) 17 + end 3 18 }
+1
lua/user/plugins.lua
··· 74 74 use "neovim/nvim-lspconfig" -- enable LSP 75 75 use "williamboman/nvim-lsp-installer" -- simple to use language server installer 76 76 use "jose-elias-alvarez/null-ls.nvim" -- for formatters and linters 77 + use "jose-elias-alvarez/nvim-lsp-ts-utils" -- typescript dev utils 77 78 78 79 -- Telescope 79 80 use "nvim-telescope/telescope.nvim"