From 26b5d14b4795df273ac3f2c8e5496a55762daddf Mon Sep 17 00:00:00 2001 From: Thies Lennart Alff Date: Sun, 3 Sep 2023 20:23:07 +0200 Subject: [PATCH] updated nvim config --- .gitignore | 2 ++ Dockerfile | 17 ++++++++++++----- build | 3 +++ docker-compose.yml | 6 ++++++ entrypoint.sh | 1 + nvim/after/plugin/harpoon.lua | 6 ++++++ nvim/after/plugin/lsp.lua | 12 +++++++++++- nvim/lazy-lock.json | 23 +++++++++++++---------- nvim/lua/lennartalff/init.lua | 4 +++- nvim/lua/lennartalff/remap.lua | 8 ++++---- nvim/lua/plugins/init.lua | 5 ++++- run | 3 +++ 12 files changed, 68 insertions(+), 22 deletions(-) create mode 100644 .gitignore create mode 100755 build create mode 100755 run diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..be921cc --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.log +nvim/lazy-lock.json diff --git a/Dockerfile b/Dockerfile index 85b6213..92ffd2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,7 @@ RUN apt-get update \ byobu \ ros-${ROS_DISTR}-rqt-tf-tree \ ros-${ROS_DISTR}-apriltag \ + ros-${ROS_DISTR}-plotjuggler-ros \ clang-format \ xclip \ # neovim build depends \ @@ -41,8 +42,11 @@ RUN apt-get update \ # end neovim build depends \ # && rosdep install --from-paths /ros2_underlay/src -y --ignore-src \ # && rosdep install --from paths /ros2/src -y --ignore-src \ - && curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh \ - && bash nodesource_setup.sh \ + && mkdir -p /etc/apt/keyrings \ + && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ + && NODE_MAJOR=20 \ + && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \ + && apt update \ && apt-get remove nodejs \ && apt-get install nodejs \ && git clone https://github.com/neovim/neovim.git \ @@ -85,13 +89,16 @@ RUN mkdir /zsh_history \ && chown -R $USERNAME /zsh_history ADD ros2-vim/nvim /home/$USERNAME/.config/nvim RUN chown -R $USERNAME /home/$USERNAME/ -ADD ros2-vim/entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh -RUN chown $USERNAME /entrypoint.sh USER ${USERNAME} RUN nvim --headless "+Lazy! sync" +qa RUN nvim --headless +"MasonInstall lua-language-server clangd python-lsp-server yaml-language-server" +q WORKDIR /home/$USERNAME + +USER root +ADD ros2-vim/entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +RUN chown $USERNAME /entrypoint.sh +USER ${USERNAME} # Switch back to dialog for any ad-hoc use of apt-get ENV DEBIAN_FRONTEND=dialog CMD [ "/usr/bin/zsh"] diff --git a/build b/build new file mode 100755 index 0000000..e7ad396 --- /dev/null +++ b/build @@ -0,0 +1,3 @@ +#!/usr/bin/bash + +docker compose build diff --git a/docker-compose.yml b/docker-compose.yml index 94fe8fd..ea52b14 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,7 +37,11 @@ services: - type: bind source: /var/run/avahi-daemon/socket target: /var/run/avahi-daemon/socket + - type: bind + source: ${HOME}/Documents/ros2-vim/nvim + target: /home/ros-user/.config/nvim - "ros2_zsh_history:/zsh_history" + - nvim_data:/home/ros-user/.local/share/nvim - $SSH_AUTH_SOCK:/ssh-agent - "~/.gitconfig:/etc/gitconfig" @@ -49,6 +53,8 @@ services: - SSH_AUTH_SOCK=/ssh-agent - TERM=xterm-256color - COLORTERM=24bit + - ROS_DOMAIN_ID=29 volumes: ros2_zsh_history: + nvim_data: diff --git a/entrypoint.sh b/entrypoint.sh index a5f030f..14801e7 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,6 +9,7 @@ echo "alias build_underlay=\"env -i HOME=\$HOME USER=\$USER TERM=xterm-256color echo 'source $HOME/uuv/ros2_underlay/install/setup.zsh' >> ~/.zshrc echo 'source $HOME/uuv/ros2/install/local_setup.zsh' >> ~/.zshrc +echo 'export RCUTILS_COLORIZED_OUTPUT=1' >> ~/.zshrc echo 'eval "$(register-python-argcomplete3 ros2)"' >> ~/.zshrc echo 'eval "$(register-python-argcomplete3 colcon)"' >> ~/.zshrc diff --git a/nvim/after/plugin/harpoon.lua b/nvim/after/plugin/harpoon.lua index 5abda8b..efcab1d 100644 --- a/nvim/after/plugin/harpoon.lua +++ b/nvim/after/plugin/harpoon.lua @@ -1,5 +1,7 @@ local mark = require('harpoon.mark') local ui = require('harpoon.ui') +local cmd_ui = require('harpoon.cmd-ui') +local term = require('harpoon.term') vim.keymap.set('n', 'a', mark.add_file) vim.keymap.set('n', '', ui.toggle_quick_menu) @@ -8,3 +10,7 @@ vim.keymap.set('n', '', function() ui.nav_file(1) end) vim.keymap.set('n', '', function() ui.nav_file(2) end) vim.keymap.set('n', '', function() ui.nav_file(3) end) vim.keymap.set('n', '', function() ui.nav_file(4) end) + +vim.keymap.set('n', 'c', cmd_ui.toggle_quick_menu) +vim.keymap.set('n', 'gt1', function() term.gotoTerminal(1) end) +vim.keymap.set('n', 'br', function() term.sendCommand(1, 'build_ros') end) diff --git a/nvim/after/plugin/lsp.lua b/nvim/after/plugin/lsp.lua index 0ccfca9..83ccf0e 100644 --- a/nvim/after/plugin/lsp.lua +++ b/nvim/after/plugin/lsp.lua @@ -9,7 +9,16 @@ require('mason-lspconfig').setup { 'lua_ls', 'clangd', 'pylsp', 'yamlls' } } -local lsp = require('lsp-zero').preset({}) +local lsp = require('lsp-zero').preset({ + manage_nvim_cmp = { + set_sources = 'lsp', + set_basic_mappings = true, + set_extra_mappings = false, + use_luasnip = true, + set_format = true, + documentation_window = true, + } +}) lsp.on_attach(function(client, bufnr) lsp.default_keymaps({ buffer = bufnr }) @@ -32,6 +41,7 @@ cmp.setup({ [''] = cmp.mapping.complete(), [''] = cmp.mapping.scroll_docs(1), [''] = cmp.mapping.scroll_docs(-1), + [''] = cmp.mapping.confirm({ select = false }), }, window = { completion = cmp.config.window.bordered(), diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index b88bf58..d66afc7 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,16 +1,19 @@ { - "LuaSnip": { "branch": "master", "commit": "c4d6298347f7707e9757351b2ee03d0c00da5c20" }, + "LuaSnip": { "branch": "master", "commit": "ea7d7ea510c641c4f15042becd27f35b3e5b3c2b" }, + "catppuccin": { "branch": "main", "commit": "2e3e5ebcdc24ef0d5b14a0a999dbbe7936512c46" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, - "gitsigns.nvim": { "branch": "main", "commit": "749267aaa863c30d721c9913699c5d94e0c07dd3" }, + "fugitive": { "branch": "master", "commit": "572c8510123cbde02e8a1dafcd376c98e1e13f43" }, + "gitsigns.nvim": { "branch": "main", "commit": "44adf808ace6cb65a3353bd61fa585a2d8fe0db3" }, "harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" }, - "lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" }, + "lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" }, "lsp-zero.nvim": { "branch": "v2.x", "commit": "f084f4a6a716f55bf9c4026e73027bb24a0325a3" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "2997f467881ac4faa6f8c5e7065e3a672297c8ad" }, - "mason.nvim": { "branch": "main", "commit": "a51c2d063c5377ee9e58c5f9cda7c7436787be72" }, - "nvim-cmp": { "branch": "main", "commit": "51f1e11a89ec701221877532ee1a23557d291dd5" }, - "nvim-lspconfig": { "branch": "master", "commit": "f7922e59aeb9bc3e31a660ea4e7405ffa3fc2c3a" }, - "nvim-treesitter": { "branch": "master", "commit": "99eef501a3d9128c15440296850b5bb178d6d560" }, - "plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" }, + "lsp_signature.nvim": { "branch": "master", "commit": "58d4e810801da74c29313da86075d6aea537501f" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "dfdd771b792fbb4bad8e057d72558255695aa1a7" }, + "mason.nvim": { "branch": "main", "commit": "0942198fb9a998b6ccee36fb8dd7495eb8ba659c" }, + "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, + "nvim-lspconfig": { "branch": "master", "commit": "a27356f1ef9c11e1f459cc96a3fcac5c265e72d6" }, + "nvim-treesitter": { "branch": "master", "commit": "f8c2825220bff70919b527ee68fe44e7b1dae4b2" }, + "plenary.nvim": { "branch": "master", "commit": "0dbe561ae023f02c2fb772b879e905055b939ce3" }, "rose-pine": { "branch": "main", "commit": "e29002cbee4854a9c8c4b148d8a52fae3176070f" }, - "telescope.nvim": { "branch": "master", "commit": "2d92125620417fbea82ec30303823e3cd69e90e8" } + "telescope.nvim": { "branch": "master", "commit": "2c1ed33a6f6f2db3b69f5421f6b405eda1b07748" } } \ No newline at end of file diff --git a/nvim/lua/lennartalff/init.lua b/nvim/lua/lennartalff/init.lua index af9c333..5d8957e 100644 --- a/nvim/lua/lennartalff/init.lua +++ b/nvim/lua/lennartalff/init.lua @@ -1,3 +1,5 @@ require('lennartalff.remap') require('lennartalff.set') -vim.cmd('colorscheme rose-pine') +-- vim.cmd('colorscheme rose-pine') +vim.o.termguicolors = true +vim.cmd.colorscheme 'catppuccin-frappe' diff --git a/nvim/lua/lennartalff/remap.lua b/nvim/lua/lennartalff/remap.lua index fca9097..ac97925 100644 --- a/nvim/lua/lennartalff/remap.lua +++ b/nvim/lua/lennartalff/remap.lua @@ -28,7 +28,7 @@ vim.keymap.set('n', 'f', function() end) -- quickfix navigation -vim.keymap.set('n', '', 'cnextzz') -vim.keymap.set('n', '', 'cprevzz') -vim.keymap.set('n', 'k', 'lnextzz') -vim.keymap.set('n', 'j', 'lprevzz') +vim.keymap.set('n', '', 'cnextzz') +vim.keymap.set('n', '', 'cprevzz') +vim.keymap.set('n', 'j', 'lnextzz') +vim.keymap.set('n', 'k', 'lprevzz') diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua index dcfbf4e..30306e1 100644 --- a/nvim/lua/plugins/init.lua +++ b/nvim/lua/plugins/init.lua @@ -7,7 +7,8 @@ return { { 'nvim-lua/plenary.nvim' } } }, { 'rose-pine/neovim', name = 'rose-pine' }, - -- 'tpope/fugitive', + { 'catppuccin/nvim', name = 'catppuccin', priority = 1000 }, + { 'tpope/vim-fugitive', name = 'fugitive' }, { 'VonHeikemen/lsp-zero.nvim', branch = 'v2.x', @@ -29,5 +30,7 @@ return { { 'nvim-lua/plenary.nvim' }, }, }, + { 'ray-x/lsp_signature.nvim', event = 'VeryLazy', opts = {}, + config = function(_, opts) require('lsp_signature').setup(opts) end }, } diff --git a/run b/run new file mode 100755 index 0000000..7b93e04 --- /dev/null +++ b/run @@ -0,0 +1,3 @@ +#!/usr/bin/bash + +docker compose run --rm --name ros2-vim dev