Restarting
This commit is contained in:
parent
be8d2d81f0
commit
0e406eeeca
14
init.lua
14
init.lua
|
@ -1,14 +0,0 @@
|
|||
require("autopairs")
|
||||
-- require("buffers") -- not wotking atm
|
||||
require("colorscheme")
|
||||
require("grammar")
|
||||
require("keymaps")
|
||||
require("lsp")
|
||||
require("lua-line")
|
||||
require("nvimtree")
|
||||
require("options")
|
||||
require("plugins")
|
||||
require("telescope")
|
||||
require("term")
|
||||
require("treesitter")
|
||||
require("whichkey")
|
|
@ -1,148 +0,0 @@
|
|||
---- If you want insert `(` after select function or method item
|
||||
--local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
--local cmp = require('cmp')
|
||||
--cmp.event:on(
|
||||
-- 'confirm_done',
|
||||
-- cmp_autopairs.on_confirm_done()
|
||||
--)
|
||||
--local Rule = require('nvim-autopairs.rule')
|
||||
--local npairs = require('nvim-autopairs')
|
||||
--
|
||||
--npairs.add_rule(Rule("$$","$$","tex"))
|
||||
--
|
||||
--local handlers = require('nvim-autopairs.completion.handlers')
|
||||
--
|
||||
--cmp.event:on(
|
||||
-- 'confirm_done',
|
||||
-- cmp_autopairs.on_confirm_done({
|
||||
-- filetypes = {
|
||||
-- -- "*" is a alias to all filetypes
|
||||
-- ["*"] = {
|
||||
-- ["("] = {
|
||||
-- kind = {
|
||||
-- cmp.lsp.CompletionItemKind.Function,
|
||||
-- cmp.lsp.CompletionItemKind.Method,
|
||||
-- },
|
||||
-- handler = handlers["*"]
|
||||
-- }
|
||||
-- },
|
||||
-- lua = {
|
||||
-- ["("] = {
|
||||
-- kind = {
|
||||
-- cmp.lsp.CompletionItemKind.Function,
|
||||
-- cmp.lsp.CompletionItemKind.Method
|
||||
-- },
|
||||
-- ---@param char string
|
||||
-- ---@param item table item completion
|
||||
-- ---@param bufnr number buffer number
|
||||
-- ---@param rules table
|
||||
-- ---@param commit_character table<string>
|
||||
-- handler = function(char, item, bufnr, rules, commit_character)
|
||||
-- -- Your handler function. Inpect with print(vim.inspect{char, item, bufnr, rules, commit_character})
|
||||
-- end
|
||||
-- }
|
||||
-- },
|
||||
-- -- Disable for tex
|
||||
-- tex = false
|
||||
-- }
|
||||
-- })
|
||||
--)
|
||||
--
|
||||
---- you can use some built-in conditions
|
||||
--
|
||||
--local cond = require('nvim-autopairs.conds')
|
||||
--print(vim.inspect(cond))
|
||||
--
|
||||
--npairs.add_rules({
|
||||
-- Rule("$", "$",{"tex", "latex"})
|
||||
-- -- don't add a pair if the next character is %
|
||||
-- :with_pair(cond.not_after_regex("%%"))
|
||||
-- -- don't add a pair if the previous character is xxx
|
||||
-- :with_pair(cond.not_before_regex("xxx", 3))
|
||||
-- -- don't move right when repeat character
|
||||
-- :with_move(cond.none())
|
||||
-- -- don't delete if the next character is xx
|
||||
-- :with_del(cond.not_after_regex("xx"))
|
||||
-- -- disable adding a newline when you press <cr>
|
||||
-- :with_cr(cond.none())
|
||||
-- },
|
||||
-- -- disable for .vim files, but it work for another filetypes
|
||||
-- Rule("a","a","-vim")
|
||||
--)
|
||||
--
|
||||
--npairs.add_rules({
|
||||
-- Rule("$$","$$","tex")
|
||||
-- :with_pair(function(opts)
|
||||
-- print(vim.inspect(opts))
|
||||
-- if opts.line=="aa $$" then
|
||||
-- -- don't add pair on that line
|
||||
-- return false
|
||||
-- end
|
||||
-- end)
|
||||
-- }
|
||||
--)
|
||||
--
|
||||
---- you can use regex
|
||||
---- press u1234 => u1234number
|
||||
--npairs.add_rules({
|
||||
-- Rule("u%d%d%d%d$", "number", "lua")
|
||||
-- :use_regex(true)
|
||||
--})
|
||||
--
|
||||
--
|
||||
--
|
||||
---- press x1234 => x12341234
|
||||
--npairs.add_rules({
|
||||
-- Rule("x%d%d%d%d$", "number", "lua")
|
||||
-- :use_regex(true)
|
||||
-- :replace_endpair(function(opts)
|
||||
-- -- print(vim.inspect(opts))
|
||||
-- return opts.prev_char:sub(#opts.prev_char - 3,#opts.prev_char)
|
||||
-- end)
|
||||
--})
|
||||
--
|
||||
--
|
||||
---- you can do anything with regex +special key
|
||||
---- example press tab to uppercase text:
|
||||
---- press b1234s<tab> => B1234S1234S
|
||||
--
|
||||
--npairs.add_rules({
|
||||
-- Rule("b%d%d%d%d%w$", "", "vim")
|
||||
-- :use_regex(true,"<tab>")
|
||||
-- :replace_endpair(function(opts)
|
||||
-- return
|
||||
-- opts.prev_char:sub(#opts.prev_char - 4,#opts.prev_char)
|
||||
-- .."<esc>viwU"
|
||||
-- end)
|
||||
--})
|
||||
--
|
||||
---- you can exclude filetypes
|
||||
--npairs.add_rule(
|
||||
-- Rule("$$","$$")
|
||||
-- :with_pair(cond.not_filetypes({"lua"}))
|
||||
--)
|
||||
----- check ./lua/nvim-autopairs/rules/basic.lua
|
||||
--
|
||||
--local npairs = require("nvim-autopairs")
|
||||
--local Rule = require('nvim-autopairs.rule')
|
||||
--
|
||||
--npairs.setup({
|
||||
-- check_ts = true,
|
||||
-- ts_config = {
|
||||
-- lua = {'string'},-- it will not add a pair on that treesitter node
|
||||
-- javascript = {'template_string'},
|
||||
-- java = false,-- don't check treesitter on java
|
||||
-- }
|
||||
--})
|
||||
--
|
||||
--local ts_conds = require('nvim-autopairs.ts-conds')
|
||||
--
|
||||
--
|
||||
---- press % => %% only while inside a comment or string
|
||||
--npairs.add_rules({
|
||||
-- Rule("%", "%", "lua")
|
||||
-- :with_pair(ts_conds.is_ts_node({'string','comment'})),
|
||||
-- Rule("$", "$", "lua")
|
||||
-- :with_pair(ts_conds.is_not_ts_node({'function'}))
|
||||
--})
|
||||
--
|
168
lua/buffers.lua
168
lua/buffers.lua
|
@ -1,168 +0,0 @@
|
|||
local status_ok, bufferline = pcall(require, "bufferline")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
bufferline.setup {
|
||||
options = {
|
||||
numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
|
||||
close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
right_mouse_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
|
||||
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
|
||||
-- NOTE: this plugin is designed with this icon in mind,
|
||||
-- and so changing this is NOT recommended, this is intended
|
||||
-- as an escape hatch for people who cannot bear it for whatever reason
|
||||
indicator_icon = nil,
|
||||
indicator = { style = "icon", icon = "▎"},
|
||||
buffer_close_icon = "",
|
||||
-- buffer_close_icon = '',
|
||||
modified_icon = "●",
|
||||
close_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.
|
||||
-- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr"
|
||||
-- -- remove extension from markdown files for example
|
||||
-- if buf.name:match('%.md') then
|
||||
-- return vim.fn.fnamemodify(buf.name, ':t:r')
|
||||
-- end
|
||||
-- end,
|
||||
max_name_length = 30,
|
||||
max_prefix_length = 30, -- prefix used when a buffer is de-duplicated
|
||||
tab_size = 21,
|
||||
diagnostics = false, -- | "nvim_lsp" | "coc",
|
||||
diagnostics_update_in_insert = false,
|
||||
-- diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||
-- return "("..count..")"
|
||||
-- end,
|
||||
-- NOTE: this will be called a lot so don't do any heavy processing here
|
||||
-- custom_filter = function(buf_number)
|
||||
-- -- filter out filetypes you don't want to see
|
||||
-- if vim.bo[buf_number].filetype ~= "<i-dont-want-to-see-this>" then
|
||||
-- return true
|
||||
-- end
|
||||
-- -- filter out by buffer name
|
||||
-- if vim.fn.bufname(buf_number) ~= "<buffer-name-I-dont-want>" then
|
||||
-- return true
|
||||
-- end
|
||||
-- -- filter out based on arbitrary rules
|
||||
-- -- e.g. filter out vim wiki buffer from tabline in your work repo
|
||||
-- if vim.fn.getcwd() == "<work-repo>" and vim.bo[buf_number].filetype ~= "wiki" then
|
||||
-- return true
|
||||
-- end
|
||||
-- end,
|
||||
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
|
||||
show_buffer_icons = true,
|
||||
show_buffer_close_icons = true,
|
||||
show_close_icon = true,
|
||||
show_tab_indicators = true,
|
||||
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
|
||||
-- can also be a table containing 2 custom separators
|
||||
-- [focused and unfocused]. eg: { '|', '|' }
|
||||
separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' },
|
||||
enforce_regular_tabs = true,
|
||||
always_show_bufferline = true,
|
||||
-- sort_by = 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b)
|
||||
-- -- add custom logic
|
||||
-- return buffer_a.modified > buffer_b.modified
|
||||
-- end
|
||||
},
|
||||
highlights = {
|
||||
fill = {
|
||||
fg = { attribute = "fg", highlight = "#ff0000" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
background = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
|
||||
-- buffer_selected = {
|
||||
-- fg = {attribute='fg',highlight='#ff0000'},
|
||||
-- bg = {attribute='bg',highlight='#0000ff'},
|
||||
-- gui = 'none'
|
||||
-- },
|
||||
buffer_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
|
||||
close_button = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
close_button_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
-- close_button_selected = {
|
||||
-- fg = {attribute='fg',highlight='TabLineSel'},
|
||||
-- bg ={attribute='bg',highlight='TabLineSel'}
|
||||
-- },
|
||||
|
||||
tab_selected = {
|
||||
fg = { attribute = "fg", highlight = "Normal" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
tab = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
tab_close = {
|
||||
-- fg = {attribute='fg',highlight='LspDiagnosticsDefaultError'},
|
||||
fg = { attribute = "fg", highlight = "TabLineSel" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
|
||||
duplicate_selected = {
|
||||
fg = { attribute = "fg", highlight = "TabLineSel" },
|
||||
bg = { attribute = "bg", highlight = "TabLineSel" },
|
||||
underline = true,
|
||||
},
|
||||
duplicate_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
underline = true,
|
||||
},
|
||||
duplicate = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
underline = true,
|
||||
},
|
||||
|
||||
modified = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
modified_selected = {
|
||||
fg = { attribute = "fg", highlight = "Normal" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
modified_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
|
||||
separator = {
|
||||
fg = { attribute = "bg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
separator_selected = {
|
||||
fg = { attribute = "bg", highlight = "Normal" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
-- separator_visible = {
|
||||
-- fg = {attribute='bg',highlight='TabLine'},
|
||||
-- bg = {attribute='bg',highlight='TabLine'}
|
||||
-- },
|
||||
indicator_selected = {
|
||||
fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
-- define colorscheme here
|
||||
--[[
|
||||
local colorscheme = "rose"
|
||||
|
||||
local is_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
|
||||
if not is_ok then
|
||||
vim.notify("colorscheme " .. colorscheme .. " not found!")
|
||||
return
|
||||
end
|
||||
]]--
|
||||
|
||||
function ColorSchemes(color)
|
||||
color = color or "rose-pine"
|
||||
vim.cmd.colorscheme(color)
|
||||
|
||||
--vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
--vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
end
|
||||
|
||||
ColorSchemes()
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
require("grammar-guard").init()
|
||||
|
||||
require("lspconfig").grammar_guard.setup({
|
||||
cmd = { '/usr/bin/ltex-ls' }, -- add this if you install ltex-ls yourself
|
||||
settings = {
|
||||
ltex = {
|
||||
enabled = { "latex", "tex", "bib", "markdown" },
|
||||
language = "en",
|
||||
diagnosticSeverity = "information",
|
||||
setenceCacheSize = 2000,
|
||||
additionalRules = {
|
||||
enablePickyRules = true,
|
||||
motherTongue = "en",
|
||||
},
|
||||
trace = { server = "verbose" },
|
||||
dictionary = {},
|
||||
disabledRules = {},
|
||||
hiddenFalsePositives = {},
|
||||
},
|
||||
},
|
||||
})
|
|
@ -1,84 +0,0 @@
|
|||
-- define common options
|
||||
local opts = {
|
||||
noremap = true, -- non-recursive
|
||||
silent = true, -- do not show message
|
||||
}
|
||||
|
||||
-----------------
|
||||
-- Normal mode --
|
||||
-----------------
|
||||
|
||||
-- Hint: see `:h vim.map.set()`
|
||||
-- Better window navigation
|
||||
vim.keymap.set("n", "<C-h>", "<C-w>h", opts)
|
||||
vim.keymap.set("n", "<C-j>", "<C-w>j", opts)
|
||||
vim.keymap.set("n", "<C-k>", "<C-w>k", opts)
|
||||
vim.keymap.set("n", "<C-l>", "<C-w>l", opts)
|
||||
|
||||
-- Resize with arrows
|
||||
-- delta: 2 lines
|
||||
vim.keymap.set("n", "<C-Up>", ":resize -2<CR>", opts)
|
||||
vim.keymap.set("n", "<C-Down>", ":resize +2<CR>", opts)
|
||||
vim.keymap.set("n", "<C-Left>", ":vertical resize -2<CR>", opts)
|
||||
vim.keymap.set("n", "<C-Right>", ":vertical resize +2<CR>", opts)
|
||||
|
||||
-- Open explorer
|
||||
--vim.keymap.set("n", "<leader>pv", vim.cmd.Ex, opts)
|
||||
|
||||
-- Navigate buffers
|
||||
vim.keymap.set("n", "<BS>", ":bnext<CR>", opts)
|
||||
vim.keymap.set("n", "<S-TAB>", ":bprevious<CR>", opts)
|
||||
|
||||
-- Telescope
|
||||
local builtin = require("telescope.builtin")
|
||||
--vim.keymap.set("n", "<leader>pf", builtin.find_files, {})
|
||||
--vim.keymap.set("n", "<C-p>", builtin.git_files, {})
|
||||
--vim.keymap.set("n", "<leader>ps", function ()
|
||||
-- builtin.grep_string( { search = vim.fn.input("Grep > ") } );
|
||||
--end)
|
||||
|
||||
-- Harpoon
|
||||
local mark = require("harpoon.mark")
|
||||
local ui = require("harpoon.ui")
|
||||
vim.keymap.set("n", "<leader>a", mark.add_file)
|
||||
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
||||
|
||||
vim.keymap.set("n", "<C-h>", function () ui.nav_file(1) end)
|
||||
vim.keymap.set("n", "<C-t>", function () ui.nav_file(2) end)
|
||||
vim.keymap.set("n", "<C-n>", function () ui.nav_file(3) end)
|
||||
vim.keymap.set("n", "<C-s>", function () ui.nav_file(4) end)
|
||||
|
||||
-- Undotree
|
||||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||||
|
||||
-- Fugitive
|
||||
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
|
||||
|
||||
-- Put line bellow in-front of line
|
||||
vim.keymap.set("n", "J", "mzJ`z")
|
||||
|
||||
-- Keep cursor in the middle
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
-- Don't loose buffer
|
||||
vim.keymap.set("x", "<leader>p", "\"_dP")
|
||||
|
||||
|
||||
-----------------
|
||||
-- Visual mode --
|
||||
-----------------
|
||||
|
||||
-- Hint: start visual mode with the same area as the previous area and the same mode
|
||||
vim.keymap.set("v", "<", "<gv", opts)
|
||||
vim.keymap.set("v", ">", ">gv", opts)
|
||||
|
||||
-- Move text on visual mode
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", opts)
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", opts)
|
||||
|
||||
|
||||
|
||||
|
136
lua/lsp.lua
136
lua/lsp.lua
|
@ -1,136 +0,0 @@
|
|||
require("mason").setup({
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
-- A list of servers to automatically install if they"re not already installed
|
||||
--ensure_installed = { "pylsp", "gopls", "lua_ls", "rust_analyzer" },
|
||||
--ensure_installed = { "pylsp", "lua_ls", "julials", "zls", "ltex", "texlab" },
|
||||
ensure_installed = { "pylsp", "lua_ls", "julials", "zls", "ltex", "texlab" },
|
||||
})
|
||||
|
||||
-- Set different settings for different languages" LSP
|
||||
-- LSP list: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||
-- How to use setup({}): https://github.com/neovim/nvim-lspconfig/wiki/Understanding-setup-%7B%7D
|
||||
-- - the settings table is sent to the LSP
|
||||
-- - on_attach: a lua callback function to run after LSP attaches to a given buffer
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- Customized on_attach function
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, opts)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(_, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
-- For Zig
|
||||
--require("completion").on_attach()
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set("n", "<space>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set("n", "<space>f", function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
end
|
||||
|
||||
-- Configure each language
|
||||
|
||||
lspconfig.lua_ls.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you"re using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
lspconfig.pylsp.setup({
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
--lspconfig.gopls.setup({
|
||||
-- on_attach = on_attach,
|
||||
--})
|
||||
|
||||
lspconfig.julials.setup({
|
||||
--on_attach = on_attach,
|
||||
symbol_cache_download = true,
|
||||
--symbol_server = "https://symbol-server",
|
||||
on_new_config = function(new_config, _)
|
||||
local julia = vim.fn.expand("/usr/share/julia/bin/julia")
|
||||
if require'lspconfig'.util.path.is_file(julia) then
|
||||
vim.notify("Hello!")
|
||||
new_config.cmd[1] = julia
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
lspconfig.texlab.setup({
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.zls.setup({
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.bashls.setup({
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.ltex.setup({
|
||||
settings = {
|
||||
ltex = {
|
||||
language = "en-GB",
|
||||
},
|
||||
},
|
||||
})
|
||||
-- source: https://rust-analyzer.github.io/manual.html#nvim-lsp
|
||||
--lspconfig.rust_analyzer.setup({
|
||||
-- on_attach = on_attach,
|
||||
-- settings = {
|
||||
-- ["rust-analyzer"] = {
|
||||
-- inlayHints = {
|
||||
-- closingBraceHints = true, -- Whether to show inlay hints after a closing } to indicate what item it belongs to.
|
||||
-- }
|
||||
-- }
|
||||
-- }
|
||||
--})
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
require("lualine").setup({})
|
||||
--[[
|
||||
require("lualine").setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "auto",
|
||||
component_separators = { left = "", right = ""},
|
||||
section_separators = { left = "", right = ""},
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {"mode"},
|
||||
lualine_b = {"branch", "diff", "diagnostics"},
|
||||
lualine_c = {"filename"},
|
||||
lualine_x = {"encoding", "fileformat", "filetype"},
|
||||
lualine_y = {"progress"},
|
||||
lualine_z = {"location"}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {"filename"},
|
||||
lualine_x = {"location"},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {}
|
||||
}
|
||||
]]--
|
|
@ -1 +0,0 @@
|
|||
require("nvim-tree").setup()
|
107
lua/options.lua
107
lua/options.lua
|
@ -1,107 +0,0 @@
|
|||
-- Hint: use `:h <option>` to figure out the meaning if needed
|
||||
vim.opt.clipboard = "unnamedplus" -- use system clipboard
|
||||
vim.opt.completeopt = {"menu", "menuone", "noselect"}
|
||||
vim.opt.mouse = "a" -- allow the mouse to be used in Nvim
|
||||
|
||||
-- Fonts
|
||||
vim.opt.encoding="utf-8"
|
||||
vim.opt.guifont = "Meslo LG M Bold for Powerline:h10"
|
||||
|
||||
-- Tab
|
||||
vim.opt.tabstop = 4 -- number of visual spaces per TAB
|
||||
vim.opt.softtabstop = 4 -- number of spacesin tab when editing
|
||||
vim.opt.shiftwidth = 4 -- insert 4 spaces on a tab
|
||||
vim.opt.expandtab = true -- tabs are spaces, mainly because of python
|
||||
|
||||
-- UI config
|
||||
vim.opt.number = true -- show absolute number
|
||||
vim.opt.relativenumber = true -- add numbers to each line on the left side
|
||||
vim.opt.cursorline = false -- highlight cursor line underneath the cursor horizontally
|
||||
vim.opt.splitbelow = true -- open new vertical split bottom
|
||||
vim.opt.splitright = true -- open new horizontal splits right
|
||||
vim.opt.termguicolors = true -- enable 23-bit RGB color in the TUI
|
||||
vim.opt.showmode = false -- we are experienced, wo don"t need the "-- INSERT --" mode hint
|
||||
|
||||
-- File recovery options
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.backup = false
|
||||
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||
vim.opt.undofile = true
|
||||
|
||||
-- Color column
|
||||
vim.opt.colorcolumn = "80"
|
||||
|
||||
-- Searching
|
||||
vim.opt.incsearch = true -- search as characters are entered
|
||||
vim.opt.hlsearch = false -- do not highlight matches
|
||||
vim.opt.ignorecase = true -- ignore case in searches by default
|
||||
vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entered
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- Linter
|
||||
--vim.g.ale_completion_enabled = 1
|
||||
--vim.g.ale_completion_autoimport = 0
|
||||
--vim.g.ale_julia_executable="/usr/share/julia/bin/julia"
|
||||
--vim.g.ale_lint_on_enter = 0
|
||||
----vim.g.ale_linters_explicit = 1
|
||||
|
||||
-- Leader key
|
||||
vim.g.mapleader = " "
|
||||
--vim.g.maplocalleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
|
||||
-- REPL
|
||||
--vim.g.slime_target = "neovim"
|
||||
|
||||
-- Airline
|
||||
vim.g.airline_powerline_fonts = 1
|
||||
|
||||
-- Zig
|
||||
vim.g.zig_fmt_autosave = 1
|
||||
-- Set completeopt to have a better completion experience
|
||||
--set completeopt=menuone,noinsert,noselect
|
||||
vim.opt.completeopt = "menuone,noinsert,noselect"
|
||||
-- Enable completions as you type
|
||||
vim.g.completion_enable_auto_popup = 1
|
||||
|
||||
-- Python
|
||||
vim.g.loaded_python_provider = 0
|
||||
vim.g.python3_host_prog = "/usr/local/bin/python"
|
||||
|
||||
-- Close parenthesis
|
||||
--vim.g.AutoPairFlymode = 1
|
||||
--vim.g.AutoPairsShortcutBackInsert = "<M-b>"
|
||||
--vim.g.AutoPairsMapBS = 1
|
||||
|
||||
-- PDF Viewer:
|
||||
-- http://manpages.ubuntu.com/manpages/trusty/man5/zathurarc.5.html
|
||||
vim.g["vimtex_view_method"] = "zathura"
|
||||
vim.g["vimtex_quickfix_mode"] =0
|
||||
|
||||
-- Ignore mappings
|
||||
vim.g["vimtex_mappings_enabled"] = 1
|
||||
|
||||
-- Auto Indent
|
||||
vim.g["vimtex_indent_enabled"] = 1
|
||||
|
||||
-- Syntax highlighting
|
||||
vim.g["vimtex_syntax_enabled"] = 1
|
||||
|
||||
-- Error suppression:
|
||||
-- https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt
|
||||
|
||||
vim.g["vimtex_log_ignore"] = ({
|
||||
"Underfull",
|
||||
"Overfull",
|
||||
"specifier changed to",
|
||||
"Token not allowed in a PDF string",
|
||||
})
|
||||
|
||||
vim.g["vimtex_context_pdf_viewer"] = "zathura"
|
||||
|
||||
-- vim.g["vimtex_complete_enabled"] = 1
|
||||
-- vim.g["vimtex_compiler_progname"] = "nvr"
|
||||
-- vim.g["vimtex_complete_close_braces"] = 1
|
202
lua/plugins.lua
202
lua/plugins.lua
|
@ -1,202 +0,0 @@
|
|||
-- Install Packer automatically if it"s not installed(Bootstraping)
|
||||
-- Hint: string concatenation is done by `..`
|
||||
local ensure_packer = function()
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath("data").."/site/pack/packer/start/packer.nvim"
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
fn.system({"git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path})
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
local packer_bootstrap = ensure_packer()
|
||||
|
||||
|
||||
-- Reload configurations if we modify plugins.lua
|
||||
-- Hint
|
||||
-- <afile> - replaced with the filename of the buffer being manipulated
|
||||
vim.cmd([[
|
||||
augroup packer_user_config
|
||||
autocmd!
|
||||
autocmd BufWritePost plugins.lua source <afile> | PackerSync
|
||||
augroup end
|
||||
]])
|
||||
|
||||
|
||||
-- Install plugins here - `use ...`
|
||||
-- Packer.nvim hints
|
||||
-- after = string or list, -- Specifies plugins to load before this plugin. See "sequencing" below
|
||||
-- config = string or function, -- Specifies code to run after this plugin is loaded
|
||||
-- requires = string or list, -- Specifies plugin dependencies. See "dependencies".
|
||||
-- ft = string or list, -- Specifies filetypes which load this plugin.
|
||||
-- run = string, function, or table, -- Specify operations to be run after successful installs/updates of a plugin
|
||||
return require("packer").startup(function(use)
|
||||
-- Packer can manage itself
|
||||
use "wbthomason/packer.nvim"
|
||||
|
||||
|
||||
|
||||
--use "tanvirtin/monokai.nvim"
|
||||
-- Autocomplete
|
||||
use {
|
||||
"williamboman/mason.nvim",
|
||||
run = ":MasonUpdate" -- :MasonUpdate updates registry contents
|
||||
}
|
||||
use { "williamboman/mason-lspconfig.nvim"}
|
||||
use { "neovim/nvim-lspconfig" } -- previous installed
|
||||
-- Cmp
|
||||
use { "hrsh7th/nvim-cmp", config = [[require("config.nvim-cmp")]] }
|
||||
use { "hrsh7th/cmp-nvim-lsp", after = "nvim-cmp" }
|
||||
use { "hrsh7th/cmp-buffer", after = "nvim-cmp" } -- buffer auto-completion
|
||||
use { "hrsh7th/cmp-path", after = "nvim-cmp" } -- path auto-completion
|
||||
use { "hrsh7th/cmp-cmdline", after = "nvim-cmp" } -- cmdline auto-completion
|
||||
use "L3MON4D3/LuaSnip"
|
||||
use "saadparwaiz1/cmp_luasnip"
|
||||
|
||||
-- helps Vimtex completions
|
||||
use { "hrsh7th/cmp-omni" }
|
||||
|
||||
-- ALE Linter
|
||||
use { "dense-analysis/ale" }
|
||||
|
||||
-- :FixWhitespace
|
||||
use "bronson/vim-trailing-whitespace"
|
||||
-- Close parenthesis
|
||||
use {
|
||||
"windwp/nvim-autopairs",
|
||||
config = function() require("nvim-autopairs").setup {} end
|
||||
}
|
||||
|
||||
-- gitgutter
|
||||
use { "airblade/vim-gitgutter" }
|
||||
|
||||
-- Mappings
|
||||
use { "folke/which-key.nvim" }
|
||||
|
||||
-- zig.vim
|
||||
use { "ziglang/zig.vim" }
|
||||
|
||||
-- julia-vim
|
||||
--use { "JuliaEditorSupport/julia-vim" }
|
||||
|
||||
-- LaTeX
|
||||
use { "lervag/vimtex" } -- essential for LaTeX; Vimscript
|
||||
use { "kdheepak/cmp-latex-symbols" }
|
||||
use { "jbyuki/nabla.nvim" } -- show symbols in editor
|
||||
use {
|
||||
"brymer-meneses/grammar-guard.nvim",
|
||||
requires = {
|
||||
"neovim/nvim-lspconfig",
|
||||
"williamboman/nvim-lsp-installer"
|
||||
}
|
||||
}
|
||||
|
||||
-- Devicons
|
||||
use { "nvim-tree/nvim-web-devicons" }
|
||||
|
||||
-- Lua Line
|
||||
use {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
requires = { "nvim-tree/nvim-web-devicons", opt = true }
|
||||
}
|
||||
|
||||
-- nvim tree
|
||||
use { "nvim-tree/nvim-tree.lua" }
|
||||
|
||||
-- Airline
|
||||
--[[
|
||||
use "vim-airline/vim-airline"
|
||||
use "vim-airline/vim-airline-themes"
|
||||
]]--
|
||||
|
||||
-- vim-visual-multi
|
||||
use { "mg979/vim-visual-multi" }
|
||||
|
||||
-- Telescope fuzzy finder
|
||||
use {
|
||||
"nvim-telescope/telescope.nvim", tag = "0.1.1",
|
||||
-- or , branch = "0.1.x",
|
||||
requires = { {"nvim-lua/plenary.nvim"} }
|
||||
}
|
||||
|
||||
use {
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build'
|
||||
}
|
||||
|
||||
-- Nord colorscheme
|
||||
--[[
|
||||
use {
|
||||
"arcticicestudio/nord-vim",
|
||||
config = function ()
|
||||
vim.cmd("colorscheme nord")
|
||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
end
|
||||
}
|
||||
]]--
|
||||
|
||||
-- Rose-Pine
|
||||
use ({
|
||||
"rose-pine/neovim",
|
||||
as = "rose-pine",
|
||||
config = function ()
|
||||
vim.cmd("colorscheme rose-pine")
|
||||
end
|
||||
})
|
||||
|
||||
-- Shadotheme
|
||||
--[[
|
||||
use ({
|
||||
"Shadorain/shadotheme",
|
||||
config = function ()
|
||||
vim.cmd("colorscheme shado")
|
||||
end
|
||||
})
|
||||
]]--
|
||||
|
||||
-- Terminal toggle
|
||||
use ({"akinsho/toggleterm.nvim", tag = "*",
|
||||
config = function()
|
||||
require("toggleterm").setup()
|
||||
end
|
||||
})
|
||||
|
||||
-- Alpha-nvim
|
||||
use {
|
||||
"goolord/alpha-nvim",
|
||||
requires = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function ()
|
||||
require"alpha".setup(require"alpha.themes.startify".config)
|
||||
end
|
||||
}
|
||||
|
||||
-- Source code coloring
|
||||
use {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
{run = ":TSUpdate"},
|
||||
}
|
||||
use "nvim-treesitter/playground"
|
||||
-- Harpoon
|
||||
use "nvim-lua/plenary.nvim"
|
||||
use "ThePrimeagen/harpoon"
|
||||
-- Undotree
|
||||
use "mbbill/undotree"
|
||||
-- Fugitive
|
||||
use "tpope/vim-fugitive"
|
||||
-- Buffers for nvim
|
||||
use {"akinsho/bufferline.nvim", tag = "v3.*", requires = "nvim-tree/nvim-web-devicons"}
|
||||
|
||||
|
||||
---------------------------------------
|
||||
-- NOTE: PUT YOUR THIRD PLUGIN HERE --
|
||||
---------------------------------------
|
||||
|
||||
-- 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)
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
local status_ok, telescope = pcall(require, "telescope")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local actions = require "telescope.actions"
|
||||
|
||||
-- local job_opts = {
|
||||
-- entry_maker = function(entry)
|
||||
-- local _, _, filename, lnum, col, text = string.find(entry, "([^:]+):(%d+):(.*)")
|
||||
-- local table = {
|
||||
-- ordinal = text,
|
||||
-- display = filename .. ":" .. text
|
||||
-- }
|
||||
-- return table
|
||||
-- end
|
||||
-- }
|
||||
--
|
||||
-- local opts = {
|
||||
-- finder = finders.new_oneshot_job(rg, job_opts),
|
||||
-- sorter = sorters.get_generic_fuzzy_sorter(),
|
||||
-- }
|
||||
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
path_display = { "smart" },
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-n>"] = actions.cycle_history_next,
|
||||
["<C-p>"] = actions.cycle_history_prev,
|
||||
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
|
||||
["<C-c>"] = actions.close,
|
||||
|
||||
["<Down>"] = actions.move_selection_next,
|
||||
["<Up>"] = actions.move_selection_previous,
|
||||
|
||||
["<CR>"] = actions.select_default,
|
||||
["<C-x>"] = actions.select_horizontal,
|
||||
["<C-v>"] = actions.select_vertical,
|
||||
["<C-t>"] = actions.select_tab,
|
||||
|
||||
["<C-u>"] = actions.preview_scrolling_up,
|
||||
["<C-d>"] = actions.preview_scrolling_down,
|
||||
|
||||
["<PageUp>"] = actions.results_scrolling_up,
|
||||
["<PageDown>"] = actions.results_scrolling_down,
|
||||
|
||||
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
|
||||
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
|
||||
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
|
||||
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||
["<C-l>"] = actions.complete_tag,
|
||||
["<C-_>"] = actions.which_key, -- keys from pressing <C-/>
|
||||
},
|
||||
|
||||
n = {
|
||||
["<esc>"] = actions.close,
|
||||
["<CR>"] = actions.select_default,
|
||||
["<C-x>"] = actions.select_horizontal,
|
||||
["<C-v>"] = actions.select_vertical,
|
||||
["<C-t>"] = actions.select_tab,
|
||||
|
||||
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
|
||||
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
|
||||
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
|
||||
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||
|
||||
["j"] = actions.move_selection_next,
|
||||
["k"] = actions.move_selection_previous,
|
||||
["H"] = actions.move_to_top,
|
||||
["M"] = actions.move_to_middle,
|
||||
["L"] = actions.move_to_bottom,
|
||||
|
||||
["<Down>"] = actions.move_selection_next,
|
||||
["<Up>"] = actions.move_selection_previous,
|
||||
["gg"] = actions.move_to_top,
|
||||
["G"] = actions.move_to_bottom,
|
||||
|
||||
["<C-u>"] = actions.preview_scrolling_up,
|
||||
["<C-d>"] = actions.preview_scrolling_down,
|
||||
|
||||
["<PageUp>"] = actions.results_scrolling_up,
|
||||
["<PageDown>"] = actions.results_scrolling_down,
|
||||
|
||||
["?"] = actions.which_key,
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
-- Default configuration for builtin pickers goes here:
|
||||
-- picker_name = {
|
||||
-- picker_config_key = value,
|
||||
-- ...
|
||||
-- }
|
||||
-- Now the picker_config_key will be applied every time you call this
|
||||
-- builtin picker
|
||||
},
|
||||
--load_extensions = { "yank_history", "bibtex" },
|
||||
--extensions = {
|
||||
-- bibtex = {
|
||||
-- depth = 1,
|
||||
-- -- Depth for the *.bib file
|
||||
-- custom_formats = {},
|
||||
-- -- Custom format for citation label
|
||||
-- format = '',
|
||||
-- -- Format to use for citation label.
|
||||
-- -- Try to match the filetype by default, or use 'plain'
|
||||
-- global_files = {'~/texmf/bibtex/bib/Zotero.bib'},
|
||||
-- -- Path to global bibliographies (placed outside of the project)
|
||||
-- search_keys = { 'author', 'year', 'title' },
|
||||
-- -- Define the search keys to use in the picker
|
||||
-- citation_format = '{{author}} ({{year}}), {{title}}.',
|
||||
-- -- Template for the formatted citation
|
||||
-- citation_trim_firstname = true,
|
||||
-- -- Only use initials for the authors first name
|
||||
-- citation_max_auth = 2,
|
||||
-- -- Max number of authors to write in the formatted citation
|
||||
-- -- following authors will be replaced by "et al."
|
||||
-- context = false,
|
||||
-- -- Context awareness disabled by default
|
||||
-- context_fallback = true,
|
||||
-- -- Fallback to global/directory .bib files if context not found
|
||||
-- -- This setting has no effect if context = false
|
||||
-- wrap = false,
|
||||
-- -- Wrapping in the preview window is disabled by default
|
||||
-- },
|
||||
-- -- Your extension configuration goes here:
|
||||
-- -- extension_name = {
|
||||
-- -- extension_config_key = value,
|
||||
-- -- }
|
||||
-- -- please take a look at the readme of the extension you want to configure
|
||||
--},
|
||||
}
|
||||
|
||||
require('telescope').load_extension('fzf')
|
||||
|
15
lua/term.lua
15
lua/term.lua
|
@ -1,15 +0,0 @@
|
|||
require("toggleterm").setup{
|
||||
open_mapping = [[<C-\>]],
|
||||
autochdir = false,
|
||||
}
|
||||
|
||||
function _G.set_terminal_keymaps()
|
||||
local opts = {buffer = 0}
|
||||
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
|
||||
vim.keymap.set('t', 'jk', [[<C-\><C-n>]], opts)
|
||||
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts)
|
||||
end
|
|
@ -1,42 +0,0 @@
|
|||
require"nvim-treesitter.configs".setup {
|
||||
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
||||
ensure_installed = { "zig", "c", "lua", "vim", "vimdoc", "query" },
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don"t have `tree-sitter` CLI installed locally
|
||||
auto_install = true,
|
||||
|
||||
-- List of parsers to ignore installing (for "all")
|
||||
ignore_install = { "javascript" },
|
||||
|
||||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
|
||||
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
||||
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||
-- the name of the parser)
|
||||
-- list of language that will be disabled
|
||||
--disable = { "rust" },
|
||||
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
|
||||
--disable = function(_, buf)
|
||||
-- local max_filesize = 100 * 1024 -- 100 KB
|
||||
-- local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
-- if ok and stats and stats.size > max_filesize then
|
||||
-- return true
|
||||
-- end
|
||||
--end,
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on "syntax" being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
|
228
lua/whichkey.lua
228
lua/whichkey.lua
|
@ -1,228 +0,0 @@
|
|||
local status_ok, which_key = pcall(require, "which-key")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local setup = {
|
||||
plugins = {
|
||||
marks = false, -- shows a list of your marks on ' and `
|
||||
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
||||
spelling = {
|
||||
enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
|
||||
suggestions = 10, -- how many suggestions should be shown in the list?
|
||||
},
|
||||
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
|
||||
-- No actual key bindings are created
|
||||
presets = {
|
||||
operators = false, -- adds help for operators like d, y, ... and registers them for motion / text object completion
|
||||
motions = false, -- adds help for motions
|
||||
text_objects = false, -- help for text objects triggered after entering an operator
|
||||
windows = false, -- default bindings on <c-w>
|
||||
nav = false, -- misc bindings to work with windows
|
||||
z = false, -- bindings for folds, spelling and others prefixed with z
|
||||
g = false, -- bindings for prefixed with g
|
||||
},
|
||||
},
|
||||
-- add operators that will trigger motion and text object completion
|
||||
-- to enable native operators, set the preset / operators plugin above
|
||||
-- operators = { gc = "Comments" },
|
||||
key_labels = {
|
||||
-- override the label used to display some keys. It doesn't effect WK in any other way.
|
||||
-- For example:
|
||||
-- ["<space>"] = "SPC",
|
||||
-- ["<CR>"] = "RET",
|
||||
-- ["<tab>"] = "TAB",
|
||||
},
|
||||
icons = {
|
||||
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
|
||||
separator = "➜", -- symbol used between a key and it's label
|
||||
group = "+", -- symbol prepended to a group
|
||||
},
|
||||
popup_mappings = {
|
||||
scroll_down = "<c-d>", -- binding to scroll down inside the popup
|
||||
scroll_up = "<c-u>", -- binding to scroll up inside the popup
|
||||
},
|
||||
window = {
|
||||
border = "rounded", -- none, single, double, shadow
|
||||
position = "bottom", -- bottom, top
|
||||
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
|
||||
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
|
||||
winblend = 0,
|
||||
},
|
||||
layout = {
|
||||
height = { min = 4, max = 25 }, -- min and max height of the columns
|
||||
width = { min = 20, max = 50 }, -- min and max width of the columns
|
||||
spacing = 3, -- spacing between columns
|
||||
align = "left", -- align columns left, center or right
|
||||
},
|
||||
ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label
|
||||
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
|
||||
show_help = true, -- show help message on the command line when the popup is visible
|
||||
triggers = "auto", -- automatically setup triggers
|
||||
-- triggers = {"<leader>"} -- or specify a list manually
|
||||
triggers_blacklist = {
|
||||
-- list of mode / prefixes that should never be hooked by WhichKey
|
||||
-- this is mostly relevant for key maps that start with a native binding
|
||||
-- most people should not need to change this
|
||||
i = { "j", "k" },
|
||||
v = { "j", "k" },
|
||||
},
|
||||
}
|
||||
|
||||
local opts = {
|
||||
mode = "n", -- NORMAL mode
|
||||
prefix = "<leader>",
|
||||
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
|
||||
silent = true, -- use `silent` when creating keymaps
|
||||
noremap = true, -- use `noremap` when creating keymaps
|
||||
nowait = true, -- use `nowait` when creating keymaps
|
||||
}
|
||||
|
||||
-- hjknoyz
|
||||
|
||||
-- GENERAL MAPPINGS
|
||||
|
||||
local builtin = require("telescope.builtin")
|
||||
local mappings = {
|
||||
c = {
|
||||
name = "Commands",
|
||||
e = { "<cmd>wqa!<CR>", "exit vim"},
|
||||
},
|
||||
l = {
|
||||
name = "LaTeX",
|
||||
b = { "<cmd>VimtexCompile<CR>" , "build" },
|
||||
c = { "<cmd>VimtexCountWords!<CR>" , "count" },
|
||||
v = { "<cmd>VimtexView<CR>" , "view" },
|
||||
|
||||
},
|
||||
p = {
|
||||
name = "Project",
|
||||
v = {"<cmd>Ex<CR>" , "explorer"},
|
||||
f = {builtin.find_files , "find-file"},
|
||||
g = {builtin.git_files , "find-git-file"},
|
||||
},
|
||||
--["b"] = { "<cmd>VimtexCompile<CR>" , "build" },
|
||||
--["c"] = { "<cmd>VimtexCountWords!<CR>" , "count" },
|
||||
--["d"] = { "<cmd>bdelete!<CR>" , "delete buffer" },
|
||||
--["e"] = { "<cmd>NvimTreeToggle<CR>" , "explorer" },
|
||||
--["i"] = { "<cmd>VimtexTocOpen<CR>" , "index" },
|
||||
--["q"] = { "<cmd>wqa!<CR>" , "quit" },
|
||||
--["r"] = { "" , "reorder" },
|
||||
---- ["r"] = { "<cmd>lua require('autolist').force_recalculate()<CR>" , "reorder list" },
|
||||
--["u"] = { "<cmd>UndotreeToggle<CR>" , "undo" },
|
||||
--["v"] = { "<cmd>VimtexView<CR>" , "view" },
|
||||
--["w"] = { "<cmd>wa!<CR>" , "write" },
|
||||
--["x"] = { "" , "checkmark" },
|
||||
---- ["x"] = { "<cmd>lua require('autolist').invert_entry()<CR>" , "checkmark" },
|
||||
--a = {
|
||||
-- name = "ACTIONS",
|
||||
-- a = { "<cmd>lua PdfAnnots()<CR>", "annotate"},
|
||||
-- b = { "<cmd>terminal bibexport -o %:p:r.bib %:p:r.aux<CR>", "bib export"},
|
||||
-- c = { "<cmd>VimtexClean<CR>" , "clean aux" },
|
||||
-- g = { "<cmd>e ~/.config/nvim/templates/Glossary.tex<CR>", "edit glossary"},
|
||||
-- h = { "<cmd>lua _HTOP_TOGGLE()<CR>", "htop" },
|
||||
-- i = { "<cmd>IlluminateToggle<CR>" , "illuminate" },
|
||||
-- l = { "<cmd>lua vim.g.cmptoggle = not vim.g.cmptoggle<CR>", "LSP"},
|
||||
-- p = { '<cmd>lua require("nabla").popup()<CR>', "preview symbols"},
|
||||
-- r = { "<cmd>VimtexErrors<CR>" , "report errors" },
|
||||
-- s = { "<cmd>e ~/.config/nvim/snippets/tex.snippets<CR>", "edit snippets"},
|
||||
-- u = { "<cmd>cd %:p:h<CR>" , "update cwd" },
|
||||
-- -- w = { "<cmd>TermExec cmd='pandoc %:p -o %:p:r.docx'<CR>" , "word"},
|
||||
-- v = { "<plug>(vimtex-context-menu)" , "vimtex menu" },
|
||||
--},
|
||||
--f = {
|
||||
-- name = "FIND",
|
||||
-- b = {
|
||||
-- "<cmd>lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{previewer = false})<CR>",
|
||||
-- "buffers",
|
||||
-- },
|
||||
-- c = { "<cmd>Telescope bibtex<CR>" , "citations" },
|
||||
-- f = { "<cmd>Telescope live_grep theme=ivy<CR>", "project" },
|
||||
-- g = { "<cmd>Telescope git_branches<CR>", "branches" },
|
||||
-- h = { "<cmd>Telescope help_tags<CR>", "help" },
|
||||
-- k = { "<cmd>Telescope keymaps<CR>", "keymaps" },
|
||||
-- -- m = { "<cmd>Telescope man_pages<CR>", "man pages" },
|
||||
-- r = { "<cmd>Telescope registers<CR>", "registers" },
|
||||
-- t = { "<cmd>Telescope colorscheme<CR>", "theme" },
|
||||
-- y = { "<cmd>YankyRingHistory<CR>" , "yanks" },
|
||||
-- -- c = { "<cmd>Telescope commands<CR>", "commands" },
|
||||
-- -- r = { "<cmd>Telescope oldfiles<CR>", "recent" },
|
||||
--},
|
||||
--g = {
|
||||
-- name = "GIT",
|
||||
-- g = { "<cmd>lua _LAZYGIT_TOGGLE()<CR>", "lazygit" },
|
||||
-- j = { "<cmd>lua require 'gitsigns'.next_hunk()<CR>", "next hunk" },
|
||||
-- k = { "<cmd>lua require 'gitsigns'.prev_hunk()<CR>", "prev hunk" },
|
||||
-- l = { "<cmd>lua require 'gitsigns'.blame_line()<CR>", "blame" },
|
||||
-- p = { "<cmd>lua require 'gitsigns'.preview_hunk()<CR>", "preview hunk" },
|
||||
-- r = { "<cmd>lua require 'gitsigns'.reset_hunk()<CR>", "reset hunk" },
|
||||
-- s = { "<cmd>lua require 'gitsigns'.stage_hunk()<CR>", "stage hunk" },
|
||||
-- u = {
|
||||
-- "<cmd>lua require 'gitsigns'.undo_stage_hunk()<CR>", "unstage hunk" },
|
||||
-- o = { "<cmd>Telescope git_status<CR>", "open changed file" },
|
||||
-- b = { "<cmd>Telescope git_branches<CR>", "checkout branch" },
|
||||
-- c = { "<cmd>Telescope git_commits<CR>", "checkout commit" },
|
||||
-- d = { "<cmd>Gitsigns diffthis HEAD<CR>", "diff" },
|
||||
--},
|
||||
--m = {
|
||||
-- name = "MANAGE SESSIONS",
|
||||
-- s = { "<cmd>SessionManager save_current_session<CR>", "save" },
|
||||
-- d = { "<cmd>SessionManager delete_session<CR>", "delete" },
|
||||
-- l = { "<cmd>SessionManager load_session<CR>", "load" },
|
||||
--},
|
||||
--p = {
|
||||
-- name = "PANDOC",
|
||||
-- w = { "<cmd>TermExec cmd='pandoc %:p -o %:p:r.docx'<CR>" , "word"},
|
||||
-- m = { "<cmd>TermExec cmd='pandoc %:p -o %:p:r.md'<CR>" , "markdown"},
|
||||
-- h = { "<cmd>TermExec cmd='pandoc %:p -o %:p:r.html'<CR>" , "html"},
|
||||
-- l = { "<cmd>TermExec cmd='pandoc %:p -o %:p:r.tex'<CR>" , "latex"},
|
||||
-- p = { "<cmd>TermExec cmd='pandoc %:p -o %:p:r.pdf'<CR>" , "pdf"},
|
||||
-- -- x = { "<cmd>echo "run: unoconv -f pdf path-to.docx"" , "word to pdf"},
|
||||
--},
|
||||
--s = {
|
||||
-- name = "SURROUND",
|
||||
-- s = { "<Plug>(nvim-surround-normal)", "surround" },
|
||||
-- d = { "<Plug>(nvim-surround-delete)", "delete" },
|
||||
-- c = { "<Plug>(nvim-surround-change)", "change" },
|
||||
--},
|
||||
--t = {
|
||||
-- name = "TEMPLATES",
|
||||
-- c = { "<cmd>PackerCompile<CR>", "Compile" },
|
||||
-- p = {
|
||||
-- "<cmd>read ~/.config/nvim/templates/PhilPaper.tex<CR>",
|
||||
-- "PhilPaper.tex",
|
||||
-- },
|
||||
-- l = {
|
||||
-- "<cmd>read ~/.config/nvim/templates/Letter.tex<CR>",
|
||||
-- "Letter.tex",
|
||||
-- },
|
||||
-- g = {
|
||||
-- "<cmd>read ~/.config/nvim/templates/Glossary.tex<CR>",
|
||||
-- "Glossary.tex",
|
||||
-- },
|
||||
-- h = {
|
||||
-- "<cmd>read ~/.config/nvim/templates/HandOut.tex<CR>",
|
||||
-- "HandOut.tex",
|
||||
-- },
|
||||
-- b = {
|
||||
-- "<cmd>read ~/.config/nvim/templates/PhilBeamer.tex<CR>",
|
||||
-- "PhilBeamer.tex",
|
||||
-- },
|
||||
-- s = {
|
||||
-- "<cmd>read ~/.config/nvim/templates/SubFile.tex<CR>",
|
||||
-- "SubFile.tex",
|
||||
-- },
|
||||
-- r = {
|
||||
-- "<cmd>read ~/.config/nvim/templates/Root.tex<CR>",
|
||||
-- "Root.tex",
|
||||
-- },
|
||||
-- m = {
|
||||
-- "<cmd>read ~/.config/nvim/templates/MultipleAnswer.tex<CR>",
|
||||
-- "MultipleAnswer.tex",
|
||||
-- },
|
||||
--},
|
||||
}
|
||||
|
||||
which_key.setup(setup)
|
||||
which_key.register(mappings, opts)
|
||||
|
Loading…
Reference in New Issue