As of 2016-02-26, there will be no more posts for this blog. s/blog/pba/
Showing posts with label tab. Show all posts

some tweaks for coding Python in Vim


I have been wanting to have that red vertical line since I started coding Python. The current line highlighter is also one thing I want to have.

Now I have more than those. You can see the vimrc diff.

I didn't really need those indentation indication but they are definitely helpful. I found them in this blog post, the original is a after-syntax file and it's for tabs. I managed to make it work for spaces.

At first, all these are turned on by default. And I felt they did slow Vim a bit. So I made them to be switchable. I really didn't know much about Vim customization/scripting, so my skill in that diff must seem awful. Anything you have in mind, please leave a comment.


You can press F8, then press one of F7 to F10 to toggle those.

I think I used to press Ctrl+Shift+PageUp and Ctrl+Shift+PageDown when I started to use tabbing in Gnome Terminal or Gedit if I recall correctly.

I think Firefox did support such keys for some time, but I could be wrong. Chromium supports them. If you are a mouse person, you probably think this is not important. But if you also use multi-profile at the same time, i.e. using --no-remote for other profiles. The drag and drop for bookmarks or tabs doesnt work for those browser processes with no-remote, which causes you can not drag a tab handler to re-order tabs, hence you need another way to re-order.

Using Vimperator proves thats a great advantage once again. By adding the following lines to ~/.vimperatorrc:

map <C-S-PageUp> :tabm -1<CR>
map <C-S-PageDown> :tabm +1<CR>

I can use those keys to move a tab.

If you prefer JavaScript version, you can use:

map <C-S-PageUp> :js getBrowser().moveTabBackward()<CR>
map <C-S-PageDown> :js getBrowser().moveTabForward()<CR>

They work less perfect than Vimperator built-in command :tabm[ove] when the tab is the leftmost or rightmost tab and it also steals focus for tab handler.

I had known of this new Panorama feature in Firefox 4 from other blogs post titles. When I first saw Panorama, I thought that was Panoramio. I was wondering why Mozilla introduced Panoramio, then I read the title again and I did.

I totally forgot it when I just installed Firefox 4. I accidentally brought it up by pressing Ctrl+Space unawarely.

http://i.imgur.com/UQ94Ah.jpg

I thought What the heck just happened? then I was trying every key combinations I could think of to get back to normal browsing mode. I finally got it after I watched the introduction clip of Panorama.

https://i.ytimg.com/vi/5r0TQJ-gGi0/hqdefault.jpg

Just press Ctrl+Space again or click on thumbnail. I have no idea why I didnt try to click at first place.

Anyway, its a cool feature. You create some groups, organize them. They will even get together again next time you open them. Ctrl+Space allows you to cycle them over group by group, tab by tab. But its not a useful feature for me, I rarely would open tabs more than five. The screenshot above took me opening half of my bookmarks (liar!), I know some people are tabmanic or tabholics, Panorama must be their thing.

There is one more thing I want to mention, its the memory usage of these 16 tabs. Firefox only used less than 300 MB, I would bet its kind of improvement, though I had never known how much memory it takes for 16 tabs in previous tabs.

Keep Last Two Tabs is my first Chrome Extension, I wrote this post because the Extension page is only allowed 2,000 characters in description.

Note

This extension has been abandoned for years. (2016-02-10T04:03:35Z)

This is a silly extension. Its made to prevent Chrome quits when you close last tab. But its not really work as you may expect. It keeps you Chrome has at least two tabs. Because intercepting last tab closing is not possible, therefore this is one possible way to get around.

1   Source Code

You can download it on GitHub.

2   Notes

  • You may want to pin the leftmost tab and leave it there unused.
  • This extension is not for preventing the result after you click on windows close button by accident. That issue is not possible to resolve by using extension, currently. And this last tab closing and window closing issues are both should be resolved by core code not by extensions. This is just a temporarily silly workaround.
  • How to Close Chrome after installation of this extension? Press Alt+F4 or Click on X button on top-right corner of Chrome window.
  • Note by sozercan: If you have an application shortcut open, it wont close the main window. (Thanks!)
  • Please go to vote for better tab controlling1.
[1]http://www.google.com/support/chrome/bin/static.py?page=suggestions.cs&issue=107375&bucket=15653 is gone.

3   Issues

  • If there is only one normal tab with one or more pinned tab closed (aka ghost tab? still there, you can click to reopen), Chrome will exit if you close that only normal tab.
  • Currently, ghost tab is not able to be detected, we can see them as normal tabs, therefore we cant stop this happening. (2010-05-19) Updated 2010-07-24: Ghost tab seems to be removed in Chrome 6.

4   Changelog

  • 0.3.1 2010-08-09 - Do not close new tab which is chrome://newtab/
  • 0.3.0.1 2010-07-25 - Change (fix) the closing second tab to be for closing New Tabs. The previous way didnt cover some situations.
  • 0.3 2010-07-24 - Add new option for closing second tab if there were only two tabs when open new tab and second tab is the New Tab page (chrome://newtab/). (Suggested by manwe)
  • 0.2 2010-02-22 - Add Options page for whether creating tab in background by user decision. (Check the new option, would have behavior like first release)
  • 0.1.1 2010-02-08 - Tab creation in background for better experience (suggested by anonymous)
  • 0.1 2009-12-19 - First release.