Add :RStrip command to strip trailing white space
This commit is contained in:
		
							parent
							
								
									f95a8fb8e5
								
							
						
					
					
						commit
						1e4412a954
					
				@ -1,3 +1,12 @@
 | 
				
			|||||||
 | 
					-- :RString Strip white psace from right of all lines, ranges supported
 | 
				
			||||||
 | 
					vim.api.nvim_create_user_command('RStrip', function(opts)
 | 
				
			||||||
 | 
					  local pos = vim.fn.getcurpos(vim.api.nvim_get_current_win())
 | 
				
			||||||
 | 
					  local range = tostring(opts.line1) .. ',' .. tostring(opts.line2)
 | 
				
			||||||
 | 
					  vim.cmd.execute("'" .. range .. 's/\\s\\+$//e' .. "'")
 | 
				
			||||||
 | 
					  vim.cmd.nohlsearch()
 | 
				
			||||||
 | 
					  vim.fn.setpos('.', pos)
 | 
				
			||||||
 | 
					end, { range = '%' })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- :TabWidth <N> set the tab width for the current buffer
 | 
					-- :TabWidth <N> set the tab width for the current buffer
 | 
				
			||||||
vim.api.nvim_create_user_command('TabWidth', function(opts)
 | 
					vim.api.nvim_create_user_command('TabWidth', function(opts)
 | 
				
			||||||
  -- Set the tab width for the current filetype
 | 
					  -- Set the tab width for the current filetype
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user