Victor Franzi - Git Sources dotfiles / b42a304
emacs save files rotsix 7 years ago
2 changed file(s) with 1 addition(s) and 164 deletion(s). Raw diff Collapse all Expand all
00 *.swp
11 *~
2 \#*\#
23
34 # neovim plugins
45 neovim/.config/nvim/plugged/*
+0
-164
emacs/#.emacs# less more
0 yes
1 ; package managers
2 (require 'package)
3 (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
4 (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
5 (add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))
6
7 (setq package-enable-at-startup nil)
8 (package-initialize)
9
10 (load-theme 'brogrammer t)
11
12 (custom-set-variables
13 ;; custom-set-variables was added by Custom.
14 ;; If you edit it by hand, you could mess it up, so be careful.
15 ;; Your init file should contain only one such instance.
16 ;; If there is more than one, they won't work right.
17 '(package-selected-packages (quote (helm tuareg))))
18 (custom-set-faces
19 ;; custom-set-faces was added by Custom.
20 ;; If you edit it by hand, you could mess it up, so be careful.
21 ;; Your init file should contain only one such instance.
22 ;; If there is more than one, they won't work right.
23 )
24
25 (defun toggle-window-split ()
26 (interactive)
27 (if (= (count-windows) 2)
28 (let* ((this-win-buffer (window-buffer))
29 (next-win-buffer (window-buffer (next-window)))
30 (this-win-edges (window-edges (selected-window)))
31 (next-win-edges (window-edges (next-window)))
32 (this-win-2nd (not (and (<= (car this-win-edges)
33 (car next-win-edges))
34 (<= (cadr this-win-edges)
35 (cadr next-win-edges)))))
36 (splitter
37 (if (= (car this-win-edges)
38 (car (window-edges (next-window))))
39 'split-window-horizontally
40 'split-window-vertically)))
41 (delete-other-windows)
42 (let ((first-win (selected-window)))
43 (funcall splitter)
44 (if this-win-2nd (other-window 1))
45 (set-window-buffer (selected-window) this-win-buffer)
46 (set-window-buffer (next-window) next-win-buffer)
47 (select-window first-win)
48 (if this-win-2nd (other-window 1))))))
49
50 (global-set-key (kbd "C-x |") 'toggle-window-split)
51
52 ;; lol, should I explain?
53 (set-language-environment "UTF-8")
54
55 ;; no bars on emacs -nw
56 ;(menu-bar-mode -1)
57 ;(tool-bar-mode -1)
58 ;(scroll-bar-mode -1)
59
60 ;; CUA mode (C-c, C-v, C-x)
61 ;; To use C-c, C-v, C-x for copy/paste/cut, just uncomment (remove ;) the following line
62 (cua-mode t)
63
64 ;; Remove start screen
65 (setq inhibit-startup-screen t)
66
67 ;; pretty cursor
68 (setq-default cursor-type 'hbar)
69
70 ;; show matching parenthese
71 (show-paren-mode 1)
72 (setq show-paren-delay 0)
73
74 ;; Show line-number and column-number in the mode line
75 (global-linum-mode 1)
76
77 ;; Highlight current line
78 (global-hl-line-mode 1)
79
80 ;; Word wrap
81 (setq-default word-wrap t)
82
83 ;; Dead circumflex
84 (load-library "iso-transl")
85
86 ;; Prevent Extraneous Tabs
87 (setq-default indent-tabs-mode nil)
88
89 ;; add padding in number line
90 (setq linum-format "%4d ")
91
92
93 ;; smooth scroll
94 (setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
95 (setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
96 (setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
97 (setq scroll-step 1) ;; keyboard scroll one line at a time
98
99
100 ;; Setup compile command for C file
101 ;; if no Makefile exists, it executes
102 ;; clang -o filename -O0 -g -std=c99 -Wall -Wextra filename.c
103 (require 'compile)
104 (add-hook 'c-mode-hook
105 (lambda ()
106 (unless (file-exists-p "Makefile")
107 (set (make-local-variable 'compile-command)
108 (let ((file (file-name-nondirectory buffer-file-name)))
109 (format "%s -o %s %s %s"
110 (or (getenv "CC") "clang")
111 (file-name-sans-extension file)
112 (or (getenv "CFLAGS") "-O0 -g -std=c99 -Wall -Wextra")
113 file))))))
114
115
116
117 ;; Setup compile command for python file
118 ;; if no Makefile exists, it executes python filename.py
119 (require 'compile)
120 (add-hook 'python-mode-hook
121 (lambda ()
122 (unless (file-exists-p "Makefile")
123 (set (make-local-variable 'compile-command)
124 (let ((file (file-name-nondirectory buffer-file-name)))
125 (format "%s %s %s"
126 (or (getenv "PYTHONP") "python")
127 (or (getenv "PYTHONFLAGS") "")
128 file))))))
129
130
131
132 ;; Setup compile command for java file
133 ;; if no Makefile exists, it executes javac filename.java
134 (require 'compile)
135 (add-hook 'java-mode-hook
136 (lambda ()
137 (unless (file-exists-p "Makefile")
138 (set (make-local-variable 'compile-command)
139 (let ((file (file-name-nondirectory buffer-file-name)))
140 (format "%s %s %s"
141 (or (getenv "JAVAC") "javac")
142 (or (getenv "JAVAFLAGS") "")
143 file))))))
144
145
146 ;; F5: compile
147 (global-set-key (kbd "<f5>") 'compile)
148
149 ;; indentation
150 (setq tab-width 4)
151
152 ;; default font
153 (add-to-list 'default-frame-alist '(font . "Iosevka Term"))
154 (set-face-attribute 'default t :font "Iosevka Term")
155 (set-frame-font "Iosevka Term" nil t)
156
157 ;; remove all theses backup files
158 (setq backup-directory-alist '(("." . "~/.saves")))
159 (setq backup-by-copying-when-linked t
160 version-control t
161 kept-new-versions 2
162 kept-old-versions 0
163 delete-old-versions t)