Merge branch 'master' of ssh://212.132.118.65:55556/flip/nvim
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,3 +6,4 @@ debug
|
||||
foo.*
|
||||
*.log
|
||||
data
|
||||
packer_compiled.lua
|
||||
|
||||
3
lua/flip/init.lua
Normal file
3
lua/flip/init.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
require("flip.remap")
|
||||
require("flip.set")
|
||||
require("flip.lazy")
|
||||
27
lua/flip/lazy.lua
Normal file
27
lua/flip/lazy.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = "plugins",
|
||||
change_detection = { notify = false },
|
||||
-- Configure any other settings here. See documentation for details
|
||||
install = { colorscheme = { "habamax" } },
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
})
|
||||
71
lua/flip/remap.lua
Normal file
71
lua/flip/remap.lua
Normal file
@@ -0,0 +1,71 @@
|
||||
-- Leader is space now
|
||||
vim.g.mapleader = " "
|
||||
-- Project View instead of :Ex
|
||||
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||
|
||||
-- Easily move up and down
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- Slide lines below into the current one
|
||||
vim.keymap.set("n", "J", "mzJ`z")
|
||||
|
||||
--- LSP settings ---
|
||||
-- Show hover text of symbol
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover)
|
||||
|
||||
-- Go to definition of symbol
|
||||
vim.keymap.set("n", "<leader>gd", vim.lsp.buf.definition)
|
||||
|
||||
-- Go to declaration of symbol
|
||||
vim.keymap.set("n", "<leader>gD", vim.lsp.buf.declaration)
|
||||
|
||||
-- List all implementations for symbol in quickfix window
|
||||
vim.keymap.set("n", "<leader>gi", vim.lsp.buf.implementation)
|
||||
|
||||
-- Go to definition of type of symbol
|
||||
vim.keymap.set("n", "<leader>go", vim.lsp.buf.type_definition)
|
||||
|
||||
-- Go to references of symbol
|
||||
vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references)
|
||||
|
||||
-- Select code action at symbol
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action)
|
||||
|
||||
-- Auto formatting
|
||||
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
|
||||
|
||||
-- Display type signature
|
||||
vim.keymap.set("n", "gs", vim.lsp.buf.signature_help)
|
||||
|
||||
--- End of LSP setings ---
|
||||
|
||||
-- Greatest remap ever
|
||||
-- Delete visual selection to null and paste latest clipboard entry
|
||||
vim.keymap.set("x", "<leader>p", [["_dP]])
|
||||
|
||||
-- Next greatest remap ever : asbjornHaland
|
||||
-- Copy selection and line respectively to system clipboard
|
||||
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
|
||||
vim.keymap.set("n", "<leader>Y", [["+Y]])
|
||||
|
||||
-- Delete to null
|
||||
vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]])
|
||||
|
||||
-- Make next and previous a bit smoother
|
||||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
-- Jump to next and previous error
|
||||
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
|
||||
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
|
||||
|
||||
-- Jump to next and previous item in location list
|
||||
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
|
||||
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
|
||||
|
||||
-- Substitute word under cursor
|
||||
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||
|
||||
-- Make current file executable
|
||||
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
|
||||
35
lua/flip/set.lua
Normal file
35
lua/flip/set.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
-- Setting line numbers
|
||||
vim.opt.nu = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
-- Setting tabs correctly
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
|
||||
vim.opt.smartindent = true
|
||||
|
||||
-- Setting backup / undo stuff
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.backup = false
|
||||
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||
vim.opt.undofile = true
|
||||
|
||||
-- Search highlighting
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.incsearch = true
|
||||
|
||||
-- Colouring
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
-- Scrolling stuff
|
||||
vim.opt.scrolloff = 20
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.opt.isfname:append("@-@")
|
||||
|
||||
-- Update time
|
||||
vim.opt.updatetime = 50
|
||||
|
||||
vim.opt.colorcolumn = "120"
|
||||
|
||||
27
lua/plugins/colors.lua
Normal file
27
lua/plugins/colors.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
function ColorMyPencils(color)
|
||||
color = color or "nightfox"
|
||||
vim.cmd.colorscheme(color)
|
||||
|
||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>c", function() ColorMyPencils() end)
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
return {
|
||||
"EdenEast/nightfox.nvim",
|
||||
name = "nightfox",
|
||||
lazy = false,
|
||||
options = {
|
||||
colorblind = {
|
||||
enable = true,
|
||||
severity = {
|
||||
protan = 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
ColorMyPencils()
|
||||
end
|
||||
}
|
||||
15
lua/plugins/harpoon.lua
Normal file
15
lua/plugins/harpoon.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
return {
|
||||
"theprimeagen/harpoon",
|
||||
|
||||
config = function()
|
||||
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", "<leader>1", function() ui.nav_file(1) end)
|
||||
vim.keymap.set("n", "<leader>2", function() ui.nav_file(2) end)
|
||||
vim.keymap.set("n", "<leader>3", function() ui.nav_file(3) end)
|
||||
vim.keymap.set("n", "<leader>4", function() ui.nav_file(4) end)
|
||||
end
|
||||
}
|
||||
8
lua/plugins/init.lua
Normal file
8
lua/plugins/init.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Load prerequisites for plugins here
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-lua/plenary.nvim",
|
||||
name = "plenary"
|
||||
}
|
||||
}
|
||||
116
lua/plugins/lsp.lua
Normal file
116
lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,116 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/nvim-cmp",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"j-hui/fidget.nvim",
|
||||
},
|
||||
|
||||
config = function()
|
||||
local cmp = require('cmp')
|
||||
local cmp_lsp = require("cmp_nvim_lsp")
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
cmp_lsp.default_capabilities())
|
||||
|
||||
require("fidget").setup({})
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"clangd",
|
||||
"lua_ls",
|
||||
"rust_analyzer",
|
||||
},
|
||||
handlers = {
|
||||
function(server_name) -- default handler (optional)
|
||||
require("lspconfig")[server_name].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
end,
|
||||
|
||||
zls = function()
|
||||
local lspconfig = require("lspconfig")
|
||||
lspconfig.zls.setup({
|
||||
root_dir = lspconfig.util.root_pattern(".git", "build.zig", "zls.json"),
|
||||
settings = {
|
||||
zls = {
|
||||
enable_inlay_hints = true,
|
||||
enable_snippets = true,
|
||||
warn_style = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
vim.g.zig_fmt_parse_errors = 0
|
||||
vim.g.zig_fmt_autosave = 0
|
||||
end,
|
||||
["lua_ls"] = function()
|
||||
local lspconfig = require("lspconfig")
|
||||
lspconfig.lua_ls.setup {
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = { version = "Lua 5.1" },
|
||||
diagnostics = {
|
||||
globals = { "bit", "vim", "it", "describe", "before_each", "after_each" },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end,
|
||||
}
|
||||
})
|
||||
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' }, -- For luasnip users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
local _border = 'rounded'
|
||||
|
||||
vim.diagnostic.config({
|
||||
-- update_in_insert = true,
|
||||
float = {
|
||||
focusable = false,
|
||||
style = "minimal",
|
||||
border = _border,
|
||||
source = "always",
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover, { border = _border }
|
||||
)
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
|
||||
vim.lsp.handlers.signature_help, { border = _border }
|
||||
)
|
||||
require('lspconfig.ui.windows').default_options = { border = _border }
|
||||
end
|
||||
}
|
||||
29
lua/plugins/telescope.lua
Normal file
29
lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
|
||||
tag = "0.1.8",
|
||||
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim"
|
||||
},
|
||||
|
||||
config = function()
|
||||
require('telescope').setup({})
|
||||
|
||||
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>pws', function()
|
||||
local word = vim.fn.expand("<cword>")
|
||||
builtin.grep_string({ search = word })
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>pWs', function()
|
||||
local word = vim.fn.expand("<cWORD>")
|
||||
builtin.grep_string({ search = word })
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>ps', function()
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") })
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>vh', builtin.help_tags, {})
|
||||
end
|
||||
}
|
||||
37
lua/plugins/treesitter.lua
Normal file
37
lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = function()
|
||||
require("nvim-treesitter.install").update({ with_sync = true })()
|
||||
end,
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
-- List of parsers
|
||||
ensure_installed = {
|
||||
"vimdoc", "vim", "lua", "c", "rust", "cpp", "cmake", "latex", "python", "groovy", "bash", "zig", "go",
|
||||
},
|
||||
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
|
||||
indent = {
|
||||
enable = true
|
||||
},
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = { "markdown" },
|
||||
},
|
||||
})
|
||||
|
||||
local treesitter_parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
treesitter_parser_config.templ = {
|
||||
install_info = {
|
||||
url = "https://github.com/vrischmann/tree-sitter-templ.git",
|
||||
files = { "src/parser.c", "src/scanner.c" },
|
||||
branch = "master",
|
||||
},
|
||||
}
|
||||
|
||||
vim.treesitter.language.register("templ", "templ")
|
||||
end
|
||||
}
|
||||
7
lua/plugins/undotree.lua
Normal file
7
lua/plugins/undotree.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
return {
|
||||
"mbbill/undotree",
|
||||
|
||||
config = function()
|
||||
vim.keymap.set("n", "<leader>u", vim.cmd.UndoTreeToggle)
|
||||
end
|
||||
}
|
||||
6
lua/plugins/vim-fugitive.lua
Normal file
6
lua/plugins/vim-fugitive.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
"tpope/vim-fugitive",
|
||||
config = function()
|
||||
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
|
||||
end
|
||||
}
|
||||
Reference in New Issue
Block a user