Code Monkey home page Code Monkey logo

n4js's Introduction

Neo4j shell for emacs

1. Dependencies

  • cypher-mode: can be installed from melpa

2. Installation

Melpa

Coming soon

Manual install

  • Clone it into your .emacs.d and add it into load path
(add-to-list 'load-path "~/.emacs.d/n4js.el/")
  • Load the library with require
(require 'n4js)

3. Variables

Change these variables based on your demand

  • n4js-cli-program: the name of neo4j shell cli program, default to neo4j-shell. Change it to absolute path if it's not in your load path.
(setq n4js-cli-program "/path/to/neo4j-shell")
  • n4js-cli-arguments: the list of arguments to pass to neo4j-shell.

  • n4js-pop-to-buffer: whether to pop up the neo4j shell buffer after sending command to execute.

  • n4js-pop-to-buffer-function: the function used for pop up the neo4j shell buffer if the above variable is set to t. Default is pop-to-buffer. An example is pop-to-buffer-same-window to pop up the neo4j buffer to current window instead of other window.

  • n4js-font-lock-keywords: font lock keywords list, default to cypher-font-lock-keywords so that why we need cypher-mode as a dependency. Usually you don't need to change this variable.

4. Commands

  • n4js-start: start a neo4j shell process
  • n4js-send-current-region: send the active region to neo4j shell process
  • n4js-send-buffer: send the whole buffer to neo4j shell process
  • n4js-send-paragraph: send the paragraph at point to neo4j shell process
  • n4js-send-region-or-buffer: send the current region if active, otherwise send the whole buffer to neo4j shell process
  • n4js-send-dwim: send the current region if active, otherwise send the paragraph at point to neo4j shell process
  • n4js-switch-to-buffer: switch to neo4j shell buffer if exist, otherwise, start a new one

5. Tips

Connect to a Neo4j shell with option

If the neo4j shell instance is running on a different port other than the default 1337, add this to your .emacs

(setq n4js-cli-arguments '("-port" "7475"))

Connect to a remote Neo4j shell instance

Usually, passing the argument -port and -host is not enough if you want to connect to a neo4j shell that is not running on your computer because neo4j shell requires some other port for running over RMI. In that case, you can use the ssh tunnel for connecting

ssh user@host -p 2222 /path/to/neo4j-shell -port 12345

To achieve that, add this to your .emacs

(setq n4js-cli-program "ssh")
(setq n4js-cli-arguments '("user@host" "-p" "2222" "/path/to/neo4j-shell -port 12345"))

Connect to a Neo4j shell instance inside Vagrant

To connect to a neo4j shell instance running inside Vagrant, use the vagrant ssh command like this

vagrant ssh -c '/path/to/neo4j-shell -port 12345'

To achieve that, add this to your .emacs

(setq n4js-cli-program "vagrant")
(setq n4js-cli-arguments '("ssh" "-c" "/path/to/neo4j-shell -port 12345"))

Note: in this case, you need to change to a dired buffer or a file inside that project folder (or any buffer with default-directory inside the project folder) so that when running the start command, it will run with the cwd is the default-directory. You only need to do this once when you call the command n4js-start.

6. Demo

Neo4j shell inside Emacs

n4js's People

Contributors

syohex avatar tmtxt avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.