using new filetype
Closed this issue · 1 comments
azinsharaf commented
i can use the code runner on py
files successfully. The issue is i have a python file with pyt
extension (from a third party application i support) and i can't run it via code runner. How can i define a new file extension (pyt
here) in the config instead of filetype
?
fyi, I have added the file type in neovim polish function and pyright lsp recognizes it as python correctly.
code runner config:
return {
"CRAG666/code_runner.nvim",
enabled = true,
event = "VeryLazy",
init = function() require("which-key").register({ ["<leader>r"] = { name = "Code Runner" } }, { mode = "n" }) end,
opts = {
mode = "float", --"toggle", "float", "tab", "toggleterm"
focus = true,
term = {
position = "bot",
size = 25,
},
float = {
border = "single",
height = 0.7,
width = 0.5,
},
filetype = {
python = "C:/Users/asharaf/AppData/Local/ESRI/conda/envs/arcgispro-py3-clone/python.exe"
-- python = "C:/Python27/ArcGIS10.8/python.exe"
},
},
keys = {
{ "<leader>rr", "<cmd>RunCode<cr>", desc = "Run Code" },
{ "<leader>rf", "<cmd>RunFile<cr>", desc = "Run File" },
-- { "<leader>rft", "<cmd>RunFile tab<cr>", desc = "Run File Tab" },
{ "<leader>rp", "<cmd>RunProject<cr>", desc = "Run Project" },
{ "<leader>rc", "<cmd>RunClose<cr>", desc = "Run Close" },
-- { "<leader>crf", "<cmd>CRFiletype<cr>", desc = "Open Json supported files" },
-- { "<leader>crp", "<cmd>CRProject<cr>", desc = "Open Json list of projects" },
},
}
neovim new filetype config:
return {
polish = function()
-- Set up custom filetypes
vim.filetype.add {
extension = {
pyt = "python",
},
-- filename = {
-- ["Foofile"] = "fooscript",
-- },
-- pattern = {
-- ["~/%.config/foo/.*"] = "fooscript",
-- },
}
end,
}
azinsharaf commented
it is working fine now, so i close this.