Nvim chaos...............:
This commit is contained in:
parent
2199599f58
commit
4a8e5bc3fa
13
archive/nvim_old/.config/nvim/init.lua
Normal file
13
archive/nvim_old/.config/nvim/init.lua
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
require "user.options"
|
||||||
|
require "user.keymaps"
|
||||||
|
require "user.plugins"
|
||||||
|
require "user.colorscheme"
|
||||||
|
require "user.cmp"
|
||||||
|
require "user.lsp"
|
||||||
|
require "user.telescope"
|
||||||
|
require "user.treesitter"
|
||||||
|
require "user.nvim-tree"
|
||||||
|
require "user.bufferline"
|
||||||
|
require "user.statusline"
|
||||||
|
require "user.gitsigns"
|
||||||
|
require "user.rust-tools"
|
@ -46,9 +46,15 @@ local kind_icons = {
|
|||||||
-- find more here: https://www.nerdfonts.com/cheat-sheet
|
-- find more here: https://www.nerdfonts.com/cheat-sheet
|
||||||
|
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
|
--snippet = {
|
||||||
|
-- expand = function(args)
|
||||||
|
-- luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
||||||
|
-- end,
|
||||||
|
--},
|
||||||
|
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
vim.fn["vsnip#anonymous"](args.body)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
mapping = {
|
mapping = {
|
@ -61,6 +61,7 @@ local function lsp_highlight_document(client)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function lsp_keymaps(bufnr)
|
local function lsp_keymaps(bufnr)
|
||||||
|
vim.cmd [[ command! Format execute 'lua vim.lsp.buf.format()' ]]
|
||||||
local opts = { noremap = true, silent = true }
|
local opts = { noremap = true, silent = true }
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||||
@ -81,7 +82,6 @@ local function lsp_keymaps(bufnr)
|
|||||||
-- for german keyboard ...
|
-- for german keyboard ...
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "*d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "*d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
|
||||||
vim.cmd [[ command! Format execute 'lua vim.lsp.buf.format()' ]]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
M.on_attach = function(client, bufnr)
|
M.on_attach = function(client, bufnr)
|
@ -7,8 +7,6 @@ require "user.lsp.mason"
|
|||||||
require("user.lsp.handlers").setup()
|
require("user.lsp.handlers").setup()
|
||||||
require "user.lsp.null-ls"
|
require "user.lsp.null-ls"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- LSP Diagnostics Options Setup
|
-- LSP Diagnostics Options Setup
|
||||||
local sign = function(opts)
|
local sign = function(opts)
|
||||||
vim.fn.sign_define(opts.name, {
|
vim.fn.sign_define(opts.name, {
|
@ -16,6 +16,5 @@ null_ls.setup({
|
|||||||
extra_filetypes = {"inl"},
|
extra_filetypes = {"inl"},
|
||||||
extra_args = {"-style=file:~/.config/nvim/lua/user/lsp/settings/clang-format"},
|
extra_args = {"-style=file:~/.config/nvim/lua/user/lsp/settings/clang-format"},
|
||||||
}),
|
}),
|
||||||
null_ls.builtins.formatting.rustfmt,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
@ -51,3 +51,28 @@ vim.cmd "set listchars=tab:\\ \\ ,space:·"
|
|||||||
--vim.cmd "set term=screen-256color"
|
--vim.cmd "set term=screen-256color"
|
||||||
vim.g.vimwiki_list = {{path = '~/Documents/vimwiki', syntax = 'markdown', ext = '.md'}}
|
vim.g.vimwiki_list = {{path = '~/Documents/vimwiki', syntax = 'markdown', ext = '.md'}}
|
||||||
vim.g.nord_disable_background = true
|
vim.g.nord_disable_background = true
|
||||||
|
|
||||||
|
--Set completeopt to have a better completion experience
|
||||||
|
-- :help completeopt
|
||||||
|
-- menuone: popup even when there's only one match
|
||||||
|
-- noinsert: Do not insert text until a selection is made
|
||||||
|
-- noselect: Do not select, force to select one from the menu
|
||||||
|
-- shortness: avoid showing extra messages when using completion
|
||||||
|
-- updatetime: set updatetime for CursorHold
|
||||||
|
vim.opt.completeopt = {'menuone', 'noselect', 'noinsert'}
|
||||||
|
vim.opt.shortmess = vim.opt.shortmess + { c = true}
|
||||||
|
vim.api.nvim_set_option('updatetime', 300)
|
||||||
|
|
||||||
|
-- Fixed column for diagnostics to appear
|
||||||
|
-- Show autodiagnostic popup on cursor hover_range
|
||||||
|
-- Goto previous / next diagnostic warning / error
|
||||||
|
-- Show inlay_hints more frequently
|
||||||
|
vim.cmd([[
|
||||||
|
set signcolumn=yes
|
||||||
|
autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
-- Treesitter folding
|
||||||
|
vim.wo.foldmethod = 'expr'
|
||||||
|
vim.wo.foldexpr = 'nvim_treesitter#foldexpr()'
|
@ -7,12 +7,17 @@ configs.setup({
|
|||||||
ensure_installed = { "bash", "c", "cpp", "javascript", "json", "lua", "python", "typescript", "tsx", "css", "rust", "java", "yaml", "markdown", "markdown_inline" }, -- one of "all" or a list of languages
|
ensure_installed = { "bash", "c", "cpp", "javascript", "json", "lua", "python", "typescript", "tsx", "css", "rust", "java", "yaml", "markdown", "markdown_inline" }, -- one of "all" or a list of languages
|
||||||
ignore_install = { "phpdoc" }, -- List of parsers to ignore installing
|
ignore_install = { "phpdoc" }, -- List of parsers to ignore installing
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true, -- false will disable the whole extension
|
enable = true,
|
||||||
disable = { "css" }, -- list of language that will be disabled
|
additional_vim_regex_highlighting=false,
|
||||||
|
},
|
||||||
|
ident = { enable = true },
|
||||||
|
rainbow = {
|
||||||
|
enable = true,
|
||||||
|
extended_mode = true,
|
||||||
|
max_file_lines = nil,
|
||||||
},
|
},
|
||||||
autopairs = {
|
autopairs = {
|
||||||
enable = true,
|
enable = true,
|
||||||
},
|
}
|
||||||
indent = { enable = true, disable = { "python", "css" } },
|
|
||||||
})
|
})
|
||||||
|
|
@ -1,13 +1,257 @@
|
|||||||
require "user.options"
|
require "keymap"
|
||||||
require "user.keymaps"
|
require "options"
|
||||||
require "user.plugins"
|
require "plugins"
|
||||||
require "user.colorscheme"
|
require "vars"
|
||||||
require "user.cmp"
|
--require "bufferline"
|
||||||
require "user.lsp"
|
|
||||||
require "user.telescope"
|
-- Color Theme
|
||||||
require "user.treesitter"
|
vim.cmd [[
|
||||||
require "user.nvim-tree"
|
try
|
||||||
require "user.bufferline"
|
colorscheme nord
|
||||||
require "user.statusline"
|
endtry
|
||||||
require "user.gitsigns"
|
]]
|
||||||
require "user.rust-tools"
|
|
||||||
|
require("bufferline").setup()
|
||||||
|
|
||||||
|
-- Mason Setup
|
||||||
|
require("mason").setup({
|
||||||
|
ui = {
|
||||||
|
icons = {
|
||||||
|
package_installed = "",
|
||||||
|
package_pending = "",
|
||||||
|
package_uninstalled = "",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
require("mason-lspconfig").setup()
|
||||||
|
|
||||||
|
-- Rust Tools Setup
|
||||||
|
local rt = require("rust-tools")
|
||||||
|
rt.setup({
|
||||||
|
server = {
|
||||||
|
on_attach = function(_, bufnr)
|
||||||
|
-- Hover actions
|
||||||
|
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
|
||||||
|
-- Code action groups
|
||||||
|
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- LSP Diagnostics Options Setup
|
||||||
|
local sign = function(opts)
|
||||||
|
vim.fn.sign_define(opts.name, {
|
||||||
|
texthl = opts.name,
|
||||||
|
text = opts.text,
|
||||||
|
numhl = ''
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
sign({name = 'DiagnosticSignError', text = ''})
|
||||||
|
sign({name = 'DiagnosticSignWarn', text = ''})
|
||||||
|
sign({name = 'DiagnosticSignHint', text = ''})
|
||||||
|
sign({name = 'DiagnosticSignInfo', text = ''})
|
||||||
|
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = false,
|
||||||
|
signs = true,
|
||||||
|
update_in_insert = true,
|
||||||
|
underline = true,
|
||||||
|
severity_sort = false,
|
||||||
|
float = {
|
||||||
|
border = 'rounded',
|
||||||
|
source = 'always',
|
||||||
|
header = '', prefix = '',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.cmd([[
|
||||||
|
set signcolumn=yes
|
||||||
|
autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- Completion Plugin Setup
|
||||||
|
local cmp = require'cmp'
|
||||||
|
cmp.setup({
|
||||||
|
-- Enable LSP snippets
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
vim.fn["vsnip#anonymous"](args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = {
|
||||||
|
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
|
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||||
|
-- Add tab support
|
||||||
|
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||||
|
['<Tab>'] = cmp.mapping.select_next_item(),
|
||||||
|
['<C-S-f>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
['<C-e>'] = cmp.mapping.close(),
|
||||||
|
['<CR>'] = cmp.mapping.confirm({
|
||||||
|
behavior = cmp.ConfirmBehavior.Insert,
|
||||||
|
select = true,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
-- Installed sources:
|
||||||
|
sources = {
|
||||||
|
{ name = 'path' }, -- file paths
|
||||||
|
{ name = 'nvim_lsp', keyword_length = 3 }, -- from language server
|
||||||
|
{ name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized
|
||||||
|
{ name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.*
|
||||||
|
{ name = 'buffer', keyword_length = 2 }, -- source current buffer
|
||||||
|
{ name = 'vsnip', keyword_length = 2 }, -- nvim-cmp source for vim-vsnip
|
||||||
|
{ name = 'calc'}, -- source for math calculation
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
formatting = {
|
||||||
|
fields = {'menu', 'abbr', 'kind'},
|
||||||
|
format = function(entry, item)
|
||||||
|
local menu_icon ={
|
||||||
|
nvim_lsp = 'λ',
|
||||||
|
vsnip = '⋗',
|
||||||
|
buffer = 'Ω',
|
||||||
|
path = '🖫',
|
||||||
|
}
|
||||||
|
item.menu = menu_icon[entry.source.name]
|
||||||
|
return item
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Treesitter Plugin Setup
|
||||||
|
require('nvim-treesitter.configs').setup {
|
||||||
|
ensure_installed = { "bash", "c", "cpp", "javascript", "json", "lua", "python", "typescript", "tsx", "css", "rust", "java", "yaml", "markdown", "markdown_inline" },
|
||||||
|
auto_install = true,
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
additional_vim_regex_highlighting=false,
|
||||||
|
},
|
||||||
|
ident = { enable = true },
|
||||||
|
rainbow = {
|
||||||
|
enable = true,
|
||||||
|
extended_mode = true,
|
||||||
|
max_file_lines = nil,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- nvim-tree Setup
|
||||||
|
-- following options are the default
|
||||||
|
-- each of these are documented in `:help nvim-tree.OPTION_NAME`
|
||||||
|
|
||||||
|
local nvimtree = require("nvim-tree")
|
||||||
|
|
||||||
|
nvimtree.setup {
|
||||||
|
on_attach = function(bufnr)
|
||||||
|
local api = require("nvim-tree.api")
|
||||||
|
|
||||||
|
local function opts(desc)
|
||||||
|
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||||
|
end
|
||||||
|
api.config.mappings.default_on_attach(bufnr)
|
||||||
|
vim.keymap.set("n", "<space>", api.node.open.edit, opts("Open"))
|
||||||
|
end,
|
||||||
|
renderer = {
|
||||||
|
icons = {
|
||||||
|
webdev_colors = true,
|
||||||
|
git_placement = "before",
|
||||||
|
padding = " ",
|
||||||
|
symlink_arrow = " ➛ ",
|
||||||
|
show = {
|
||||||
|
file = true,
|
||||||
|
folder = true,
|
||||||
|
folder_arrow = true,
|
||||||
|
git = true,
|
||||||
|
},
|
||||||
|
glyphs = {
|
||||||
|
default = "",
|
||||||
|
symlink = "",
|
||||||
|
git = {
|
||||||
|
unstaged = "",
|
||||||
|
staged = "S",
|
||||||
|
unmerged = "",
|
||||||
|
renamed = "➜",
|
||||||
|
deleted = "",
|
||||||
|
untracked = "U",
|
||||||
|
ignored = "◌",
|
||||||
|
},
|
||||||
|
folder = {
|
||||||
|
default = "",
|
||||||
|
open = "",
|
||||||
|
empty = "",
|
||||||
|
empty_open = "",
|
||||||
|
symlink = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
highlight_git = true,
|
||||||
|
root_folder_modifier = ":t",
|
||||||
|
},
|
||||||
|
hijack_directories = {
|
||||||
|
enable = true,
|
||||||
|
auto_open = true,
|
||||||
|
},
|
||||||
|
disable_netrw = true,
|
||||||
|
hijack_netrw = true,
|
||||||
|
hijack_cursor = false,
|
||||||
|
update_cwd = true,
|
||||||
|
diagnostics = {
|
||||||
|
enable = true,
|
||||||
|
icons = {
|
||||||
|
hint = "",
|
||||||
|
info = "",
|
||||||
|
warning = "",
|
||||||
|
error = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
update_focused_file = {
|
||||||
|
enable = true,
|
||||||
|
update_cwd = true,
|
||||||
|
ignore_list = {},
|
||||||
|
},
|
||||||
|
system_open = {
|
||||||
|
cmd = nil,
|
||||||
|
args = {},
|
||||||
|
},
|
||||||
|
filters = {
|
||||||
|
dotfiles = false,
|
||||||
|
custom = {},
|
||||||
|
},
|
||||||
|
git = {
|
||||||
|
enable = true,
|
||||||
|
ignore = true,
|
||||||
|
timeout = 500,
|
||||||
|
},
|
||||||
|
view = {
|
||||||
|
width = 30,
|
||||||
|
side = "left",
|
||||||
|
float = {
|
||||||
|
quit_on_focus_loss = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
trash = {
|
||||||
|
cmd = "trash",
|
||||||
|
require_confirm = true,
|
||||||
|
},
|
||||||
|
actions = {
|
||||||
|
open_file = {
|
||||||
|
resize_window = true,
|
||||||
|
quit_on_open = false,
|
||||||
|
window_picker = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Statusline
|
||||||
|
require('lualine').setup {
|
||||||
|
options = { theme = 'nord' }
|
||||||
|
}
|
||||||
|
|
||||||
|
81
nvim/.config/nvim/lua/bufferline.lua
Normal file
81
nvim/.config/nvim/lua/bufferline.lua
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
local status_ok, bufferline = pcall(require, "bufferline")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
bufferline.setup {
|
||||||
|
options = {
|
||||||
|
mode = "buffers", -- set to "tabs" to only show tabpages instead
|
||||||
|
style_preset = bufferline.style_preset.default, -- or bufferline.style_preset.minimal,
|
||||||
|
themable = true, -- allows highlight groups to be overriden i.e. sets highlights as default
|
||||||
|
numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
|
||||||
|
close_command = "bdelete! %d", -- can be a string | function, | false see "Mouse actions"
|
||||||
|
right_mouse_command = "bdelete! %d", -- can be a string | function | false, see "Mouse actions"
|
||||||
|
left_mouse_command = "buffer %d", -- can be a string | function, | false see "Mouse actions"
|
||||||
|
middle_mouse_command = nil, -- can be a string | function, | false see "Mouse actions"
|
||||||
|
indicator = {
|
||||||
|
icon = '▎', -- this should be omitted if indicator style is not 'icon'
|
||||||
|
style = 'icon', --| 'underline' | 'none',
|
||||||
|
},
|
||||||
|
buffer_close_icon = '',
|
||||||
|
modified_icon = '● ',
|
||||||
|
close_icon = ' ',
|
||||||
|
left_trunc_marker = ' ',
|
||||||
|
right_trunc_marker = ' ',
|
||||||
|
--- name_formatter can be used to change the buffer's label in the bufferline.
|
||||||
|
--- Please note some names can/will break the
|
||||||
|
--- bufferline so use this at your discretion knowing that it has
|
||||||
|
--- some limitations that will *NOT* be fixed.
|
||||||
|
max_name_length = 18,
|
||||||
|
max_prefix_length = 15, -- prefix used when a buffer is de-duplicated
|
||||||
|
truncate_names = true, -- whether or not tab names should be truncated
|
||||||
|
tab_size = 18,
|
||||||
|
diagnostics = "nvim_lsp",
|
||||||
|
diagnostics_update_in_insert = false, -- only applies to coc
|
||||||
|
diagnostics_update_on_event = true, -- use nvim's diagnostic handler
|
||||||
|
-- The diagnostics indicator can be set to nil to keep the buffer name highlight but delete the highlighting
|
||||||
|
offsets = {
|
||||||
|
{
|
||||||
|
filetype = "NvimTree",
|
||||||
|
text = "File Explorer",-- | function ,
|
||||||
|
text_align = "left",-- | "center" | "right"
|
||||||
|
separator = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
color_icons = true, -- whether or not to add the filetype icon highlights
|
||||||
|
get_element_icon = function(element)
|
||||||
|
-- element consists of {filetype: string, path: string, extension: string, directory: string}
|
||||||
|
-- This can be used to change how bufferline fetches the icon
|
||||||
|
-- for an element e.g. a buffer or a tab.
|
||||||
|
-- e.g.
|
||||||
|
local icon, hl = require('nvim-web-devicons').get_icon_by_filetype(element.filetype, { default = false })
|
||||||
|
return icon, hl
|
||||||
|
-- or
|
||||||
|
--local custom_map = {my_thing_ft: {icon = "my_thing_icon", hl}}
|
||||||
|
--return custom_map[element.filetype]
|
||||||
|
end,
|
||||||
|
show_buffer_icons = true , -- disable filetype icons for buffers
|
||||||
|
show_buffer_close_icons = true ,
|
||||||
|
show_close_icon = true,
|
||||||
|
show_tab_indicators = true ,
|
||||||
|
show_duplicate_prefix = true , -- whether to show duplicate buffer prefix
|
||||||
|
duplicates_across_groups = true, -- whether to consider duplicate paths in different groups as duplicates
|
||||||
|
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
|
||||||
|
move_wraps_at_ends = false, -- whether or not the move command "wraps" at the first or last position
|
||||||
|
-- can also be a table containing 2 custom separators
|
||||||
|
-- [focused and unfocused]. eg: { '|', '|' }
|
||||||
|
separator_style = "thin", --| "slope" | "thick" | "thin" | { 'any', 'any' },
|
||||||
|
enforce_regular_tabs = true,--| true,
|
||||||
|
always_show_bufferline = true,-- | false,
|
||||||
|
auto_toggle_bufferline = true,-- | false,
|
||||||
|
hover = {
|
||||||
|
enabled = true,
|
||||||
|
delay = 200,
|
||||||
|
reveal = {'close'}
|
||||||
|
},
|
||||||
|
sort_by = 'insert_after_current',
|
||||||
|
pick = {
|
||||||
|
alphabet = "abcdefghijklmopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ1234567890",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
99
nvim/.config/nvim/lua/keymap.lua
Normal file
99
nvim/.config/nvim/lua/keymap.lua
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
local term_opts = { silent = true }
|
||||||
|
|
||||||
|
-- Shorten function name
|
||||||
|
local keymap = vim.api.nvim_set_keymap
|
||||||
|
|
||||||
|
--Remap space as leader key
|
||||||
|
keymap("", "<Space>", "<Nop>", opts)
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.g.maplocalleader = " "
|
||||||
|
|
||||||
|
-- Modes
|
||||||
|
-- normal_mode = "n",
|
||||||
|
-- insert_mode = "i",
|
||||||
|
-- visual_mode = "v",
|
||||||
|
-- visual_block_mode = "x",
|
||||||
|
-- term_mode = "t",
|
||||||
|
-- command_mode = "c",
|
||||||
|
|
||||||
|
-- Disable Arrow keys to force myself to the Vim-Way of movement --
|
||||||
|
keymap("i", "<Up>", "<Nop>", opts)
|
||||||
|
keymap("i", "<Down>", "<Nop>", opts)
|
||||||
|
keymap("i", "<Left>", "<Nop>", opts)
|
||||||
|
keymap("i", "<Right>", "<Nop>", opts)
|
||||||
|
|
||||||
|
keymap("n", "<Up>", "<Nop>", opts)
|
||||||
|
keymap("n", "<Down>", "<Nop>", opts)
|
||||||
|
keymap("n", "<Left>", "<Nop>", opts)
|
||||||
|
keymap("n", "<Right>", "<Nop>", opts)
|
||||||
|
|
||||||
|
-- Remap some language specific stuff --
|
||||||
|
keymap("n", "ü", "{", opts)
|
||||||
|
keymap("n", "<C-ü>", "<C-{>", opts)
|
||||||
|
|
||||||
|
keymap("n", "+", "}", opts)
|
||||||
|
keymap("n", "<C-+>", "<C-}>", opts)
|
||||||
|
|
||||||
|
-- Normal --
|
||||||
|
-- Better window navigation
|
||||||
|
keymap("n", "<C-h>", "<C-w>h", opts)
|
||||||
|
keymap("n", "<C-j>", "<C-w>j", opts)
|
||||||
|
keymap("n", "<C-k>", "<C-w>k", opts)
|
||||||
|
keymap("n", "<C-l>", "<C-w>l", opts)
|
||||||
|
|
||||||
|
keymap("n", "<leader>e", ":NvimTreeToggle<cr>", opts)
|
||||||
|
|
||||||
|
-- Resize with arrows
|
||||||
|
keymap("n", "<C-Up>", ":resize -2<CR>", opts)
|
||||||
|
keymap("n", "<C-Down>", ":resize +2<CR>", opts)
|
||||||
|
keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts)
|
||||||
|
keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts)
|
||||||
|
|
||||||
|
-- Navigate buffers
|
||||||
|
keymap("n", "<S-l>", ":bnext<CR>", opts)
|
||||||
|
keymap("n", "<S-h>", ":bprevious<CR>", opts)
|
||||||
|
|
||||||
|
-- Move text up and down
|
||||||
|
keymap("n", "<A-j>", "<Esc>:m .+1<CR>==gi", opts)
|
||||||
|
keymap("n", "<A-k>", "<Esc>:m .-2<CR>==gi", opts)
|
||||||
|
|
||||||
|
-- Insert --
|
||||||
|
-- Press jk fast to enter
|
||||||
|
keymap("i", "jk", "<ESC>", opts)
|
||||||
|
|
||||||
|
-- Visual --
|
||||||
|
-- Stay in indent mode
|
||||||
|
keymap("v", "<", "<gv", opts)
|
||||||
|
keymap("v", ">", ">gv", opts)
|
||||||
|
|
||||||
|
-- Move text up and down
|
||||||
|
keymap("v", "<A-j>", ":m .+1<CR>==", opts)
|
||||||
|
keymap("v", "<A-k>", ":m .-2<CR>==", opts)
|
||||||
|
keymap("v", "p", '"_dP', opts)
|
||||||
|
|
||||||
|
-- Visual Block --
|
||||||
|
-- Move text up and down
|
||||||
|
keymap("x", "J", ":move '>+1<CR>gv-gv", opts)
|
||||||
|
keymap("x", "K", ":move '<-2<CR>gv-gv", opts)
|
||||||
|
keymap("x", "<A-j>", ":move '>+1<CR>gv-gv", opts)
|
||||||
|
keymap("x", "<A-k>", ":move '<-2<CR>gv-gv", opts)
|
||||||
|
|
||||||
|
-- Terminal --
|
||||||
|
-- Better terminal navigation
|
||||||
|
keymap("t", "<Esc>", "<C-\\><C-n>", term_opts)
|
||||||
|
keymap("t", "<C-h>", "<C-\\><C-N><C-w>h", term_opts)
|
||||||
|
keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", term_opts)
|
||||||
|
keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", term_opts)
|
||||||
|
keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", term_opts)
|
||||||
|
|
||||||
|
-- Format document --
|
||||||
|
keymap("n", "<leader><leader>f", "<cmd>Format<cr>", opts)
|
||||||
|
|
||||||
|
-- close buffer --
|
||||||
|
keymap("n", "<leader>q", "<cmd>Bdelete! %d<cr>", opts)
|
||||||
|
|
||||||
|
-- toggle whitespace --
|
||||||
|
keymap("n", "<leader>w", "<cmd>set list!<cr>", opts)
|
||||||
|
|
71
nvim/.config/nvim/lua/options.lua
Normal file
71
nvim/.config/nvim/lua/options.lua
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
local options = {
|
||||||
|
backup = false, -- creates a backup file
|
||||||
|
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
|
||||||
|
cmdheight = 2, -- more space in the neovim command line for displaying messages
|
||||||
|
conceallevel = 0, -- so that `` is visible in markdown files
|
||||||
|
fileencoding = "utf-8", -- the encoding written to a file
|
||||||
|
hlsearch = true, -- highlight all matches on previous search pattern
|
||||||
|
ignorecase = true, -- ignore case in search patterns
|
||||||
|
mouse = "a", -- allow the mouse to be used in neovim
|
||||||
|
pumheight = 10, -- pop up menu height
|
||||||
|
showmode = false, -- we don't need to see things like -- INSERT -- anymore
|
||||||
|
showtabline = 2, -- always show tabs
|
||||||
|
smartcase = true, -- smart case
|
||||||
|
smartindent = true, -- make indenting smarter again
|
||||||
|
splitbelow = true, -- force all horizontal splits to go below current window
|
||||||
|
splitright = true, -- force all vertical splits to go to the right of current window
|
||||||
|
swapfile = false, -- creates a swapfile
|
||||||
|
termguicolors = true, -- set term gui colors (most terminals support this)
|
||||||
|
timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds)
|
||||||
|
undofile = true, -- enable persistent undo
|
||||||
|
updatetime = 300, -- faster completion (4000ms default)
|
||||||
|
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
|
||||||
|
expandtab = true, -- convert tabs to spaces
|
||||||
|
shiftwidth = 4, -- the number of spaces inserted for each indentation
|
||||||
|
tabstop = 4, -- insert 2 spaces for a tab
|
||||||
|
cursorline = true, -- highlight the current line
|
||||||
|
number = true, -- set numbered lines
|
||||||
|
relativenumber = true, -- set relative numbered lines
|
||||||
|
numberwidth = 4, -- set number column width to 2 {default 4}
|
||||||
|
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
|
||||||
|
wrap = false, -- display lines as one long line
|
||||||
|
scrolloff = 8, -- is one of my fav
|
||||||
|
sidescrolloff = 8,
|
||||||
|
guifont = "monospace:h17", -- the font used in graphical neovim applications
|
||||||
|
list = true,
|
||||||
|
foldenable = false,
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.opt.shortmess:append "c"
|
||||||
|
|
||||||
|
for k, v in pairs(options) do
|
||||||
|
vim.opt[k] = v
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.g.vimwiki_list = {{path = '~/Documents/vimwiki', syntax = 'markdown', ext = '.md'}}
|
||||||
|
vim.g.nord_disable_background = true
|
||||||
|
|
||||||
|
--Set completeopt to have a better completion experience
|
||||||
|
-- :help completeopt
|
||||||
|
-- menuone: popup even when there's only one match
|
||||||
|
-- noinsert: Do not insert text until a selection is made
|
||||||
|
-- noselect: Do not select, force to select one from the menu
|
||||||
|
-- shortness: avoid showing extra messages when using completion
|
||||||
|
-- updatetime: set updatetime for CursorHold
|
||||||
|
vim.opt.completeopt = {'menuone', 'noselect', 'noinsert'}
|
||||||
|
vim.opt.shortmess = vim.opt.shortmess + { c = true}
|
||||||
|
vim.api.nvim_set_option('updatetime', 300)
|
||||||
|
|
||||||
|
-- Fixed column for diagnostics to appear
|
||||||
|
-- Show autodiagnostic popup on cursor hover_range
|
||||||
|
-- Goto previous / next diagnostic warning / error
|
||||||
|
-- Show inlay_hints more frequently
|
||||||
|
vim.cmd([[
|
||||||
|
set signcolumn=yes
|
||||||
|
autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- Treesitter folding
|
||||||
|
vim.wo.foldmethod = 'expr'
|
||||||
|
vim.wo.foldexpr = 'nvim_treesitter#foldexpr()'
|
||||||
|
|
94
nvim/.config/nvim/lua/plugins.lua
Normal file
94
nvim/.config/nvim/lua/plugins.lua
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
local fn = vim.fn
|
||||||
|
|
||||||
|
-- Automatically install packer
|
||||||
|
local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
|
||||||
|
if fn.empty(fn.glob(install_path)) > 0 then
|
||||||
|
PACKER_BOOTSTRAP = fn.system {
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--depth",
|
||||||
|
"1",
|
||||||
|
"https://github.com/wbthomason/packer.nvim", install_path,
|
||||||
|
}
|
||||||
|
print "Installing packer close and reopen Neovim..."
|
||||||
|
vim.cmd [[packadd packer.nvim]]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Autocommand that reloads neovim whenever you save the plugins.lua file
|
||||||
|
vim.cmd [[
|
||||||
|
augroup packer_user_config
|
||||||
|
autocmd!
|
||||||
|
autocmd BufWritePost plugins.lua source <afile> | PackerSync
|
||||||
|
augroup end
|
||||||
|
]]
|
||||||
|
|
||||||
|
-- Use a protected call so we don't error out on first use
|
||||||
|
local status_ok, packer = pcall(require, "packer")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Have packer use a popup window
|
||||||
|
packer.init {
|
||||||
|
display = {
|
||||||
|
open_fn = function()
|
||||||
|
return require("packer.util").float { border = "rounded" }
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Install your plugins here
|
||||||
|
return packer.startup(function(use)
|
||||||
|
-- My plugins here
|
||||||
|
use "wbthomason/packer.nvim" -- Have packer manage itself
|
||||||
|
|
||||||
|
-- Colorschemes
|
||||||
|
use "shaunsingh/nord.nvim"
|
||||||
|
|
||||||
|
-- LSP
|
||||||
|
use "neovim/nvim-lspconfig" -- enable LSP
|
||||||
|
use "williamboman/mason.nvim" -- simple to use language server installer
|
||||||
|
use "williamboman/mason-lspconfig.nvim" -- simple to use language server installer
|
||||||
|
|
||||||
|
use 'simrat39/rust-tools.nvim'
|
||||||
|
|
||||||
|
-- Completion framework:
|
||||||
|
use 'hrsh7th/nvim-cmp'
|
||||||
|
|
||||||
|
-- LSP completion source:
|
||||||
|
use 'hrsh7th/cmp-nvim-lsp'
|
||||||
|
|
||||||
|
-- Useful completion sources:
|
||||||
|
use 'hrsh7th/cmp-nvim-lua'
|
||||||
|
use 'hrsh7th/cmp-nvim-lsp-signature-help'
|
||||||
|
use 'hrsh7th/cmp-vsnip'
|
||||||
|
use 'hrsh7th/cmp-path'
|
||||||
|
use 'hrsh7th/vim-vsnip'
|
||||||
|
use "hrsh7th/cmp-cmdline" -- cmdline completions
|
||||||
|
|
||||||
|
use 'nvim-treesitter/nvim-treesitter'
|
||||||
|
|
||||||
|
-- lualine (bottom line)
|
||||||
|
use {'nvim-lualine/lualine.nvim', requires = { 'nvim-tree/nvim-web-devicons', opt = true} }
|
||||||
|
|
||||||
|
-- nvim-tree
|
||||||
|
use {'kyazdani42/nvim-tree.lua', requires = 'nvim-tree/nvim-web-devicons'}
|
||||||
|
|
||||||
|
-- Bufferline
|
||||||
|
use {'akinsho/bufferline.nvim', requires = 'nvim-tree/nvim-web-devicons'}
|
||||||
|
|
||||||
|
-- VimWiki
|
||||||
|
use { 'vimwiki/vimwiki', branch='dev'}
|
||||||
|
|
||||||
|
-- dicord fuckery
|
||||||
|
use 'andweeb/presence.nvim'
|
||||||
|
|
||||||
|
-- LaTeX
|
||||||
|
--use 'lervag/vimtex'
|
||||||
|
|
||||||
|
-- Automatically set up your configuration after cloning packer.nvim
|
||||||
|
-- Put this at the end after all plugins
|
||||||
|
if PACKER_BOOTSTRAP then
|
||||||
|
require("packer").sync()
|
||||||
|
end
|
||||||
|
end)
|
0
nvim/.config/nvim/lua/vars.lua
Normal file
0
nvim/.config/nvim/lua/vars.lua
Normal file
Loading…
Reference in New Issue
Block a user