tmux status bar configuration - configuration

How is the status bar is customized? I noticed in this youtube video (at 3:05 - image below), the status bar looks very different than the default one that I see after installing tmux on my Mac OS X.
In particular, I like how the middle of the status bar shows the current program and the left side shows the name of only the current session. In comparison, my setup shows the name of all of the sessions and doesn't show the current application (for the currently focused pane).
If anyone could show me a sample configuration that could do this or show me where I can find the customization rules, that would be great! Thanks!
Update: In case anyone is curious, I was able to customize a status bar that is similar to the one seen in the video (minor tweaks) and you can find my config file on my github if you'd like to see an example.

The man page has very detailed descriptions of all of the various options (the status bar is highly configurable). Your best bet is to read through man tmux and pay particular attention to those options that begin with status-.
So, for example, status-bg red would set the background colour of the bar.
The three components of the bar, the left and right sections and the window-list in the middle, can all be configured to suit your preferences. status-left and status-right, in addition to having their own variables (like #S to list the session name) can also call custom scripts to display, for example, system information like load average or battery time.
The option to rename windows or panes based on what is currently running in them is automatic-rename. You can set, or disable it globally with:
setw -g automatic-rename [on | off]
The most straightforward way to become comfortable with building your own status bar is to start with a vanilla one and then add changes incrementally, reloading the config as you go.1
You might also want to have a look around on github or bitbucket for other people's conf files to provide some inspiration. You can see mine here2.
1 You can automate this by including this line in your .tmux.conf:
bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."
You can then test your new functionality with Ctrlb,Shiftr. tmux will print a helpful error message—including a line number of the offending snippet—if you misconfigure an option.
2 Note: I call a different status bar depending on whether I am in X or the console - I find this quite useful.

I used tmux-powerline to fully pimp my tmux status bar. I was googling for a way to change to background of the status bar when your typing a tmux command. When I stumbled on this post I thought I should mention it for completeness.
Update: This project is in a maintenance mode and no future functionality is likely to be added. tmux-powerline, with all other powerline projects, is replaced by the new unifying powerline. However this project is still functional and can serve as a lightweight alternative for non-python users.

I have been playing about with tmux today, trying to customised a little here and there, managed to get battery info displaying on the status right with a ruby script.
Copy the ruby script from http://natedickson.com/blog/2013/04/30/battery-status-in-tmux/ and save it as:
battinfo.rb in ~/bin
To make it executable make sure to run:
chmod +x ~/bin/battinfo.rb
edit your ~/.tmux.config and include this line
set -g status-right "#[fg=colour155]#(pmset -g batt | ~/bin/battinfo.rb) | #[fg=colour45]%d %b %R"

Do C-b, :show which will show you all your current settings. /green, nnn will find you which properties have been set to green, the default. Do C-b, :set window-status-bg cyan and the bottom bar should change colour.
List available colours for tmux
You can tell more easily by the titles and the colours as they're actually set in your live session :show, than by searching through the man page, in my opinion. It is a very well-written man page when you have the time though.
If you don't like one of your changes and you can't remember how it was originally set, you can open do a new tmux session. To change settings for good edit ~/.tmux.conf with a line like set window-status-bg -g cyan. Here's mine: https://gist.github.com/9083598

Related

How do I configure fpp (Facebook Path Picker) to open new tabs in macvim using a vimer alias?

I believe that I need to set the $FPP_EDITOR environment variable to be able to change the default editor that fpp would invoke when opening files.
I have aliased mvim to vimer -t with alias mvim="vimer -t". This means that the mvim command should open new files in the currently available (operating system level) macvim window, and even if a sequence of files is included, it should open them in new tabs in that (operating system level) window. So if I already have an instance of macvim running and I try to pass in 4 files, I now have one window with 5 tabs in it.
But when I try to use mvim as the editor (with export FPP_EDITOR="mvim"), it opens the files in new macvim (operating system level) window, in separate (vim buffer level) windows in a single tab. So if I already have an instance of macvim running and I try to pass in 4 files, I now have two macvim "instances" running in separate OS-level windows, one with 1 tab with 1 buffer-level window, and one with 1 tab with 4 buffer-level windows.
It seems like FPP must be doing more than just passing in files in a sequence as a suffix to the $FPP_EDITOR command. I'm not sure what that is, nor exactly how to figure it out.
This is an answer to the question (technically) that I figured out as I was writing out the question.
But, it's missing all the right extra info about what was going wrong, so I'm going to this as an answer, but will happily accept another answer that can do more than just answer the question per se, but can give some background info about why the aliasing only sorta works.
The key though (if you just want a solution) is to use
export FPP_EDITOR="vimer -t"
and this performs as desired. For some reason it does not seem that setting the environment variable to a command that is aliased uses the aliased command, if it has an available original meaning (which mvim does).

GitHub Website Publishing of "Knit"-Generated HTML files in RStudio

I want to share a step-by-step illustration on how to publish online your work on RStudio using GitHub pages.
A lot of people taking the Coursera courses on data have problems with it if they don't come from computer science, including myself, so I want to share a system that works. I'm sure it can be greatly improved.
Let's do it step-by-step, really easy:
1. Start with Github, not with RStudio.
Don't have an account, sign-up for one - it's free and incredibly valuable. Now go to Repositories (top menu bar), and press on the green button New in the upper-right-hand corner. Give a name to the repository ("test" for our puposes). You can skip the Description if you are in a hurry to proving to yourself that it works (same for the prompt to write some memo style one-liner under README). So go... click on Create Repository (green button). Now don't panic... just go directly to Settings (the cogwheel symbol in the vertical menu on the right-hand side). Perfect! One more click and we're there... Launch automatic page generator. Now we enter the guided part. Feel free to leave all this as is for now... We can modify it later, or we can go back and do it all over again when we know the end of the story (with a real repository that we do intend to publish. Click on Continue to layouts. Click on any of the designs (I chose "Architect)... And Publish page (green button upper-right corner). Beautiful!
Quick check: Click on Settings again, and check under GitHub Pages for the message: "Your site is published at http://...github.io/test. In my case the address is http://rinterested.github.io/test/ (was... I erased it after I finished this post) beacuse my Github account is RInterested. Very critical: pay attention to the structure: github.io without this there's no website. Now you can go to your browser, type the address and see that a new site has been born (caution: sometimes this takes minutes to materialize).
2. Now it's time to go to RStudio. If you're taking the Coursera course this is your comfort zone. If not I will assume that you've been working with [R], and that a simple download of RStudio (free online) is about to change your life for the better.
So we start RStudio and we go to the upper-right corner, where there is a cube containing an R, and the word Project. See it? Great, because we are going to start a New Project from the pull-down menu. Pop-up... which one to choose? Version Control is the answer. More pop-ups... No panicking... Click on the gray/red/green sideways GIT symbol ("Git Clone a project from a Git repository"). We have that, remember? We called it "Test". And we are facing a final screen with three fields to fill in. Under Repository URL we need to enter information that will require a quick trip back to Github for a second...
Are you there? OK... Do you see the HTTPS clone URL thing with a clipboard symbol on the right, half-way down within the test repository? Click on the clipboard symbol... Copied! Great! Now we go back to the screen with questions on RStudio, where we got re-routed, and do a right-click and paste, filling in the Repository URL field of the questionnaire. The rest is not critical. Press on Create Project... That's it!
3. Time to work. Let's now create a new R Markdown document by clicking on the corresponding option on the pull-down menu in the left-upper corner (green plus sign on a sheet of paper icon). Give it a name. You are the author. Select HTML. Click OK. Now you can modify, add, or just leave what popped-up on the screen as is to finish up the demonstration. Notice that there are so-called chunks of code started with ``{r} which indicate that the following code will be executed upon rendering the html document (or pdf). echo=FALSE means that only the result of the code (not the actual command) will be printed.
OK. Press on the top menu where you see a knitting pin (Knit HTML)... give it a name and save the document... Very important... whatever you name it it has to end up in .Rmd (case sensitive). What about "cars.Rmd"? Original enough... Save it and watch RStudio do its magic... Hopefully you're now admiring a beautiful webpage with a plot and numbers... Only one problem... It is NOT online.
4. Pushing our work to GitHub:
We are going now in the opposite direction. First, click on the GiT super-cool symbol on the top menu (above "knit HTML" depending on the configuration of your RStudio). It's a pull-down menu. Select Commit. You can select cars.html, or everything. Disregard a warning message, and post an ultra-short note under "Commit message". Whatever you want to write (e.g. "update"?). Click on the Commit button - very important! Now you are ready to click on Push... You guessed it... It's the green button. You will be prompted to enter your Github account Username and Password. Do so.
5. Back to GitHub:
Refresh the page displaying our "test" repository. You should now see the additional documents, including cars.html
Quick check: Go to your browser and enter in the URL bar what for me would be rinterested.github.io/test/cars.html (remember that you can get your own website address by going under Settings as explained above), and then just tag on the name of the document we have worked on with RStudio.
6. Hyperlink the pages:
As a test click on "index.html" under the "test" repository and somewhere there, in the body embed the following:
Click here to go to cars.
You will have to click on the pencil icon to edit this file. When done click on Commit changes. Go back on the browser to see your site. Refresh until it's updated with the hyperlink you just embedded. Click on it... You are now watching your RStudio work fully functional online. Magic!
Now it's just a matter to change things around using some html code quickly accessible online, changing the wording on the index.html (home page), or perhaps building a nice site with internal cohesiveness from scratch.
Good luck!
An alternative (more manual) approach - anything covered on the initial answer skipped.
1. Create a Repository in GitHub
Let's call it Course_project without need to README - we're just going to need its URL.
2. Open Windows PowerShell (or Git Bash)
Opening Git Bash is as simple as to right click on the directory in Windows Explorer we want to select, and click on Git Bash here. I'll use PowerShell. You can get the directory you're in by typing pwd. From there we can type ls to list subfolders, all along changing directory to reach where we want to be - for instance cd R to get R as the working directory.
Clone project by typing https://github.com/RInterested/Course_project.git (I am RInterested, so change that part to your GitHub username; also remember that "Course_project" is the name of this project). Change the directory to Course_project by typing cd Course_project. We now create a branch without parent branches: git checkout --orphan gh-pages. Make sure that the cloned Course_project is empty by typing: git rm -rf . We'll soon work with real RStudio markdown, but just to test what we have done so far, we can type into the empty working directory a name of a webpage: echo "Test Page" > index.html. Time now to Add/Commit/Push: git add index.html followed by git git commit -a -m "first commit", and git push origin gh-pages. This page is now visible at: http://RInterested.github.io/Course_project/index.html.
3. Creating content with RStudio
We have a directory (Course_project) and a toy index.html in it... We need real content. So we go to RStudio. Create an R Markdown file and name it (I'm calling it mtcars). Check HTML as the output. Change the document (some info about it in the answer above). Finally, an important step: Save it as Index.Rmd(make sure that the R working directory is the same as in PowerShell). Click on knit HTML to create the html file rendering the R code embedded in R Markdown.
4. Pushing it upstream with PowerShell
Now we have material within the directory Course_project, but it is not online - it is still local (you can go to it with Windows Explorer and see the html file under "index"). Type git status to see the changes made, and again follow the routine Add/Commit/Push: git add ., followed by git commit -a -m "commit", and git push origin gh-pages.
After a while the page will be live in http://RInterested.github.io/Course_project/index.html
5. Adding a second page
We can now start a second R Markdown file on RStudio (I labeled it Second_page and saved it as Second_page.Rmd. After writing what we want we knit HTML, and we can see these two new files appear in the Course_project local folder. We simply have to Add/Commit/Push like before in PowerShell. The new page will be in http://rinterested.github.io/Course_project/Second_page.html. It is very easy now to type a hyperlink on the first (index.Rmd) to the second (Second_page.html), knit the index.Rmd, and push it up to the web.

PhpStorm multiple project navigation, quick switch between projects

How can I open few projects in left work area in PhpStorm? I need to quick switch between projects.
If you want to open more than one project in this way (and by this I mean so they have their own different settings), then currently it is not possible.
http://youtrack.jetbrains.com/issue/WI-15187 -- vote/star/comment to get notified on progress.
If you need to include files from those projects for reference purposes (to see how you have done it there, to copy some code from there etc) -- you can include them under "External Libraries" -- Settings | PHP | Include paths. Files included this way are protected from modifications.
If you need to modify those files ... you can add them into actual project as Additional Content Root (Settings | Directories| Add Content Root) -- such folders will be treated as part of the actual project with no separate settings.
Other than that -- Alt + Tab (or whatever the shortcut is on your OS) to switch between different PhpStorm windows (each project is opened in separate window/frame).
This is a right on time answer.
It is possible to quick switch between project by adding a keyboard shortcut to the "manage project" menu.
To do just that, go to Settings > Keymap and search for "Manage Projects". Then add it the keyboard shortcut you desire and you're all set.
Hope this will help someone looking for an answer like I did.
As LazyOne said, you can add paths to your project from Setting | PHP | Include paths or from the useful keystroke F4.
But I'd like to also share how I organise my projects, I think when you create a project, you should not open a new window but instead open it in the same window.
This way you don't get confused between the different opened windows.
In settings you can assign a keystroke to Reopen recent projects. I then use ctrl + shift + R but it is up for you to chose the keystroke you like.
Hope this will help you as I struggled as well to find a way to manage all my current projects.

How to start Sublime Text with selected project using a local .sublime-project file?

I may be missing the obvious, but can't seem to solve this fairly simple & typical case (with v3 build 3022 on Debian or XP, in case it matters):
Start Sublime Text opening a project "myprj", specified on its command-line,
using default.sublime-project located under that project's dir (say "/repo/myprj"),
automatically re-opening the last open files of that project (i.e. its workspace),
using default.sublime-workspace for that (also from the same project dir)
but (obviously) not auto-opening any other files remembered from non-project sessions,
and automatically saving all open files (to the above default.sublime-workspace) on exit.
Ideally:
$ sublime_text --project /repo/myprj/default.sublime-project
should just work. But it doesn't (see below).
Another approximation that seemed reasonable:
setting "hot_exit" and "remember_open_files" to false, and then invoking ST with:
$ sublime_text --data /repo/myprj --project default.sublime-project
But ST3 either doesn't find the project file (via --data), unless I chdir there first (--data seems to be no longer supported?), and it either doesn't auto-open any workspace files from last time (despite a previous "Project / Save Workspace As..."), or, if I set "remember_open_files" back to true, it just re-opens the last open files regardless of the project given on the command line.
I guess the issue is the workspace file not being handled automatically for some reason, and I'm just missing some trivial step somewhere. (The official docs (and also the unofficial) seem to discuss command-line switches for OS X only, and asking for --help didn't actually help with this one.)
(Please note: I wouldn't like to launch ST first, and then switch to some project from inside manually, and I also don't want to store the sublime-project/-workspace files outside of the prj. dir.) Thanks a lot!
I seached for a solution for a similar problem these days and didn't find a proper way. So i created an automator app with a small apple script. Maybe this helps you too.
Open Automator and Choose news Application.
Create an action to start Sublime Text 2
Insert an action to perfom the following apple script:
delay 0.2
tell application "System Events"
tell process "Sublime Text 2"
tell menu bar 1
tell menu bar item "Project"
tell menu "Project"
tell menu item "Recent Projects"
tell menu "Recent Projects"
click menu item "~/yourproject.sublime-project"
keystroke "p" using {command down, shift down}
end tell
end tell
end tell
end tell
end tell
end tell
end tell
For anyone still looking to do this, you can launch the built-in command line tool and launch it with a project like so (Mac OSX):
"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" --project "absolute-path-to-your.sublime-project"

How to set the height of the Sublime Text 2 status bar, or get its history?

I'm currently using the Sublime Code Intel plugin with ST2. Trying to add additional python paths but it's not working. So I'm trying to do a little debug and notice that the plugin prints the paths being searched in the ST2 status bar as it's building the index. The problem is, a lot of the messages go by too fast. I've just started using this editor and so far I can't find out how to either expand the height of the status bar - so I could scroll up a few commands - or view some sort of status bar history. As it is, I can only see the last thing logged in the status bar and that's not very useful for debugging my problem.
The console provides useful debug info. You can also use it to enter Python commands.
To open: ctrl + `
or
View>Show Console