You are not logged in.

#1 2010-05-20 19:35:39

ryuuzaki
Member
Registered: 2008-09-22
Posts: 10

Vim and ManageHooks

Hi there, I need help moving things im editing with "Vim" to my "3:code" workspace

this is the basic code in my ManageHooks segment in my xmonad.hs:

myManageHook = composeAll . concat $

    [ [className =? c      --> doFloat | c <- myFloats]
    , [className =? e      --> doF (W.shift "3:code") | e <- code]
    ]
    where
      myFloats = ["Gimp"]
      code = ["Vim"]

Funny thing is if i install Gvim and add it to my ManageHook, it will move all the things im editing with Gvim to my "3:code" workspace.

But if i install vim, and open files with vim, it opens in the current workspace.

Can someone help me with this? I have a feeling its just an easy fix, i've been looking around the xmonad thread but cant find anything close to it and when i used google, i've found ppl using query and fmap with "isPrefixOf", but my haskell programming skills isnt up there yet and looking at their code is very confusing.

Thanks in advance big_smile

Last edited by ryuuzaki (2010-05-20 19:38:15)

Offline

#2 2010-05-20 23:56:19

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: Vim and ManageHooks

vim doesn't run in its own window; It runs in a terminal that has its own window. I think that you'll need to use 'title' instead of 'className' somehow, but I'm not sure how to do it. xprop for an empty vim session in urxvt on my machine shows "[No Name] - VIM".

Offline

#3 2010-05-21 04:24:05

ryuuzaki
Member
Registered: 2008-09-22
Posts: 10

Re: Vim and ManageHooks

Hi,

Thanks for the reply, with your tip i looked around and here is what i got so far:

myManageHook = composeAll . concat $

    [ 
      [className =? c      --> doFloat | c <- myFloats]
    , [ className =? e      --> doF (W.shift "3:code") | e <- code]
    , [ fmap ( c `isInfixOf`) title     --> doF (W.shift "3:code") | c <- code ]
    ]
    where
      myFloats = ["Gimp"]
      code = ["vim", "vim:"]

It still does not switch to my "3:code" workspace. I have no idea how fmap works so any help would be helpful. big_smile

Offline

#4 2010-05-22 01:57:10

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: Vim and ManageHooks

I'm still a little out of my range here, but xprop sees vim as VIM (all caps). These things are case sensitive.

Offline

#5 2010-05-22 05:05:32

mikesd
Member
From: Australia
Registered: 2008-02-01
Posts: 788
Website

Re: Vim and ManageHooks

I use:

...
, [ fmap ( "JAVA:" `isInfixOf`) title --> doCenterFloat]
...

to auto float any of my Java apps as I always include "JAVA:" in the window title.

This should work:

...
, [ fmap ( "VIM" `isInfixOf`) title     --> doF (W.shift "3:code")]
...

though you will probably be better off with `isSuffixOf` [1] as on my system the title looks like "<filename> (<dir>) - VIM" and matching "VIM" anywhere in the title will match all sorts of things eg a google search for VIM in your browser. Even better would be to match on "- VIM" or whatever it is on your system. As skottish mentioned, check with xprop.

[1] http://www.haskell.org/ghc/docs/6.12.1/ … isPrefixOf

Offline

#6 2010-05-22 06:27:48

pseup
Member
Registered: 2008-06-06
Posts: 103

Re: Vim and ManageHooks

You can also change the vim titlestring to whatever you want via the 'titlestring' option, if you want something a bit more specific to match against.

I have 'set titlestring=[vim]\ %f' which simply turns out "[vim] filename"

Offline

Board footer

Powered by FluxBB