Add all nvim files
This commit is contained in:
48
.config/nvim/after/plugin/colors.lua
Normal file
48
.config/nvim/after/plugin/colors.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
vim.g.dobiadi_colorscheme = "tokyonight"
|
||||
|
||||
--require("tokyonight").setup({
|
||||
-- transparent = true,
|
||||
-- styles = {
|
||||
-- sidebars = "transparent",
|
||||
-- },
|
||||
--})
|
||||
|
||||
function ColorMyPencils()
|
||||
vim.g.tokyonight_transparent = true
|
||||
vim.g.tokyonight_transparent_sidebar = true
|
||||
vim.opt.background = "dark"
|
||||
|
||||
vim.cmd("colorscheme " .. vim.g.dobiadi_colorscheme)
|
||||
|
||||
local hl = function(thing, opts)
|
||||
vim.api.nvim_set_hl(0, thing, opts)
|
||||
end
|
||||
|
||||
hl("SignColumn", {
|
||||
bg = "none",
|
||||
})
|
||||
|
||||
hl("ColorColumn", {
|
||||
ctermbg = 0,
|
||||
bg = "#555555",
|
||||
})
|
||||
|
||||
hl("CursorLineNR", {
|
||||
bg = "None"
|
||||
})
|
||||
|
||||
hl("Normal", {
|
||||
bg = "none"
|
||||
})
|
||||
|
||||
hl("LineNr", {
|
||||
fg = "#5eacd3"
|
||||
})
|
||||
|
||||
hl("netrwDir", {
|
||||
fg = "#5eacd3"
|
||||
})
|
||||
|
||||
end
|
||||
ColorMyPencils()
|
||||
|
||||
0
.config/nvim/after/plugin/init.lua
Normal file
0
.config/nvim/after/plugin/init.lua
Normal file
9
.config/nvim/after/plugin/keymap.lua
Normal file
9
.config/nvim/after/plugin/keymap.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
-- Space yoink to system clipboard
|
||||
vim.keymap.set('v', '<space>y', '"+y', { noremap=true, silent=true })
|
||||
vim.keymap.set('n', '<space>y', '"+y', { noremap=true, silent=true })
|
||||
vim.keymap.set('n', '<space>Y', '"+yg_', { noremap=true, silent=true })
|
||||
|
||||
-- Telescope binding
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<C-p>', builtin.find_files, { noremap=true, silent=true })
|
||||
vim.keymap.set('n', '<C-b>', builtin.diagnostics, { noremap=true, silent=true })
|
||||
112
.config/nvim/after/plugin/lspconfig.lua
Normal file
112
.config/nvim/after/plugin/lspconfig.lua
Normal file
@@ -0,0 +1,112 @@
|
||||
local opts = { noremap=true, silent=true }
|
||||
vim.keymap.set('n', '<space>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)
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
-- 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', 'gT', vim.lsp.buf.type_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>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
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
require'lspconfig'.clangd.setup{
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require'lspconfig'.tsserver.setup{
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require'lspconfig'.pyright.setup{
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require'lspconfig'.rust_analyzer.setup{
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
require'lspconfig'.phpactor.setup{
|
||||
on_attach = on_attach,
|
||||
init_options = {
|
||||
["language_server_phpstan.enabled"] = false,
|
||||
["language_server_psalm.enabled"] = false,
|
||||
}
|
||||
}
|
||||
vim.opt.completeopt = {"menu", "menuone", "noselect"}
|
||||
|
||||
-- Set up nvim-cmp.
|
||||
local cmp = require'cmp'
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
-- completion = cmp.config.window.bordered(),
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<Tab>'] = cmp.mapping.select_next_item(),
|
||||
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' }, -- For luasnip users.
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
float = {
|
||||
source = "always",
|
||||
},
|
||||
})
|
||||
|
||||
require("null-ls").setup({
|
||||
sources = {
|
||||
require("null-ls").builtins.formatting.prettier,
|
||||
require("null-ls").builtins.diagnostics.eslint_d,
|
||||
require("null-ls").builtins.formatting.black.with({ extra_args = {"--fast"}}),
|
||||
require("null-ls").builtins.diagnostics.flake8,
|
||||
require("null-ls").builtins.formatting.phpcbf.with({ extra_args = {"--standard=PSR12"}}),
|
||||
require("null-ls").builtins.diagnostics.phpcs.with({ extra_args = {"--standard=PSR12"}}),
|
||||
},
|
||||
})
|
||||
5
.config/nvim/after/plugin/statusline.lua
Normal file
5
.config/nvim/after/plugin/statusline.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
require('lualine').setup({
|
||||
options = {
|
||||
theme = 'tokyonight'
|
||||
}
|
||||
})
|
||||
14
.config/nvim/lua/dobiadi/init.lua
Normal file
14
.config/nvim/lua/dobiadi/init.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
require("dobiadi.set")
|
||||
require("dobiadi.packer")
|
||||
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
autocmd("BufReadPost", {
|
||||
pattern = "*",
|
||||
callback = function ()
|
||||
local row, col = unpack(vim.api.nvim_buf_get_mark(0, '"'))
|
||||
if {row, col} ~= {0, 0} and row <= vim.api.nvim_buf_line_count(0) then
|
||||
vim.api.nvim_win_set_cursor(0, {row, 0})
|
||||
end
|
||||
end
|
||||
})
|
||||
36
.config/nvim/lua/dobiadi/packer.lua
Normal file
36
.config/nvim/lua/dobiadi/packer.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
|
||||
return require('packer').startup(function(use)
|
||||
-- Package manager
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
-- Theme
|
||||
use 'folke/tokyonight.nvim'
|
||||
|
||||
-- LSP
|
||||
use 'neovim/nvim-lspconfig'
|
||||
use 'jose-elias-alvarez/null-ls.nvim'
|
||||
|
||||
-- Autocomplete
|
||||
use 'hrsh7th/nvim-cmp'
|
||||
use 'hrsh7th/cmp-nvim-lsp'
|
||||
use 'hrsh7th/cmp-buffer'
|
||||
use 'hrsh7th/cmp-path'
|
||||
use 'hrsh7th/cmp-nvim-lsp-signature-help'
|
||||
use 'L3MON4D3/LuaSnip'
|
||||
use 'saadparwaiz1/cmp_luasnip'
|
||||
|
||||
-- Telescope
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim', tag = '0.1.0',
|
||||
requires = { {'nvim-lua/plenary.nvim'} }
|
||||
}
|
||||
use 'nvim-treesitter/nvim-treesitter'
|
||||
use 'nvim-treesitter/nvim-treesitter-context'
|
||||
use 'kyazdani42/nvim-web-devicons'
|
||||
use 'sharkdp/fd'
|
||||
use 'BurntSushi/ripgrep'
|
||||
|
||||
-- Statusline
|
||||
use 'nvim-lualine/lualine.nvim'
|
||||
end)
|
||||
27
.config/nvim/lua/dobiadi/set.lua
Normal file
27
.config/nvim/lua/dobiadi/set.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
vim.opt.guicursor = ""
|
||||
|
||||
vim.opt.nu = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.opt.errorbells = false
|
||||
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
|
||||
vim.opt.smartindent = true
|
||||
|
||||
vim.opt.wrap = false
|
||||
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.incsearch = true
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
vim.opt.updatetime = 50
|
||||
|
||||
vim.opt.colorcolumn = "80,100,120"
|
||||
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.mouse = ""
|
||||
189
.config/nvim/plugin/packer_compiled.lua
Normal file
189
.config/nvim/plugin/packer_compiled.lua
Normal file
@@ -0,0 +1,189 @@
|
||||
-- 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/dobiadi/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/dobiadi/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/dobiadi/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/dobiadi/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
||||
local install_cpath_pattern = "/home/dobiadi/.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 = {
|
||||
LuaSnip = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
||||
url = "https://github.com/L3MON4D3/LuaSnip"
|
||||
},
|
||||
["cmp-buffer"] = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||
},
|
||||
["cmp-nvim-lsp"] = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
["cmp-nvim-lsp-signature-help"] = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp-signature-help",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help"
|
||||
},
|
||||
["cmp-path"] = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||
url = "https://github.com/hrsh7th/cmp-path"
|
||||
},
|
||||
cmp_luasnip = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
|
||||
url = "https://github.com/saadparwaiz1/cmp_luasnip"
|
||||
},
|
||||
fd = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/fd",
|
||||
url = "https://github.com/sharkdp/fd"
|
||||
},
|
||||
["lualine.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/lualine.nvim",
|
||||
url = "https://github.com/nvim-lualine/lualine.nvim"
|
||||
},
|
||||
["null-ls.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/null-ls.nvim",
|
||||
url = "https://github.com/jose-elias-alvarez/null-ls.nvim"
|
||||
},
|
||||
["nvim-cmp"] = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||
},
|
||||
["nvim-lspconfig"] = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||
url = "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
["nvim-treesitter"] = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
["nvim-treesitter-context"] = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/nvim-treesitter-context",
|
||||
url = "https://github.com/nvim-treesitter/nvim-treesitter-context"
|
||||
},
|
||||
["nvim-web-devicons"] = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
|
||||
url = "https://github.com/kyazdani42/nvim-web-devicons"
|
||||
},
|
||||
["packer.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||
url = "https://github.com/wbthomason/packer.nvim"
|
||||
},
|
||||
["plenary.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
ripgrep = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/ripgrep",
|
||||
url = "https://github.com/BurntSushi/ripgrep"
|
||||
},
|
||||
["telescope.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||
},
|
||||
["tokyonight.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/tokyonight.nvim",
|
||||
url = "https://github.com/folke/tokyonight.nvim"
|
||||
}
|
||||
}
|
||||
|
||||
time([[Defining packer_plugins]], 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
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -2,6 +2,5 @@
|
||||
|
||||
!.gitignore
|
||||
!.config/
|
||||
!.config/nvim/*
|
||||
!.config/nvim/
|
||||
#!.config
|
||||
!.config/nvim/**/*
|
||||
|
||||
Reference in New Issue
Block a user