feat(nvim): use kickstart.nvim as base configuration

To make this effective, the following changes were made:

1. Patch `init.lua` to change common configurations
2. Implement custom configuration for plugins
This commit is contained in:
Joao P Dubas 2023-10-01 23:39:11 +00:00
parent e8d45d7b77
commit ea3b1a302e
4 changed files with 207 additions and 3 deletions

View File

@ -130,9 +130,16 @@ ENV PATH ${LOCAL_BIN_HOME}:$PATH
RUN curl https://rtx.pub/install.sh | sh \
&& curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash
# configure fish
RUN git clone https://github.com/NvChad/NvChad.git ~/.config/nvim \
&& fish -c true \
# git configuration
COPY ./patch/kickstart.nvim/updates.patch /tmp
COPY ./config/nvim/lua/custom/plugins/init.lua /tmp
RUN git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME}"/nvim \
&& cd ${XDG_CONFIG_HOME}/nvim \
&& git reset --hard 313bd75ca04cb2cef48a79ac3ad697a1b9a2daab \
&& git apply /tmp/updates.patch \
&& cp /tmp/init.lua ${XDG_CONFIG_HOME}/nvim/lua/custom/plugins \
&& nvim --headless "+Lazy! sync" +qa
# configure fish and bash
RUN fish -c true \
&& echo 'starship init fish | source' >> ${XDG_CONFIG_HOME}/fish/config.fish \

View File

@ -0,0 +1,89 @@
-- You can add your own plugins here or in other files in this directory!
-- I promise not to create any merge conflicts in this directory :)
--
-- See the kickstart.nvim README for more information
return {
{
'joaodubas/gitlinker.nvim',
config = function ()
local actions = require('gitlinker.actions')
local hosts = require('gitlinker.hosts')
require('gitlinker').setup({
opts = {
remote = "origin",
add_current_line_on_normal_mode = true,
action_callback = actions.copy_to_clipboard,
print_url = true,
},
callbacks = {
["github.com"] = hosts.get_github_type_url,
["bitbucket.org"] = hosts.get_bitbucket_type_url,
["gitea.dubas.dev"] = hosts.get_gitea_type_url,
},
mappings = "<leader>gy"
})
end
},
{
'rest-nvim/rest.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
ft = {
'http',
'rest'
},
opts = {
result_split_horizontal = false,
result_split_in_place = false,
skip_ssl_verification = false,
encode_url = true,
highlight = {
enabled = true,
timeout = 15
},
result = {
show_url = true,
show_curl_command = true,
show_http_info = true,
show_headers = true,
formatters = {
json = 'jq',
html = false
},
jump_to_request = true,
env_file = '.env',
custom_dynamic_variables = { },
yank_dry_run = true
}
},
keys = function ()
require('which-key').register({
['<leader>t'] = { name = 'Res[t]', _ = 'which_key_ignore' }
})
return {
{ '<leader>tr', '<Plug>RestNvim', desc = 'Run the request under cursor' },
{ '<leader>tp', '<Plug>RestNvimPreview', desc = 'Preview the curl command for the request under cursor' },
{ '<leader>tl', '<Plug>RestNvimLast', desc = 'Re-run the last request' }
}
end
},
{
'Vigemus/iron.nvim',
config = function ()
local iron = require('iron.core')
iron.setup({
config = {
scratch_repl = true,
repl_definition = {
sh = {
command = { 'fish' }
},
elixir = require('iron.fts.elixir').iex,
javascript = require('iron.fts.javascript').node,
python = require('iron.fts.python').ipython,
typescript = require('iron.fts.typescript').ts
}
}
})
end
}
}

View File

@ -12,6 +12,7 @@ services:
- 'home_cache:/home/coder/.cache'
- 'home_local_share:/home/coder/.local/share'
- './config/rtx:/home/coder/.config/rtx'
- './config/nvim/lua/custom:/home/coder/.confing/nvim/lua/custom'
volumes:
home_cache: {}

View File

@ -0,0 +1,107 @@
diff --git a/init.lua b/init.lua
index 5257113..4e95937 100644
--- a/init.lua
+++ b/init.lua
@@ -219,7 +219,7 @@ require('lazy').setup({
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
--
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
- -- { import = 'custom.plugins' },
+ { import = 'custom.plugins' },
}, {})
-- [[ Setting options ]]
@@ -229,11 +229,12 @@ require('lazy').setup({
-- Set highlight on search
vim.o.hlsearch = false
--- Make line numbers default
+-- Make relative line numbers default
vim.wo.number = true
+vim.wo.relativenumber = true
--- Enable mouse mode
-vim.o.mouse = 'a'
+-- Disable mouse mode
+vim.o.mouse = ''
-- Sync clipboard between OS and Neovim.
-- Remove this option if you want your OS clipboard to remain independent.
@@ -263,6 +264,14 @@ vim.o.completeopt = 'menuone,noselect'
-- NOTE: You should make sure your terminal supports this
vim.o.termguicolors = true
+-- Set foldmethod
+-- See `:help foldmethod`
+vim.opt.foldmethod = 'expr'
+vim.opt.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
+vim.opt.foldnestmax = 5
+vim.opt.foldlevel = 1
+vim.opt.foldenable = false
+
-- [[ Basic Keymaps ]]
-- Keymaps for better default experience
@@ -323,11 +332,27 @@ vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc =
-- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup {
-- Add languages to be installed here that you want installed for treesitter
- ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' },
-
+ ensure_installed = {
+ 'css',
+ 'dockerfile',
+ 'eex',
+ 'elixir',
+ 'erlang',
+ 'go',
+ 'heex',
+ 'html',
+ 'javascript',
+ 'lua',
+ 'markdown',
+ 'python',
+ 'sql',
+ 'tsx',
+ 'typescript',
+ 'vim',
+ 'vimdoc'
+ },
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
auto_install = false,
-
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
@@ -456,19 +481,24 @@ require('which-key').register({
-- If you want to override the default filetypes that your language server will attach to you can
-- define the property 'filetypes' to the map in question.
local servers = {
- -- clangd = {},
- -- gopls = {},
- -- pyright = {},
- -- rust_analyzer = {},
- -- tsserver = {},
- -- html = { filetypes = { 'html', 'twig', 'hbs'} },
-
+ elixirls = {
+ elixirLS = {
+ dialyzerEnabled = true,
+ dialyzerFormat = "dialyxir_long",
+ fetchDeps = false,
+ mixEnv = "test"
+ }
+ },
+ gopls = {},
+ html = { filetypes = { 'html', 'twig', 'hbs'} },
lua_ls = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
},
+ pyright = {},
+ tsserver = {},
}
-- Setup neovim lua configuration