feat(nvim): dynamic listchars
This commit is contained in:
parent
42a61a77a8
commit
94d6215b1f
@ -1,6 +1,5 @@
|
|||||||
-- variables
|
-- variables
|
||||||
vim.opt_local.shiftwidth = 2
|
vim.opt_local.shiftwidth = 2
|
||||||
vim.opt_local.tabstop = 2
|
vim.opt_local.tabstop = 2
|
||||||
vim.opt_local.listchars = vim.o.listchars .. ",leadmultispace:│ "
|
|
||||||
|
|
||||||
-- keybindings
|
-- keybindings
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
-- variables
|
-- variables
|
||||||
vim.opt_local.shiftwidth = 2
|
vim.opt_local.shiftwidth = 2
|
||||||
vim.opt_local.tabstop = 2
|
vim.opt_local.tabstop = 2
|
||||||
vim.opt_local.listchars = vim.o.listchars .. ",leadmultispace:│ "
|
|
||||||
|
|
||||||
-- keybindings
|
-- keybindings
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
-- variables
|
-- variables
|
||||||
vim.opt_local.shiftwidth = 2
|
vim.opt_local.shiftwidth = 2
|
||||||
vim.opt_local.tabstop = 2
|
vim.opt_local.tabstop = 2
|
||||||
vim.opt_local.listchars = vim.o.listchars .. ",leadmultispace:│ "
|
|
||||||
|
|
||||||
-- keybindings
|
-- keybindings
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
-- variables
|
-- variables
|
||||||
vim.opt_local.shiftwidth = 2
|
vim.opt_local.shiftwidth = 2
|
||||||
vim.opt_local.tabstop = 2
|
vim.opt_local.tabstop = 2
|
||||||
vim.opt_local.listchars = vim.o.listchars .. ",leadmultispace:│ "
|
|
||||||
|
|
||||||
-- keybindings
|
-- keybindings
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
-- variables
|
-- variables
|
||||||
vim.opt_local.shiftwidth = 2
|
vim.opt_local.shiftwidth = 2
|
||||||
vim.opt_local.tabstop = 2
|
vim.opt_local.tabstop = 2
|
||||||
vim.opt_local.listchars = vim.o.listchars .. ",leadmultispace:│ "
|
|
||||||
vim.opt_local.spelllang = "fr"
|
vim.opt_local.spelllang = "fr"
|
||||||
|
|
||||||
-- keybindings
|
-- keybindings
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
-- variables
|
-- variables
|
||||||
vim.opt_local.shiftwidth = 2
|
vim.opt_local.shiftwidth = 2
|
||||||
vim.opt_local.tabstop = 2
|
vim.opt_local.tabstop = 2
|
||||||
vim.opt_local.listchars = vim.o.listchars .. ",leadmultispace:│ "
|
|
||||||
|
|
||||||
-- keybindings
|
-- keybindings
|
||||||
|
@ -4,45 +4,47 @@
|
|||||||
|
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
vim.o.expandtab = true
|
vim.opt.expandtab = true
|
||||||
vim.o.smartindent = true
|
vim.opt.smartindent = true
|
||||||
vim.o.shiftwidth = 4
|
vim.opt.shiftwidth = 4
|
||||||
vim.o.tabstop = 4
|
vim.opt.tabstop = 4
|
||||||
vim.o.cino = "(s"
|
vim.opt.cino = "(s"
|
||||||
vim.g.python_indent = {
|
vim.g.python_indent = { open_paren = "shiftwidth()" }
|
||||||
open_paren = "shiftwidth()"
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.o.list = true
|
vim.opt.list = true
|
||||||
vim.o.listchars = "tab:> ,trail:-,nbsp:+,leadmultispace:│ "
|
--vim.opt.listchars = {
|
||||||
|
-- tab = "> ",
|
||||||
|
-- trail = "-",
|
||||||
|
-- nbsp = "+",
|
||||||
|
--}
|
||||||
|
|
||||||
vim.o.number = true
|
vim.opt.number = true
|
||||||
vim.o.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
vim.o.laststatus = 3
|
vim.opt.laststatus = 3
|
||||||
|
|
||||||
vim.o.ignorecase = true
|
vim.opt.ignorecase = true
|
||||||
vim.o.smartcase = true
|
vim.opt.smartcase = true
|
||||||
|
|
||||||
vim.o.guicursor = ""
|
vim.opt.guicursor = ""
|
||||||
vim.o.mousemodel = extend
|
vim.opt.mousemodel = extend
|
||||||
|
|
||||||
vim.o.path = vim.o.path .. ",**"
|
vim.opt.path = vim.o.path .. ",**"
|
||||||
vim.o.suffixes = vim.o.suffixes .. ",.pyc,.hi"
|
vim.opt.suffixes = vim.o.suffixes .. ",.pyc,.hi"
|
||||||
|
|
||||||
vim.o.foldmethod = "indent"
|
vim.opt.foldmethod = "indent"
|
||||||
vim.o.foldlevel = 99
|
vim.opt.foldlevel = 99
|
||||||
|
|
||||||
vim.o.grepprg = "grep -rn"
|
vim.opt.grepprg = "grep -rn"
|
||||||
|
|
||||||
vim.o.scrolloff = 2
|
vim.opt.scrolloff = 2
|
||||||
vim.wo.colorcolumn = "80"
|
vim.opt.colorcolumn = "80"
|
||||||
|
|
||||||
vim.g.netrw_banner = 0
|
vim.g.netrw_banner = 0
|
||||||
vim.g.netrw_list_hide = "\\.o$,\\.d$,\\.gc..$"
|
vim.g.netrw_list_hide = "\\.o$,\\.d$,\\.gc..$"
|
||||||
|
|
||||||
vim.o.lazyredraw = true
|
vim.opt.lazyredraw = true
|
||||||
|
|
||||||
vim.o.complete = vim.o.complete .. ",i"
|
vim.opt.complete = vim.o.complete .. ",i"
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
----- packages -----
|
----- packages -----
|
||||||
@ -67,3 +69,12 @@ require"pack-treesitter"
|
|||||||
vim.keymap.set("n", "<Leader>f", "<cmd>%s/\\s\\+$//e<CR>")
|
vim.keymap.set("n", "<Leader>f", "<cmd>%s/\\s\\+$//e<CR>")
|
||||||
vim.keymap.set("n", "n", "nzz")
|
vim.keymap.set("n", "n", "nzz")
|
||||||
vim.keymap.set("n", "N", "Nzz")
|
vim.keymap.set("n", "N", "Nzz")
|
||||||
|
|
||||||
|
------------------------
|
||||||
|
----- autocommands -----
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({ "BufWinEnter" }, { callback = function()
|
||||||
|
vim.opt_local.listchars = vim.o.listchars ..
|
||||||
|
",leadmultispace:│" .. string.rep(" ", vim.o.shiftwidth - 1)
|
||||||
|
end })
|
||||||
|
@ -4,5 +4,5 @@ vim.keymap.set("n", "ga", "<Plug>(EasyAlign)")
|
|||||||
vim.keymap.set("x", "ga", "<Plug>(EasyAlign)")
|
vim.keymap.set("x", "ga", "<Plug>(EasyAlign)")
|
||||||
|
|
||||||
vim.g.easy_align_delimiters = {
|
vim.g.easy_align_delimiters = {
|
||||||
["\\"] = {["pattern"] = "\\\\$"}
|
["\\"] = { ["pattern"] = "\\\\$" }
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ local servers = {
|
|||||||
-- Global mappings.
|
-- Global mappings.
|
||||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
||||||
|
|
||||||
-- Use LspAttach autocommand to only map the following keys
|
-- Use LspAttach autocommand to only map the following keys
|
||||||
@ -19,20 +19,20 @@ local on_attach = function(client, bufnr)
|
|||||||
-- Buffer local mappings.
|
-- Buffer local mappings.
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
local opts = { buffer = ev.buf }
|
local opts = { buffer = ev.buf }
|
||||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||||
vim.keymap.set('n', '<space>wl', function()
|
vim.keymap.set('n', '<space>wl', function()
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
end, opts)
|
end, opts)
|
||||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
||||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, server in ipairs(servers) do
|
for _, server in ipairs(servers) do
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
vim.cmd("packadd treesitter")
|
vim.cmd("packadd treesitter")
|
||||||
require"nvim-treesitter.configs".setup {
|
require"nvim-treesitter.configs".setup {
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
highlight = {enable = true},
|
highlight = { enable = true },
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.cmd("TSUpdate")
|
vim.cmd("TSUpdate")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
vim.cmd("packadd onedark")
|
vim.cmd("packadd onedark")
|
||||||
require"onedark".setup {
|
local theme = require"onedark"
|
||||||
|
theme.setup {
|
||||||
style = "dark",
|
style = "dark",
|
||||||
transparent = true
|
transparent = true
|
||||||
}
|
}
|
||||||
require"onedark".load()
|
theme.load()
|
||||||
|
Loading…
Reference in New Issue
Block a user