auto-indent

How to get reliable indentation in elisp

家住魔仙堡 提交于 2019-12-10 23:47:10
问题 I'm new to Emacs. I'm trying to write an elisp function that works across all modes. Specifically, I want to write a function that inserts braces (a bit like insert-parentheses ) in the same way the following key sequence does for a dumb editor that only supports auto-indent: "{" <ret> "}" <up-arrow> <end> <ret> <tab> This key sequence works for both Java and C# (bsd) style indentation. I need it to work in all brace-y emacs modes, and also in plain text files - I have other formats that have

Emacs indenting after macro in C

本小妞迷上赌 提交于 2019-12-10 15:14:49
问题 #define INIT_MACRO create(); some(); enviroment(); ... void function(){ INIT_MACRO extra_indented(); normal_indented(); } how do i make emacs deal correctly with the above situation when it is requested to automatically indent? EDIT the only solution i see is to tell emacs to treat lines containing only caps, underscores and spaces as if they have a semicolon at the end... but how would i do that? 回答1: This works: #define INIT_MACRO do { create(); some(); enviroment(); } while (0) ... void

How to automatically indent the JavaScript code in Aptana Studio?

孤者浪人 提交于 2019-12-10 03:26:27
问题 Previously I used Eclipse for PHP and Java development, and I liked the command Ctrl + i to automatically indent the code. Now am I using Aptana Studio that is based on Eclipse, for JavaScript development. I would like to automatically indent my JavaScript code, but Ctrl + i deletes all my code. Is there any other command that automatically indent JavaScript code in Aptana Studio? 回答1: The Studio does not have this feature yet. You can add a feature request here: https://aptana.lighthouseapp

Notepad++ plugin for auto format Css [closed]

匆匆过客 提交于 2019-12-08 14:32:20
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I'm looking for a plugin for Notepad++ that will auto align (auto format) my Css files. Something similar to visual studio ctrl+k, ctrl+d effect only for notepad++. Anybody know something like that? 回答1: try JSON Viewer... after installing select all content of css and "Ctrl + shift + alt + m" . It will format

Disable auto-indent of comments with Visual Studio 2015

时间秒杀一切 提交于 2019-12-06 18:48:36
问题 I have looked and searched for ways to disable indentation of comments when I save C# files in Visual Studio 2015 with Resharper 9.0.0.0 installed. I'd like to pseudocode before I start writing actual code. However I have been tweaking with both Visual studio's and Resharper's settings to no avail. So for example I want the comments to look like: private string ToggleString(string input) { // If input.length is between 1-100 // All the uppercase letters converted to lowercase. // All the

Vim: Use tabs for indentation, spaces for alignment with C source files

本小妞迷上赌 提交于 2019-12-05 04:16:20
Does anybody have her vim setup in a way that uses hard tabs as indentation characters, but does use spaces for alignment? The problem I have is that when starting a continuation line like in if (condition1 && (anotherlongcondition || /* <-- Here I insert a newline */ |-------|------- whatever /* some additional alignment added automatically */ , then cin (which is a must for me) adds some alignment just the way I prefer positionally , but this alignment is created using as much hard tabs as possible and filling the rest with spaces (as I tried to visualize). So, in short, cin doesn't really

How to automatically indent the JavaScript code in Aptana Studio?

筅森魡賤 提交于 2019-12-05 03:19:20
Previously I used Eclipse for PHP and Java development, and I liked the command Ctrl + i to automatically indent the code. Now am I using Aptana Studio that is based on Eclipse, for JavaScript development. I would like to automatically indent my JavaScript code, but Ctrl + i deletes all my code. Is there any other command that automatically indent JavaScript code in Aptana Studio? The Studio does not have this feature yet. You can add a feature request here: https://aptana.lighthouseapp.com/projects/35272-studio/tickets/new Ctrl+Shift+F will format your entire file, as Tim suggested. You can

How do I define indents in vim based on curly braces?

混江龙づ霸主 提交于 2019-12-05 00:42:36
问题 I use https://github.com/cakebaker/scss-syntax.vim for syntax highlighting SCSS (or SASS ) files on vim, which works very well for syntax highlighting. However, the plugin does not come with an indent file and am having trouble writing one. I would like to set the indent to look like this: However, if i do gg=G , I get: I suspect that it does not understand nested indent based on braces. I tried all the different combinations of set cindent set nocindent set autoindent set smartindent and

How to auto indent a C++ class with 4 spaces using clang-format?

那年仲夏 提交于 2019-12-04 08:03:43
问题 I got the next .clang-format file in my project's root directory: --- AlignTrailingComments: true AllowShortFunctionsOnASingleLine: false AllowShortIfStatementsOnASingleLine: true AllowShortLoopsOnASingleLine: true BreakBeforeBinaryOperators: false IndentWidth: 4 SortIncludes: false NamespaceIndentation: All ... Problem comes when I run clang-format on my c++ headers, the classes become autoindented like this: As you can see, labels public & private are indented only with 2 spaces. But what I

Sublime Text 3, convert spaces to tabs

一笑奈何 提交于 2019-12-03 18:18:22
问题 I know there are a lot of posts about this, but I couldn´t get it to work. I use tabs for coding. Is there a way, to convert always spaces to tabs? I.e. on open and on Save files? Anyone got an idea? // edit: My desire is to do this automatically ! -> open, save or on the fly Does anyone know how to do? I tried this: import sublime, sublime_plugin, os class ExpandTabsOnSave(sublime_plugin.EventListener): # Run ST's 'expand_tabs' command when saving a file def on_pre_save(self, view): if view