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?
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.
Try these, and experiment.
dotfiles emacs
dotfiles.org
Apart from those, always a nice link:
GNU Emacs Manuals Online
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.
you definitely should try evil-mode. Best vim emulator for emacs:
http://www.emacswiki.org/emacs/Evil
Related
I've installed ultisnips using vim plug on Neovim. While the snippets engine works, the plugin installed snippets do not seem to work. The docs seem to suggest that writing 'let g:UltiSnipsSnippetDirectories=['UltiSnips']' will let me use plugin installed snippets (e.g., vim-snippets and vim-react-snippets), but this doesn't seem to work. How can I fix this?
Configuration:
set showmatch " show matching
set ignorecase " case insensitive
set mouse=v " middle-click paste with
set hlsearch " highlight search
set incsearch " incremental search
set tabstop=4 " number of columns occupied by a tab
set softtabstop=4 " see multiple spaces as tabstops so <BS> does the right thing
set expandtab " converts tabs to white space
set shiftwidth=4 " width for autoindents
set autoindent " indent a new line the same amount as the line just typed
set number " add line numbers
set wildmode=longest,list " get bash-like tab completions
set cc=80 " set an 80 column border for good coding style
filetype plugin indent on "allow auto-indenting depending on file type
syntax on " syntax highlighting
set mouse=a " enable mouseclick
set clipboard=unnamedplus " using system clipboard
filetype plugin on
set cursorline " highlight current cursorline
set ttyfast " Speed up scrolling in Vim
set backupcopy=yes " disable safe write
set ma
" set spell " enable spell check (may need to download language package)
" set noswapfile " disable creating swap file
" set backupdir=~/.cache/vim " Directory to store backup files.
call plug#begin('~/.vim/plugged')
Plug 'ryanoasis/vim-devicons'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'scrooloose/nerdtree'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'mxw/vim-jsx'
Plug 'pangloss/vim-javascript'
Plug 'NLKNguyen/papercolor-theme'
Plug 'mlaursen/vim-react-snippets'
call plug#end()
let g:UltiSnipsExpandTrigger='<tab>'
" shortcut to go to next position
let g:UltiSnipsJumpForwardTrigger='<c-j>'
" shortcut to go to previous position
let g:UltiSnipsJumpBackwardTrigger='<c-k>'
let g:UltiSnipsSnippetDirectories=['UltiSnips']
:inoremap ii <Esc>
:nnoremap <F2> :NERDTreeToggle<CR>
colorscheme PaperColor
If relevant, I am using a macOS Monterey 12.3.
I'm preparing a document that contains colored tables (using colortbl) and to correct the thin white lines that appear in those tables I'm using a custom new line macro to compensate for that. However, AUCTeX does not recognize the new macro and tries to indent the table in a strange way.
\begin{table}[h]
\centering\sffamily
\begin{tabular}{lcc}
\rowcolor{row1} \textbf{Nominative} & \emph{Wer?} & Who? \mynewline
\rowcolor{row2}\textbf{Accusative} & \emph{Wen?} & Who(m)? \\
\rowcolor{row1} \textbf{Dative} & \emph{Wem?} & To who(m)? \\
\rowcolor{row2} \textbf{Genitive} & \emph{Wessen?} & Whose? \mynewline
\end{tabular}
\end{table}
How can I make AUCTeX understand that \mynewline plays the same role as \\?
In many cases, AUCTeX should be able to learn about your own commands automatically if you set TeX-parse-self and TeX-auto-save to t. See https://www.gnu.org/software/auctex/manual/auctex/Parsing-Files.html#Parsing-Files
If that is not sufficient, you can tell AUCTeX about your own macros and environment using a style file. See https://www.gnu.org/software/auctex/manual/auctex/Style-Files.html#Style-Files for more on this. It boils down to using the function TeX-add-symbols correctly.
Please note that it's been a few years since I last did this.
AUCTeX ships with a style file for longtable which seems to contain exactly what you need. See http://git.savannah.gnu.org/cgit/auctex.git/tree/style/longtable.el#n92
(TeX-add-symbols
;; Commands to end table rows
'("endhead" 0)
'("endfirsthead" 0)
'("endfoot" 0)
'("endlastfoot" 0)
;; Caption commands
'("caption*" 1))
I have just started using org-mode and it looks awesome. The only issue that I have so far is that when I write a text in mathmode ($...$) it appears in the standard-text font color.
So, I would like to make org-mode to identify the mathmode text and be able to present it in some other color. Note that I don't need to change the color of the actual equation, just the source text in org-mode.
Here is an example of how the text is currently presented
A paper by Rohnert, titled "Moving a disc between polygons" introduces
a structure using which one can generate a solution (path) for
a given query in $O(\log n) + k$ time.
and how I would like it to look
A paper by Rohnert, titled "Moving a disc between polygons" introduces
a structure using which one can generate a solution (path) for
a given query in $O(\log n) + k$ time.
(Note that I would prefer to display in some given color, e.g. red, and not bold face.)
In Emacs version 24.4 and later, this is controlled via the variable org-highlight-latex-and-related:
Non-nil means highlight LaTeX related syntax in the buffer. When non
nil, the value should be a list containing any of the following
symbols:
`latex' Highlight LaTeX snippets and environments.
`script' Highlight subscript and superscript.
`entities' Highlight entities.
So something like
(eval-after-load 'org
'(setf org-highlight-latex-and-related '(latex)))
in your init should help. Such code is formatted according to the face org-latex-and-related.
In earlier versions, the variable org-highlight-latex-fragments-and-specials, which is a simpler nil / non-nil variable:
(eval-after-load 'org
'(setf org-highlight-latex-fragments-and-specials t))
In this case, the face org-latex-and-export-specials is used.
I am revamping an old Emacs / Gnus configuration dating from before unicode Emacs (21.3 or 22). In this configuration, I was using some unicode characters to show usenet threads:
(setq gnus-sum-thread-tree-root "\x490a4 ") ; "> "
(setq gnus-sum-thread-tree-false-root "\x490a4 ") ; "> "
(setq gnus-sum-thread-tree-indent " ") ; " "
(setq gnus-sum-thread-tree-single-indent "") ; ""
(setq gnus-sum-thread-tree-leaf-with-other "\x4903c\x49020\x4904c\x490f9 ") ; "+-> "
(setq gnus-sum-thread-tree-vertical "\x49022 ") ; "| "
(setq gnus-sum-thread-tree-single-leaf "\x490b0\x49020\x490f9 ")) ; "\\-> "
But now with Emacs 23.2.1 I see empty squares instead of curved arrows. I suspect it can be either a fontset or an escaping problem related to unibyte / multibyte.
To exclude the escaping problem or solve it, how can I retrieve the unicode characters to use the \u1234 escaping instead of the \x12345 ? Thanks.
Edit: Thanks to an Emacs-22 I was able to insert those characters in a buffer and find their code with C-uC-x=.
The correspondance is
(setq gnus-sum-thread-tree-root "\u2564 "
gnus-sum-thread-tree-false-root "\u2564 "
gnus-sum-thread-tree-leaf-with-other "\u251c\u2500\u252c\25b9 "
gnus-sum-thread-tree-vertical "\u2502 "
gnus-sum-thread-tree-single-leaf "\u2570\u2500\u25b9 "))
...but the display is not as nice as it was at the time those unicode characters were chosen. It was on another system and I suppose that the font was nicer to display them.
I suggest you fire an older Emacs (Emacs-22), make it display those strings so you get to see those nice curved arrows and then copy&paste them with the mouse (no need to use the \uNNN notation).
In theory (decode-coding-string "\x490a4 " 'emacs-mule) should do what you want, but it doesn't seem to recognize that character, maybe because it was from an extension to MULE to support more Unicode characters.
I think the easiest solution will be to find visually the arrows you want, and replace those codes with their Unicode code points. See Arrows (Unicode block) in Wikipedia for a list of the potential candidates.
In text, can I make org-mode ignore forward slashes somehow? Phonetics uses /s/ to denote a certain level of analysis.
I assume that you do not want the text to appear emphasized in the buffer, nor in the output. This is a slightly more complex answer which will achieve that result:
There is a variable defined by Org-mode called org-emphasis-alist which defines the different emphasis modes, what their plain-text syntaxes are, and how they are exported to HTML. You can achieve the result you want by changing the value of this variable before Org-mode has been loaded. That last part is critical so note it well—Org-mode reads the value of org-emphasis-alist when it is loaded and uses that value to generate a regular expression for highlighting ("font-lock") purposes.
Here are two routes to that:
Add the following lines to your .emacs file above the lines that load Org-mode:
(setq org-emphasis-alist
`(("*" bold "<b>" "</b>")
;; ("/" italic "<i>" "</i>")
("_" underline "<span style=\"text-decoration:underline;\">" "</span>")
("=" org-code "<code>" "</code>" verbatim)
("~" org-verbatim "<code>" "</code>" verbatim)
("+" ,(if (featurep 'xemacs) 'org-table '(:strike-through t))
"<del>" "</del>")))
(Notice the commented out line.)
Make the change through Emacs' customization facility:
M-x customize RET
In the search box enter Org Emphasis and click Search.
Click the down arrow next to Org Emphasis Alist to reveal its value.
Find and click the second DEL button—corresponding to the italic list item.
Click the Save for future sessions button at the top of the buffer.
You can use
#+OPTIONS: *:nil
to turn off text-emphasis (bold,italics,underline). This will however only work on export itself, the emphasis will still be visible.
See the manual for other export options.
If you like the standard emphasis functionality of the forward slashes in org-mode, you could also just define a new environment. I put something like the following in the preamble whenever I do phonetics/phonology typesetting:
\newcommand\uRep[1]{$/$\textipa{#1}$/$}