|  |  | @ -1,4 +1,4 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | -- Empty keymap for the menu |  |  |  | 
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | vim.keymap.set("n", "<leader>t", function() end, { desc = "+Todos" }) |  |  |  | vim.keymap.set("n", "<leader>t", function() end, { desc = "+Todos" }) | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | -- add new todo line when previous is already a todo |  |  |  | -- add new todo line when previous is already a todo | 
			
		
	
	
		
		
			
				
					|  |  | @ -58,16 +58,18 @@ local function add_todo() | 
			
		
	
		
		
			
				
					
					|  |  |  | 	local closedpattern = "^%s*%- %[[x]%]" |  |  |  | 	local closedpattern = "^%s*%- %[[x]%]" | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	local line = vim.api.nvim_get_current_line() |  |  |  | 	local line = vim.api.nvim_get_current_line() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	local spaces = string.match(line, "^%s*") | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	if not string.match(line, openpattern) and not string.match(line, closedpattern) then |  |  |  | 	if not string.match(line, openpattern) and not string.match(line, closedpattern) then | 
			
		
	
		
		
			
				
					
					|  |  |  | 		if not string.sub(line, 1, 1) == " " then |  |  |  | 		line = spaces .. "- [ ] " .. line | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			line = "- [ ] " .. line |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 			vim.api.nvim_set_current_line(line) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		else |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 			line = "- [ ]" .. line |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		vim.api.nvim_set_current_line(line) |  |  |  | 		vim.api.nvim_set_current_line(line) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		-- if not string.sub(line, 1, 1) == " " then | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		-- 	line = "- [ ] " .. line | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		-- 	vim.api.nvim_set_current_line(line) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		-- else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		-- 	line = "- [ ]" .. line | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		-- 	vim.api.nvim_set_current_line(line) | 
			
		
	
		
		
			
				
					
					|  |  |  | 		end |  |  |  | 		end | 
			
		
	
		
		
			
				
					
					|  |  |  | 		-- vim.api.nvim_feedkeys("A", "n", true) -- move cursor to the end of the line |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 	end |  |  |  | 	end | 
			
		
	
		
		
			
				
					
					|  |  |  | end |  |  |  | end | 
			
		
	
		
		
			
				
					
					|  |  |  | vim.keymap.set("n", "<leader>ta", add_todo, { desc = "Add todo" }) |  |  |  | vim.keymap.set("n", "<leader>ta", add_todo, { desc = "Add todo" }) | 
			
		
	
	
		
		
			
				
					|  |  | 
 |