Add neovim config
commit
b902dae549
|
@ -0,0 +1,9 @@
|
|||
let g:netrw_dirhistmax =10
|
||||
let g:netrw_dirhistcnt =7
|
||||
let g:netrw_dirhist_7='/home/georg/workspace'
|
||||
let g:netrw_dirhist_6='/home/georg/workspace/openAV-Luppp/src'
|
||||
let g:netrw_dirhist_5='/home/georg/workspace/openAV-Luppp'
|
||||
let g:netrw_dirhist_4='/home/georg/workspace'
|
||||
let g:netrw_dirhist_3='/home/georg'
|
||||
let g:netrw_dirhist_2='/home/georg/backup-handy'
|
||||
let g:netrw_dirhist_1='/home/georg'
|
|
@ -0,0 +1 @@
|
|||
au BufRead,BufNewFile *.html.j2 set filetype=html
|
|
@ -0,0 +1,65 @@
|
|||
vim.opt.termguicolors = true
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.hlsearch = true
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
vim.g.neon_style = "doom"
|
||||
vim.g.neon_italic_keyword = true
|
||||
vim.g.neon_italic_function = true
|
||||
vim.g.neon_transparent = true
|
||||
|
||||
vim.cmd[[colorscheme neon]]
|
||||
|
||||
require('plugins')
|
||||
require('gitsigns-config')
|
||||
require('lsp')
|
||||
require('nvim-tree').setup({
|
||||
update_focused_file = {
|
||||
enable = true
|
||||
}
|
||||
})
|
||||
|
||||
local function open_nvim_tree(data)
|
||||
|
||||
-- buffer is a [No Name]
|
||||
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
|
||||
|
||||
-- buffer is a directory
|
||||
local directory = vim.fn.isdirectory(data.file) == 1
|
||||
|
||||
if not no_name and not directory then
|
||||
return
|
||||
end
|
||||
|
||||
-- change to the directory
|
||||
if directory then
|
||||
vim.cmd.cd(data.file)
|
||||
end
|
||||
|
||||
-- open the tree
|
||||
require("nvim-tree.api").tree.open()
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = {
|
||||
enable = true
|
||||
}
|
||||
}
|
||||
|
||||
-- Configure highlighting of current file
|
||||
local c = require("neon.colors")
|
||||
vim.opt.cursorline = true
|
||||
vim.api.nvim_set_hl(0, "CursorLine", { bg=c.bg0, underline = None })
|
|
@ -0,0 +1,40 @@
|
|||
return require('gitsigns').setup{
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then return ']c' end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, {expr=true})
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then return '[c' end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, {expr=true})
|
||||
|
||||
-- Actions
|
||||
map({'n', 'v'}, '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||
map({'n', 'v'}, '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||
map('n', '<leader>hS', gs.stage_buffer)
|
||||
map('n', '<leader>hu', gs.undo_stage_hunk)
|
||||
map('n', '<leader>hR', gs.reset_buffer)
|
||||
map('n', '<leader>hp', gs.preview_hunk)
|
||||
map('n', '<leader>hb', function() gs.blame_line{full=true} end)
|
||||
map('n', '<leader>tb', gs.toggle_current_line_blame)
|
||||
map('n', '<leader>hd', gs.diffthis)
|
||||
map('n', '<leader>hD', function() gs.diffthis('~') end)
|
||||
map('n', '<leader>td', gs.toggle_deleted)
|
||||
|
||||
-- Text object
|
||||
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
end
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
-- Mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
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)
|
||||
vim.keymap.set('n', '<space>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(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', '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
|
||||
|
||||
local lsp_flags = {
|
||||
-- This is the default in Nvim 0.7+
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
require('lspconfig')['pyright'].setup{
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
}
|
||||
require('lspconfig')['tsserver'].setup{
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
}
|
||||
require('lspconfig')['svelte'].setup{
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
vim.cmd [[packadd packer.nvim]]
|
||||
|
||||
return require('packer').startup(function(use)
|
||||
use 'wbthomason/packer.nvim'
|
||||
use 'lewis6991/gitsigns.nvim'
|
||||
use 'posva/vim-vue'
|
||||
use 'editorconfig/editorconfig-vim'
|
||||
use 'neovim/nvim-lspconfig'
|
||||
use 'nvim-tree/nvim-tree.lua'
|
||||
use 'nvim-tree/nvim-web-devicons'
|
||||
use 'nvim-treesitter/nvim-treesitter'
|
||||
use 'rafamadriz/neon'
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
requires = { {'nvim-lua/plenary.nvim'} }
|
||||
}
|
||||
end)
|
|
@ -0,0 +1,149 @@
|
|||
-- 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/georg/.cache/nvim/packer_hererocks/2.1.1700008891/share/lua/5.1/?.lua;/home/georg/.cache/nvim/packer_hererocks/2.1.1700008891/share/lua/5.1/?/init.lua;/home/georg/.cache/nvim/packer_hererocks/2.1.1700008891/lib/luarocks/rocks-5.1/?.lua;/home/georg/.cache/nvim/packer_hererocks/2.1.1700008891/lib/luarocks/rocks-5.1/?/init.lua"
|
||||
local install_cpath_pattern = "/home/georg/.cache/nvim/packer_hererocks/2.1.1700008891/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 = {
|
||||
["editorconfig-vim"] = {
|
||||
loaded = true,
|
||||
path = "/home/georg/.local/share/nvim/site/pack/packer/start/editorconfig-vim",
|
||||
url = "https://github.com/editorconfig/editorconfig-vim"
|
||||
},
|
||||
["gitsigns.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/georg/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
|
||||
url = "https://github.com/lewis6991/gitsigns.nvim"
|
||||
},
|
||||
neon = {
|
||||
loaded = true,
|
||||
path = "/home/georg/.local/share/nvim/site/pack/packer/start/neon",
|
||||
url = "https://github.com/rafamadriz/neon"
|
||||
},
|
||||
["nvim-lspconfig"] = {
|
||||
loaded = true,
|
||||
path = "/home/georg/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||
url = "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
["nvim-tree.lua"] = {
|
||||
loaded = true,
|
||||
path = "/home/georg/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
|
||||
url = "https://github.com/nvim-tree/nvim-tree.lua"
|
||||
},
|
||||
["nvim-treesitter"] = {
|
||||
loaded = true,
|
||||
path = "/home/georg/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
["nvim-web-devicons"] = {
|
||||
loaded = true,
|
||||
path = "/home/georg/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
|
||||
url = "https://github.com/nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
["packer.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/georg/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||
url = "https://github.com/wbthomason/packer.nvim"
|
||||
},
|
||||
["plenary.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/georg/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
["telescope.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/georg/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||
},
|
||||
["vim-vue"] = {
|
||||
loaded = true,
|
||||
path = "/home/georg/.local/share/nvim/site/pack/packer/start/vim-vue",
|
||||
url = "https://github.com/posva/vim-vue"
|
||||
}
|
||||
}
|
||||
|
||||
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
|
Loading…
Reference in New Issue