Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We should provide CUA+/Sublime/Atom/Notepad++ compatibility layer "for the rest of us" #5429

Closed
a13ph opened this issue Mar 9, 2016 · 20 comments
Labels
- Mailling list - Discussion stale marked as a stale issue/pr (usually by a bot)

Comments

@a13ph
Copy link

a13ph commented Mar 9, 2016

I need a list of usually expected features that would be needed in it.
See XahLee's rants on modernizing Emacs and ErgoEmacs for some ideas on features as well as implementations.

One additional reason besides user attraction is guest-mode - having some saner for others configuration that "just works as usually expected" when some guest wants to use your editor.
Pair programming with GUI/IDE crowd (which is most programming population) is another good reason.

@syl20bnr
Copy link
Owner

syl20bnr commented Mar 9, 2016

I'm open to the idea, can be feasible as an additional editing style. Once I have a clear vision about editing style in Spacemacs I'll give it a go.

@a13ph
Copy link
Author

a13ph commented Mar 9, 2016

Great! That's why I'm mostly opening a discussion rather than pushing my own ideas, I can keep them to myself a bit not to force my pushy opinionated designs.

@gilch
Copy link
Contributor

gilch commented Mar 23, 2016

Here's the rant.

Vim's keys are worth learning, but I do understand the need for a guest mode. I think Windows notepad.exe has a pretty minimal set of text editor features that most Windows editors and IDEs reproduce. Most people would be familiar with these. Besides menu-bar and holy-mode, a guest mode should include almost all of the keyboard shortcuts from notepad. cua-mode will help.

File

C-n New
C-o Open...
C-s Save
Save As... (should be in the menu)
Page Setup
C-p Print... (maybe less important nowadays)
Exit

Edit

C-z Undo
(I would also add:
C-Z Redo)
C-x Cut
C-c Copy
C-v Paste
Delete (redundant?)
C-f Find...
f3 Find Next
C-h Replace...
C-g Go To...
C-a Select All
f5 Time/Date (probably not this one)

Format

Word Wrap (should be in the menu)
Font... (probably not this one, but consider a text zoom feature instead:
C-<wheel-up> / C-<wheel-down> Text Zoom)

View

Status Bar (probably not this one)

Help

View Help
About Notepad (about spacemacs? about guest-mode?)

Commands ending in ... open dialogs. These don't all have to look the same as notepad's, they just have to work the same way.

This is just a starting point, a good guest mode would need more.

The cursor motions with the keyboard should also behave like notepad. That is, arrow keys, home, end, PgUp/Down, and these with Ctrl/Alt/Shift modifiers. Holy-mode already does some of this the same way. A selection should be replaced when typing.

Any entered commands should be echoed in a status line. A user may accidentally enter a command not intended, and not understand what happened. This would help.

Modes can be extremely confusing for new users, as can hidden states that the user is expected to know about.

It should be difficult to change modes accidentally from guest mode.

The buffers that aren't visible are hidden state. I can think of several ways to correct this. There could be a clickable list of open buffers visible at all times, either across the top like browser tabs, or on the side like neotree. Another possibility is to always open buffers in a new frame while in guest-mode. Let the user use the window manager he's already familiar with to deal with them.

@gilch
Copy link
Contributor

gilch commented Apr 4, 2016

I noticed that Speedbar can show the buffers list. Maybe we could use that for the guest mode.

@alganet
Copy link

alganet commented Jul 10, 2016

I'm currently setting up this for myself. Got basic CUA working and some Sublime Text key bindings, including multiple cursors, C-S-p as helm-M-x alias, Ctrl+F that moves with <return>, region/line move and line duplicate.

I'm still figuring out C-p. I'd like to start projectile find if in project and helm find files if not in project.

Here is my .spacemacs file. If anyone uses this, please let me know.

UPDATE: Added tabs using tabbar-ruler package and C-S-p. I'm also reading the conventions and exploring with creating layers. I might refactor this into one in the near future. Any suggestions?

;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.

(defun dotspacemacs/layers ()
  "Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
  (setq-default
   ;; Base distribution to use. This is a layer contained in the directory
   ;; `+distribution'. For now available distributions are `spacemacs-base'
   ;; or `spacemacs'. (default 'spacemacs)
   dotspacemacs-distribution 'spacemacs
   ;; List of additional paths where to look for configuration layers.
   ;; Paths must have a trailing slash (i.e. `~/.mycontribs/')
   dotspacemacs-configuration-layer-path '()
   ;; List of configuration layers to load. If it is the symbol `all' instead
   ;; of a list then all discovered layers will be installed.
   dotspacemacs-configuration-layers
   '(
     ;; ----------------------------------------------------------------
     ;; Example of useful layers you may want to use right away.
     ;; Uncomment some layer names and press <SPC f e R> (Vim style) or
     ;; <M-m f e R> (Emacs style) to install them.
     ;; ----------------------------------------------------------------
     auto-completion
     better-defaults
     emacs-lisp
     git
     php
     markdown
     org
     (shell :variables
            shell-default-height 30
            shell-default-position 'bottom)
     ;; spell-checking
     ;; syntax-checking
     version-control
     )
   ;; List of additional packages that will be installed without being
   ;; wrapped in a layer. If you need some configuration for these
   ;; packages, then consider creating a layer. You can also put the
   ;; configuration in `dotspacemacs/user-config'.
   dotspacemacs-additional-packages '(
                                      multiple-cursors
                                      drag-stuff
                                      tabbar
                                      tabbar-ruler
                                      )
   ;; A list of packages and/or extensions that will not be install and loaded.
   dotspacemacs-excluded-packages '(
                                    smartparens
                                    )
   ;; If non-nil spacemacs will delete any orphan packages, i.e. packages that
   ;; are declared in a layer which is not a member of
   ;; the list `dotspacemacs-configuration-layers'. (default t)
   dotspacemacs-delete-orphan-packages t))

(defun dotspacemacs/init ()
  "Initialization function.
This function is called at the very startup of Spacemacs initialization
before layers configuration.
You should not put any user code in there besides modifying the variable
values."
  ;; This setq-default sexp is an exhaustive list of all the supported
  ;; spacemacs settings.
  (setq-default
   ;; If non nil ELPA repositories are contacted via HTTPS whenever it's
   ;; possible. Set it to nil if you have no way to use HTTPS in your
   ;; environment, otherwise it is strongly recommended to let it set to t.
   ;; This variable has no effect if Emacs is launched with the parameter
   ;; `--insecure' which forces the value of this variable to nil.
   ;; (default t)
   dotspacemacs-elpa-https t
   ;; Maximum allowed time in seconds to contact an ELPA repository.
   dotspacemacs-elpa-timeout 5
   ;; If non nil then spacemacs will check for updates at startup
   ;; when the current branch is not `develop'. (default t)
   dotspacemacs-check-for-update t
   ;; One of `vim', `emacs' or `hybrid'. Evil is always enabled but if the
   ;; variable is `emacs' then the `holy-mode' is enabled at startup. `hybrid'
   ;; uses emacs key bindings for vim's insert mode, but otherwise leaves evil
   ;; unchanged. (default 'vim)
   dotspacemacs-editing-style 'emacs
   ;; If non nil output loading progress in `*Messages*' buffer. (default nil)
   dotspacemacs-verbose-loading nil
   ;; Specify the startup banner. Default value is `official', it displays
   ;; the official spacemacs logo. An integer value is the index of text
   ;; banner, `random' chooses a random text banner in `core/banners'
   ;; directory. A string value must be a path to an image format supported
   ;; by your Emacs build.
   ;; If the value is nil then no banner is displayed. (default 'official)
   dotspacemacs-startup-banner nil
   ;; List of items to show in the startup buffer. If nil it is disabled.
   ;; Possible values are: `recents' `bookmarks' `projects'.
   ;; (default '(recents projects))
   dotspacemacs-startup-lists '(recents projects)
   ;; Number of recent files to show in the startup buffer. Ignored if
   ;; `dotspacemacs-startup-lists' doesn't include `recents'. (default 5)
   dotspacemacs-startup-recent-list-size 5
   ;; Default major mode of the scratch buffer (default `text-mode')
   dotspacemacs-scratch-mode 'text-mode
   ;; List of themes, the first of the list is loaded when spacemacs starts.
   ;; Press <SPC> T n to cycle to the next theme in the list (works great
   ;; with 2 themes variants, one dark and one light)
   dotspacemacs-themes '(monokai
                         solarized-light
                         spacemacs-light
                         spacemacs-dark
                         solarized-dark
                         leuven
                         zenburn)
   ;; If non nil the cursor color matches the state color in GUI Emacs.
   dotspacemacs-colorize-cursor-according-to-state t
   ;; Default font. `powerline-scale' allows to quickly tweak the mode-line
   ;; size to make separators look not too crappy.
   dotspacemacs-default-font '("Ubuntu Mono"
                               :size 16
                               :weight normal
                               :width normal
                               :powerline-scale 2)
   ;; The leader key
   dotspacemacs-leader-key "SPC"
   ;; The leader key accessible in `emacs state' and `insert state'
   ;; (default "M-m")
   dotspacemacs-emacs-leader-key "M-m"
   ;; Major mode leader key is a shortcut key which is the equivalent of
   ;; pressing `<leader> m`. Set it to `nil` to disable it. (default ",")
   dotspacemacs-major-mode-leader-key ","
   ;; Major mode leader key accessible in `emacs state' and `insert state'.
   ;; (default "C-M-m)
   dotspacemacs-major-mode-emacs-leader-key "C-M-m"
   ;; These variables control whether separate commands are bound in the GUI to
   ;; the key pairs C-i, TAB and C-m, RET.
   ;; Setting it to a non-nil value, allows for separate commands under <C-i>
   ;; and TAB or <C-m> and RET.
   ;; In the terminal, these pairs are generally indistinguishable, so this only
   ;; works in the GUI. (default nil)
   dotspacemacs-distinguish-gui-tab t
   ;; (Not implemented) dotspacemacs-distinguish-gui-ret nil
   ;; The command key used for Evil commands (ex-commands) and
   ;; Emacs commands (M-x).
   ;; By default the command key is `:' so ex-commands are executed like in Vim
   ;; with `:' and Emacs commands are executed with `<leader> :'.
   dotspacemacs-command-key ":"
   ;; If non nil `Y' is remapped to `y$'. (default t)
   dotspacemacs-remap-Y-to-y$ t
   ;; Name of the default layout (default "Default")
   dotspacemacs-default-layout-name "Default"
   ;; If non nil the default layout name is displayed in the mode-line.
   ;; (default nil)
   dotspacemacs-display-default-layout nil
   ;; If non nil then the last auto saved layouts are resume automatically upon
   ;; start. (default nil)
   dotspacemacs-auto-resume-layouts t
   ;; Location where to auto-save files. Possible values are `original' to
   ;; auto-save the file in-place, `cache' to auto-save the file to another
   ;; file stored in the cache directory and `nil' to disable auto-saving.
   ;; (default 'cache)
   dotspacemacs-auto-save-file-location 'cache
   ;; Maximum number of rollback slots to keep in the cache. (default 5)
   dotspacemacs-max-rollback-slots 5
   ;; If non nil then `ido' replaces `helm' for some commands. For now only
   ;; `find-files' (SPC f f), `find-spacemacs-file' (SPC f e s), /and
   ;; `find-contrib-file' (SPC f e c) are replaced. (default nil)
   dotspacemacs-use-ido nil
   ;; If non nil, `helm' will try to minimize the space it uses. (default nil)
   dotspacemacs-helm-resize nil
   ;; if non nil, the helm header is hidden when there is only one source.
   ;; (default nil)
   dotspacemacs-helm-no-header nil
   ;; define the position to display `helm', options are `bottom', `top',
   ;; `left', or `right'. (default 'bottom)
   dotspacemacs-helm-position 'bottom
   ;; If non nil the paste micro-state is enabled. When enabled pressing `p`
   ;; several times cycle between the kill ring content. (default nil)
   dotspacemacs-enable-paste-micro-state nil
   ;; Which-key delay in seconds. The which-key buffer is the popup listing
   ;; the commands bound to the current keystroke sequence. (default 0.4)
   dotspacemacs-which-key-delay 0.1
   ;; Which-key frame position. Possible values are `right', `bottom' and
   ;; `right-then-bottom'. right-then-bottom tries to display the frame to the
   ;; right; if there is insufficient space it displays it at the bottom.
   ;; (default 'bottom)
   dotspacemacs-which-key-position 'bottom
   ;; If non nil a progress bar is displayed when spacemacs is loading. This
   ;; may increase the boot time on some systems and emacs builds, set it to
   ;; nil to boost the loading time. (default t)
   dotspacemacs-loading-progress-bar t
   ;; If non nil the frame is fullscreen when Emacs starts up. (default nil)
   ;; (Emacs 24.4+ only)
   dotspacemacs-fullscreen-at-startup nil
   ;; If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen.
   ;; Use to disable fullscreen animations in OSX. (default nil)
   dotspacemacs-fullscreen-use-non-native nil
   ;; If non nil the frame is maximized when Emacs starts up.
   ;; Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil.
   ;; (default nil) (Emacs 24.4+ only)
   dotspacemacs-maximized-at-startup t
   ;; A value from the range (0..100), in increasing opacity, which describes
   ;; the transparency level of a frame when it's active or selected.
   ;; Transparency can be toggled through `toggle-transparency'. (default 90)
   dotspacemacs-active-transparency 100
   ;; A value from the range (0..100), in increasing opacity, which describes
   ;; the transparency level of a frame when it's inactive or deselected.
   ;; Transparency can be toggled through `toggle-transparency'. (default 90)
   dotspacemacs-inactive-transparency 100
   ;; If non nil unicode symbols are displayed in the mode line. (default t)
   dotspacemacs-mode-line-unicode-symbols nil
   ;; If non nil smooth scrolling (native-scrolling) is enabled. Smooth
   ;; scrolling overrides the default behavior of Emacs which recenters the
   ;; point when it reaches the top or bottom of the screen. (default t)
   dotspacemacs-smooth-scrolling t
   ;; If non nil line numbers are turned on in all `prog-mode' and `text-mode'
   ;; derivatives. If set to `relative', also turns on relative line numbers.
   ;; (default nil)
   dotspacemacs-line-numbers nil
   ;; If non-nil smartparens-strict-mode will be enabled in programming modes.
   ;; (default nil)
   dotspacemacs-smartparens-strict-mode t
   ;; Select a scope to highlight delimiters. Possible values are `any',
   ;; `current', `all' or `nil'. Default is `all' (highlight any scope and
   ;; emphasis the current one). (default 'all)
   dotspacemacs-highlight-delimiters 'all
   ;; If non nil advises quit functions to keep server open when quitting.
   ;; (default nil)
   dotspacemacs-persistent-server nil
   ;; List of search tool executable names. Spacemacs uses the first installed
   ;; tool of the list. Supported tools are `ag', `pt', `ack' and `grep'.
   ;; (default '("ag" "pt" "ack" "grep"))
   dotspacemacs-search-tools '("ag" "pt" "ack" "grep")
   ;; The default package repository used if no explicit repository has been
   ;; specified with an installed package.
   ;; Not used for now. (default nil)
   dotspacemacs-default-package-repository nil
   ;; Delete whitespace while saving buffer. Possible values are `all'
   ;; to aggressively delete empty line and long sequences of whitespace,
   ;; `trailing' to delete only the whitespace at end of lines, `changed'to
   ;; delete only whitespace for changed lines or `nil' to disable cleanup.
   ;; (default nil)
   dotspacemacs-whitespace-cleanup nil
   ))

(defun dotspacemacs/user-init ()
  "Initialization function for user code.
It is called immediately after `dotspacemacs/init', before layer configuration
executes.
 This function is mostly useful for variables that need to be set
before packages are loaded. If you are unsure, you should try in setting them in
`dotspacemacs/user-config' first."
 )
(defun dotspacemacs/user-config ()
  "Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
bbyou should place your code here."


  (global-linum-mode) ; Show line numbers by default
  (linum-relative-toggle) 
  (spacemacs/toggle-truncate-lines-on)
  ;; Visual line navigation for textual modes
  (add-hook 'text-mode-hook 'spacemacs/toggle-visual-line-navigation-on)

  (setq-default dotspacemacs-configuration-layers '(
                                                    (auto-completion :variables
                                                                     auto-completion-enable-snippets-in-popup t
                                                                     auto-completion-enable-help-tooltip t
                                                                     auto-completion-return-key-behavior 'complete
                                                                     auto-completion-tab-key-behavior 'cycle
                                                                     auto-completion-complete-with-key-sequence nil
                                                                     auto-completion-complete-with-key-sequence-delay 0.1
                                                                     auto-completion-private-snippets-directory nil)
                                                    ))
  (setq tabbar-ruler-global-tabbar t)    ; get tabbar
  (setq tabbar-ruler-global-ruler nil)     ; get global ruler
  (setq tabbar-ruler-popup-menu nil)       ; get popup menu.
  (setq tabbar-ruler-popup-toolbar nil)    ; get popup toolbar
  (setq tabbar-ruler-popup-scrollbar nil)  ; show scroll-bar on mouse-move
  (setq powerline-default-separator 'bar)
  (require 'mc-cycle-cursors)
  (require 'company)
  (require 'tabbar-ruler)
  (setq tabbar-ruler-use-mode-icons nil) 
  (setq tabbar-use-images nil) 
  (tabbar-ruler-group-by-projectile-project)
  ;; hide-header-button
  (defcustom tabbar-hide-header-button t
    "Hide header button at left-up corner.
Default is t."
    :type 'boolean
    :set (lambda (symbol value)
           (set symbol value)
           (if value
               (setq
                tabbar-scroll-left-help-function nil ;don't show help information
                tabbar-scroll-right-help-function nil
                tabbar-help-on-tab-function nil
                tabbar-home-help-function nil
                tabbar-buffer-home-button (quote (("") "")) ;don't show tabbar button
                tabbar-scroll-left-button (quote (("") ""))
                tabbar-scroll-right-button (quote (("") "")))))
    :group 'tabbar)
  ;; Tabbar settings
  (set-face-attribute
   'tabbar-default nil
   :family "Ubuntu"
   :background "gray20"
   :foreground "gray20"
   :box '(:line-width 1 :color "gray20" :style nil))
  (set-face-attribute
   'tabbar-unselected nil
   :family "Ubuntu"
   :background "gray30"
   :foreground "white"
   :box '(:line-width 5 :color "gray30" :style nil))
  (set-face-attribute
   'tabbar-unselected-modified nil
   :family "Ubuntu"
   :background "gray30"
   :foreground "tomato"
   :box '(:line-width 5 :color "gray30" :style nil))
  (set-face-attribute
   'tabbar-unselected-highlight nil
   :family "Ubuntu"
   :background "gray30"
   :foreground "light gray"
   :box '(:line-width 5 :color "gray30" :style nil))
  (set-face-attribute
   'tabbar-unselected-modified nil
   :family "Ubuntu"
   :background "gray30"
   :foreground "tomato"
   :box '(:line-width 5 :color "gray30" :style nil))
  (set-face-attribute
   'tabbar-unselected nil
   :family "Ubuntu"
   :background "gray30"
   :foreground "white"
   :box '(:line-width 5 :color "gray30" :style nil))
  (set-face-attribute
   'tabbar-selected nil
   :family "Ubuntu"
   :background "gray75"
   :foreground "dim gray"
   :box '(:line-width 5 :color "gray75" :style nil))
  (set-face-attribute
   'tabbar-selected-highlight nil
   :family "Ubuntu"
   :background "gray75"
   :foreground "black"
   :box '(:line-width 5 :color "gray75" :style nil))
  (set-face-attribute
   'tabbar-selected nil
   :family "Ubuntu"
   :background "gray75"
   :foreground "black"
   :box '(:line-width 5 :color "gray75" :style nil))
  (set-face-attribute
   'tabbar-selected-modified nil
   :family "Ubuntu"
   :background "gray75"
   :foreground "dark red"
   :box '(:line-width 5 :color "gray75" :style nil))
  (set-face-attribute
   'tabbar-selected-modified nil
   :family "Ubuntu"
   :background "gray75"
   :foreground "dark red"
   :box '(:line-width 5 :color "gray75" :style nil))
  (set-face-attribute
   'tabbar-selected nil
   :family "Ubuntu"
   :background "gray75"
   :foreground "black"
   :box '(:line-width 5 :color "gray75" :style nil))
  (set-face-attribute
   'tabbar-highlight nil
   :family "Ubuntu"
   :background "white"
   :foreground "black"
   :underline nil
   :box '(:line-width 5 :color "white" :style nil))
  (set-face-attribute
   'tabbar-button nil
   :box '(:line-width 1 :color "gray20" :style nil))
  (set-face-attribute
   'tabbar-separator nil
   :background "gray20"
   :height 0.6)

    (setq tabbar-buffer-groups-function
          (lambda () (list "All Buffers")))
    (setq tabbar-buffer-list-function
          (lambda ()
            (remove-if
             (lambda(buffer)
               (find (aref (buffer-name buffer) 0) " *"))
             (buffer-list))))

  ;; Change padding of the tabs
  ;; we also need to set separator to avoid overlapping tabs by highlighted tabs
  (custom-set-variables
   '(tabbar-separator (quote (0.5))))
  ;; adding spaces
  (defun tabbar-buffer-tab-label (tab)
    "Return a label for TAB.
That is, a string used to represent it on the tab bar."
    (let ((label  (if tabbar--buffer-show-groups
                      (format "[%s]  " (tabbar-tab-tabset tab))
                    (format "%s  " (tabbar-tab-value tab)))))
      ;; Unless the tab bar auto scrolls to keep the selected tab
      ;; visible, shorten the tab label to keep as many tabs as possible
      ;; in the visible area of the tab bar.
      (if tabbar-auto-scroll-flag
          label
        (tabbar-shorten
         label (max 1 (/ (window-width)
                         (length (tabbar-view
                                  (tabbar-current-tabset)))))))))

  (setq ring-bell-function (lambda ()
                             (if (not air-bell-ringing)
                                 (let* ((bg (face-background 'default))
                                        (fg (face-foreground 'default))
                                        (reset `(lambda ()
                                                  (set-face-background 'default ,bg)
                                                  (set-face-foreground 'default ,fg)
                                                  (setq air-bell-ringing nil))))

                                   (set-face-background 'default "NavajoWhite4")
                                        ;(set-face-foreground 'default "black")
                                   (setq air-bell-ringing t)

                                   (run-with-timer 0.05 nil reset)))))


  (defun alganet-duplicate-region (arg)
    "Duplicates the current line or region ARG times.
    If there's no region, the current line will be duplicated. However, if
    there's a region, all lines that region covers will be duplicated."
    (interactive "p")
    (let (beg end (origin (point)))
      (if (and mark-active (> (point) (mark)))
          (exchange-point-and-mark))
      (setq beg (line-beginning-position))
      (if mark-active
          (exchange-point-and-mark))
      (setq end (line-end-position))
      (let ((region (buffer-substring-no-properties beg end)))
        (dotimes (i arg)
          (goto-char end)
          (newline)
          (insert region)
          (setq end (point)))
        (goto-char (+ origin (* (length region) arg) arg)))))

  (defun alganet-text-scale-reset ()
    "Set the height of the default face in the current buffer to its default value."
    (interactive)
    (text-scale-increase 0))

  ;; when C-- C-> (to unmark next)
  ;; cycle-backward first, then do unmark
  (advice-add 'mc/mark-next-like-this
              :before
              '(lambda(arg)(interactive "p")
                 (when (< arg 0)
                   (mc/cycle-backward))))

  (advice-add 'mc/mark-next-like-this
              :after
              '(lambda(arg)(interactive "p")
                 (unless (< arg 0)
                   (mc/cycle-forward))))

  (advice-add 'mc/skip-to-next-like-this
              :before
              '(lambda()(interactive)
                 (when (> (mc/num-cursors) 1)
                   (mc/cycle-backward))))


  (global-set-key (kbd "C-<tab>") (lambda () (interactive) (tabbar-forward)))
  (global-set-key (kbd "C-S-<tab>") (lambda () (interactive) (tabbar-backward)))
  (global-set-key (kbd "C-p")    'helm-projectile-find-file-dwim)
  (global-set-key (kbd "C-'") (lambda () (interactive) (next-buffer)))
  (global-set-key (kbd "C-w") (lambda () (interactive) (kill-this-buffer)))
  (global-set-key (kbd "C-M-w") (lambda () (interactive) (delete-window)))
  (global-set-key (kbd "C-n") (lambda () (interactive) (spacemacs/new-empty-buffer)))
  (global-set-key (kbd "C-d")   'mc/mark-next-like-this)
  (global-set-key (kbd "C-S-p")   'helm-M-x)
  (global-set-key (kbd "C-S-<up>")   'drag-stuff-up)
  (global-set-key (kbd "C-S-<down>")   'drag-stuff-down)
  (global-set-key (kbd "C-M-<up>")   'other-window)
  (global-set-key (kbd "C-M-/")   'split-window-right-and-focus)
  (global-set-key (kbd "C-M--")   'split-window-below-and-focus)
  (global-set-key (kbd "C-o")   'find-file)
  (global-set-key (kbd "C-s")   'save-buffer)
  (global-set-key (kbd "C-S-s") 'write-file)
  (global-set-key (kbd "C-f")   'isearch-forward)
  (global-set-key (kbd "M-f")   'helm-swoop)
  (global-set-key (kbd "C-q")   'spacemacs/kill-emacs)'
  (global-set-key (kbd "C--")   'text-scale-decrease)
  (global-set-key (kbd "C-+")   'text-scale-increase)
  (global-set-key (kbd "C-=")   'text-scale-increase)
  (global-set-key (kbd "C-0")   'alganet-text-scale-reset)
  (global-set-key (kbd "C-S-d") 'alganet-duplicate-region)
  (global-set-key (kbd "C-a") 'mark-whole-buffer)
  (global-set-key (kbd "C-h")   'query-replace)      ; Find and replace...
  (define-key isearch-mode-map (kbd "<return>") 'isearch-repeat-forward)
  (define-key isearch-mode-map (kbd "S-<return>") 'isearch-repeat-backward)
  (define-key mc/keymap        (kbd "<escape>")  'mc/keyboard-quit)
  (define-key mc/keymap        (kbd "<return>") 'newline-and-indent)  

  (tabbar-mode 1)
  (cua-mode)
  (global-auto-complete-mode)
  (blink-cursor-mode)
  (spaceline-compile)
  )

;; Do not write anything past this comment. This is where Emacs will
;; auto-generate custom variable definitions.
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-faces-vector
   [default default default italic underline success warning error])
 '(ansi-color-names-vector
   ["#272822" "#F92672" "#A6E22E" "#E6DB74" "#66D9EF" "#FD5FF0" "#A1EFE4" "#F8F8F2"])
 '(compilation-message-face (quote default))
 '(cua-global-mark-cursor-color "#2aa198")
 '(cua-normal-cursor-color "#839496")
 '(cua-overwrite-cursor-color "#b58900")
 '(cua-read-only-cursor-color "#859900")
 '(highlight-changes-colors (quote ("#FD5FF0" "#AE81FF")))
 '(highlight-symbol-colors
   (--map
    (solarized-color-blend it "#002b36" 0.25)
    (quote
     ("#b58900" "#2aa198" "#dc322f" "#6c71c4" "#859900" "#cb4b16" "#268bd2"))))
 '(highlight-symbol-foreground-color "#93a1a1")
 '(highlight-tail-colors
   (quote
    (("#49483E" . 0)
     ("#679A01" . 20)
     ("#4BBEAE" . 30)
     ("#1DB4D0" . 50)
     ("#9A8F21" . 60)
     ("#A75B00" . 70)
     ("#F309DF" . 85)
     ("#49483E" . 100))))
 '(hl-bg-colors
   (quote
    ("#7B6000" "#8B2C02" "#990A1B" "#93115C" "#3F4D91" "#00629D" "#00736F" "#546E00")))
 '(hl-fg-colors
   (quote
    ("#002b36" "#002b36" "#002b36" "#002b36" "#002b36" "#002b36" "#002b36" "#002b36")))
 '(hl-sexp-background-color "#efebe9")
 '(magit-diff-use-overlays nil)
 '(nrepl-message-colors
   (quote
    ("#dc322f" "#cb4b16" "#b58900" "#546E00" "#B4C342" "#00629D" "#2aa198" "#d33682" "#6c71c4")))
 '(package-selected-packages
   (quote
    (xterm-color toc-org shell-pop phpunit f phpcbf php-auto-yasnippets org-repo-todo org-present org-pomodoro alert log4e gntp org-plus-contrib org-bullets multi-term mmm-mode markdown-toc markdown-mode htmlize gnuplot git-gutter-fringe+ git-gutter-fringe fringe-helper git-gutter+ git-gutter gh-md eshell-prompt-extras esh-help drupal-mode php-mode diff-hl smeargle helm-gitignore request gitignore-mode gitconfig-mode gitattributes-mode git-timemachine git-messenger magit-popup git-commit with-editor helm-company helm-c-yasnippet company-statistics company-quickhelp pos-tip company auto-yasnippet yasnippet ac-ispell auto-complete drag-stuff editorconfig zenburn-theme monokai-theme multiple-cursors persistent-soft ergoemacs-mode paradox hydra adaptive-wrap ws-butler window-numbering volatile-highlights vi-tilde-fringe spaceline s powerline smooth-scrolling restart-emacs rainbow-delimiters popwin persp-mode pcre2el spinner page-break-lines open-junk-file neotree move-text macrostep lorem-ipsum linum-relative leuven-theme info+ indent-guide ido-vertical-mode hungry-delete hl-todo highlight-parentheses highlight-numbers parent-mode highlight-indentation help-fns+ helm-themes helm-swoop helm-projectile helm-mode-manager helm-make projectile pkg-info epl helm-flx helm-descbinds helm-ag google-translate golden-ratio flx-ido flx fill-column-indicator fancy-battery expand-region exec-path-from-shell evil-visualstar evil-tutor evil-surround evil-search-highlight-persist evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-lisp-state smartparens evil-indent-plus evil-iedit-state iedit evil-exchange evil-escape evil-args evil-anzu anzu eval-sexp-fu highlight elisp-slime-nav define-word clean-aindent-mode buffer-move bracketed-paste auto-highlight-symbol auto-compile packed dash aggressive-indent ace-window ace-link ace-jump-helm-line helm avy helm-core popup async quelpa package-build use-package which-key bind-key bind-map evil spacemacs-theme)))
 '(paradox-github-token t)
 '(pos-tip-background-color "#A6E22E")
 '(pos-tip-foreground-color "#272822")
 '(smartrep-mode-line-active-bg (solarized-color-blend "#859900" "#073642" 0.2))
 '(tabbar-separator (quote (0.5)))
 '(term-default-bg-color "#002b36")
 '(term-default-fg-color "#839496")
 '(vc-annotate-background nil)
 '(vc-annotate-color-map
   (quote
    ((20 . "#F92672")
     (40 . "#CF4F1F")
     (60 . "#C26C0F")
     (80 . "#E6DB74")
     (100 . "#AB8C00")
     (120 . "#A18F00")
     (140 . "#989200")
     (160 . "#8E9500")
     (180 . "#A6E22E")
     (200 . "#729A1E")
     (220 . "#609C3C")
     (240 . "#4E9D5B")
     (260 . "#3C9F79")
     (280 . "#A1EFE4")
     (300 . "#299BA6")
     (320 . "#2896B5")
     (340 . "#2790C3")
     (360 . "#66D9EF"))))
 '(vc-annotate-very-old-color nil)
 '(weechat-color-list
   (unspecified "#272822" "#49483E" "#F70057" "#F92672" "#86C30D" "#A6E22E" "#BEB244" "#E6DB74" "#40CAE4" "#66D9EF" "#FB35EA" "#FD5FF0" "#74DBCD" "#A1EFE4" "#F8F8F2" "#F8F8F0"))
 '(xterm-color-names
   ["#073642" "#dc322f" "#859900" "#b58900" "#268bd2" "#d33682" "#2aa198" "#eee8d5"])
 '(xterm-color-names-bright
   ["#002b36" "#cb4b16" "#586e75" "#657b83" "#839496" "#6c71c4" "#93a1a1" "#fdf6e3"]))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(company-tooltip-common ((t (:inherit company-tooltip :weight bold :underline nil))))
 '(company-tooltip-common-selection ((t (:inherit company-tooltip-selection :weight bold :underline nil)))))

@a13ph
Copy link
Author

a13ph commented Jul 21, 2016

mode-icons are probably a good addition towards this goal: #5632

@jasonm23
Copy link

jasonm23 commented Oct 9, 2016

Probably tack onto this the need for an OSX style CUA mode. Cmd(Super or Meta) instead of Ctrl for things like:

  • Cmd o Open
  • Cmd s Save
  • Cmd q Quit
  • Cmd z Undo
  • Cmd x Cut
  • Cmd c Copy
  • Cmd v Paste

Maybe a few more

  • Cmd f isearch
  • Cmd a select all
  • Cmd w kill frame

...

I think Emacs for OSX build supports at least some of these

@ryukinix
Copy link

I prefer Ctrl

@jasonm23
Copy link

I prefer Ctrl

@ryukinix - it's important to note that all these bindings are platform specific, and should match the general expectation and standard of the platform.

Personal preference is what your local settings are for.

On Windows and many popular Linux Window managers the Ctrl bindings are standardised and on OSX Cmd key bindings are the standard.

Please bear these standards in mind. It's really not about anyone's personal preferences.

@arronmabrey
Copy link
Contributor

@jasonm23 I totally agree with the OSX keybindings using CMD

However it might be an issue when running via terminal. I'm not sure of a way for the CMD to be forwarded to emacs. I believe it gets trapped by the Terminal.app or in my case iTerm2.app.

Although if anyone know otherwise please let me know.

@jasonm23
Copy link

We can very easily set up conditional bindings for different platforms & environments

@PhilipDaniels
Copy link

I have been working on my own set of keybindings to bring Emacs more in line with Windows defaults. The attempt is here https://github.com/PhilipDaniels/windows-defaults, it is structured as a Spacemacs layer. Feedback welcome.

@MarcusE1W
Copy link

This works great for me 😄
Is there a plan to make this an official layer at some point ?
What would still need to be done ?

@syl20bnr
Copy link
Owner

syl20bnr commented Jun 16, 2018 via email

@tiagobalmeida
Copy link

tiagobalmeida commented Aug 25, 2018

I've been playing around with @PhilipDaniels code.

Ctrl+Z as undo did not work for me so I had to do something to remap evil-toggle-key. Seems to be working now. I'm an emacs lisp noob... so can you please have a look to see if this is OK or is there a better way of remapping ?

package.el:

(defun windows-keybindings/init-evil ()
  (setq evil-toggle-key "C-`"))

Layer code here:
https://github.com/jumpifzero/spacemacs-windows-keybindings

Happy to contribute this to spacemacs core when it is fully working as a few more keys need to be added.

Thanks

@tiagobalmeida
Copy link

Update:
With an up to date spacemacs on emacs 26 I get this warning on startup:

More than one init function found for package evil. Previous owner was spacemacs-bootstrap, replacing it with layer windows-keybindings.

This is becuase the windows-keybindings layer is providing a new init for evil to override the evil trigger key so it doesn't collide with Ctrl + Z.
Anyone more knowledgeable can help me sort this cleanly please?

Thanks

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
@MarcusE1W
Copy link

@tiagobalmeida
Have you been able to solve the short cut clash you had?

@tiagobalmeida
Copy link

@tiagobalmeida
Have you been able to solve the short cut clash you had?

Hi, don't think so. I lived with that warning for a while.
The closest I got to working "windows" keybindings on spacemacs is here: https://github.com/tiagobalmeida/spacemacs-windows-keybindings .

It is fairly usable but not complete.

@duianto duianto removed the stale marked as a stale issue/pr (usually by a bot) label Apr 5, 2020
@github-actions
Copy link

github-actions bot commented Apr 5, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Apr 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Mailling list - Discussion stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests

13 participants