alajmo / pinto

:paintbrush: Create, view and edit vim color themes
https://pintovim.dev
MIT License
29 stars 0 forks source link

Import .vim files that were exported? #13

Open leftbones opened 2 years ago

leftbones commented 2 years ago

I spent quite awhile yesterday remaking my personal theme, which I then exported to test out. I got a .vim version and I also did something that downloaded it as just the name with no extension, didn't look at that file until today.

I come back today to continue editing, try to import, and it won't take either file. I see it wants a JSON, the file I saved yesterday had no extension so I opened it in TextEdit and it's just blank. Tried adding .json to it but that's no good obviously because it's empty.

Is there any way to salvage this? Import my .vim that I had exported yesterday? Or am I just screwed and I have to start over?

alajmo commented 2 years ago

Hey, sorry about the inconvenience, unfortunately, it's not possible to import the vim file directly :(.

However, the vim file is easily parsable so one could quickly write a script to extract the keyword details and then manually input it into a JSON file and import that file. The vim export function doesn't however export the palette, so if you had created a custom one then that is lost, except for the colors you had in your vim export.

If you paste your vim config here then I can take a look at it and create that script and integrate it into pinto later.

{
  "id": "05e10e74-8f58-4c0c-9dfa-d22ccfe9eec0",
  "created": 1649189382472,
  "updated": 1649189460458,
  "theme": {
    "id": "05e10e74-8f58-4c0c-9dfa-d22ccfe9eec0",
    "name": "kaka",
    "version": "v1",
    "editor": "vim",
    "editorTheme": "dark",
    "fontSettings": {
      "lineHeight": "14",
      "fontSize": "12",
      "fontFamily": "monospace"
    },
    "keywords": {

      "String": {
        "name": "String",
        "foregroundColor": "#ffffff",
        "backgroundColor": "#1c1c1c",
        "bold": false,
        "italic": false,
        "underline": false,
        "lineThrough": false,
        "active": true,
        "enabled": true
      },

      ...
    },

    "groups": {
      "javascript": true,
      "typescript": false,
      "html": false,
      "css": false,
      "markdown": false,
      "bash": false,
      "c": false,
      "cpp": false,
      "go": false,
      "lisp": false,
      "lua": false,
      "rust": false,
      "ruby": false,
      "perl": false,
      "haskell": false,
      "clojure": false,
      "erlang": false,
      "python": false,
      "php": false,
      "json": false,
      "yaml": false,
      "toml": false,
      "make": false,
      "vim": false,
      "misc": true,
      "major": true,
      "minor": true
    },

    groupKeywords": {
      "major": [
        "Normal",
        "Comment",
        "Constant",
        "Identifier",
        "Statement",
        "PreProc",
        "Type",
        "Special",
        "Underlined",
        "Ignore",
        "Error",
        "Todo"
      ],

      ...
    },

    "keywordLinks": {
      "String": "Constant",
      "Character": "Constant",
      "Number": "Constant",
      "Boolean": "Constant",
      "Float": "Constant",
      "Function": "Identifier",
      "Conditional": "Statement",
      "Repeat": "Statement",
      "Label": "Statement",
      "Operator": "Statement",
      "Keyword": "Statement",
      "Exception": "Statement",
      "Include": "PreProc",
      ...
    },

    "keywordGroups": {
      "Debug": "minor",
      "SpecialComment": "minor",
      "Delimiter": "minor",
      "Tag": "minor",
      "SpecialChar": "minor",
      "Typedef": "minor",
      "Structure": "minor",
      "StorageClass": "minor",
      "PreCondit": "minor",
      "Macro": "minor",
      "Define": "minor",
      "Include": "minor",
      "Exception": "minor",
      "Keyword": "minor",
      "Operator": "minor",
      "Label": "minor",
      "Repeat": "minor",
      "Conditional": "minor",
      ...
    },

    "fileHandle": null,
    "created": 1649189382472,
    "updated": 1649189460458

  "palette": {
    "palettes": [
      {
        "name": "Untitled",
        "colors": ["#000000", "#ffffff", "#A3BFA8"],
        "type": "default"
      },
      {
        "name": "xterm 256 colors",
        "colors": [
          "#000000",
          "#800000",
          "#008000",
          "#808000",
           ...
        ],
        "type": "xterm"
      }
    ]
  }