Holding session title after spliting pane in iterm2 - title

I'd like to set a name for a tab, but in iterm2 there's only a session title.
It works fine when I have one split pane in a tab,
but the session title will change after split the tab to two panes.
Is there a way to write a script to hold the session title after spliting?

I solved it by following applescript:
tell application "iTerm"
tell current session of current window
set nameOfSession to {get name} as text
set newSession to {split horizontally with same profile}
select newSession
set name to nameOfSession
end tell
end tell
Put it to ~/Library/Application Support/iTerm/Scripts, restart iterm2 then you can see the script in Script Menu (more about scripts).
And may be you want to map a shortcut to execute the script in System Keyboard Shortcut settings.

Related

Set define off permanent

When running queries in SQL Developer and using the character & in my literals, a popup appears asking me to provide a variable. I then execute SET DEFINE OFF; and I can run my query for the rest of the session.
Is there any way to configure Oracle so it can never ask for manual variables when containing the & character?
Create a text file on your PC which contains set define off and any other set-up instructions you might want.
Then in SQL developer, go to the Tools menu and pick the Preferences... option. In the panel on the left click on Database.
Then either type the path to the file you created, or click Browse and navigate to the file in the 'Select connection startup script' dialog that appears.
That script will then be run every time you connect to any database.
Put SET DEFINE OFF into
login.sql (so that it works for you only, i.e. use user profile file), or
glogin.sql (so that its affect is global, i.e. use site profile file)

How can script the rename of pane in tmux to reflect the current directory?

I'd like to make a quick key in TMUX that queries the current directory and makes some portion of it the name of the pane window. Normally, I rename the pane window with ctrl-b , only to then add some indication about the where it is in the file system. It might be nice if I could both automate it putting the name there or even have new pane window open with this title.
So how can script a new keyboard shortcut like ctrl-b T that will add the title?
You can use #{pane_current_path} on most platforms (not OpenBSD) to get the pane's working directory. So you can do for example "tmux renamew '#{pane_current_path}'" to rename a single window, or put it in automatic-rename-format to automatically include it in every window name.
You might find the = modifier to be useful to trim the path (look at FORMATS in the manual).
If you want it to be shortened more intelligently your best bet is to rename it to $PWD from the shell prompt either with "tmux renamew" or by turning on allow-rename and using the rename escape sequence \033k$PWD\033\.

Focus on dialog with ideavim

I have some handy mappings set up in my ~/.ideavimrc some of which result in IntelliJ opening a new window/dialog box. For example the following line lets me type \t and it'll open IntelliJ's "jump to test" dialog box which lets me jump to an existing test or create a new test file:
:map \t :action GotoTest<CR>
This almost works great. The only issue is that when the dialog box pops up the focus is still on the editor window, not the dialog box. As a result I can't simply use the arrow keys to select my option and hit enter. Instead, I have to use the mouse. As a good code nerd, I abhor the mouse. So, how do I get the keyboard focus to change? Is this possible?
It's fixed in the master branch https://youtrack.jetbrains.com/issue/VIM-796, but the fix hasn't been released yet. You can download a CI build and help testing IdeaVim. See https://github.com/JetBrains/ideavim for more details.

PHPstorm scrolling with keyboard

I'am looking for an option to force scroll code when entering with keyboard cursor in example at 5 line from the end.
Default behavior is to scroll code when entering 1st or last visible line of code.
I would like to change it even for 10th from the beginning and 10th before last.
It appears the base IDE does not have an option for this. However, the behaviour is available in the IdeaVIM plugin (docs) under the scrolloff option.
'Scroll offset' mode can be enabled for the current session with the command:
:set scrolloffset=10
Add that to your ~/.ideavimrc to make it permanent.
NB: IdeaVIM changes the IDE to behave more like vim*, which may require some re-training.
If you're not familiar with Vim:
Install the IdeaVIM plugin (via Settings → Plugins → Browse Repositores → type 'ideavim' in search)
Restart the IDE
Open a file
Note the caret is a block like █; this indicates 'normal' mode
Press : to enter the 'command' mode
Type set scrolloff=10 then Enter
Scroll around, notice the editor scrolls before the caret gets to the very top (or bottom)
Press i to enter 'insert' mode, and edit your file as usual
Press ESC to return to 'normal' mode
Interactive vim lessons
openvim.com
vim-adventures.com
* It seems difficult to have the plugin only modify the scrolloffset behaviour and leave the rest per the default IDE.
You can set "EditorMoveUpAndScroll" shortcut.

Open a method body in the split screen immediately (without having to go thru tab's header)?

Is there a way to set Settings or a shortcut which will open a specific method directly into Split screen of IntelliJ or AndroidStudio?
Right now, I am doing the long way via tab's header and choosing one of two split options.
You can set your favorite shortcut to split screen.
Go to Settings -> Keymap.
Then search for the command split (you can use the search field).
Finally select the command, right click and "Add keyboard shortcut"