mirror of https://github.com/E-Almqvist/dotfiles
parent
6bcbf5646d
commit
14f8f6825f
@ -0,0 +1 @@ |
|||||||
|
require('Comment').setup() |
@ -0,0 +1,48 @@ |
|||||||
|
local lsp = require("lsp-zero") |
||||||
|
|
||||||
|
lsp.preset("recommended") |
||||||
|
|
||||||
|
lsp.ensure_installed({ |
||||||
|
"tsserver", |
||||||
|
"eslint", |
||||||
|
"lua_ls", |
||||||
|
"rust_analyzer", |
||||||
|
"pyright", |
||||||
|
}) |
||||||
|
|
||||||
|
local cmp = require("cmp") |
||||||
|
local cmp_select = { behavior = cmp.SelectBehavior.Select } |
||||||
|
local cmp_mappings = lsp.defaults.cmp_mappings({ |
||||||
|
["<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(), |
||||||
|
}) |
||||||
|
|
||||||
|
lsp.set_preferences({ |
||||||
|
sign_icons = {} |
||||||
|
}) |
||||||
|
|
||||||
|
lsp.setup_nvim_cmp({ |
||||||
|
mapping = cmp_mappings |
||||||
|
}) |
||||||
|
|
||||||
|
lsp.on_attach(function(client, bufnr) |
||||||
|
local opts = { buffer = bufnr, remap = false } |
||||||
|
|
||||||
|
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) |
||||||
|
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) |
||||||
|
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts) |
||||||
|
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts) |
||||||
|
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) |
||||||
|
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) |
||||||
|
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts) |
||||||
|
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts) |
||||||
|
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts) |
||||||
|
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts) |
||||||
|
vim.keymap.set("n", "<A-g>", function() |
||||||
|
vim.lsp.buf.format { async = true } |
||||||
|
end, opts) |
||||||
|
end) |
||||||
|
|
||||||
|
lsp.setup() |
@ -0,0 +1 @@ |
|||||||
|
require("lualine").setup() |
@ -0,0 +1,23 @@ |
|||||||
|
require("presence").setup({ |
||||||
|
-- General options |
||||||
|
auto_update = true, -- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`) |
||||||
|
neovim_image_text = "Neovim", -- Text displayed when hovered over the Neovim image |
||||||
|
main_image = "file", -- Main image display (either "neovim" or "file") |
||||||
|
client_id = "793271441293967371", -- Use your own Discord application client id (not recommended) |
||||||
|
log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error") |
||||||
|
debounce_timeout = 10, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`) |
||||||
|
enable_line_number = false, -- Displays the current line number instead of the current project |
||||||
|
blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches |
||||||
|
buttons = false, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`, or a function(buffer: string, repo_url: string|nil): table) |
||||||
|
file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference) |
||||||
|
show_time = false, -- Show the timer |
||||||
|
|
||||||
|
-- Rich Presence text options |
||||||
|
editing_text = "Editing %s", -- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string) |
||||||
|
file_explorer_text = "Browsing %s", -- Format string rendered when browsing a file explorer (either string or function(file_explorer_name: string): string) |
||||||
|
git_commit_text = "Committing changes", -- Format string rendered when committing changes in git (either string or function(filename: string): string) |
||||||
|
plugin_manager_text = "Managing plugins", -- Format string rendered when managing plugins (either string or function(plugin_manager_name: string): string) |
||||||
|
reading_text = "Reading %s", -- Format string rendered when a read-only or unmodifiable file is loaded in the buffer (either string or function(filename: string): string) |
||||||
|
workspace_text = "Working on %s", -- Format string rendered when in a git repository (either string or function(project_name: string|nil, filename: string): string) |
||||||
|
line_number_text = "Line %s out of %s", -- Format string rendered when `enable_line_number` is set to true (either string or function(line_number: number, line_count: number): string) |
||||||
|
}) |
@ -0,0 +1,16 @@ |
|||||||
|
-- Treesitter init |
||||||
|
require("nvim-treesitter.configs").setup({ |
||||||
|
-- A list of parser names, or "all" (the five listed parsers should always be installed) |
||||||
|
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "typescript", "javascript", "python", "rust" }, |
||||||
|
|
||||||
|
-- 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, |
||||||
|
highlight = { |
||||||
|
enable = true, |
||||||
|
additional_vim_regex_highlighting = false, |
||||||
|
}, |
||||||
|
}) |
@ -0,0 +1,23 @@ |
|||||||
|
-- __ ___ |
||||||
|
-- __\ \ / (_)_ __ ___ |
||||||
|
-- / _ \ \ / /| | '_ ` _ \ |
||||||
|
-- | __/\ V / | | | | | | | |
||||||
|
-- \___| \_/ |_|_| |_| |_| |
||||||
|
-- epsilons Viim |
||||||
|
|
||||||
|
require("evim.init") |
||||||
|
|
||||||
|
-- Theme |
||||||
|
vim.opt.termguicolors = true |
||||||
|
vim.cmd.colorscheme "melange" |
||||||
|
|
||||||
|
-- Editor settings |
||||||
|
vim.opt.nu = true |
||||||
|
vim.opt.scrolloff = 4 |
||||||
|
|
||||||
|
vim.opt.autoindent = true |
||||||
|
vim.opt.tabstop = 4 |
||||||
|
vim.opt.shiftwidth = 4 |
||||||
|
|
||||||
|
vim.opt.hlsearch = false |
||||||
|
vim.opt.incsearch = true |
@ -0,0 +1,3 @@ |
|||||||
|
require("evim.remap") -- Default binds |
||||||
|
require("evim.packer") -- Package manager |
||||||
|
|
@ -0,0 +1,52 @@ |
|||||||
|
vim.cmd [[packadd packer.nvim]] |
||||||
|
|
||||||
|
return require("packer").startup(function(use) |
||||||
|
-- Core |
||||||
|
use "wbthomason/packer.nvim" |
||||||
|
use("nvim-treesitter/nvim-treesitter", { run = ":TSUpdate" }) |
||||||
|
use { |
||||||
|
"nvim-telescope/telescope.nvim", tag = "0.1.1", |
||||||
|
requires = { { "nvim-lua/plenary.nvim" } } |
||||||
|
} |
||||||
|
use { |
||||||
|
"numToStr/Comment.nvim", |
||||||
|
config = function() |
||||||
|
require("Comment").setup() |
||||||
|
end |
||||||
|
} |
||||||
|
|
||||||
|
-- Themes |
||||||
|
use "savq/melange-nvim" |
||||||
|
use "chriskempson/base16-vim" |
||||||
|
|
||||||
|
-- LSP |
||||||
|
use { |
||||||
|
"VonHeikemen/lsp-zero.nvim", |
||||||
|
branch = "v2.x", |
||||||
|
requires = { |
||||||
|
-- LSP Support |
||||||
|
{ "neovim/nvim-lspconfig" }, -- Required |
||||||
|
{ |
||||||
|
-- Optional |
||||||
|
"williamboman/mason.nvim", |
||||||
|
run = function() |
||||||
|
pcall(vim.cmd, "MasonUpdate") |
||||||
|
end, |
||||||
|
}, |
||||||
|
{ "williamboman/mason-lspconfig.nvim" }, -- Optional |
||||||
|
|
||||||
|
-- Autocompletion |
||||||
|
{ "hrsh7th/nvim-cmp" }, -- Required |
||||||
|
{ "hrsh7th/cmp-nvim-lsp" }, -- Required |
||||||
|
{ "L3MON4D3/LuaSnip" }, -- Required |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
-- Misc |
||||||
|
-- use "vimsence/vimsence" |
||||||
|
use "andweeb/presence.nvim" |
||||||
|
use { |
||||||
|
'nvim-lualine/lualine.nvim', |
||||||
|
requires = { 'nvim-tree/nvim-web-devicons', opt = true } |
||||||
|
} |
||||||
|
end) |
@ -0,0 +1,21 @@ |
|||||||
|
vim.g.mapleader = " " |
||||||
|
|
||||||
|
-- Generic binds |
||||||
|
vim.keymap.set("n", "<leader>f", vim.cmd.Ex) |
||||||
|
|
||||||
|
-- Telescope |
||||||
|
local builtin = require("telescope.builtin") |
||||||
|
vim.keymap.set("n", "<A-f>", builtin.find_files, {}) |
||||||
|
-- vim.keymap.set("n", "<A-g>", builtin.live_grep, {}) |
||||||
|
vim.keymap.set("n", "<A-b>", builtin.buffers, {}) |
||||||
|
vim.keymap.set("n", "<A-h>", builtin.help_tags, {}) |
||||||
|
|
||||||
|
-- Editor binds |
||||||
|
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") |
||||||
|
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") |
||||||
|
|
||||||
|
-- Copy/paste stuff |
||||||
|
vim.keymap.set("n", "<leader>y", "\"+y") |
||||||
|
vim.keymap.set("v", "<leader>y", "\"+y") |
||||||
|
vim.keymap.set("n", "<leader>Y", "\"+Y") |
||||||
|
|
@ -0,0 +1,185 @@ |
|||||||
|
-- Automatically generated packer.nvim plugin loader code |
||||||
|
|
||||||
|
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then |
||||||
|
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') |
||||||
|
return |
||||||
|
end |
||||||
|
|
||||||
|
vim.api.nvim_command('packadd packer.nvim') |
||||||
|
|
||||||
|
local no_errors, error_msg = pcall(function() |
||||||
|
|
||||||
|
_G._packer = _G._packer or {} |
||||||
|
_G._packer.inside_compile = true |
||||||
|
|
||||||
|
local time |
||||||
|
local profile_info |
||||||
|
local should_profile = false |
||||||
|
if should_profile then |
||||||
|
local hrtime = vim.loop.hrtime |
||||||
|
profile_info = {} |
||||||
|
time = function(chunk, start) |
||||||
|
if start then |
||||||
|
profile_info[chunk] = hrtime() |
||||||
|
else |
||||||
|
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 |
||||||
|
end |
||||||
|
end |
||||||
|
else |
||||||
|
time = function(chunk, start) end |
||||||
|
end |
||||||
|
|
||||||
|
local function save_profiles(threshold) |
||||||
|
local sorted_times = {} |
||||||
|
for chunk_name, time_taken in pairs(profile_info) do |
||||||
|
sorted_times[#sorted_times + 1] = {chunk_name, time_taken} |
||||||
|
end |
||||||
|
table.sort(sorted_times, function(a, b) return a[2] > b[2] end) |
||||||
|
local results = {} |
||||||
|
for i, elem in ipairs(sorted_times) do |
||||||
|
if not threshold or threshold and elem[2] > threshold then |
||||||
|
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' |
||||||
|
end |
||||||
|
end |
||||||
|
if threshold then |
||||||
|
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)') |
||||||
|
end |
||||||
|
|
||||||
|
_G._packer.profile_output = results |
||||||
|
end |
||||||
|
|
||||||
|
time([[Luarocks path setup]], true) |
||||||
|
local package_path_str = "/home/elal/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/elal/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/elal/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/elal/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" |
||||||
|
local install_cpath_pattern = "/home/elal/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" |
||||||
|
if not string.find(package.path, package_path_str, 1, true) then |
||||||
|
package.path = package.path .. ';' .. package_path_str |
||||||
|
end |
||||||
|
|
||||||
|
if not string.find(package.cpath, install_cpath_pattern, 1, true) then |
||||||
|
package.cpath = package.cpath .. ';' .. install_cpath_pattern |
||||||
|
end |
||||||
|
|
||||||
|
time([[Luarocks path setup]], false) |
||||||
|
time([[try_loadstring definition]], true) |
||||||
|
local function try_loadstring(s, component, name) |
||||||
|
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) |
||||||
|
if not success then |
||||||
|
vim.schedule(function() |
||||||
|
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) |
||||||
|
end) |
||||||
|
end |
||||||
|
return result |
||||||
|
end |
||||||
|
|
||||||
|
time([[try_loadstring definition]], false) |
||||||
|
time([[Defining packer_plugins]], true) |
||||||
|
_G.packer_plugins = { |
||||||
|
["Comment.nvim"] = { |
||||||
|
config = { "\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0" }, |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/Comment.nvim", |
||||||
|
url = "https://github.com/numToStr/Comment.nvim" |
||||||
|
}, |
||||||
|
LuaSnip = { |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/LuaSnip", |
||||||
|
url = "https://github.com/L3MON4D3/LuaSnip" |
||||||
|
}, |
||||||
|
["base16-vim"] = { |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/base16-vim", |
||||||
|
url = "https://github.com/chriskempson/base16-vim" |
||||||
|
}, |
||||||
|
["cmp-nvim-lsp"] = { |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", |
||||||
|
url = "https://github.com/hrsh7th/cmp-nvim-lsp" |
||||||
|
}, |
||||||
|
["lsp-zero.nvim"] = { |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim", |
||||||
|
url = "https://github.com/VonHeikemen/lsp-zero.nvim" |
||||||
|
}, |
||||||
|
["lualine.nvim"] = { |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/lualine.nvim", |
||||||
|
url = "https://github.com/nvim-lualine/lualine.nvim" |
||||||
|
}, |
||||||
|
["mason-lspconfig.nvim"] = { |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim", |
||||||
|
url = "https://github.com/williamboman/mason-lspconfig.nvim" |
||||||
|
}, |
||||||
|
["mason.nvim"] = { |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/mason.nvim", |
||||||
|
url = "https://github.com/williamboman/mason.nvim" |
||||||
|
}, |
||||||
|
["melange-nvim"] = { |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/melange-nvim", |
||||||
|
url = "https://github.com/savq/melange-nvim" |
||||||
|
}, |
||||||
|
["nvim-cmp"] = { |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/nvim-cmp", |
||||||
|
url = "https://github.com/hrsh7th/nvim-cmp" |
||||||
|
}, |
||||||
|
["nvim-lspconfig"] = { |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", |
||||||
|
url = "https://github.com/neovim/nvim-lspconfig" |
||||||
|
}, |
||||||
|
["nvim-treesitter"] = { |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/nvim-treesitter", |
||||||
|
url = "https://github.com/nvim-treesitter/nvim-treesitter" |
||||||
|
}, |
||||||
|
["nvim-web-devicons"] = { |
||||||
|
loaded = false, |
||||||
|
needs_bufread = false, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons", |
||||||
|
url = "https://github.com/nvim-tree/nvim-web-devicons" |
||||||
|
}, |
||||||
|
["packer.nvim"] = { |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/packer.nvim", |
||||||
|
url = "https://github.com/wbthomason/packer.nvim" |
||||||
|
}, |
||||||
|
["plenary.nvim"] = { |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/plenary.nvim", |
||||||
|
url = "https://github.com/nvim-lua/plenary.nvim" |
||||||
|
}, |
||||||
|
["presence.nvim"] = { |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/presence.nvim", |
||||||
|
url = "https://github.com/andweeb/presence.nvim" |
||||||
|
}, |
||||||
|
["telescope.nvim"] = { |
||||||
|
loaded = true, |
||||||
|
path = "/home/elal/.local/share/nvim/site/pack/packer/start/telescope.nvim", |
||||||
|
url = "https://github.com/nvim-telescope/telescope.nvim" |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
time([[Defining packer_plugins]], false) |
||||||
|
-- Config for: Comment.nvim |
||||||
|
time([[Config for Comment.nvim]], true) |
||||||
|
try_loadstring("\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0", "config", "Comment.nvim") |
||||||
|
time([[Config for Comment.nvim]], false) |
||||||
|
|
||||||
|
_G._packer.inside_compile = false |
||||||
|
if _G._packer.needs_bufread == true then |
||||||
|
vim.cmd("doautocmd BufRead") |
||||||
|
end |
||||||
|
_G._packer.needs_bufread = false |
||||||
|
|
||||||
|
if should_profile then save_profiles() end |
||||||
|
|
||||||
|
end) |
||||||
|
|
||||||
|
if not no_errors then |
||||||
|
error_msg = error_msg:gsub('"', '\\"') |
||||||
|
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') |
||||||
|
end |
Loading…
Reference in new issue