Update nvim config
This commit is contained in:
parent
48ca7757c8
commit
79288e5da9
@ -4,11 +4,32 @@ require 'better_escape'
|
||||
.setup()
|
||||
require 'Comment'
|
||||
.setup()
|
||||
local conform = require 'conform'
|
||||
conform.setup {
|
||||
formatters_by_ft = {
|
||||
objc = {
|
||||
'clang_format',
|
||||
},
|
||||
go = {
|
||||
'goimports', 'gopls',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vim.keymap.set('n', '<Leader>f', vim.lsp.buf.format)
|
||||
|
||||
vim.keymap.set('n', '<Leader><Leader>', vim.cmd.so)
|
||||
vim.keymap.set('n', '<Leader>w', vim.cmd.write)
|
||||
vim.keymap.set('n', '<Leader>q', vim.cmd.quit)
|
||||
vim.keymap.set('n', '<Leader>b', vim.cmd.Buffers)
|
||||
vim.keymap.set('n', '<Leader>f', conform.format)
|
||||
vim.keymap.set('n', '<Leader>F', vim.lsp.buf.format)
|
||||
vim.keymap.set('n', '<Leader>r', vim.lsp.buf.rename)
|
||||
vim.keymap.set('n', '<Leader>e', vim.cmd.Neotree)
|
||||
vim.keymap.set('n', '<Leader>h', vim.cmd.History)
|
||||
vim.keymap.set('n', '<Leader>g', vim.cmd.Rg)
|
||||
vim.keymap.set('n', '<Leader>G', vim.cmd.FZF)
|
||||
vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle)
|
||||
vim.keymap.set('n', '<Leader>j', vim.cmd.FZF)
|
||||
vim.keymap.set('n', '<Leader>u', vim.cmd.UndotreeToggle)
|
||||
vim.keymap.set('n', '<Leader>5', ':vsplit<CR>:Files<CR>')
|
||||
vim.keymap.set('v', '<Leader>y', '"+y')
|
||||
vim.keymap.set('n', '<Leader>y', '"+y')
|
||||
vim.keymap.set('n', '<Leader>p', '"+p')
|
||||
vim.keymap.set('v', '<Leader>p', '"+p')
|
||||
|
@ -11,7 +11,7 @@ vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
|
||||
-- )
|
||||
|
||||
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
require 'luasnip.loaders.from_vscode'.lazy_load()
|
||||
|
||||
local cmp = require('cmp')
|
||||
local lspkind = require('lspkind')
|
||||
@ -76,8 +76,37 @@ lsp_defaults.capabilities = vim.tbl_deep_extend(
|
||||
require 'cmp_nvim_lsp'.default_capabilities()
|
||||
)
|
||||
|
||||
lsp_config.lua_ls.setup {
|
||||
on_init = function(client)
|
||||
local path = client.workspace_folders[1].name
|
||||
if vim.loop.fs_stat(path .. '/.luarc.json') or vim.loop.fs_stat(path .. '/.luarc.jsonc') then
|
||||
return
|
||||
end
|
||||
|
||||
lsp_config.lua_ls.setup({})
|
||||
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using
|
||||
-- (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT'
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME
|
||||
-- Depending on the usage, you might want to add additional paths here.
|
||||
-- "${3rd}/luv/library"
|
||||
-- "${3rd}/busted/library",
|
||||
}
|
||||
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower
|
||||
-- library = vim.api.nvim_get_runtime_file("", true)
|
||||
}
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {}
|
||||
}
|
||||
}
|
||||
|
||||
lsp_config.jsonls.setup {
|
||||
settings = {
|
||||
@ -93,3 +122,5 @@ lsp_config.rust_analyzer.setup {}
|
||||
lsp_config.clangd.setup {}
|
||||
lsp_config.eslint.setup {}
|
||||
lsp_config.tsserver.setup {}
|
||||
lsp_config.gopls.setup {}
|
||||
lsp_config.ols.setup {}
|
||||
|
@ -3,7 +3,7 @@ require('neo-tree').setup({
|
||||
"filesystem",
|
||||
"buffers",
|
||||
"git_status",
|
||||
-- "document_symbols",
|
||||
"document_symbols",
|
||||
},
|
||||
add_blank_line_at_top = false, -- Add a blank line at the top of the tree.
|
||||
auto_clean_after_session_restore = false, -- Automatically clean up broken neo-tree buffers saved in sessions
|
||||
@ -17,7 +17,6 @@ require('neo-tree').setup({
|
||||
enable_modified_markers = true, -- Show markers for files with unsaved changes.
|
||||
enable_opened_markers = true, -- Enable tracking of opened files. Required for `components.name.highlight_opened_files`
|
||||
enable_refresh_on_write = true, -- Refresh the tree when a file is written. Only used if `use_libuv_file_watcher` is false.
|
||||
enable_normal_mode_for_inputs = false, -- Enable normal mode for input dialogs.
|
||||
git_status_async = true,
|
||||
-- These options are for people with VERY large git repos
|
||||
git_status_async_options = {
|
||||
@ -85,7 +84,15 @@ require('neo-tree').setup({
|
||||
highlight_separator_active = "NeoTreeTabSeparatorActive",
|
||||
},
|
||||
--
|
||||
--event_handlers = {
|
||||
event_handlers = {
|
||||
{
|
||||
event = "neo_tree_popup_input_ready",
|
||||
---@param args { bufnr: integer, winid: integer }
|
||||
handler = function(args)
|
||||
vim.cmd("stopinsert")
|
||||
vim.keymap.set("i", "<esc>", vim.cmd.stopinsert, { noremap = true, buffer = args.bufnr })
|
||||
end,
|
||||
},
|
||||
-- {
|
||||
-- event = "before_render",
|
||||
-- handler = function (state)
|
||||
@ -156,7 +163,7 @@ require('neo-tree').setup({
|
||||
-- vim.cmd("wincmd =")
|
||||
-- end
|
||||
-- }
|
||||
--},
|
||||
},
|
||||
default_component_configs = {
|
||||
container = {
|
||||
enable_character_fade = true,
|
||||
@ -331,7 +338,7 @@ require('neo-tree').setup({
|
||||
|
||||
window = { -- see https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/popup for
|
||||
-- possible options. These can also be functions that return these options.
|
||||
position = "left", -- left, right, top, bottom, float, current
|
||||
position = "current", -- left, right, top, bottom, float, current
|
||||
width = 40, -- applies to left and right positions
|
||||
height = 15, -- applies to top and bottom positions
|
||||
auto_expand_width = false, -- expand the window when file exceeds the window width. does not work with position = "float"
|
||||
@ -345,7 +352,7 @@ require('neo-tree').setup({
|
||||
-- the global popup_border_style.
|
||||
},
|
||||
same_level = false, -- Create and paste/move files/directories on the same level as the directory under cursor (as opposed to within the directory under cursor).
|
||||
insert_as = "child", -- Affects how nodes get inserted into the tree during creation/pasting/moving of files if the node under the cursor is a directory:
|
||||
insert_as = "sibling", -- Affects how nodes get inserted into the tree during creation/pasting/moving of files if the node under the cursor is a directory:
|
||||
-- "child": Insert nodes as children of the directory under cursor.
|
||||
-- "sibling": Insert nodes as siblings of the directory under cursor.
|
||||
-- Mappings for tree window. See `:h neo-tree-mappings` for a list of built-in commands.
|
||||
|
@ -1,35 +1,20 @@
|
||||
local alpha_dashboard = require 'alpha.themes.dashboard'
|
||||
alpha_dashboard.section.buttons.val = {
|
||||
alpha_dashboard.button("e", " > New file", ":ene <BAR> startinsert <CR>"),
|
||||
alpha_dashboard.button("f", " > Find file", ":FZF --reverse --info=inline $HOME/Sync<CR>"),
|
||||
alpha_dashboard.button("r", " > Recent", ":History<CR>"),
|
||||
alpha_dashboard.button("s", " > Settings", ":e $MYVIMRC | :cd %:p:h | split . | wincmd k | pwd<CR>"),
|
||||
alpha_dashboard.button("q", " > Quit NVIM", ":qa<CR>"),
|
||||
alpha_dashboard.button("e", "> New file", ":ene <BAR> startinsert <CR>"),
|
||||
alpha_dashboard.button("f", "> Find file", ":FZF --reverse --info=inline $HOME/Sync<CR>"),
|
||||
alpha_dashboard.button("r", "> Recent", ":History<CR>"),
|
||||
alpha_dashboard.button("s", "> Settings", ":e $MYVIMRC | :cd %:p:h | :split . | :q <CR>"),
|
||||
alpha_dashboard.button("q", "> Quit NVIM", ":qa!<CR>"),
|
||||
}
|
||||
|
||||
require 'alpha'
|
||||
.setup(alpha_dashboard.opts)
|
||||
if (os.getenv('TERM_PROGRAM') == 'Apple_Terminal') then
|
||||
vim.cmd.colorscheme('slate')
|
||||
else
|
||||
require 'monokai'
|
||||
.setup()
|
||||
require 'noice'
|
||||
.setup({
|
||||
lsp = {
|
||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
},
|
||||
-- you can enable a preset for easier configuration
|
||||
presets = {
|
||||
bottom_search = false, -- use a classic bottom cmdline for search
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = true, -- add a border to hover docs and signature help
|
||||
},
|
||||
})
|
||||
end
|
||||
require 'alpha'
|
||||
.setup(alpha_dashboard.opts)
|
||||
require 'lualine'
|
||||
.setup({
|
||||
options = {
|
||||
|
@ -3,10 +3,6 @@ vim.g.mapleader = ' '
|
||||
vim.keymap.set('v', 'K', ':m \'<-2<CR>gv=gv')
|
||||
vim.keymap.set('v', 'J', ':m \'>+1<CR>gv=gv')
|
||||
|
||||
vim.keymap.set('n', '<Leader>b', vim.cmd.Buffers)
|
||||
|
||||
vim.keymap.set('n', '<Leader><Leader>', vim.cmd.so)
|
||||
|
||||
vim.keymap.set('n', '<C-d>', '<C-d>zz')
|
||||
vim.keymap.set('n', '<C-u>', '<C-u>zz')
|
||||
|
||||
@ -79,6 +75,7 @@ Plug 'rafamadriz/friendly-snippets'
|
||||
|
||||
Plug('williamboman/mason.nvim', { ['do'] = ':MasonUpdate' })
|
||||
Plug 'williamboman/mason-lspconfig.nvim'
|
||||
Plug 'stevearc/conform.nvim'
|
||||
|
||||
Plug 'folke/trouble.nvim'
|
||||
Plug 'b0o/schemastore.nvim'
|
||||
@ -99,4 +96,8 @@ Plug 'folke/noice.nvim'
|
||||
|
||||
Plug 'tpope/vim-fugitive'
|
||||
Plug 'tpope/vim-sensible'
|
||||
|
||||
Plug 'github/copilot.vim'
|
||||
|
||||
|
||||
vim.call('plug#end')
|
||||
|
Loading…
x
Reference in New Issue
Block a user