help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting up Emacs tabs like my Vim config


From: Damien Wyart
Subject: Re: Setting up Emacs tabs like my Vim config
Date: Mon, 30 Dec 2013 21:39:48 +0100
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50

* "William G. Gardella" <wgg2@member.fsf.org> in gnu.emacs.help:
> A rough equivalent to your code could be something like this: 

> --8<---------------cut here---------------start------------->8---
> (defun tab-is-tab-is-tab ()
>   "Configure tab-related settings and ensure that TAB is
> `tab-to-tab-stop' in the local map."

>   (setq tab-width 4
>       tab-stop-list (loop for i to 120 by 4 collect i)
>       indent-tabs-mode t)
>   (local-set-key (kbd "TAB") 'tab-to-tab-stop))
> --8<---------------cut here---------------end--------------->8---

I do not think this will be equivalent to the OP's vim settings, because
expandtab inserts spaces instead of a tab.

So I would rather go with

(setq tab-width 4
      indent-tabs-mode nil)

but this doesn't get the effect of backspace going back to the previous
tab stop. I do not know a way to get this when using spaces (when using
tabs, this can be approached with
http://www.emacswiki.org/emacs/BackspaceWhitespaceToTabStop)

To get something stronger that the default of DEL removing one space,
hungry delete might be used, but it will often be too strong (removing
all whitespace instead of going back to previous tab stop). Hungry
delete from CC mode can be used, or there is also a dedicated minor
mode :
http://stackoverflow.com/questions/5045820/how-to-bind-hungry-delete-for-clojure-in-emacs
https://github.com/nflath/hungry-delete

delete-horizontal-space is also somehow usable, but with a dedicated key
sequence (C-u M-\).

-- 
DW


reply via email to

[Prev in Thread] Current Thread [Next in Thread]