File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1112,5 +1112,27 @@ require('lspconfig').pylsp.setup {
11121112vim .keymap .set (' t' , ' <ESC>' , ' <C-\\ ><C-n>' , {})
11131113vim .keymap .set (' n' , ' <leader>xt' , ' :Telescope colorscheme<CR>' , {})
11141114vim .keymap .set ({ ' n' , ' x' }, ' s' , ' <Nop>' )
1115+ vim .keymap .set (' n' , ' <leader>xs' , function ()
1116+ local current_file = vim .fn .expand ' %:p'
1117+
1118+ local base = vim .fn .expand ' %:r' -- gets full path without extension
1119+ local ext = vim .fn .expand ' %:e' -- gets the file extension
1120+
1121+ local target
1122+ if ext == ' ts' then
1123+ target = base .. ' .html'
1124+ elseif ext == ' html' then
1125+ target = base .. ' .ts'
1126+ else
1127+ print ' Not a .ts or .html file'
1128+ return
1129+ end
1130+
1131+ if vim .fn .filereadable (target ) == 1 then
1132+ vim .cmd (' edit ' .. target )
1133+ else
1134+ print (' File does not exist: ' .. target )
1135+ end
1136+ end , { desc = ' Switch between .ts and .html files' })
11151137-- The line beneath this is called `modeline`. See `:help modeline`
11161138-- vim: ts=2 sts=2 sw=2 et
You can’t perform that action at this time.
0 commit comments