| 
					
				 | 
			
			
				@@ -12,6 +12,32 @@ vim.filetype.add({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+-- helpers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+local function resolve_git_path(buf_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  local bufname = vim.api.nvim_buf_get_name(buf_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if not vim.startswith(bufname, "fugitive://") then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  end 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  local parsed = vim.fn.FugitiveParse(bufname) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  local resolved_path = parsed[1] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  local repo = parsed[2] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if resolved_path == "" then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  end 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  local parts = vim.split(resolved_path, ':') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  local commit = parts[1] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  local path = parts[2] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    repo = repo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    commit = commit, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    path = path, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+end 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 -- file/buffer/etc picker 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 local telescope_actions = require('telescope.actions') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 local action_state = require('telescope.actions.state') 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -133,25 +159,18 @@ end 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 -- custom picker for files within a commit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 _G.commit_files = function(opts) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  local current_path = vim.api.nvim_buf_get_name(0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  local parsed = vim.fn.FugitiveParse(current_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  local resolved_path = parsed[1] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  local repo = parsed[2] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  if resolved_path == "" then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  local resolved = resolve_git_path(0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if not resolved then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     vim.print("current file is not a fugitive path") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   end 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  local parts = vim.split(resolved_path, ':') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  local commit = parts[1] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   opts = opts or {} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   telescope_pickers.new(opts, { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    prompt_title = commit, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    finder = telescope_finders.new_oneshot_job({ "git", "ls-tree", "--name-only", "-r", commit }, { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    prompt_title = resolved.commit, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    finder = telescope_finders.new_oneshot_job({ "git", "ls-tree", "--name-only", "-r", resolved.commit }, { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       entry_maker = function(entry) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        local path = string.format("fugitive://%s//%s/%s", repo, commit, entry) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        local path = string.format("fugitive://%s//%s/%s", resolved.repo, resolved.commit, entry) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           path = path, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           value = entry, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -186,7 +205,32 @@ _G.commit_files = function(opts) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 end 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 -- shows added/removed/changed lines 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-require('gitsigns').setup() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+local MiniDiff = require('mini.diff') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+MiniDiff.setup({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  view = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    style = 'sign', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    signs = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      delete = '_', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  source = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    MiniDiff.gen_source.git(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    -- handle fugitive paths 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      name = "fugitive", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      attach = function(buf_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        local resolved = resolve_git_path(buf_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if not resolved or resolved.path == "" then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          return false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        end 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        local source = vim.fn.FugitiveFind(string.format("%s~1:%s", resolved.commit, resolved.path)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        local text = vim.fn['fugitive#readfile'](source) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        MiniDiff.set_ref_text(buf_id, text) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      end 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 require('mini.statusline').setup({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   content = { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -222,7 +266,17 @@ require('mini.indentscope').setup() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 require('mini.comment').setup() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 -- surround actions 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-require('mini.surround').setup() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+require('mini.surround').setup({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  custom_surroundings = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    -- js template string 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ['$'] = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      output = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left = '`${', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        right = '}`', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 local spec_treesitter = require('mini.ai').gen_spec.treesitter 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -326,6 +380,11 @@ require('blink.cmp').setup({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     enabled = false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   completion = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    accept = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      auto_brackets = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        enabled = false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     documentation = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       auto_show = true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       auto_show_delay_ms = 500, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -353,3 +412,15 @@ require('blink.cmp').setup({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 -- typescript-vim compiler options 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 vim.g.typescript_compiler_options = '--incremental --noEmit' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+-- stuff 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+_G.toggle_end_char = function(char) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  local cursor = vim.api.nvim_win_get_cursor(0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  local row = cursor[1] - 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  local end_char = vim.api.nvim_buf_get_text(0, row, -2, row, -1, {})[1] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if end_char == char then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    vim.api.nvim_buf_set_text(0, row, -2, row, -1, {}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    vim.api.nvim_buf_set_text(0, row, -1, row, -1, { char }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  end 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+end 
			 |