oni icon indicating copy to clipboard operation
oni copied to clipboard

How do I set the filetype for a particular extension

Open bennybobw opened this issue 8 years ago • 3 comments

Oni Version: 0.3.4 Neovim Version (Linux only): v0.2.1-dev Operating System: Ubuntu 18.04

Describe your issue

Sorry for such a simple question. I'm trying to add filetypes for php to my config. Here's what I have:

export const configuration = {
    //add custom config here, such as

    "ui.colorscheme": "nord",

    //"oni.useDefaultConfig": true,
    //"oni.bookmarks": ["~/Documents"],
    //"oni.loadInitVim": false,
    //"editor.fontSize": "12px",
    //"editor.fontFamily": "Monaco",
    "language.php.textMateGrammar": {
      "php": "/opt/Oni/resources/app/extensions/php/syntaxes/php.tmLanguage.json",   
      ".theme": "/opt/Oni/resources/app/extensions/php/syntaxes/php.tmLanguage.json"   
    },

    // UI customizations
    "ui.animations.enabled": true,
    "ui.fontSmoothing": "auto"
    
}

But when I open a theme file, the console says:

[LanguageManager::_onBufferEnter] Setting language for file /var/www/howlround.lxc/site/web/themes/custom/howlround/howlround.theme to image

bennybobw avatar May 30 '18 20:05 bennybobw

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.

oni-bot avatar May 30 '18 20:05 oni-bot

I'm not sure how to configure filetypes in the oni config, but if you are using your own init.vim file you can add the following lines to override the filetype detection:

augroup php_theme
  au!
  autocmd BufNewFile,BufRead *.theme   set filetype=php
augroup END

You can also just run :setf php while the file is open, but you will have to do this manually every time you open a .theme file.

parkerault avatar May 30 '18 23:05 parkerault

Cool, I'm still figuring out how oni and neovim play together. Thanks!

bennybobw avatar Jun 01 '18 16:06 bennybobw