 (define-key osx-key-mode-map [(alt \\) ?t] 'toggle-truncate-lines)
 
 ;; buffer
+(use-package buffer-move
+  :ensure t
+  :init
+  (define-key osx-key-mode-map [(meta alt left)] 'buf-move-left)
+  (define-key osx-key-mode-map [(meta alt right)] 'buf-move-right)
+  )
 (define-key osx-key-mode-map [(alt t)] 'new-empty-buffer)
 (define-key osx-key-mode-map [(alt r)] 'revert-buffer)
 (define-key osx-key-mode-map [(alt q)] 'erase-buffer)
 
-(define-key osx-key-mode-map [(meta alt left)] 'buf-move-left)
-(define-key osx-key-mode-map [(meta alt right)] 'buf-move-right)
+(define-key osx-key-mode-map [(ctrl right)] 'next-buffer)
+(define-key osx-key-mode-map [(ctrl left)] 'previous-buffer)
 
 ;; macro
 (defun apply-named-macro-to-region-lines (top bottom)


;; files
(defmacro hot-file (name)
  `(lambda () (interactive) (find-file ,name)))

(define-key osx-key-mode-map [(alt /) ?s] (hot-buffer "*scratch*"))
(define-key osx-key-mode-map [(alt /) ?e] (hot-file "~/Library/Preferences/Aquamacs Emacs/Preferences.el"))


;; tramp
(set-default 'tramp-default-proxies-alist (quote ((".*" "\\`root\\'" "/ssh:%h:"))))
(define-key osx-key-mode-map [(alt \\) ?T] 'tramp-cleanup-all-connections)

;; ensime
(use-package ensime
  :ensure t
  :defer t
  :init
  (add-to-list 'exec-path "/opt/local/bin")
  :config
  (setq ensime-startup-snapshot-notification nil)
  (setq ensime-startup-notification nil)
  (add-hook 'scala-mode-hook 'ensime-scala-mode-hook)
  )

;; Go
(use-package env-var-import
  :ensure t
  :config
  (env-var-import '("GOPATH"))
  )

(use-package go-mode
  :ensure t
  :mode "\\.go\\'"
  :interpreter "go"
  :config
  (defun go-mode-setup ()
    (setq compile-command "go build -v && go test -v && go vet")
    (define-key (current-local-map) "\C-c\C-c" 'compile)
    (go-eldoc-setup)
    (setq gofmt-command "goimports")
    (add-hook 'before-save-hook 'gofmt-before-save)
    (local-set-key [(alt b)] 'godef-jump))
  (add-hook 'go-mode-hook 'go-mode-setup)
  )

(use-package go-eldoc
  :ensure t
  :defer t)

(use-package go-autocomplete
  :ensure t
  :defer t
  :config
  (ac-config-default)
  )

;; swift
(use-package swift-mode
  :ensure t
  :mode "\\.swift\\'"
  :interpreter "swift")

(use-package flycheck-swift
  :ensure t
  :defer t
  :config
  (flycheck-swift-setup)
  )

;; start server
(server-start)
