LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-15-2009, 09:54 AM   #1
Miarld
LQ Newbie
 
Registered: Oct 2009
Distribution: Debian Lenny
Posts: 6

Rep: Reputation: 0
Emacs indentation


Hello
I'm trying to get used to advanced text editors. I've started with vim, and now switched to emacs. However, emacs indentation drives me crazy. Things like

Code:
int main(void)
{
    ...
    if (n == 1)
      {
       ...
and so on

I just want it to be similar like VIM's:

Code:
 99 ········set expandtab "no real tabs, spaces instead
102 ········set softtabstop=4 " when hitting tab or backspace, how many spaces
103                         "should a tab be (see expandtab)
104 ········set tabstop=8···"real tabs should be 8, and they will show with
106 ········set autoindent
107 ········set smartindent
108
109 ········set listchars=tab:··
110 ········set list
so the code will look like

Code:
  7 int main(void)
  8 {
  9     int a, b, num = 0, errors, i;
 10
 11     srand(time(NULL));
 12
 13     while (true)
 14     {
 15         errors = 0;
 16
 17         for (i = 1; i <= 10; i++)
 18         {
 19             a = rand() % 10;
 20             b = rand() % 10;
and it can be handy to emphasis real tabs too. Also when I hit enter, I want emacs to place the cursor in the same indentation position (106 ········set autoindent).

Thank you for your attention.
 
Old 10-15-2009, 10:01 AM   #2
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
I'm a big fan of Emacs, but when you newline, you can hit tab to bring your cursor over to the indentation position, or you can just type out your next statement, and when you type in any of the "(", "{", "[" or ";" characters, it will automatically indent it for you.

Here's a link to the Emacs manual: http://www.gnu.org/software/emacs/ma...acs/index.html
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Emacs syntax-driven indentation problem moo-cow Programming 7 01-15-2007 07:52 AM
emacs' html indentation prell Linux - Software 1 05-26-2005 08:21 PM
auto indentation ilnli Programming 3 03-27-2005 08:14 PM
improving indentation in Kate JustinHoMi Linux - Software 4 02-12-2005 02:27 AM
emacs: requiring tabs in all indentation prell Linux - Software 0 08-24-2004 10:32 AM


All times are GMT -5. The time now is 12:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration