From 2a1645ae9593114514a7f28fa6d9109d1820375d Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Mon, 24 Jun 2024 16:34:51 +0800 Subject: Update --- vim/nvim/lua/configs/conform.lua | 15 +++++++++ vim/nvim/lua/configs/lazy.lua | 47 ++++++++++++++++++++++++++++ vim/nvim/lua/configs/lspconfig.lua | 23 ++++++++++++++ vim/nvim/lua/configs/telescope.lua | 48 ++++++++++++++++++++++++++++ vim/nvim/lua/configs/treesitter.lua | 62 +++++++++++++++++++++++++++++++++++++ 5 files changed, 195 insertions(+) create mode 100644 vim/nvim/lua/configs/conform.lua create mode 100644 vim/nvim/lua/configs/lazy.lua create mode 100644 vim/nvim/lua/configs/lspconfig.lua create mode 100644 vim/nvim/lua/configs/telescope.lua create mode 100644 vim/nvim/lua/configs/treesitter.lua (limited to 'vim/nvim/lua/configs') diff --git a/vim/nvim/lua/configs/conform.lua b/vim/nvim/lua/configs/conform.lua new file mode 100644 index 0000000..a000447 --- /dev/null +++ b/vim/nvim/lua/configs/conform.lua @@ -0,0 +1,15 @@ +local options = { + formatters_by_ft = { + lua = { "stylua" }, + -- css = { "prettier" }, + -- html = { "prettier" }, + }, + + -- format_on_save = { + -- -- These options will be passed to conform.format() + -- timeout_ms = 500, + -- lsp_fallback = true, + -- }, +} + +require("conform").setup(options) diff --git a/vim/nvim/lua/configs/lazy.lua b/vim/nvim/lua/configs/lazy.lua new file mode 100644 index 0000000..cd170bd --- /dev/null +++ b/vim/nvim/lua/configs/lazy.lua @@ -0,0 +1,47 @@ +return { + defaults = { lazy = true }, + install = { colorscheme = { "nvchad" } }, + + ui = { + icons = { + ft = "", + lazy = "󰂠 ", + loaded = "", + not_loaded = "", + }, + }, + + performance = { + rtp = { + disabled_plugins = { + "2html_plugin", + "tohtml", + "getscript", + "getscriptPlugin", + "gzip", + "logipat", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", + "matchit", + "tar", + "tarPlugin", + "rrhelper", + "spellfile_plugin", + "vimball", + "vimballPlugin", + "zip", + "zipPlugin", + "tutor", + "rplugin", + "syntax", + "synmenu", + "optwin", + "compiler", + "bugreport", + "ftplugin", + }, + }, + }, +} diff --git a/vim/nvim/lua/configs/lspconfig.lua b/vim/nvim/lua/configs/lspconfig.lua new file mode 100644 index 0000000..a73657a --- /dev/null +++ b/vim/nvim/lua/configs/lspconfig.lua @@ -0,0 +1,23 @@ +-- EXAMPLE +local on_attach = require("nvchad.configs.lspconfig").on_attach +local on_init = require("nvchad.configs.lspconfig").on_init +local capabilities = require("nvchad.configs.lspconfig").capabilities + +local lspconfig = require "lspconfig" +local servers = { "html", "cssls" } + +-- lsps with default config +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + on_attach = on_attach, + on_init = on_init, + capabilities = capabilities, + } +end + +-- typescript +lspconfig.tsserver.setup { + on_attach = on_attach, + on_init = on_init, + capabilities = capabilities, +} diff --git a/vim/nvim/lua/configs/telescope.lua b/vim/nvim/lua/configs/telescope.lua new file mode 100644 index 0000000..73c64e5 --- /dev/null +++ b/vim/nvim/lua/configs/telescope.lua @@ -0,0 +1,48 @@ +return { + defaults = { + mappings = { + i = { + -- [""] = "move_selection_next", + -- [""] = "move_selection_previous", + [""] = require("telescope.actions.layout").toggle_preview, + [""] = false, + }, + }, + layout_config = { + horizontal = { + prompt_position = "bottom", + }, + vertical = { height = 0.8 }, + -- other layout configuration here + preview_cutoff = 0, + }, + }, + pickers = { + buffers = { + show_all_buffers = true, + sort_lastused = true, + theme = "dropdown", + previewer = false, + mappings = { + i = { + [""] = "delete_buffer", + }, + n = { + [""] = "delete_buffer", + } + } + }, + + }, + extensions_list = {}, + extensions = { + aerial = { + -- Display symbols as .. + show_nesting = { + ["_"] = false, -- This key will be the default + json = true, -- You can set the option for specific filetypes + yaml = true, + }, + }, + }, +} diff --git a/vim/nvim/lua/configs/treesitter.lua b/vim/nvim/lua/configs/treesitter.lua new file mode 100644 index 0000000..8375d5b --- /dev/null +++ b/vim/nvim/lua/configs/treesitter.lua @@ -0,0 +1,62 @@ +return { + -- Add languages to be installed here that you want installed for treesitter + ensure_installed = { 'bash', 'c', 'html', 'css', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' }, + + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) + auto_install = true, + + -- highlight = { enable = true }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + scope_incremental = '', + node_decremental = '', + }, + }, + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + [']f'] = '@function.outer', + [']c'] = '@class.outer', + }, + goto_next_end = { + [']F'] = '@function.outer', + [']C'] = '@class.outer', + }, + goto_previous_start = { + ['[f'] = '@function.outer', + ['[c'] = '@class.outer', + }, + goto_previous_end = { + ['[F'] = '@function.outer', + ['[C'] = '@class.outer', + }, + }, + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, + }, + }, +} -- cgit v1.2.3-70-g09d2