Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which .emacs -file would you give for a Vim veteran?

Tags:

vim

emacs

I have used Vim for coding. I want to learn Emacs too.

I would like to export at least some of the following customizations in my .vimrc to my .emacs.

My .vimrc

let Tlist_Auto_Open = 1

" http://stackoverflow.com/questions/165231/vim-dvorak-keybindings-rebinding
" Dvorak it!
no d h
no h j
no t k
no n l
no s :
no S :
no j d
no J D
no l n
no L N
" Added benefits
no - $
no _ ^
no N 
no ; z
no T L
no P P
no p p

let Tex_ViewRuleComplete_pdf = '/usr/bin/open -a Skim $*.pdf' 

set history=1000

set smartindent
set autoindent
set tabstop=4
set expandtab
set shiftwidth=3                                                                                            
set softtabstop=4
set number
set hlsearch
syntax on
set cursorline
highlight CursorLine guibg=#400000
set ruler
set textwidth=78
set foldcolumn=5

" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on 
filetype indent on

" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*

" OPTIONAL: This enables automatic indentation as you type.
filetype indent on

" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'


" http://ubuntuforums.org/showthread.php?t=74889
set foldmethod=manual "folds by indentation, manual, indent
set nocompatible                "Use Vim extensions
set backspace=indent,eol,start  "More powerful backspacing
set nobackup                    "No backup file
set showmode                    "Tell when in insert mode
set showmatch                   "Show matching () {} etc
set hlsearch                    "Highlight what is searched for
set incsearch                   "Highlight as you type

if &t_Co > 2
  syntax on
endif

set bg=dark
hi clear
if exists("syntax_on")
  syntax reset
endif


"Allowable colors: red, yellow, green, blue, magenta,
"                  cyan, gray, black, gray
hi Normal ctermfg=gray ctermbg=none
hi ErrorMsg ctermfg=gray ctermbg=lightblue
hi Visual ctermfg=lightblue ctermbg=fg cterm=reverse
hi VisualNOS ctermfg=lightblue ctermbg=fg cterm=reverse,underline
hi Todo ctermfg=red ctermbg=darkblue
hi Search ctermfg=gray ctermbg=darkblue
hi IncSearch ctermfg=darkblue ctermbg=gray
hi SpecialKey ctermfg=darkcyan
hi Directory ctermfg=cyan
hi Title ctermfg=magenta cterm=bold
hi WarningMsg ctermfg=red
hi WildMenu ctermfg=yellow ctermbg=black cterm=none
hi ModeMsg ctermfg=lightblue
hi MoreMsg ctermfg=darkgreen ctermfg=darkgreen
hi Question ctermfg=green cterm=none
hi NonText ctermfg=darkblue
hi StatusLine ctermfg=blue ctermbg=gray cterm=none
hi StatusLineNC ctermfg=black ctermbg=gray cterm=none
hi VertSplit ctermfg=black ctermbg=gray cterm=none
"hi Folded ctermfg=darkgrey ctermbg=black cterm=bold
"hi FoldColumn ctermfg=darkgrey ctermbg=black cterm=bold
hi LineNr ctermfg=gray cterm=none
hi DiffAdd ctermbg=darkblue cterm=none
hi DiffChange ctermbg=magenta cterm=none
hi DiffDelete ctermfg=blue ctermbg=cyan
hi DiffText cterm=bold ctermbg=red
hi Cursor ctermbg=brown
hi lCursor ctermbg=darkgreen

hi Comment ctermfg=lightgreen cterm=none
hi Constant ctermfg=cyan cterm=none
hi Identifier ctermfg=gray cterm=none
hi Statement ctermfg=red cterm=none
hi PreProc ctermfg=yellow cterm=bold
hi Type ctermfg=darkyellow cterm=none
hi Special ctermfg=magenta cterm=none
hi Underlined cterm=underline
hi Ignore cterm=none

What is in your .emacs which would allow me to have some of the above features?

like image 394
Léo Léopold Hertz 준영 Avatar asked Apr 12 '09 21:04

Léo Léopold Hertz 준영


3 Answers

The EMACS Starter Kit is helpful too.

My God -- you really remap your keyboard to Dvorak in your .vim?

Okay, here are some of the others:

set smartindent
set autoindent

There automagically in programming modes. For text modes, look at 'autoindent-mode" and "filladapt."

set tabstop=4
set shiftwidth=3
set softtabstop=4

(setq c-basic-offset 4) ; indents 4 chars
(setq tab-width 4)          ; and 4 char wide for TAB
(setq indent-tabs-mode nil) ; And force use of spaces

(There's no easy equivalent for shiftwidth; EMACS uses a smarter autindentation algorithm.

set expandtab

(setq indent-tabs-mode nil)

set number

There is a way to get numbered lines, but I never use it and don't remember it.

syntax on

 (turn-on-font-lock)

set cursorline

There are a pile of cursor settings, look through M-x apropos cursor

Some of the other stuff is also available, these are the things I know of offhand.

like image 191
Charlie Martin Avatar answered Oct 29 '22 00:10

Charlie Martin


Try these, and experiment.

dotfiles emacs

dotfiles.org

Apart from those, always a nice link:

GNU Emacs Manuals Online

like image 31
Rook Avatar answered Oct 29 '22 01:10

Rook


You can get numbered lines with (linum-mode 1) or (global-linum-mode 1) for every buffer. This feature is currently only in the CVS Emacs. See further choices.

For opening PDF documents inside Emacs, there is doc-view-mode. See View PDF/PS/DVI files in an Emacs buffer for further instructions.

Anyway, it'd better if you start up learning Emacs with Emacs Starter Kit as Charlie Martin suggested, and then find yourself what you're really missing. Emacs world is different than Vi's. And you can always browse Stack Overflow to find if your question was already answered.

like image 2
viam0Zah Avatar answered Oct 29 '22 02:10

viam0Zah