Compare commits
	
		
			3 Commits
		
	
	
		
			07de246f77
			...
			7e85124b10
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 7e85124b10 | |||
| 171ed7447e | |||
| 197eafd34d | 
							
								
								
									
										21
									
								
								nvim/.config/nvim/lua/config/null-ls.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								nvim/.config/nvim/lua/config/null-ls.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| local null_ls_status_ok, null_ls = pcall(require, "null-ls") | ||||
| if not null_ls_status_ok then | ||||
|   return | ||||
| end | ||||
|  | ||||
| -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting | ||||
| local formatting = null_ls.builtins.formatting | ||||
| -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics | ||||
| local diagnostics = null_ls.builtins.diagnostics | ||||
|  | ||||
| null_ls.setup { | ||||
|   debug = false, | ||||
|   sources = { | ||||
|     formatting.prettier.with { extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }, | ||||
|     formatting.black.with { extra_args = { "--fast" } }, | ||||
|     diagnostics.flake8, | ||||
|   }, | ||||
| } | ||||
|  | ||||
| local map = vim.api.nvim_set_keymap | ||||
| map('n', '<leader>f', '<cmd>lua vim.lsp.buf.formatting_sync()<cr>', {}) | ||||
| @@ -1,6 +1,22 @@ | ||||
| local lsp_installer = require("nvim-lsp-installer") | ||||
|  | ||||
| -- Register a handler that will be called for each installed server when it's ready (i.e. when installation is finished | ||||
| -- or if the server is already installed). | ||||
| lsp_installer.on_server_ready(function(server) | ||||
|     local opts = {} | ||||
|  | ||||
|     -- (optional) Customize the options passed to the server | ||||
|     -- if server.name == "tsserver" then | ||||
|     --     opts.root_dir = function() ... end | ||||
|     -- end | ||||
|  | ||||
|     -- This setup() function will take the provided server configuration and decorate it with the necessary properties | ||||
|     -- before passing it onwards to lspconfig. | ||||
|     -- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md | ||||
|     server:setup(opts) | ||||
| end) | ||||
|  | ||||
| local nvim_lsp = require('lspconfig') | ||||
|  | ||||
| -- Use an on_attach function to only map the following keys | ||||
| -- after the language server attaches to the current buffer | ||||
| local on_attach = function(client, bufnr) | ||||
|   | ||||
| @@ -1,7 +1,46 @@ | ||||
| -- Only required if you have packer configured as `opt` | ||||
| vim.cmd [[packadd packer.nvim]] | ||||
| local fn = vim.fn | ||||
|  | ||||
| return require('packer').startup(function() | ||||
| -- Automatically install packer | ||||
| local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim" | ||||
| if fn.empty(fn.glob(install_path)) > 0 then | ||||
|   PACKER_BOOTSTRAP = fn.system { | ||||
|     "git", | ||||
|     "clone", | ||||
|     "--depth", | ||||
|     "1", | ||||
|     "https://github.com/wbthomason/packer.nvim", | ||||
|     install_path, | ||||
|   } | ||||
|   print "Installing packer close and reopen Neovim..." | ||||
|   vim.cmd [[packadd packer.nvim]] | ||||
| end | ||||
|  | ||||
| -- Autocommand that reloads neovim whenever you save the plugins.lua file | ||||
| vim.cmd [[ | ||||
|   augroup packer_user_config | ||||
|     autocmd! | ||||
|     autocmd BufWritePost plugins.lua source <afile> | PackerSync | ||||
|   augroup end | ||||
| ]] | ||||
|  | ||||
| -- Use a protected call so we don't error out on first use | ||||
| local status_ok, packer = pcall(require, "packer") | ||||
| if not status_ok then | ||||
|   return | ||||
| end | ||||
|  | ||||
| -- Have packer use a popup window | ||||
| packer.init { | ||||
|   display = { | ||||
|     open_fn = function() | ||||
|       return require("packer.util").float { border = "rounded" } | ||||
|     end, | ||||
|   }, | ||||
| } | ||||
|  | ||||
| return packer.startup(function(use) | ||||
|     -- Packer can manage itself | ||||
|     use 'wbthomason/packer.nvim' | ||||
|     use 'morhetz/gruvbox' | ||||
|  | ||||
|     -- Status line | ||||
| @@ -19,7 +58,8 @@ return require('packer').startup(function() | ||||
|     use { | ||||
|         'neovim/nvim-lspconfig', | ||||
|         requires = { | ||||
|             "hrsh7th/cmp-nvim-lsp" | ||||
|             "hrsh7th/cmp-nvim-lsp", | ||||
|             'williamboman/nvim-lsp-installer', | ||||
|         } | ||||
|     } | ||||
|     use { | ||||
| @@ -38,6 +78,12 @@ return require('packer').startup(function() | ||||
|     use {'hrsh7th/cmp-nvim-lsp', after = 'nvim-cmp'} | ||||
|     -- use {'f3fora/cmp-spell', after = 'nvim-cmp'} | ||||
|  | ||||
|     -- for formatters and linters | ||||
|     use { | ||||
|         "jose-elias-alvarez/null-ls.nvim", | ||||
|         config = [[require('config.null-ls')]] | ||||
|     } | ||||
|  | ||||
|  | ||||
|     use 'nvim-lua/popup.nvim' | ||||
|     use { | ||||
| @@ -80,4 +126,7 @@ return require('packer').startup(function() | ||||
|         config = [[require('config.colorizer')]], | ||||
|     } | ||||
|  | ||||
|     if PACKER_BOOTSTRAP then | ||||
|         require("packer").sync() | ||||
|     end | ||||
| end) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user