@@ -73,22 +73,18 @@ A.gh_issue_insert = function(prompt_bufnr)
7373end
7474
7575A .gh_insert_markdown_link = function (prompt_bufnr )
76+ if not (vim .api .nvim_buf_get_option (vim .api .nvim_get_current_buf (), " modifiable" )) then
77+ return
78+ end
7679 local issue_number = close_telescope_prompt (prompt_bufnr )
77- local output = utils .get_os_command_output {
78- " gh" ,
79- " issue" ,
80- " view" ,
81- issue_number ,
82- " --json" ,
83- " number,title,url" ,
84- " --template" ,
85- ' {{printf "%.0f\\ x1f%s\\ x1f%s" .number .title .url}}' ,
80+ local text = utils .get_os_command_output {
81+ " gh" , " issue" , " view" , issue_number ,
82+ " --json" , " number,title,url" ,
83+ " --template" , ' {{printf "%.0f\\ x1f%s\\ x1f%s" .number .title .url}}' ,
8684 }
87- if output then
88- local tmp_table = vim .split (output [1 ], " \x1f " )
89- if vim .api .nvim_buf_get_option (vim .api .nvim_get_current_buf (), " modifiable" ) then
90- vim .api .nvim_put ({ string.format (" [%s (#%s)](%s)" , tmp_table [2 ], tmp_table [1 ], tmp_table [3 ]) }, " b" , true , true )
91- end
85+ if text then
86+ local tmp_table = vim .split (text [1 ], " \x1f " )
87+ vim .api .nvim_put ({ string.format (" [%s (#%s)](%s)" , tmp_table [2 ], tmp_table [1 ], tmp_table [3 ]) }, " b" , true , true )
9288 end
9389end
9490
0 commit comments