updated nvim config

This commit is contained in:
Thies Lennart Alff 2023-09-03 20:23:07 +02:00
parent ec1a6cd00f
commit 26b5d14b47
12 changed files with 68 additions and 22 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.log
nvim/lazy-lock.json

View file

@ -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"]

3
build Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/bash
docker compose build

View file

@ -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:

View file

@ -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

View file

@ -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', '<leader>a', mark.add_file)
vim.keymap.set('n', '<C-e>', ui.toggle_quick_menu)
@ -8,3 +10,7 @@ vim.keymap.set('n', '<C-h>', function() ui.nav_file(1) end)
vim.keymap.set('n', '<C-t>', function() ui.nav_file(2) end)
vim.keymap.set('n', '<C-n>', function() ui.nav_file(3) end)
vim.keymap.set('n', '<C-s>', function() ui.nav_file(4) end)
vim.keymap.set('n', '<leader>c', cmd_ui.toggle_quick_menu)
vim.keymap.set('n', '<leader>gt1', function() term.gotoTerminal(1) end)
vim.keymap.set('n', '<leader>br', function() term.sendCommand(1, 'build_ros') end)

View file

@ -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({
['<C-space>'] = cmp.mapping.complete(),
['<C-j>'] = cmp.mapping.scroll_docs(1),
['<C-k>'] = cmp.mapping.scroll_docs(-1),
['<CR>'] = cmp.mapping.confirm({ select = false }),
},
window = {
completion = cmp.config.window.bordered(),

View file

@ -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" }
}

View file

@ -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'

View file

@ -28,7 +28,7 @@ vim.keymap.set('n', '<leader>f', function()
end)
-- quickfix navigation
vim.keymap.set('n', '<C-k>', '<cmd>cnext<CR>zz')
vim.keymap.set('n', '<C-j>', '<cmd>cprev<CR>zz')
vim.keymap.set('n', '<leader>k', '<cmd>lnext<CR>zz')
vim.keymap.set('n', '<leader>j', '<cmd>lprev<CR>zz')
vim.keymap.set('n', '<C-j>', '<cmd>cnext<CR>zz')
vim.keymap.set('n', '<C-k>', '<cmd>cprev<CR>zz')
vim.keymap.set('n', '<leader>j', '<cmd>lnext<CR>zz')
vim.keymap.set('n', '<leader>k', '<cmd>lprev<CR>zz')

View file

@ -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 },
}

3
run Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/bash
docker compose run --rm --name ros2-vim dev