Updated scripts
This commit is contained in:
@@ -1,85 +1,45 @@
|
||||
-------------------------------------------------------------------
|
||||
-- Settings
|
||||
-------------------------------------------------------------------
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
-- vim.g.loaded_netrw = 1
|
||||
-- vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
-- Set highlight on search
|
||||
vim.o.hlsearch = false
|
||||
|
||||
-- Make line numbers default
|
||||
vim.wo.number = true
|
||||
|
||||
-- Enable mouse mode
|
||||
vim.o.mouse = "a"
|
||||
|
||||
-- Enable break indent
|
||||
vim.o.breakindent = true
|
||||
|
||||
-- Save undo history
|
||||
vim.o.undofile = true
|
||||
|
||||
-- Case insensitive searching UNLESS /C or capital in search
|
||||
vim.o.ignorecase = true
|
||||
vim.o.smartcase = true
|
||||
|
||||
-- Keep signcolumn on by default
|
||||
vim.wo.signcolumn = "yes"
|
||||
|
||||
-- Set completeopt to have a better completion experience
|
||||
-- vim.o.completeopt = "menuone,noselect,noinsert"
|
||||
|
||||
-- Use terminal colors
|
||||
vim.o.termguicolors = true
|
||||
|
||||
-- Tabs
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.smarttab = true
|
||||
vim.o.tabstop = 4
|
||||
vim.o.expandtab = true
|
||||
vim.o.softtabstop = 4
|
||||
|
||||
-- Preview substitutions live, as you type!
|
||||
vim.o.inccommand = "split"
|
||||
|
||||
-- Show cursor line
|
||||
vim.o.cursorline = true
|
||||
|
||||
vim.o.showmatch = true
|
||||
|
||||
-- Decrease update time
|
||||
vim.o.updatetime = 250
|
||||
|
||||
-- Decrease mapped sequence wait time
|
||||
vim.o.timeoutlen = 300
|
||||
|
||||
vim.o.pumheight = 10
|
||||
vim.o.relativenumber = true
|
||||
vim.o.scrolloff = 8
|
||||
|
||||
-- Don't show the mode, since it's already in the status line
|
||||
vim.o.showmode = false
|
||||
|
||||
vim.o.showtabline = 0
|
||||
|
||||
vim.o.wrap = true
|
||||
|
||||
vim.o.foldmethod = "expr"
|
||||
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
vim.o.foldlevelstart = 99
|
||||
vim.o.autoread = true
|
||||
|
||||
vim.schedule(function()
|
||||
vim.o.clipboard = "unnamedplus"
|
||||
end)
|
||||
|
||||
vim.o.autoread = true
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- Autocommands
|
||||
-------------------------------------------------------------------
|
||||
|
||||
-- Autoset current working directory based on closest git repo
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
callback = function()
|
||||
@@ -90,7 +50,6 @@ vim.api.nvim_create_autocmd("BufEnter", {
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- show cursor line only in active window
|
||||
local cursorLineGrp = vim.api.nvim_create_augroup("CursorLine", { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
@@ -109,7 +68,6 @@ vim.api.nvim_create_autocmd(
|
||||
{ "InsertEnter", "FocusLost" },
|
||||
{ pattern = "*", command = "set nocursorline", group = cursorLineGrp }
|
||||
)
|
||||
|
||||
-- Auto update on file changes
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, {
|
||||
command = "if mode() != 'c' | checktime | endif",
|
||||
@@ -177,48 +135,22 @@ require("lazy").setup({
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
|
||||
callback = function(event)
|
||||
-- In this case, we create a function that lets us more easily define mappings specific
|
||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
||||
local map = function(keys, func, desc, mode)
|
||||
mode = mode or "n"
|
||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
|
||||
end
|
||||
|
||||
-- Rename the variable under your cursor.
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
map("grn", vim.lsp.buf.rename, "[R]e[n]ame")
|
||||
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
-- or a suggestion from your LSP for this to activate.
|
||||
map("gra", vim.lsp.buf.code_action, "[G]oto Code [A]ction", { "n", "x" })
|
||||
|
||||
-- Find references for the word under your cursor.
|
||||
map("grr", require("fzf-lua").lsp_references, "[G]oto [R]eferences")
|
||||
|
||||
-- Jump to the implementation of the word under your cursor.
|
||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
||||
map("gri", require("fzf-lua").lsp_implementations, "[G]oto [I]mplementation")
|
||||
|
||||
-- Jump to the definition of the word under your cursor.
|
||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||
-- To jump back, press <C-t>.
|
||||
map("grd", require("fzf-lua").lsp_definitions, "[G]oto [D]efinition")
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header.
|
||||
map("grD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||
|
||||
-- Fuzzy find all the symbols in your current document.
|
||||
-- Symbols are things like variables, functions, types, etc.
|
||||
map("gO", require("fzf-lua").lsp_document_symbols, "Open Document Symbols")
|
||||
|
||||
-- Fuzzy find all the symbols in your current workspace.
|
||||
-- Similar to document symbols, except searches over your entire project.
|
||||
map("gW", require("fzf-lua").lsp_live_workspace_symbols, "Open Workspace Symbols")
|
||||
|
||||
-- Jump to the type of the word under your cursor.
|
||||
-- Useful when you're not sure what type a variable is and you want to see
|
||||
-- the definition of its *type*, not where it was *defined*.
|
||||
map("grt", require("fzf-lua").lsp_typedefs, "[G]oto [T]ype Definition")
|
||||
|
||||
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
|
||||
@@ -349,15 +281,29 @@ require("lazy").setup({
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
-- Conform will run multiple formatters sequentially
|
||||
python = { "black" },
|
||||
-- You can customize some of the format options for the filetype (:help conform.format)
|
||||
python = { "isort", "black", timeout_ms = 3000 },
|
||||
rust = { "rustfmt", lsp_format = "fallback" },
|
||||
-- Conform will run the first available formatter
|
||||
javascript = { "prettier", stop_after_first = true },
|
||||
c = { "clang_format" },
|
||||
cpp = { "clang_format" },
|
||||
javascript = { "prettier" },
|
||||
typescript = { "prettier" },
|
||||
javascriptreact = { "prettier" },
|
||||
typescriptreact = { "prettier" },
|
||||
css = { "prettier" },
|
||||
html = { "prettier" },
|
||||
json = { "prettier" },
|
||||
yaml = { "prettier" },
|
||||
markdown = { "prettier" },
|
||||
},
|
||||
formatters = {
|
||||
clang_format = {
|
||||
prepend_args = { "--style={BasedOnStyle: LLVM, IndentWidth: 4, TabWidth: 4, UseTab: Never}" },
|
||||
},
|
||||
shfmt = {
|
||||
prepend_args = { "-i", "4" },
|
||||
},
|
||||
},
|
||||
format_on_save = {
|
||||
-- These options will be passed to conform.format()
|
||||
timeout_ms = 500,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
@@ -374,9 +320,6 @@ require("lazy").setup({
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "2.*",
|
||||
build = (function()
|
||||
-- Build Step is needed for regex support in snippets.
|
||||
-- This step is not supported in many windows environments.
|
||||
-- Remove the below condition to re-enable on windows.
|
||||
if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
|
||||
return
|
||||
end
|
||||
@@ -399,8 +342,6 @@ require("lazy").setup({
|
||||
},
|
||||
|
||||
completion = {
|
||||
-- By default, you may press `<c-space>` to show the documentation.
|
||||
-- Optionally, set `auto_show = true` to show the documentation after a delay.
|
||||
documentation = { auto_show = false, auto_show_delay_ms = 500 },
|
||||
},
|
||||
|
||||
@@ -412,10 +353,7 @@ require("lazy").setup({
|
||||
},
|
||||
|
||||
snippets = { preset = "luasnip" },
|
||||
|
||||
fuzzy = { implementation = "prefer_rust_with_warning" },
|
||||
|
||||
-- Shows a signature help window while you type arguments for a function
|
||||
signature = { enabled = true },
|
||||
},
|
||||
},
|
||||
@@ -443,9 +381,6 @@ require("lazy").setup({
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
|
||||
-- If you are experiencing weird indenting issues, add the language to
|
||||
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
|
||||
additional_vim_regex_highlighting = { "ruby" },
|
||||
},
|
||||
indent = { enable = true, disable = { "ruby" } },
|
||||
|
||||
Reference in New Issue
Block a user