When I create a file of any name with a .go prefix, GoLand's icon indicates that it is a Go file. However, when I create a main.go file, GoLand's icon indicates it is a plain text file. See image below. How can I fix this problem?
Navigate to Preferences / Settings | Editor | File Types, find type Text and exclude main.go file.
Related
If I compare a local file to its parent file, I can edit, in the right pane of VS, the local file if the file extension is cpp or h. If I compare text files that have a different extension (e.g. file.abc), the comparison is against a copy of the local file (e.g. file - copy 2.abc), not against the local file itself, and the copy is not editable.
The file extension must be registered with the c++ editor (Tools | Options... | Text Editor | File Extension).
The following command line generates copies of the compared files.
devenv /diff c:\file.abc d:\file.abc compares c:\temp\file copy.abc to c:\temp\file copy 2.abc.
Is it possible to have the same behavior as for cpp & h?
I am using Sphinx Documentation tool alongwith LaTeX to generate pdf files.
While trying to include images in the pdf file, I am coming up with the following error during compile:
LaTeX Warning: File `{img_file}.jpg' not found on input line 920.
! Package pdftex.def Error: File `"""{img_file}".jpg' not found: using dra
ft setting.
See the pdftex.def package documentation for explanation.
Type H <return> for immediate help.
...
l.920 ...phinxincludegraphics{{img_file}.jpg}
}
?
These are some key environment variables:
A. In my conf.py, I have defined absolute path as: sys.path.insert(0, os.path.abspath('..'))
B. This is the directory tree:
docs/ # (Sphinx) Documentation folder
_build/
_static/
css/
images/
abc.jpg
img_file.jpg <= This image file is in the root ("_static") directory
_templates/
conf.py
index.rst
modules/ <= Folder containing my source (.rst) files
execute/
file_with_image.rst <= I am trying to put the image in this source file
some_other_file.rst
C. For including the image I am using the following.
.. image:: /_static/img_file.*
D. I have included graphix in conf.py preamble.
Why am I getting this error? What is the source of so many """ quotes in the error message?
Edit
On opening the *.tex file in Tex editor, this is what the code fragment from the image insertion section shows:
\subsection{Add Image}
\label{\detokenize{modules/aud_execution/add_image_with_image_directive:add-image}}\label{\detokenize{modules/aud_execution/add_image_with_image_directive::doc}}
\sphinxstylestrong{Adding an image}
Example of image usage using “image” directive:
\noindent{\hspace*{\fill}\sphinxincludegraphics{{img_file}.jpg}} % ***
Using the Quick Build, the editor throws error as under:
! Package pdftex.def Error: File `"""{img_file}".jpg' not
found: ...
However, when the curly brackets from the image file name, {{img_file}.jpg} are removed and changed it to (line marked ***):
\noindent{\hspace*{\fill}\sphinxincludegraphics{img_file.jpg}} % ***
the document successfully compiles and the image can be seen in the pdf file.
If the .tex file is saved, the pdf file in the _build/latex/ folder shows the image.
So why are the extra brackets being inserted during make latexpdf from the terminal?
Don't place your images under _static. It is special-purpose folder, not for images. E.g. create modules/execute/img/, move image there, and .. image:: img/my-image.png.
I'm trying to output the compiled CSS to a different directory.
/project/scss/ to /project/css/
I've tried this, but get the error below:
Error: error No such file or directory - /Applications/MAMP/htdocs/project/public/css/style.scss
What are the Arguments and Output paths to refresh exactly for?
I got it working now with the following settings:
The only difference now is the Output paths to refresh field. It's the default now.
$FileParentDir$ contains the path of the parent SCSS file. So in our case it will be /project/scss. In order to make it work like you need, it is necessary to use $ProjectFileDir$ variable or (if you insist to use $FileParentDir$) $FileParentDir$/../ so it would go to an upper level directory.
If you will open any file in Editor and then go to Preferences | Tools | File Watchers > edit your file watcher settings > press Insert Macro button, you will see the list of all the variables with previews for currently opened file so you can see the values and build the arguments accordingly.
Note that Output paths to refresh also should be modified according to the Arguments path.
How to (easily) get current file path in Sublime Text 3
I don't often use ST console (I used it only once to install package manager), but I suppose it could be good way to :
get current file path like some kind pwd command.
But it doesn't work.
Does anyone know an easy way to get current file path?
to clipboard : better not a strict objective in the answer
not necessary by ST command, maybe package?
Right click somewhere in the file (not on the title tab) --> Copy file path
If you don't want to use the mouse, you could set up a keyboard shortcut as explained here https://superuser.com/questions/636057/how-to-set-shortcut-for-copy-file-path-in-sublime-text-3
To easily copy the current file path, add the following to Key Bindings - User:
{ "keys": ["ctrl+alt+c"], "command": "copy_path" },
Source
Key Bindings - User can be opened via the command palette (command + p on OSX)
Easy to understand using image. On Right Click you will get this.
Transcribed code in image for convenience:
import sublime, sublime_plugin, os
class CopyFilenameCommand(sublime_plugin.TextCommand):
def run(self, edit):
if len(self.view.file_name()) > 0:
filename = os.path.split(self.view.file_name())[1]
sublime.set_clipboard(filename)
sublime.status_message("Copied file name: %s" % filename)
def is_enabled(self):
return self.view.file_name()... # can't see
Mac OS X - Sublime Text 3
Right click > Copy File Path
A lot of these answers involve touching the mouse. Here's how to do get the path without any mouse clicks using SideBarEnhancements
Install SideBarEnhancements using PackageControl.
Click super + shift + P to open the command palette
In the command palette begin typing path until you see File: Copy Path
Select File: Copy Path
Now the path to file you are working in is copied into your clipboard.
There is a Sublime Package which gives your current file location inside a status bar. I just cloned them directly to my /sublime-text-3/Packages folder.
git clone git#github.com:shagabutdinov/sublime-shell-status.git ShellStatus;
git clone git#github.com:shagabutdinov/sublime-status-message.git StatusMessage;
You have to check/read the description on GitHub. Even it is listed in package control it would not install properly for me. You can actually edit the shell output as you want. If you have the right skills with python/shell.
Looks like this (Material Theme)
If you're like me and always click on items in the sidebar just to realize that copying the path only works when clicking in the editor area, have a look at the SideBarEnhancements package. It has a huge bunch of options to copy file paths in a variety of different ways.
Installation is available via Package Control (despite the webpage only mentions installation via manual download).
Note: The package “sends basic, anonymous statistics”. The webpage explains how to opt out from that.
Go to this link. The code in the link is given by robertcollier4.
Create a file named CpoyFileName.py or whatever you like with .py extension.
Save the file in Sublime Text 3\Packages\User folder. Then paste the above given key bindings in your Preferences: Key Bindings file.
Now, you can use the specified key bindings to copy just filename or total (absolute) filepath.
Please note that the filename or filepath do contain file extension.
Fastest Solution ( No Packages Needed + Comprehensive ):
Folder Path:
Folder in "Sidebar"
Right Click
"Find In Folder"
"Where" field contains everything you need
File Path:
File in current "Tab"
Right Click
"Copy File Path"
Is there a way to set a default document type when saving a NEW FILE?
I created several new files and I want to have a default value of .txt when saving a NEW FILE.
Create a new plugin Tools > Developer > New Plugin...
Paste this in:
import sublime, sublime_plugin
class EverythingIsPowerShell(sublime_plugin.EventListener):
def on_new(self, view):
view.set_syntax_file('Packages/PowerShell/Support/PowershellSyntax.tmLanguage')
Save and call it NewTabSyntax.py. New tabs will now default to Powershell.
You can change the syntax to whatever you prefer. To find out the "path" of a particular syntax, simply open a file of that syntax, open the console (View > Show Console) and type:
view.settings().get('syntax')
This plugin does it:
https://github.com/spadgos/sublime-DefaultFileType
seems pretty great.
Edit:
Ok, two things, there currently seems to be a small bug so the text file syntax is not being correctly picked up due to the whitespace in the filename. In addition you need to set the "use_current_file_syntax" to false, (otherwise the new file will default to whatever filetype you have open already when you hit Ctrl-N)... So the fix/workaround is this:
Put the following code in: Packages/User/default_file_type.sublime-settings
{ "default_new_file_syntax": "Packages/Text/Plain_text.tmLanguage",
"use_current_file_syntax": false }
NOTE THE UNDERSCORE.
Next, find the "Plain text.tmLanguage" file and copy and rename it (in the same folder) as "Plain_text.tmLanguage". [be sure to copy/duplicate it, do not just rename it, as it may have dependancies]
Restart, just to be sure, and this should do the trick.
Also note this plugin only works for new files created with Ctrl-N.
Working after these steps:
1.Uninstalled
2.Installed using Package Control
3.Test using default install (type Jave) <-- worked
4.Copy and Renamed file Sublime Text 2\Packages\Text\Plain text.tmLanguage > Sublime Text 2\Packages\Text\Plain_text.tmLanguage
5.Changed file Sublime Text 2\Packages\Default File Type\default_file_type.sublime-settings >
`{ "default_new_file_syntax": "Packages/Text/Plain_text.tmLanguage", "use_current_file_syntax": true }`
-- All working.
I did not need to copy any files into the 'Packages/User' folder
#fraxel _ Thanks for all the help and quick response.