Variable: neocaml-base-mode-map

neocaml-base-mode-map is a variable defined in neocaml.el.

Value

C-M-u      neocaml-backward-up-list
C-c 4 C-a  ff-find-other-file-other-window
C-c C-a    ff-find-other-file
C-c C-c    compile
C-c C-f    neocaml-format-buffer

Documentation

Keymap shared by neocaml-mode and neocaml-interface-mode.

Source Code

;; Defined in /nix/store/ahssdx4rwzyxhyhavpn0bkznk13xrggi-emacs-packages-deps/share/emacs/site-lisp/elpa/neocaml-20260907.2015/neocaml.el
;;;; Major mode definitions

;; Mode hierarchy (following the pattern used by c-ts-mode / c++-ts-mode):
;;
;;   prog-mode
;;     └─ neocaml-base-mode     — shared setup: syntax table, comments,
;;          │                      compilation, navigation, keybindings,
;;          │                      prettify-symbols
;;          ├─ neocaml-mode      — .ml: ocaml grammar, ml-specific imenu
;;          └─ neocaml-interface-mode — .mli: ocaml-interface grammar,
;;                                       mli-specific imenu
;;
;; Users hook into neocaml-base-mode-hook for configuration that applies
;; to both modes.  Language-specific setup lives in neocaml--setup-mode.

(defvar neocaml-base-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "C-c C-a") #'ff-find-other-file)
    (define-key map (kbd "C-c 4 C-a") #'ff-find-other-file-other-window)
    (define-key map (kbd "C-c C-c") #'compile)
    (define-key map (kbd "C-c C-f") #'neocaml-format-buffer)
    (define-key map (kbd "C-M-u") #'neocaml-backward-up-list)
    (easy-menu-define neocaml-mode-menu map "Neocaml Mode Menu"
      '("OCaml"
        ("Navigate"
         ["Beginning of Definition" beginning-of-defun
          :help "Move to the beginning of the current definition"]
         ["End of Definition" end-of-defun
          :help "Move to the end of the current definition"]
         ["Forward Expression" forward-sexp
          :help "Move forward across one balanced expression"]
         ["Backward Expression" backward-sexp
          :help "Move backward across one balanced expression"]
         ["Forward Statement" forward-sentence
          :help "Move forward to the next top-level statement"]
         ["Backward Statement" backward-sentence
          :help "Move backward to the previous top-level statement"]
         ["Up to Enclosing Block" neocaml-backward-up-list
          :help "Move out of the enclosing block"])
        ("Find..."
         ["Find Interface/Implementation" ff-find-other-file
          :help "Switch between the .ml and .mli file"]
         ["Find Interface/Implementation in other window" ff-find-other-file-other-window
          :help "Switch between the .ml and .mli file in another window"])
        ("Edit"
         ["Comment Out Region" comment-region (use-region-p)
          :help "Comment out the lines in the region"]
         ["Uncomment Region" uncomment-region (use-region-p)
          :help "Uncomment the lines in the region"]
         ["Fill Comment Paragraph" fill-paragraph t
          :help "Fill the comment paragraph at point"]
         "--"
         ["Indent Region" indent-region (use-region-p)
          :help "Reindent the lines in the region"]
         "--"
         ["Format Buffer (ocamlformat)" neocaml-format-buffer
          :help "Format the whole buffer with ocamlformat"])
        ("Toggle"
         ["Prettify Symbols" prettify-symbols-mode
          :style toggle :selected (bound-and-true-p prettify-symbols-mode)
          :help "Display keywords and operators using Unicode symbols"]
         ["Subword Mode" subword-mode
          :style toggle :selected (bound-and-true-p subword-mode)
          :help "Treat CamelCase subwords as separate words when moving"]
         ["Outline Minor Mode" outline-minor-mode
          :style toggle :selected (bound-and-true-p outline-minor-mode)
          :help "Fold and navigate top-level definitions"])
        ("Font-Lock Level"
         ["1 - Comments & definitions" (neocaml-set-font-lock-level 1)
          :style radio :selected (= treesit-font-lock-level 1)
          :help "Fontify only comments and definitions"]
         ["2 - + keywords, strings, types" (neocaml-set-font-lock-level 2)
          :style radio :selected (= treesit-font-lock-level 2)
          :help "Also fontify keywords, strings, and data types"]
         ["3 - + constants, numbers, etc." (neocaml-set-font-lock-level 3)
          :style radio :selected (= treesit-font-lock-level 3)
          :help "Full fontification: constants, numbers, literals, etc."]
         ["4 - Everything" (neocaml-set-font-lock-level 4)
          :style radio :selected (= treesit-font-lock-level 4)
          :help "Also fontify delimiters, operators, variables, etc."]
         "--"
         ["Customize (persist)..." (customize-variable 'treesit-font-lock-level)
          :help "Set the default font-lock level for new buffers"])
        "--"
        ["Mark Definition" mark-defun
         :help "Mark the current definition"]
        ["Mark Expression" mark-sexp
         :help "Mark the expression after point"]
        ["Mark Statement" neocaml-mark-sentence
         :help "Mark the current statement"]
        "--"
        ["Transpose Expression" transpose-sexps
         :help "Transpose the expressions around point"]
        ["Transpose Statement" transpose-sentences
         :help "Transpose the statements around point"]
        "--"
        ["Start/Switch to REPL" neocaml-repl-switch-to-repl
         :help "Start the OCaml REPL or switch to a running one"]
        ["Compile..." compile
         :help "Compile the project"]
        ["Cycle indent function" neocaml-cycle-indent-function
         :help "Switch between tree-sitter and relative indentation"]
        ["Install tree-sitter grammars" neocaml-install-grammars
         :help "Install the OCaml tree-sitter grammars"]
        ("Documentation"
         ["Browse OCaml Docs" neocaml-browse-ocaml-docs
          :help "Browse the OCaml documentation in a web browser"])
        "--"
        ["Customize neocaml..." (customize-group 'neocaml)
         :help "Customize neocaml settings"]
        ["Report a neocaml bug" neocaml-report-bug
         :help "Report a bug to the neocaml issue tracker"]
        ["Show bug report info" neocaml-bug-report-info
         :help "Show environment info useful for bug reports"]
        ["neocaml version" neocaml-version
         :help "Display the neocaml version"]))
    map)
  "Keymap shared by `neocaml-mode' and `neocaml-interface-mode'.")