Always make :Build/:BuildDir available
Don't attached this functionality to only c/cpp filetypes.
This commit is contained in:
		
							parent
							
								
									0c1328ead4
								
							
						
					
					
						commit
						831ac41440
					
				| @ -1 +0,0 @@ | ||||
| require('build').create_commands() | ||||
| @ -1,4 +1,2 @@ | ||||
| vim.opt.commentstring = '//%s' | ||||
| vim.opt.matchpairs:append('<:>') | ||||
| 
 | ||||
| require('build').create_commands() | ||||
|  | ||||
| @ -151,22 +151,20 @@ function build.list_targets() | ||||
|   return targets | ||||
| end | ||||
| 
 | ||||
| function build.create_commands() | ||||
|   local buffer = vim.api.nvim_get_current_buf() | ||||
| local buffer = vim.api.nvim_get_current_buf() | ||||
| 
 | ||||
|   -- Create :BuildDir command | ||||
|   vim.api.nvim_buf_create_user_command(buffer, 'BuildDir', function(opts) | ||||
|     build.set_dir(opts.fargs[1]) | ||||
|   end, { | ||||
|     bang = true, nargs = '?', complete = build.list_dirs, | ||||
|   }) | ||||
| -- Create :BuildDir command | ||||
| vim.api.nvim_buf_create_user_command(buffer, 'BuildDir', function(opts) | ||||
|   build.set_dir(opts.fargs[1]) | ||||
| end, { | ||||
|   bang = true, nargs = '?', complete = build.list_dirs, | ||||
| }) | ||||
| 
 | ||||
|   -- Create :Build command | ||||
|   vim.api.nvim_buf_create_user_command(buffer, 'Build', function(opts) | ||||
|     build.run(opts.fargs) | ||||
|   end, { | ||||
|     bang = true, nargs = '*', complete = build.list_targets, | ||||
|   }) | ||||
| end | ||||
| -- Create :Build command | ||||
| vim.api.nvim_buf_create_user_command(buffer, 'Build', function(opts) | ||||
|   build.run(opts.fargs) | ||||
| end, { | ||||
|   bang = true, nargs = '*', complete = build.list_targets, | ||||
| }) | ||||
| 
 | ||||
| return build | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user