Giter VIP home page Giter VIP logo

ros-nvim's Introduction

🐒 ros-nvim 🐒

ROS in Neovim.

List ROS nodes with live info πŸ”¦ nodelist_compressed List ROS msgs with definitions βœ‰οΈ msg_compressed Search current ROS package πŸ”Ž search_package_compressed

Wraps ROS CLI utils (rosnode, rostopic, rosmsg, etc) with Vim and Telescope to bring it right to your favourite editor! 😁

🀩 Features

πŸ“¦ ROS package wise build and search

  • Search files with Telescope in the current ROS package
  • Live grep with Telescope in the current ROS package
  • Build current ROS package in terminal
  • Execute current ROS test in terminal

πŸ•΅οΈ Several Telescope extensions for ROS introspection

  • Nodes list & info
  • Topics list & info & echo
  • Services list & info
  • Msgs list & info
  • Srvs list & info
  • Params list & values

πŸ¦’ Requirements

🏠 Installation

With your plugin manager of choice:

vim-plug:

Plug 'thibthib18/ros-nvim'

Packer:

use { 'thibthib18/ros-nvim', config=function()
    require 'ros-nvim'.setup({})
  end
}

βš™οΈ Setup

In Lua:

local vim_utils = require "ros-nvim.vim-utils"
require 'ros-nvim'.setup {
  -- path to your catkin workspace
  catkin_ws_path = "~/catkin_ws",

  -- make program (e.g. "catkin_make" or "catkin build" )
  catkin_program = "catkin_make"

  --method for opening terminal for e.g. catkin_make: `vim_utils.open_new_buffer` or custom function
  open_terminal_method = function()
      require vim-utils.open_split()
  end,

  -- terminal height for build / test, only valid with `open_terminal_method=open_split()`
  terminal_height = 8

  -- Picker mappings
  node_picker_mappings = function(map)
      map("n", "<c-k>", vim_utils.open_terminal_with_format_cmd_entry("rosnode kill %s"))
      map("i", "<c-k>", vim_utils.open_terminal_with_format_cmd_entry("rosnode kill %s"))
  end,
  topic_picker_mappings = function(map)
      local cycle_previewers = function(prompt_bufnr)
          local picker = action_state.get_current_picker(prompt_bufnr)
          picker:cycle_previewers(1)
      end
      map("n", "<c-b>", vim_utils.open_terminal_with_format_cmd_entry("rostopic pub %s"))
      map("i", "<c-b>", vim_utils.open_terminal_with_format_cmd_entry("rostopic pub %s"))
      -- While browsing topics, press <c-e> to switch between `rostopic info` and `rostopic echo`
      map("n", "<c-e>", cycle_previewers)
      map("i", "<c-e>", cycle_previewers)
  end,
  service_picker_mappings = function(map)
      map("n", "<c-e>", vim_utils.open_terminal_with_format_cmd_entry("rosservice call %s"))
      map("i", "<c-e>", vim_utils.open_terminal_with_format_cmd_entry("rosservice call %s"))
  end,
  param_picker_mappings = function(map)
      map("n", "<c-e>", vim_utils.open_terminal_with_format_cmd_entry("rosparam set %s"))
      map("i", "<c-e>", vim_utils.open_terminal_with_format_cmd_entry("rosparam set %s"))
  end
}

In Vim, simply enclose it in a lua block:

lua << EOF
local vim_utils = require "ros-nvim.vim-utils"
require 'ros-nvim'.setup {
  -- path to your catkin workspace
  catkin_ws_path = "~/catkin_ws",

  -- make program (e.g. "catkin_make" or "catkin build" )
  catkin_program = "catkin_make"

  --method for opening terminal for e.g. catkin_make: utils.open_new_buffer or custom function
  open_terminal_method = function()
      require vim-utils.open_split()
  end,

  -- terminal height for build / test, only valid with `open_terminal_method=open_split()`
  terminal_height = 8

  -- Picker mappings
  node_picker_mappings = function(map)
      map("n", "<c-k>", vim_utils.open_terminal_with_format_cmd_entry("rosnode kill %s"))
      map("i", "<c-k>", vim_utils.open_terminal_with_format_cmd_entry("rosnode kill %s"))
  end,
  topic_picker_mappings = function(map)
      local cycle_previewers = function(prompt_bufnr)
          local picker = action_state.get_current_picker(prompt_bufnr)
          picker:cycle_previewers(1)
      end
      map("n", "<c-b>", vim_utils.open_terminal_with_format_cmd_entry("rostopic pub %s"))
      map("i", "<c-b>", vim_utils.open_terminal_with_format_cmd_entry("rostopic pub %s"))
      map("n", "<c-e>", cycle_previewers)
      map("i", "<c-e>", cycle_previewers)
  end,
  service_picker_mappings = function(map)
      map("n", "<c-e>", vim_utils.open_terminal_with_format_cmd_entry("rosservice call %s"))
      map("i", "<c-e>", vim_utils.open_terminal_with_format_cmd_entry("rosservice call %s"))
  end,
  param_picker_mappings = function(map)
      map("n", "<c-e>", vim_utils.open_terminal_with_format_cmd_entry("rosparam set %s"))
      map("i", "<c-e>", vim_utils.open_terminal_with_format_cmd_entry("rosparam set %s"))
  end
}
EOF

βš™οΈ Config

" Search files in current package
nnoremap <leader>fp <cmd>lua require('ros-nvim.telescope.package').search_package()<cr>
" Live grep in current package
nnoremap <leader>fgp <cmd>lua require('ros-nvim.telescope.package').grep_package()<cr>

" #### ROS Introspection ####
" Topics list & info
nnoremap <leader>rtl <cmd>lua require('ros-nvim.telescope.pickers').topic_picker()<cr>
" Nodes list & info
nnoremap <leader>rnl <cmd>lua require('ros-nvim.telescope.pickers').node_picker()<cr>
" Services list & info
nnoremap <leader>rsl <cmd>lua require('ros-nvim.telescope.pickers').service_picker()<cr>
" Service definitions list & info
nnoremap <leader>rds <cmd>lua require('ros-nvim.telescope.pickers').srv_picker()<cr>
" Message definitions list & info
nnoremap <leader>rdm <cmd>lua require('ros-nvim.telescope.pickers').msg_picker()<cr>
" Params list & values
nnoremap <leader>rpl <cmd>lua require('ros-nvim.telescope.pickers').param_picker()<cr>

" Build entire workspace
nnoremap <leader>bb <cmd>lua require('ros-nvim.build').catkin_make()<cr>
" Build current package
nnoremap <leader>bp <cmd>lua require('ros-nvim.build').catkin_make_pkg()<cr>

" Execute current rostest
nnoremap <leader>rt <cmd>lua require('ros-nvim.test').rostest()<cr>

ros-nvim's People

Contributors

thibthib18 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ros-nvim's Issues

What's ROS?

I guess it is in the category β€œif you need to ask you have no business to”, but it would be probably kind to your random visitors to at least point in README to some explanation what ROS is.

Any Plan for ROS2 Support?

This plugin looks super cool, but I am going to be working with ROS2, which doesn't seem like this plugin works for. Is there any plan to add support for that?

please provide a clean default configuration

I have been using the plugin for a while, and I have realised that my config wasn't up to date when I opened the readme and saw major changes in the configuration.
unfortunately I found some errors in the configuration and I would ask if you could kindly provide a clean configuration that can be simply copied and pasted, because as of right now it doesn't work.

I got the default to work by setting the shortcuts and nothing more, because when I tried adding a setup function I couldn't figure out how to correct.
first error (although small) I found is

use { 'thibthib18/ros-nvim', config=function()
  require 'ros-nvim'.setup({})
}

lacking and end for the function.

then in the setup function
map("n", "<c-k>", vim_utils.open_terminal_with_format_cmd_entry("rosnode kill %s"))
vim_util isn't specified. I tried using vim.utils.open_terminal_with_format_cmd_entry but it didn't work at first and want to dig too much since you already have a working configuration with these fixed.

also, thank you for the great plugin, the echo thing in the picker is awesome and really helpful

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.