Start Sublime 3 from terminal, when default is Sublime Text 2 |
When you run sublime, your computer should run a bash file at
/usr/bin/sublime (running which sublime as Mike Li suggested will confirm
the location. Open that up and edit it for Sublime Text 3. The contents
of that file should be:
#!/bin/bash
/usr/lib/sublime-text-2/sublime_text --class=sublime-text-2 "$@"
Edit it as so: (On my computer the executable is called subime_text_3
instead of subime_text. Verifiy by opening /usr/lib/sublime-text-3.)
#!/bin/bash
/usr/lib/sublime-text-3/sublime_text_3 --class=sublime-text-3 "$@"
Point it to the location of Sublime Text 3 on your system.
Edit Build 2221 (using the ppa) changed the installation directory from
/usr/lib/sublime-text-2 to /opt/sublime_text_2
|
When using sublime text 2, how can I have the built executable run in terminal? |
It's because the terminal program closes as soon as your compiler or C++
program quits (and since the compiler also quits after failed compilation,
you'll never see any error messages). And also because the terminal doesn't
know how to handle &&.
Use this:
"cmd": ["x-terminal-emulator","-e",
"bash -c "g++ '${file}' -o '${file_path}/${file_base_name}' &&
'${file_path}/${file_base_name}' ; read -p 'Press any key to
continue...'""],
|
Cannot build Jekyll blog using Sublime Text 2 Ant build |
Solved! Thank you Martin Clayton for pointing me in the right direction.
Sublime Text 2 was indeed missing the path information from .bash_profile
or wherever.
The solution was to get my path by going into Terminal and typing
echo $PATH
Copied this and put it into a "path" entry in my .sublime-project file
"name": "MyBlog",
"cmd": ["ant"],
"working_dir": "/Users/JordanRoher/Dropbox/Projects/BlogFolder/Web/www",
"path":
"/Users/JordanRoher/.rvm/gems/ruby-1.9.3-p429/bin:/Users/JordanRoher/.rvm/gems/ruby-1.9.3-p429@global/bin:/Users/JordanRoher/.rvm/rubies/ruby-1.9.3-p429/bin:/Users/JordanRoher/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
I'm also using the short version of the Jekyll target, like so:
<target name="jekyll">
<exec dir="${dir.source}" executable=
|
gnome-terminal font resize (zoom in, zoom out), but adjust terminal height and width contrariwise for getting a "lock in" of window dimensions |
I can’t tell you for sure, but since this is GNOME and moreover GNOME 3,
it’s unlikely that the Terminal has this kind of customization built-in.
But in Linux, you can always improvise. How about the following.
Find a program that can send keys to an X11 window. Maybe xdotool.
Find a program that can control an X11 window’s geometry. Maybe xdotool.
Write a short script that locates the terminal window (probably just the
focused one), sends it Ctrl-Plus / Ctrl-Minus, waits a tiny bit, then sets
its geometry to the one you like (or to whatever it was initially, which
you can also query with xdotool).
Bind this script to a keyboard shortcut of your choice, say Win+Plus /
Win+Minus. No idea how to do this in modern Ubuntu / GNOME 3, but
GNOME 2’s Metacity used to have GConf keys f
|
Cannot keep gnome-terminal open |
Your sub process ends when the command execution ends. In your case after
ps and grep have finished executing your script will end.
Try with xterm with -hold option
xterm -e "ps ax | grep gnome" -hold
|
Sublime Text 3 C++ Build System for OS X |
According to this thread, ST simply doesn't allow for interactive builds.
Edit:
Check out this thread here for a workaround.
|
gnome-terminal new tab with alias as command to execute |
When a bash shell is started, per default bash executes the commands
specified in .bashrc. This is how your shell knows your alias's.
Now your idea does not work because gnome-terminal never sees your .bashrc
file.
You could try
gnome-terminal
--working-directory='<path-to-your-home-directory>/Desktop/myproject/
|
Sublime Text: Is it possible to build a simple - headless - objective-c app? |
Paste the following into Sublime and save the file as main.m
#import <Foundation/Foundation.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog(@"Hello, World!");
[pool drain];
return 0;
}
Then in the terminal navigate to the file with cd and type:
gcc -framework Foundation main.m -o NAME_OF_YOUR_APP
And run the app by typing:
./NAME_OF_YOUR_APP
|
Configuring sublime text build system to use shell script |
Shell variables and functions, including those defined in .bash_profile and
other places, are not available to ST2 because it doesn't run inside bash.
It's its own independent program - analogous to how Firefox (for example)
can't read your $PATH variable.
To have your custom functions, variables, etc. available to your build
system, you'll have to create a separate build script to run as your build
system:
{
"cmd": ["ST2_build.sh", "$file"],
"file_regex": "^[ ]*File "(...*?)", line ([0-9]*)",
"selector": "source.python"
}
then within ST2_build.sh have the following at the top:
#!/bin/bash
if [ -f ~/hcom-env/conf/sys/hcom-profile]; then
source ~/hcom-env/conf/sys/hcom-profile
fi
# now I can use my cool functions...
myfunc($1)
|
How can I start the gnome-terminal with multiple tabs with always the same title and history? |
I suppose you can use a gnome-terminal custom command for each profile, for
example
bash -c 'PROFILE=default_profile exec bash'
or
bash -c 'PROFILE=screen_profile exec screen -U'
or similar.
Then in ~/.bashrc
if [[ -n $PROFILE ]]; then
HISTFILE=~/.bash_history."$PROFILE"
fi
source of the answer.
|
RSync works stand alone, not as script in Sublime Text Build System |
The Sublime Text console/build system is not interactive, so there is
unfortunately no way to enter input during a build. To get around this,
you'll either need some other way of authenticating, such as with an SSH
key, or you'll need to program a small plugin that uses
sublime.Window.show_input_panel() to obtain the password from the user.
|
gnome-terminal cmd leaving processes open after closing parent window |
Run like below:
gnome-terminal --tab -t "Tab 1" -e "bash -ic 'echo Hello; exec bash'" --tab
-t "Tab 2" -e "bash -ic 'echo Hello; exec bash'"
You need to run some comand before the ;bash and you can change 'echo
Hello' by any other.
|
Sublime Text 2 edited file-changes does not show when refreshing browser in Maven project |
In order for the changes to take place you have to right-click the file in
Eclipse explorer tab and choose "refresh" in order for the (static) changes
to be reloaded to Apache. For dynamic changes you'll need to restart apache
or use a plugin such as JRebel.
|
Sublime Text 3 Java autocomplete |
Sublime 3 does have basic autocompletion for Java baked-in - if you start
typing "pub", for example, it'll suggest "public". I'd also suggest looking
at the Javatar plugin, which adds things like automatic creation of
classes, packages, and interfaces. The QuickJava plugin might also be worth
a look - it adds automatic creation commands for setters, getters, and
constructors.
|
Sublime Text 2 Python.sublime-package |
Remove existing /User/Python.sublime-package and try manually unzip
Python.sublime-package (change it's extension to .zip) to Package folder
/Packages/Python. Package folder can be revealed via Preferences->Browse
Packages... command.
|
how to install sublime text indent xml in sublime 3 |
The location is system dependent, but are located at:
OS X: ~/Library/Application Support/Sublime Text 3/Packages/
Windows: %APPDATA%/Sublime Text 3/Packages/
Linux: ~/.config/sublime-text-3/Packages/
|
Bash script to wait for gnome-terminal to finish before continuing script, only works for first instance of script |
#!/bin/bash
date
bash -c "sleep 7" &
bash -c "sleep 5" &
wait
date
As you can see while running this script, both sleep commands will run in
parallel, but main thread stalls, while they are running.
Sat. Jule 27 01:11:49 2013
Sat. Jule 27 01:11:56 2013
Replace sleep 7 with expect launchneuron.exp
and sleep 5 with expect launchmpj.exp
and add your plot commands after calling "wait":
echo "Simulation Complete"
...(your code to plot results)
|
Build in xcode via terminal, using the "build for profiler" settings |
Here is an example:
$ xcodebuild -project MyProject.xcodeproj -alltargets -configuration
Release
You can get the full documentation in the terminal with this command:
$ man xcodebuild
There is also an article here:
http://blog.octo.com/en/automating-over-the-air-deployment-for-iphone/
|
Android:How can i make an AutoCompleteTextView to pass the text from a website and show me the results |
After parsing the webservice data you will get results into an array.
Let's say you are getting result into array named resultData then use below
code.
arrayAdapter = new ArrayAdapter<String>(viewAutoComplete,
android.R.layout.simple_list_item_1, resultData);
autoCompleteText.setAdapter(arrayAdapter);
|
Sublime 2 Build System for CLISP in Windows (Cygwin) |
A working build file is the following JSON:
{
"cmd": ["clisp", "$file_name" ]
}
It's the use of $file_name rather than $file ($file as used in the first
example on the page of the Sublime 2 Build Systems Documentation) that
makes it work.
This would probably be obvious to anyone who didn't manage to be a dope and
miss the list of Build System Variable way down the page until after they'd
accidentally stumbled upon the right answer. xD
|
How to spawn a new application from Gnome/GTK to a CLI application and read its output back into Gnome/GTK application? |
top and tail -f are long-running programs (in fact, they never exit), so
your strategy of reading the whole output and populating the the textbuffer
with it obviously won't work.
Instead, you need to create an IO channel that watches what's going on with
the pipe, hook the channel into the event loop, and append it to the text
buffer as new output arrives. The minimalistic change to your program would
be to rewrite the prepare function like this:
static gboolean data_ready(GIOChannel *channel, GIOCondition cond, gpointer
data)
{
FILE *fp = data;
char line[256];
if (fgets(line, sizeof line, fp)) {
gtk_text_buffer_get_end_iter (buffer, &iter);
gtk_text_buffer_insert (buffer, &iter, line, -1);
return TRUE;
}
else {
fclose(fp);
re
|
Java and SQL: Receive partial ResultSet and use SwingWorker's publish() to show incoming results |
You should limit the SQl query. E.g. in MySQL you can add LIMIT 10,20 to
retrieve only part of select results
[LIMIT [offset,] rows | rows OFFSET offset]
UPDATE you can add count to the same query and get the count in the first
row to avoid additional DB call
select * from (select count(*) as count, 0 as id from users
union all
select 0 as count, id from users limit 0,10) full
ORDER BY count desc
limit 0,11;
|
Searching a text file in java and Listing the results |
You can read the file line by line and search in every line for your
keywords. If you find one, store the line in an array.
But first split you text box String by whitespaces and create the array:
String[] keyWords = yourTextBoxString.split(" ");
ArrayList<String> results = new ArrayList<String>();
Reading the file line by line:
void readFileLineByLine(File file) {
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
while ((line = br.readLine()) != null) {
processOneLine(line);
}
br.close();
}
Processing the line:
void processOneLine(String line) {
for (String currentKey : keyWords) {
if (line.contains(currentKey) {
results.add(line);
break;
}
}
}
I h
|
Build failure on terminal for junit test case |
The standard maven-build will run all tests found in src/test/java and if
one of them fails (like your example-test) the build will fail.
So to make the build succeed you have to make all tests pass.
|
How to set the terminal title to show the current running command while it's running and to show it in brackets once it's finished? |
You can (ab)use PS1 by putting the same escape sequence in so that every
time the prompt is printed, the title gets updated.
export PS1="33]2;[$(history 1 | sed 's/^[ ]*[0-9]*[ ]*//g')]07$PS1"
The final PS1 just keeps your old prompt for the actual command line.
I don't actually use this, but it should work.
|
Output MySQL results with a line for each row in terminal |
You could use a query instead of a command. The following query will place
all the databses in a list separated by spaces:
SELECT group_concat(SCHEMA_NAME separtor ' ') as databases
FROM INFORMATION_SCHEMA.SCHEMATA;
You would execute this as:
mysql -s -u root -p -e "SELECT group_concat(SCHEMA_NAME separtor ', ') as
databases FROM INFORMATION_SCHEMA.SCHEMATA"
|
Using Sublime Text 3 as a Python IDE with 3.3.2? |
Set your "cmd" to the following:
"cmd": ["/Library/Framework/Python.framework/Versions/3.3/bin/python3",
"-u", "$file"],
and it should work. Probably the reason your path addition didn't work was
because it was missing the beginning /.
|
Vintage Sublime Text go to tab N |
Not that it matters, but those are ST1 docs. The command is probably
focus_view (though I haven't checked it). If you are using ST3, I'd
recommend trying Vintageous. It appears to be much more complete than the
built in vintage mode. For example, 3gt does move you to the third tab with
this plugin.
|
Jslint and sublime text |
I found solution in this link:
http://nicksantan.com/blog/2012/12/adding-auto-format-code-indenting-to-sublime-text-2/
Hopt it work.
|
Sublime Text 2 C Compiling |
What Operating System do you use? Linux? Using Linux is more practical,
because you compile in the terminal.
Installing the Compiler
1 - Make sure that you have the compiler installed. If you dont have, open
the terminal (Ctrl + Alt + t) and type this and press Enter: sudo apt-get
install g++ gcc build-essential
Compiling a file
Open the terminal and go to the local that you had saved the files.
Type in the terminal: gcc filename.c -o filename
Then, type:
./filename The program you run in the terminal normally.
PS:
gcc is for programs in .c
g++ for programs in .cpp
-o = to create an "executable" file
./ = to run the program
|
Using Sublime Text 2 for C++ and OpenGL |
I c++, if you want to use a (static in this example) library, you have to
link against it. In normal english, you have to tell your compiler where it
can find the implementations of the library's functions. I don't know how
to do that in your editor, but usually there is something called linker
settings, where you can link all the libraries you need for your project.
For more info see this wiki page
|
Sublime text 2 snippets |
Sorry snippets are primarily meant for reusability; you can do precisely as
you say above but cannot insert specific things - you would have to write
your own plugin in order to add this functionality as it would require
things like a specific way of selecting things to modify and replace which
would be specific to it.
|
apache solr - show possibly related search results if no results found |
You have to handle it on the Client side to fire a Second Query in case of
No results found in Solr.
You can use the Spell Check components/Did You mean based on the Index
dictionary to provide suitable suggestions to the User instead of firing a
default search.
|
MySQL - Filter Results Based on the Results of Another Query (Show Distinct) |
For an "exception" query, think "outer join". In this case, a left outer
join will do, but you need to move the existing conditions into the on
clause:
select c.lastname, c.firstname, a.contactid, a.completeddate
from contacts c left join
activities a
on a.contactid = c.contactid and
completeddate >= curdate() - INTERVAL DAYOFWEEK(curdate())+6 DAY
and
completeddate < curdate() - INTERVAL DAYOFWEEK(curdate())-1 DAY
where a.contactid is null
order by c.lastname asc;
The final check of a.contactid is checking for no matches -- which is your
exception report.
|
Custom terminal prompt colors results in cycling issue |
You need to surround nonprinting characters in your prompt with [] so that
bash can accurately count the length of the prompt. It looks like you have
the end of (most of) those pairs but not the beginnings - perhaps you
thought the e[... sequences had to be closed? They don't. Here's what it
should look like:
export PS1='[e[0;36m][u] w:[e[0;31m]$(__git_ps1 " (%s)") [e[00m]
[e[1;33m]342230200 >[e[0m] '
|
Change behavior of Alt key in Sublime Text 2 |
There is a Sublime Text 2 plugin called Sublemacs Pro that provides
emacs-like keybindings and operations, including those that you mentioned
pining for. You can find installation instructions and the complete
keybinding reference on the Github page.
|
uninstall sublime text 3 on ubuntu 12.04 |
Option 1
If you installed sublime-text-3 with apt-get, based on this article:
http://www.webupd8.org/2013/07/sublime-text-3-ubuntu-ppa-now-available.html
With these lines:
sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer
You could remove your installation:
sudo apt-get remove sublime-text-installer
Option 2
If you installed Sublime Text 3 from a .deb package which was downloaded
directly from Sublime Text page: http://www.sublimetext.com/3
And you have used this command for installation
sudo dpkg -i sublime-text_build-3047_amd64.deb
Or you just double clicked on it and Ubuntu Software Center installed it...
So, in this case:
sudo dpkg -r sublime-text
But you have to reinstall Sublime Text 2 in each case
|
Python settings in Sublime Text 2 |
First make sure that you saved the file with .py extension and then try to
run again. You also need to check that the Python in your .sublime-build is
correct. For this look at %APPDATA%Sublime Text 2PythonPython.sublime-build
file. This file should have something like this:
{
"cmd": ["C:\python27\python.exe", "-u", "$file"],
"file_regex": "^[ ]*File "(...*?)", line ([0-9]*)",
"selector": "source.python"
}
This is equivalent to doing the following on the command line, check that
you can do:
python -u C:your_pathyour_script.py
If this doesn't work from the command line it also wont from sublime.
|
How to update Sublime Text 2 on Ubuntu 12.04? |
There is a PPA for Sublime Text 2:
https://launchpad.net/~webupd8team/+archive/sublime-text-2
But remember, that you will be integrating a new third-party-repository
into your system.
|
The REPL of sublime text 2 can't using the command of git? |
SublimeREPL is for programming language interpreters like Clojure or
Python, not shell programs like git. What you need is sublime-text-2-git,
available from the Package Control menu as "Git". SideBarGit may also be
useful.
|