SFTP file alignment issues - sublimetext3

I have sublime text 3 with SFTP plugin installed. Using it im able to download the code but the python files that are opened are not aligned properly.
I opened a ticket in SO but its not resolved.
https://askubuntu.com/questions/959866/files-improperly-aligned-after-transfer-via-ftp?noredirect=1#comment1533479_959866
Not sure I need to change in my py files either in the server or the editor. The lines are not aligned only after the SFTP.
My SFTP settings:-
"translate_tabs_to_spaces": true,
"detect_indentation": false,
"tab_size": 8,
"tab_width": 8

Indentation changes when viewing files on different computers or in different software are indicative of using tabs for indentation, as unlike spaces the amount of space that a tab takes up changes based on usage and configuration settings, and is one of the more hotly fought Holy Wars in the development arena.
As you have correctly surmised, you need to tell Sublime how wide you think a tab should be, since it's defaults are out of sync with what you expect.
For the most part your issue is that the settings you've mentioned in your post aren't SFTP Settings (the available settings are in the documentation). SFTP just moves files around as a series of bytes, it's not involved with the actual display and editing of anything.
In order to get things to work better, you should put those settings in your user preferences. That's Sublime Text > Preferences > Settings in the menu (i.e. press ⌘+,) and add them to the settings pane on the right.
That said, note that tab_width is not a setting that Sublime understands by default, although the other three you mentioned are valid. Additionally those settings will cause Sublime to expand all tabs into 8 spaces, removing the tab characters entirely.
Assuming you don't want your files to be indented with tabs any longer, that's what you want. If you prefer tabs, you should set translate_tabs_to_spaces to false instead, so that tab characters are retained.

Related

Auto refresh in Sublime Text 3

I want Sublime Text to auto reload files when they are changed in the hard disk (by some process else). Although I am not expecting to have my code open in different places, I use the editor to see resulting files, which is why this feature is crucial to my coding setup. I’ve figured out the option to prompt for the reload as below. But my issue is, it takes a long time for Sublime Text to realize the file has changed and give me the prompt. The files are in a Linux server and I am accessing them through Samba in Windows. Previously I've used Notepad++ which instantly recognize the change and prompt me to reload - so this is not to do with the file systems or hardware. Is there a way to achieve this in Sublime Text or VSCode?
"always_prompt_for_file_reload": true

In vscode, how to put editor regions inside tabs, and not the other way around?

I've been trying Visual Studio Code for a few days, and it's the first editor that I used in years that makes me feel I could switch from my beloved vim.
Now, it's hard to get used to new habits when you have years of muscle memory, but I'm trying to keep an open mind. There's one thing that's bugging me, though, and I could not find a way to get around: it's the fact that editor regions and tabs are "swapped". Let me explain:
In vscode, you define editor regions by splitting your screen, then each region can contain as many tabs as you want.
My problem is, that does not fit my workflow. Here's what my workflow used to be with vim, where regions are inside a single set of tabs (I mainly work with Django):
In a first tab, I've split my editor in half and I'm editing my models.py and forms.py side by side.
In a second tab, I've split the editor in half, I'm editing my views.py on the left hand side, and the right hand side is again split horizontaly, allowing me to edit multiple templatetags files.
In a third tab, I'm editing my main template, and I don't split the editor since the file may contain very long lines.
In a fourth tab, I'm editing several html files and the editor is split multiple times.
Etc.
That way, I can very quickly go to edit my models, then my views, then the templates, and start over in quick iterations.
With vscode, where the tabs are inside the fixed regions, not so much.
So my question is, what solution could I use? Am I missing a big feature here? Are there any extension that would allow me to get my old workflow back?
I'm also open to suggestions about new workflows.
As #romainl pointed out: the workflow is different, it doesn't work that way with VS Code (and I know, I'm a vim user, too).
The best you can get that is vaguely close to what you're used to is to consider VS Code windows as you did with vim tabs.
To give you an idea using your example:
You open a VS Code window and open side by side models.py and forms.py
You hit Ctrl+Shift+N (or Command+Shift+N on a Mac) and open a new window. There you open your views.py on the left and split the right one horizontally for the templates.
You open a new window again and repeat.
This way you can switch between different layouts with Alt+Tab
(or Command+Tab).
You could speed this up a bit by saving different workspace files for different files that you want open, because I think (not 100% sure) that saving the workspace also saves the layout.
There's a couple of annoying things with this approach though:
If you have multiple windows open in general (say, a browser, slack app and so on), they'll also appear in the list when you try to switch.
I'm not sure if the open folder will be remembered when opening a new window, but you can work around that by saving the workspace and opening it.
It's annoying but at least there's already a feature request about this ( https://github.com/Microsoft/vscode/issues/41486 )

Amount of spaces not configurable in eclipse mars

I do not want to use tabs for indentation. So I check the option "Indent using spaces" but I can't set the amount of spaces. The Plus and Minus buttons are not clickable and I can't edit the value by hand, which means typing in a number. Indenting only one space is far too little.
I remember some hack including editing the workspace configuration files but I can't find the correct file or page I once read it on.
I am using Linux Mint, Eclipse for PHP Developers 4.5.1.
This is Eclipse bug 479274
You can work around it by editing the indentationSize entry in the properties file org.eclipse.wst.css.core.prefs which is in the workspace .metadata/.plugins/org.eclipse.core.runtime/.settings folder.

Notepad++ tab color

Is there a way to change the color of a tab (in the tab bar) according to the path of the file?
I tried with the PythonScript plugin, but couldn't find a method to change the color of a tab.
I need this because I edit scripts from two environments at the same time, from a LIVE environment, and from a development environment, and I need to be extra careful when editing a LIVE file.
I was looking for a programmatic way to change the color of the tabs, and reviewed the online documentation of Notepad++ but did not find anything about it. So, instead, I propose the following method for your case, it could be helpful to always know which of your files are from the development environment and which from the live environment:
Open a blank instance of Notepad++:
Now start a macro recording: Press Start Recording button on Notepad++ toolbar:
Open a new document
Now you'll have two open blank tabs.
Right click newly open tab and click in option Move to other view from contextual menu
You'll have a window splitted vertically and your two tabs will be displayed next to each other. You'll use these two tabs as separated "containers" for your files
Press Stop Recording button:
Save your just recorded macro:
assign a keyboard shortcut:
Now you can run that recorded macro (from Macro menu, or invoking keyboard shortcut you assigned), every time you want to work on your two environments.
(Optional) Right click vertical separator between "containers" and click Rotate to right
Now your "containers" will be split horizontally and will be displayed one above the other. Personally, I'd recommend you this layout.
Click on the tab at first "container" and from there, open all your "dev" environment files; and analogously open all your "live" environment files from second "container". Note that currently selected container has a more intensely coloured active tab.
If you notice that your working space is small, drag the separator to increase your current "container" size, but I recommend you not to take it completely towards the end, because it will make difficult to differentiate which of the two "containers" you are working on.
Note: If you, mistakenly opened a file of an environment from the wrong "container" you'll always be able to fix that by dragging the tab and dropping it to the other "container":
So you'll always keep control of what files must be on each container.
That's it. I hope this info will be helpful for you.
About changing the color of the tab (not folder specific).
Notepad++ has a file called stylers.xml, located in the roaming folder or in the program folder. It also depends in the installation & windows version. If it does not exists then it is self generated.
At the very end of the file, it says
<WidgetStyle name="Inactive tabs" styleID="0" fgColor="xxxxx" bgColor="xxxxxx" />
And here it is possible to change the color of the inactive tab.
However, it does not work, it is a bug that has been "fixed" countless of times in the past. To the date, the current version 6.2.3 UNICODE, changing the values does nothing.
So far, editing the stylers.xml:
6.2.3 = does nothing
design guideline, gray + gray = not good.
6.2.0 = does nothing
6.1.8 = works.
Nice contrast
6.1 = works.
5.9.8 = works.
5.7 = edit works.
ps: sadly,it is not possible to change the fonts of the tabs.
Wanted to add this as a comment, the button's not there.
You can solve your actual problem by using multiple instances of notepad++, refer this. You can save different sessions and optionally use the "Open File In Solution (OFIS)" plug-in.
I've if you've picked a different Style like 'Black Board', then you will have to change these setting in it's .XML in '/themes', and these setting are found at the bottom of the file.

more intelligent global bookmarks in vim

Here's how global bookmarks work.
Let's say I have two tabs in my vim session. One showing foo.txt, one showing bar.txt. I go to line 10 in foo.txt and hit mA
Then I go to the other tab, showing bar.txt. I hit `A, and the workspace on that tab opens foo.txt, putting my cursor on line 10.
So now I have two tabs, both showing foo.txt. This is less than ideal.
How I want it to work is, if one of my active workspaces on any tab is showing the file I the bookmark system is trying to navigate too, move my focus to that tab. If the file isn't open, sure - open it in my active workspace.
Is there any way to make this possible?
Thanks!
This is not a problem with Vim's global bookmarks. It's a problem with Vim's tabs.
In most text editors, tabs serve as a list of currently open files, but in Vim, the buffer list serves this purpose. If you think of a tab in Vim as being like a saved layout for split windows, then you'll meet less friction. This answer sums it up nicely, and I made a screencast to try and explain how tabs can be used.
Here is a script that answers your initial question. But as far as I'm concerned, nelstrom is right: tabs are not meant to contains the others files, but other layouts.
How do I jump to markers within different tabs in vim?

Resources