From f0f0a978a00242604ab199c756338fc48b12462c Mon Sep 17 00:00:00 2001 From: AntoXa PRO Date: Fri, 29 Sep 2023 12:40:41 +0300 Subject: [PATCH] remove null-ls --- nvim/.config/nvim/lua/axp/base.lua | 9 ++-- .../nvim/lua/axp/plugins/blankline.lua | 12 +++--- nvim/.config/nvim/lua/axp/plugins/init.lua | 14 +++--- nvim/.config/nvim/lua/axp/plugins/lsp.lua | 29 +++++++------ .../nvim/lua/axp/plugins/null-ls/init.lua | 15 ++++--- .../nvim/lua/axp/plugins/null-ls/init.old.lua | 15 +++++++ .../.config/nvim/lua/axp/plugins/prettier.lua | 15 +++++++ .../nvim/lua/axp/plugins/treesitter.lua | 43 ++++--------------- nvim/.config/nvim/plugin/packer_compiled.lua | 14 +++--- 9 files changed, 88 insertions(+), 78 deletions(-) create mode 100644 nvim/.config/nvim/lua/axp/plugins/null-ls/init.old.lua create mode 100644 nvim/.config/nvim/lua/axp/plugins/prettier.lua diff --git a/nvim/.config/nvim/lua/axp/base.lua b/nvim/.config/nvim/lua/axp/base.lua index 93579cd..e1e6ce4 100644 --- a/nvim/.config/nvim/lua/axp/base.lua +++ b/nvim/.config/nvim/lua/axp/base.lua @@ -1,6 +1,9 @@ -- Encoding. +vim.scriptencoding = 'utf-8' vim.o.encoding = 'utf-8' vim.o.fileencoding = 'utf-8' + +-- Backups. vim.o.backup = false vim.o.swapfile = false @@ -9,14 +12,14 @@ vim.o.number = true vim.o.relativenumber = true vim.o.colorcolumn = '79' vim.o.signcolumn = 'yes' +vim.o.cursorline = true +vim.o.guicursor = '' -- Tabs. vim.o.tabstop = 2 vim.o.shiftwidth = 2 --- vim.o.expandtab = true -- Etc. -vim.o.guicursor = '' vim.o.clipboard = 'unnamedplus' -- View. @@ -25,8 +28,8 @@ vim.g.netrw_liststyle = 3 vim.o.list = true vim.opt.listchars:append 'space:⋅' +vim.opt.listchars:append 'tab:┊ ' -- vim.opt.listchars:append 'eol:↴' --- vim.opt.listchars:append 'tab:>-' -- Mappings tabs. vim.keymap.set('n', '', ':-tabmove') diff --git a/nvim/.config/nvim/lua/axp/plugins/blankline.lua b/nvim/.config/nvim/lua/axp/plugins/blankline.lua index 752733d..5fd7625 100644 --- a/nvim/.config/nvim/lua/axp/plugins/blankline.lua +++ b/nvim/.config/nvim/lua/axp/plugins/blankline.lua @@ -1,10 +1,8 @@ -local status, blankline = pcall(require, 'indent_blankline') +local status, ibl = pcall(require, 'ibl') if (not status) then return end -blankline.setup { - char = '┊', - show_trailing_blankline_indent = false, - -- for example, context is off by default, use this to turn it on - -- show_current_context = true, - -- show_current_context_start = true, +ibl.setup { + indent = { + char = '┊' + } } diff --git a/nvim/.config/nvim/lua/axp/plugins/init.lua b/nvim/.config/nvim/lua/axp/plugins/init.lua index 997e257..e4d1eed 100644 --- a/nvim/.config/nvim/lua/axp/plugins/init.lua +++ b/nvim/.config/nvim/lua/axp/plugins/init.lua @@ -22,14 +22,15 @@ M.list = { 'hrsh7th/cmp-nvim-lsp', --- Null-ls. - 'jose-elias-alvarez/null-ls.nvim', + -- 'jose-elias-alvarez/null-ls.nvim', + 'MunifTanjim/prettier.nvim', - -- Autocompletion + -- Autocompletion 'L3MON4D3/LuaSnip', 'hrsh7th/nvim-cmp' } -M.init = function () +M.init = function() -- Etc. require('axp.plugins.autopairs') require('axp.plugins.comment') @@ -38,16 +39,17 @@ M.init = function () -- View. require('axp.plugins.nightfox') - -- require('axp.plugins.lualine') require('axp.plugins.blankline') + -- require('axp.plugins.lualine') -- Lsp. require('axp.plugins.lsp') -- Null-ls. - require('axp.plugins.null-ls') + -- require('axp.plugins.null-ls') + require('axp.plugins.prettier') - -- Autocompletion + -- Autocompletion require('axp.plugins.luasnip') require('axp.plugins.nvim-cmp') end diff --git a/nvim/.config/nvim/lua/axp/plugins/lsp.lua b/nvim/.config/nvim/lua/axp/plugins/lsp.lua index 47b439d..f781ad2 100644 --- a/nvim/.config/nvim/lua/axp/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/axp/plugins/lsp.lua @@ -15,24 +15,22 @@ local servers = { lua_ls = { Lua = { diagnostics = { - -- Get the language server to recognize the 'vim' global. globals = { 'vim' } }, - workspace = { checkThirdParty = false }, - telemetry = { enable = false }, + workspace = { + library = vim.api.nvim_get_runtime_file('', true), + checkThirdParty = false + } }, }, bashls = {}, clangd = {}, cmake = {}, - tsserver = {}, - dockerls = {}, - volar = {}, - astro = {}, html = {}, - cssls = {}, + tsserver = {}, + volar = {}, + dockerls = {}, jsonls = {}, - pyright = {}, yamlls = {} } @@ -74,9 +72,9 @@ local on_attach = function(_, bufnr) end, '[W]orkspace [L]ist Folders') -- Create a command `:Format` local to the LSP buffer - vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) - vim.lsp.buf.format() - end, { desc = 'Format current buffer with LSP' }) + -- vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) + -- vim.lsp.buf.format() + -- end, { desc = 'Format current buffer with LSP' }) end -- nvim-cmp supports additional completion capabilities, so broadcast that to servers @@ -94,10 +92,13 @@ mason_lspconfig.setup { -- Mason configure servers. mason_lspconfig.setup_handlers { function(server_name) - lspconfig[server_name].setup { - capabilities = capabilities, + + local config = { on_attach = on_attach, + capabilities = capabilities, settings = servers[server_name], } + + lspconfig[server_name].setup(config) end } diff --git a/nvim/.config/nvim/lua/axp/plugins/null-ls/init.lua b/nvim/.config/nvim/lua/axp/plugins/null-ls/init.lua index e558824..558616a 100644 --- a/nvim/.config/nvim/lua/axp/plugins/null-ls/init.lua +++ b/nvim/.config/nvim/lua/axp/plugins/null-ls/init.lua @@ -1,15 +1,16 @@ -- Null-ls. -local status_null_ls, null_ls = pcall(require, 'null-ls') -if (not status_null_ls) then return end +local status, null_ls = pcall(require, 'null-ls') +if (not status) then return end --- Config. local prettier_config = vim.fn.stdpath('config') .. '/lua/axp/plugins/null-ls/.prettierrc' local formatting = null_ls.builtins.formatting --- local diagnostics = null_ls.builtins.diagnostics -- Init. null_ls.setup { - sources = { - formatting.prettier.with({ extra_args = { "--config", prettier_config } }) - } + sources = {}, + on_attach = function (client, bufnr) + if client.supports_method('textDocument/formatting') then + print('Test textDocument/formatting') + end + end } diff --git a/nvim/.config/nvim/lua/axp/plugins/null-ls/init.old.lua b/nvim/.config/nvim/lua/axp/plugins/null-ls/init.old.lua new file mode 100644 index 0000000..e558824 --- /dev/null +++ b/nvim/.config/nvim/lua/axp/plugins/null-ls/init.old.lua @@ -0,0 +1,15 @@ +-- Null-ls. +local status_null_ls, null_ls = pcall(require, 'null-ls') +if (not status_null_ls) then return end + +-- Config. +local prettier_config = vim.fn.stdpath('config') .. '/lua/axp/plugins/null-ls/.prettierrc' +local formatting = null_ls.builtins.formatting +-- local diagnostics = null_ls.builtins.diagnostics + +-- Init. +null_ls.setup { + sources = { + formatting.prettier.with({ extra_args = { "--config", prettier_config } }) + } +} diff --git a/nvim/.config/nvim/lua/axp/plugins/prettier.lua b/nvim/.config/nvim/lua/axp/plugins/prettier.lua new file mode 100644 index 0000000..fcca015 --- /dev/null +++ b/nvim/.config/nvim/lua/axp/plugins/prettier.lua @@ -0,0 +1,15 @@ +local status, prettier = pcall(require, 'prettier') +if (not status) then return end + +prettier.setup { + bin = 'prettier', + filetype = { + 'html', + 'typescript', + 'typescriptreact', + 'css', + 'sass', + 'scss', + 'json' + } +} diff --git a/nvim/.config/nvim/lua/axp/plugins/treesitter.lua b/nvim/.config/nvim/lua/axp/plugins/treesitter.lua index 4f8991f..9759f47 100644 --- a/nvim/.config/nvim/lua/axp/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/axp/plugins/treesitter.lua @@ -2,7 +2,6 @@ local status, ts = pcall(require, 'nvim-treesitter.configs') if (not status) then return end ts.setup { - -- A list of parser names, or 'all' (the four listed parsers should always be installed) ensure_installed = { 'dockerfile', 'lua', @@ -10,6 +9,7 @@ ts.setup { 'bash', 'javascript', 'typescript', + 'tsx', 'json', 'html', 'pug', @@ -23,42 +23,17 @@ ts.setup { 'astro', 'cmake' }, - - -- Install parsers synchronously (only applied to `ensure_installed`) + ignore_install = {}, + modules = {}, sync_install = false, - - -- Automatically install missing parsers when entering buffer - -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally auto_install = true, - - -- List of parsers to ignore installing (for 'all') - -- ignore_install = { 'javascript' }, - - ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) - -- parser_install_dir = '/some/path/to/store/parsers', -- Remember to run vim.opt.runtimepath:append('/some/path/to/store/parsers')! - + autotag = { enable = true }, highlight = { enable = true, - - -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to - -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is - -- the name of the parser) - -- list of language that will be disabled - -- disable = { 'c', 'rust' }, - - -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files - disable = function(lang, buf) - local max_filesize = 100 * 1024 -- 100 KB - local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) - if ok and stats and stats.size > max_filesize then - return true - end - end, - - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, + disable = {}, + }, + indent = { + enable = true, + disable = {} } } diff --git a/nvim/.config/nvim/plugin/packer_compiled.lua b/nvim/.config/nvim/plugin/packer_compiled.lua index 7491e70..0375084 100644 --- a/nvim/.config/nvim/plugin/packer_compiled.lua +++ b/nvim/.config/nvim/plugin/packer_compiled.lua @@ -49,8 +49,8 @@ local function save_profiles(threshold) end time([[Luarocks path setup]], true) -local package_path_str = "/home/antoxa/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/antoxa/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/antoxa/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/antoxa/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" -local install_cpath_pattern = "/home/antoxa/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" +local package_path_str = "/home/antoxa/.cache/nvim/packer_hererocks/2.1.1694285958/share/lua/5.1/?.lua;/home/antoxa/.cache/nvim/packer_hererocks/2.1.1694285958/share/lua/5.1/?/init.lua;/home/antoxa/.cache/nvim/packer_hererocks/2.1.1694285958/lib/luarocks/rocks-5.1/?.lua;/home/antoxa/.cache/nvim/packer_hererocks/2.1.1694285958/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/antoxa/.cache/nvim/packer_hererocks/2.1.1694285958/lib/lua/5.1/?.so" if not string.find(package.path, package_path_str, 1, true) then package.path = package.path .. ';' .. package_path_str end @@ -109,11 +109,6 @@ _G.packer_plugins = { path = "/home/antoxa/.local/share/nvim/site/pack/packer/start/nightfox.nvim", url = "https://github.com/EdenEast/nightfox.nvim" }, - ["null-ls.nvim"] = { - loaded = true, - path = "/home/antoxa/.local/share/nvim/site/pack/packer/start/null-ls.nvim", - url = "https://github.com/jose-elias-alvarez/null-ls.nvim" - }, ["nvim-autopairs"] = { loaded = true, path = "/home/antoxa/.local/share/nvim/site/pack/packer/start/nvim-autopairs", @@ -144,6 +139,11 @@ _G.packer_plugins = { path = "/home/antoxa/.local/share/nvim/site/pack/packer/start/plenary.nvim", url = "https://github.com/nvim-lua/plenary.nvim" }, + ["prettier.nvim"] = { + loaded = true, + path = "/home/antoxa/.local/share/nvim/site/pack/packer/start/prettier.nvim", + url = "https://github.com/MunifTanjim/prettier.nvim" + }, ["telescope.nvim"] = { loaded = true, path = "/home/antoxa/.local/share/nvim/site/pack/packer/start/telescope.nvim",