does find_under_expand_skip not work on mac sublime? - sublimetext2

does find_under_expand_skip not work on mac sublime?
Hi I have been trying this on and off for the last week.
I use the "find_under_expand" all the time and when I heard out the ability to skip certain variables it made total sense but I haven't been able to get this to work. any thoughts?
cheers
Will

find_under_expand_skip is bound to the key sequence command + k, command + d. Since it's a sequence you have to press both keybindings in succession.

Related

How to set the environment decimal separator in Octave?

It is anyway to set decimal separator in Octave different from OS default locale for decimals.
For example: normally I used point(.) for decimal separator like US locale, but sometimes I need to plot data that need to be presented with comma(,) as decimal separator like Europe locale.
How can it be done in Octave enviroment?
I don't think octave supports locales like this. Maybe if you compile it from the very beginning against a particular locale, but I wouldn't advise that anyway.
Your best bet is to pre-process all relevant strings to replace dots with commas etc.
Alternatively you can rely on an external utility (e.g. the printf command in bash) to create a file of strings and then read them from your octave script.
Another thing to try is to try and replicate this https://undocumentedmatlab.com/articles/formatting-numbers/ in octave
(but, disclaimer, I tried, but run into this bug, which I reported just now: https://savannah.gnu.org/bugs/?60396)

Function to open a file and navigate to a specified line number

I have the output of recursive grep (actually ag) in a buffer, which is of the form filename:linenumber: ... [match] ..., and I want to be able to go to the occurrence (file and line number) currently under the cursor. This told me that I could execute normal-mode movements, so after extracting the file:line portion, I wrote this function:
function OpenFileNewTab(name)
let l:pair=split(a:name, ":")
execute "tabnew" get(l:pair, 0)
execute "normal!" get(l:pair, 1) . "G"
endfunction
It is supposed to open the specified file in a tab and then do <lineno>G, like I am able to do manually, to go to the specified line number. However, the cursor just stays on line 1. What am I doing wrong?
This question, by title alone, would be an exact duplicate, but it talks locating symbols in other files, while I already have the locations at hand.
Edit: My mappings for grep / ag are as follows:
nnoremap <Leader>ag :execute "new \| read !ag --literal -w" "<C-r><C-w>" g:repo \| :set filetype=c<CR>
nnoremap <Leader>gf ^v2t:"zy :execute OpenFileNewTab("<C-r>z")<CR>
To get my grep / ag results, I put the cursor on the word I want to search and enter <leader>ag, then, in the new buffer, I put the cursor on a line and enter <leader>gf - it selects from the start up to the second colon and calls OpenFileNewTab.
Edit 2: I'm on Cygwin, if it is of any importance - I doubt it.
Why don't you set &grepprg to call ag ?
" according to man ag
set grepprg=ag\ --vimgrep\ $*
set grepformat=%f:%l:%c:%m
" And then (not tested)
nnoremap <Leader>ag :grep -w <c-r><c-w><cr>
As others have said in the comments, you are just trying to emulate what the quickfix windows already provides. And, we are lucky vim can call grep, and it has a variation point to let us specify which grep program we wish to use: 'grepprg'.
Use file-line plugin. Pressing Enter on a line in the quicklist will normally open that file; file-line will make any filename of the form file:line:column (and several other formats) to open file and position to line and column.
I only found this (old) thread after I posted the exact same question on vi.stackexchange: https://vi.stackexchange.com/q/39557/44764. To help anyone who comes looking, I post the best answer to my question below as an alternative to the answers already given.
The gF command, like gf, opens the file in a new tab but additionally it also positions the cursor on the line after the colon. (I note the OP defines <leader>gf so maybe vim/neovim didn't auto-define gf or gF at the time this thread was originally created.)

EMACS find-grep command switching windows

I have the following in my .emacs
(defun find-in-workspace(term)
(interactive "sSearchInWorkspace: \n")
(grep-find (concat "grep -rnH --include=\*.{c,cpp,h} --include=-e '" term "' /home/workspaces/*")))
which is just a wrapper around grep-find so that it can search all the files in my workspace.
My problem is with the grep buffer. I would like to keep my cursor in the grep buffer's window when I select items from it so that I can quickly browse through the code, but selecting a line will automatically moves my cursor to the other window, which adds up in keystrokes when I have a list of over 5 items. Is there anyway I can build this functionality into this function, or change a setting for grep-find? I've been searching but haven't found a solution.
See the functions next-error and previous-error. They leave the grep buffer, but they work from anywhere, so, for example, if you bind next-error to a convenient a key then you can keep pressing it and it will iterate over the grep buffer.
There might be some options of grep behavior, that you might find if you dig in the lisp/progmodes/grep.el from the source, but I really think it might be better and easier to have a look of GrepPlus library which bring many enhancement of emacs grep.
Otherwise you could also use occur and see how you could customize it. In occur, when you are in the match buffer, you can it C-o instead of Ret, which will show in the other buffer the match you selected, keeping your cursor in the match buffer. Difference with grep, is that it only works with opened buffer. I'm rather sure grep+ might have the equivalent. You should have a look
There are two functions for doing exactly what you want: previous-error-no-select and next-error-no-select.
Also, you may find useful next-error-follow-minor-mode.

MySQL the command line and pagers

I cant find anything about this from searching here.
I use mysql on the command line at work and I work with fairly large tables so I set the mysql pager allowing a more readable result if I run a query, that returns 1000's of results. I use the command below to set the pager.
\P less -Sin
This suits my needs but has left me wondering if there are any more pager styles that mysql uses on the command line.
The MySQL client just passes its output to whatever command you specify with \P (for "Pager").
-Sin are commandline switches to the program less. From man less:
-i Causes searches to ignore case
-n Suppresses line numbers
-S Causes lines longer than the screen width to be chopped rather than folded.
For more options of the MySQL client, see reference.
mysql> pager less
PAGER set to 'less'
You might want to try pspg:
Unix pager designed for work with tables. Designed for PostgreSQL, but MySQL is supported too.
Main target
possibility to freeze first few rows, first few columns
possibility to use fancy colors - like mcview or FoxPro
In action:
This post is old, but still very helpful.
You can set the pager to whatever you want, including a script that parses all output before feeding it back to you. The examples there include using an add-on tool that makes EXPLAIN output more readable.
Also note that to turn off this functionality and return to normal stdout the command is nopager.
If you don't like less you can use more :)
\P more

Moving a word forward in z shell

In zshell how to move forward word, I can set -o vi and use vi format. Is there a way to move forward in zshell by a word
If you're using iTerm2 on OSX, you can use the Natural Text Editing preset under Preferences -> Profile -> Keys.
This supports these key combos (which are very similar to other editors):
alt/option + left = move left one word
alt/option + right = move right one word
The ZLE widget for moving forward by one word is forward-word. Therefore, you may use bindkey to bind this widget to any key you want.
For example,
$> bindkey ^O forward-word
would allow you to move forward by one word when pressing Ctrl-O. Note that ^O is actually a quoted insert of Control followed by O.
Your zsh command prompt works either like emacs or like vi. If it works like vi, put it in command mode (esc) and type w. If it works like emacs, use M-f.
More information available at man zshzle.
Similar to other answers, but for Zsh on iTerm it took me a while to find this:
If you are using Zsh, like Oh My Zsh, in iTerm then go to: Preferences > Profiles > Keys sub-menu
Click + sign
Add your shortcut combo, choose "Send Escape Sequence"
inputs for left and right below.
left:
[1;5D
right:
[1;5C
forward word [Meta]+[f]
backward word [Meta]+[b]
On macOS, [option]+[→] and [option]+[←] work too.
In my zsh terminal it was already set to the below using bindkey
"^[f" forward-word
"^[b" backward-word
I was not sure how to use this, read on Apple Forum's, this is basically
^+[ release it then press f or press esc release it then press f
Similarly for backward,
^+[ release it then press b or press esc release it then press b