2

I'm trying to enable weather widget for powerline but with no success. I added this code

{
    "name": "weather",
    "priority": 50,
    "args": {
        "unit": "F",
        "location_query": "oslo, norway"
    }
}

at the end of my theme file. When I start MacVim I get an error

Error detected while processing VimEnter Auto commands for "*":
2014-01-30 14:13:11,122:ERROR:vim:segment_generator:Failed to generate segment from {u'priority': 50, u'args': {u'location_query': u'oslo, norway', u'u
nit': u'F'}, u'name': u'weather'}: 'module' object has no attribute 'weather'

I've read powerline documentation but I'm still confused. Any help will be appreciated.

moemoe
  • 63
  • 5
  • 2
    Vim is not an operating system; you're confusing it with the _other_ editor, which is everything but a kitchen sink. – Ingo Karkat Jan 30 '14 at 12:22
  • @Ingo Karkat ??? Did I say vim is an operating system???? – moemoe Jan 30 '14 at 12:36
  • When you start adding weather information into your statusline, it'll soon resemble one... How's that related to text editing? Do you code outside?! (And please forgive me my feeble attempts at an inside joke, which you obviously failed to get.) – Ingo Karkat Jan 30 '14 at 12:39
  • As meteorologist this feature is important for me. I'm using vim for writing a different kind of articles. – moemoe Jan 30 '14 at 12:46
  • As a meteorologist, you certainly have better ways to know what the weather is. As a non-meteorologist, I have a window. Also, powerline issues should be discussed on powerline's issue tracker. – romainl Jan 30 '14 at 12:52

1 Answers1

3

Here is how I configured weather for the Shell. I don't think it is possible with VI as it is not listed in the available segment

https://powerline.readthedocs.org/en/latest/configuration/segments/vim.html

Create the following folder tree:

    ~/.config/powerline/config.json
    ~/.config/powerline/themes/shell/netsamir.json
    ~/.config/powerline/colorschemes/shell/netsamir.json

~/.config/powerline/config.json

{
    "common": {
        "term_truecolor": false
    },
    "ext": {
      "shell": {
            "theme": "netsamir",
            "colorscheme": "netsamir"
        },            
    }
}

~/.config/powerline/themes/shell/netsamir.json

{
    "segments": {
        "above": [
            {
                "left": [
                   {
                        "function":  "powerline.segments.common.wthr.weather",
                        "args": {
                            "unit": "C"
                       }
                    },
                    {
                        "name": "user",
                        "function": "powerline.segments.common.env.user",
                        "priority": 30
                    },
                    {
                        "function": "powerline.segments.common.vcs.branch",
                        "args": {
                            "status_colors": true,
                            "ignore_statuses": ["U"]
                         }
                    },
                    {
                        "name": "cwd",
                        "function": "powerline.segments.common.env.cwd"
                    }
                ]
            }
         ],
        "left": [
            {
                "type": "string",
                "contents": ">",
                "highlight_groups": ["promptline"],
                "draw_soft_divider": false
            },
            {
                "type": "string",
                "contents": "",
                 "highlight_groups": ["blank"],
                "draw_hard_divider": false
            }
        ]
    }
}

~/.config/powerline/colorschemes/shell/netsamir.json

{
    "name": "netsamir",
    "groups": {
        "information:additional":    { "fg": "gray9", "bg": "gray4", "attrs": [] },
        "information:regular":       { "fg": "gray10", "bg": "gray4", "attrs": [] },
        "information:highlighted":   { "fg": "white", "bg": "gray4", "attrs": ["bold"] },
        "information:priority":      { "fg": "brightyellow", "bg": "mediumorange", "attrs": [] },
        "hostname":                  { "fg": "black", "bg": "gray10", "attrs": ["bold"] },
        "background:divider":        "information:additional",
        "weather":                   { "fg": "gray9", "bg": "gray2", "attrs": [] },
        "user":                      { "fg": "brightcyan", "bg": "darkestblue", "attrs": ["bold"] },
        "branch":                    { "fg": "gray9", "bg": "gray2", "attrs": [] },
        "branch_dirty":              { "fg": "black", "bg": "orangered", "attrs": [] },
        "branch_clean":              { "fg": "gray9", "bg": "gray2", "attrs": [] },
        "branch:divider":            { "fg": "gray7", "bg": "gray2", "attrs": [] },
        "cwd":                       "information:additional",
        "cwd:current_folder":        "information:highlighted",
        "cwd:divider":               { "fg": "gray7", "bg": "gray4", "attrs": [] },
        "promptline": { "fg": "white", "bg": "darkestblue", "attrs": ["bold"] },
        "blank": { "fg": "black", "bg": "black", "attrs": [] }
    }
}
Samir Sadek
  • 1,620
  • 1
  • 17
  • 20