EzDevInfo.com

iterm2 interview questions

Top iterm2 frequently asked interview questions

Mac OS X: Command-Tab doesn't switch back to fullscreen app

Using the Spaces style fullscreen mode in OS X, I can easily Command-Tab out of a fullscreen app, but trying to Command-Tab back in doesn't take me back to that space, only switches the Menu Bar to the application.

Currently the easiest way to get back to the fullscreen app is using the gesture system, which is kind of annoying.

How do I Command-Tab back to the fullscreen app?

NB: Tested with iTerm2 and Terminal.


Source: (StackOverflow)

Programmatically set the color of a tab in iTerm2?

My daily workflow includes me

  1. Launching iTerm2
  2. Creating 3 tabs
  3. Setting one tab each to red, orange and yellow
  4. Changing to a specific path in each tab

I would like to script this process; shell, applescript, etc. However, I cannot seem to find a hook that allows me to change the tab color. Is this possible? Here is a screen shot with an example of what I am trying to achieve.

iTerm tab setup


Source: (StackOverflow)

Advertisements

Is there a keyboard shortcut to alternate between color schemes in iTerm2

I am using the Solarized color scheme in iTerm2 and it comes with two themes: one with a light background for daytime hours and one with a dark background for nighttime hours.

I am currently switching between them by going to the iTerm2 preferences, clicking Profiles, then Colors, and finally selecting the theme from the Load Presets menu.

My question is: is there a way to bind this to a keyboard shortcut?


Source: (StackOverflow)

iTerm 2 window resizing

My iTerm 2 window is up against the menubar at the top of the screen.

When I resize the window vertically from the top to the bottom, a small gap is always left. It never resizes down fully to the bottom.

I think this is because it is only resizing within whole terminal rows and columns.

Is there anyway to stop this behaviour, I can't bear to look at this much longer ;)


Source: (StackOverflow)

Disable Cmd+Enter on iTerm 2

I'm using iTerm 2 on Mac, and whenever I press Command + Return the thing goes full screen. My big fat fingers can't help it, so I really need to turn it off. Any suggestions?

Thanks in advance


Source: (StackOverflow)

Remote server, iTerm2, and tmux integration

I want to be able to start a tmux session on a remote server, and then use iTerm2's native windows and split screens on my local machine.

For example, let's say my remote server has a tmux session running with one window that has two panes. In iTerm2 on my local machine, I want two native iTerm2 panes such that each pane contains a different tmux pane.

Is this possible?

(I know the reverse is possible — whereby I can run a tmux session on my local machine and another machine will see my iTerm2 tabs as windows for instance. But this seems kind of useless.)


Source: (StackOverflow)

With Bash + iTerm2, how to name tabs?

In iTerm2 (Build 1.0.0.20120203), I typically open several tabs, each of which has split panes , and is about one particular theme of work, for example revision control, coding, managing files, mysql terminal work. I typically need to switch between 5 or more tabs in my work flow. It is sometimes hard to remember or tell which is which by looking at the content of the screen. I'd like to name the tabs somehow, so I can quickly tell which is which by quickly glancing. Is this possible?


Source: (StackOverflow)

How can I get control+left arrow to go back one word in iTerm2?

I was reading up in the Linux manual and I noticed that it said I could use control+left and control+right to move forward and back words in the terminal while editing.

"Pressing Ctrl plus the Left or Right arrow key moves backward or forward a word at a time, as does pressing Esc and then B or F."

On OS X control+left and control+right normally control spaces. I have disabled those. I also tried to use the preferences pane to set the keyboard shortcuts:

enter image description here

enter image description here

However this does not work and causes this error:

enter image description here

Also, if I am in iTerm and use alt+escape then B or F the character moves back and forth. This was happening before any of my config changes. But I'd really like to be able to use control + the arrow keys.


Source: (StackOverflow)

Vim configuration slow in Terminal & iTerm2 but not in MacVim

Ideally, I want to use Vim from Terminal or iTerm2. However, it becomes unbearably slow so I had to resort to using MacVim. There is nothing wrong with MacVim, however my workflow would be much smoother if I used only Terminal/iTerm2.

When its slow

  • Loading files, in particular Rails files takes about 1 - 1.5s. Removing rails.vim decreases this time to 0.5 - 1s. In MacVim this is instantaneous.

  • Scrolling through the rows and columns via h, j, k, l. It progressively gets slower the longer I hold down the keys. Eventually, it starts jumping rows. I have my Key Repeat set to Fast and Delay Until Repeat set to Short.

  • After 10 - 15 minutes of usage, using plugins such as ctrlp or Command-T gets very laggy. I'd type a letter, wait 2 - 3s, then type the next.

My Setup

11" MacBook Air running Mac OS X Version 10.7.3 (1.6 Ghz Intel Core 2 Duo, 4 GB DDR3)

My dotfiles.

> vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Nov 16 2011 16:44:23)
MacOS X (unix) version
Included patches: 1-333
Huge version without GUI.  Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent 
-clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
+conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con +diff +digraphs 
-dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path 
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv 
+insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent 
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape 
+mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm -mouse_sysmouse 
+mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg +path_extra -perl
 +persistent_undo +postscript +printer +profile +python -python3 +quickfix 
+reltime +rightleft +ruby +scrollbind +signs +smartindent -sniff +startuptime 
+statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white 
-tcl +terminfo +termresponse +textobjects +title -toolbar +user_commands 
+vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore 
+wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp -xterm_clipboard 
-xterm_save 
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/Cellar/vim/7.3.333/share/vim"
Compilation: /usr/bin/llvm-gcc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX -no-cpp-precomp  -O3 -march=core2 -msse4.1 -w -pipe -D_FORTIFY_SOURCE=1      
Linking: /usr/bin/llvm-gcc   -L.     -L/usr/local/lib -o vim       -lm  -lncurses -liconv -framework Cocoa     -framework Python   -lruby

I've tried running without any plugins or syntax highlighting. It opens files a lot faster but still not as fast as MacVim. But the other two problems still exist.

  1. Why is my vim configuration slow?
  2. How can I improve the speed of my vim configuration within Terminal or iTerm2?

Source: (StackOverflow)

Fancy colored rendering issue on osx 10.8 retina with iTerm

I use iTerm2, with oh-my-zsh and zsh and in my .zshrc file I set a couple of my prompts to the unicode bolt symbol as follows.

ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
RPROMPT="%(?..%{$fg[white]%}%?%{$fg[red]%}⚡)%{$reset_color%} ${ruby}"

This was all fine an dandy until I recently upgraded to Mountain Lion and a new MacBook Pro Retina. Now, my super cool lighting bolt, which use to display as a normal character, is super flash and is actually composed of yellow in the middle and orange along the edges. Unfortunately, I can't enjoy enjoy the effect because whatever is rendering this is causing the area around it to become transparent in iterm. This means, whatever is below the window is rendered in the area around the character.

Over a black background things are fine.

Over any other color things suck.

If someone could let me know how to fix this issue, or disable the fancy bolt I would be very appreciative. Thanks


Source: (StackOverflow)

How to automatically restore window arrangement from last time in iTerm?

I have two old Macs, both have iTerm2 installed and could automatically restore window arrangement (tabs with different directories and colors) from last time after launch. I forget what configuration I've made for both.

Now I'm setting up a new Mac with iTerm2, but could never get "automatically restore window arrangement from last time" working there.

What I've tried:

  1. Compared with the working ones, check and set the preferences one by one;
  2. Cloned the working "~/Library/Preferences/com.googlecode.iterm2.plist";
  3. Preferences -> Profiles -> General -> Working Directory -> Reuse previous session's directory (but I think this impacts when you open a new tab, not for launch);
  4. Menu -> Window -> Save Window Arrangement -> and save it as default. But in this case, every time if I launch from start, iTerm always restore fixed window arrangement from the save. I don't want to save any pattern, I just want restore whatever I have from last time.

All the things I've tried could not make it work. Could anyone tell me what should I do please? Thanks a lot.

iTerm version: iTerm2-1_0_0_20140112


Source: (StackOverflow)

iTerm2: Alt-Dot functionality with Cmd-Dot

Is there any known way to achieve the "insert last command argument"-functionality that is usually available in Bash by typing Alt-. (Alt and period) on OSX using iTerm2?

The ways I know this should be possible is by the two key-sequences:

Alt + .
Esc + .

The Esc-. one works, but the Alt-. does not. Not with Alt-. or Cmd-.


Source: (StackOverflow)

iTerm command click to open with Atom

I am trying to figure out how to change iTerm function when CMD+Clicking on a file in an iTerm window to have it open in my default editor, Atom.

Currently, the CMD+click function in iTerm opens files in Sublime. I have the function CMD+Click set to open with the default app (within iTerm preferences). I have also ensured that this file type is configured to always open with Atom (in the file's info screen from Finder).

If I click the file from finder, it opens with Atom, not sublime text. The only clue I have is that maybe iTerm won't recognize Atom as an editor. If I go to iTerm Preferences > Profiles > Advanced and change the CMD+Click to open with what Editor, only sublime 3 is available in the list of editors to choose from.

Any help would be appreciated!


Source: (StackOverflow)

How to identify the terminal from a script?

And don't say "$TERM" – it's always xterm.

How can a bash script tell what terminal it's running in, specifically whether it's iTerm, Terminal.app, or actually an xterm?

I ask because reset does not work¹ out of the box on Terminal.app and iTerm2. iTerm2, however, does recognize an escape sequence for doing a terminal reset (\x1b]50;ClearScrollback\x07), and if I could detect it, I could override reset with an alias that does the right thing. AFAICT, Terminal.app lacks a reset sequence, and people resort to ridiculous tom-hackery to hack around that.

My end goal here is to have reset work the same whether I'm working on OS X or Linux, working locally or remotely through SSH. (I don't want to have to try to remember which, and it's useful to do reset && command-that-outputs-a-bunch and have up-enter work.) Terminal.app and iTerm are throwing a wrench in this plan by not implementing reset correctly.

This means that simply overriding reset isn't quite it: if I'm on a Linux machine, it needs to know whether I'm using gnome-terminal or iTerm in order to send the right escape sequence.

Is there any way (even if I need an ioctl) to ask the terminal what it really is?

¹For the purposes of this question, reset should clear the screen, reset the cursor, and wipe the scrollback buffer.


Source: (StackOverflow)

OS X 10.11 (El Capitan) Making Zsh Very Slow

I just freshly installed El Capitan on my MacBook Pro. I had trouble earlier with the my terminal being too slow while typing in simple commands. I thought it might have been that I need to format my drive and install 10.11.

After re-installation. It turns out nothing changed. Still my iterm is very heavy. When I tried to further investigate this, it turns out that I don't have this problem when running on a bash shell. I only have this issue with Zsh.

I use homebrew, iterm2, and oh-my-zsh. I hope someone can shed some light on this. Thanks.


Source: (StackOverflow)