Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
|
2d47c184fd | |
|
f29beb74cf |
|
@ -0,0 +1,3 @@
|
|||
let g:netrw_dirhistmax =10
|
||||
let g:netrw_dirhistcnt =1
|
||||
let g:netrw_dirhist_1='/home/nick/.config/nvim'
|
27
init.lua
27
init.lua
|
@ -1,27 +0,0 @@
|
|||
-- Basic setup configuration
|
||||
vim.cmd("source ~/.config/nvim/viml/vanilla.vim")
|
||||
require("vanilla")
|
||||
|
||||
-- Lazy plugin setup
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup("plugins")
|
||||
|
||||
require("plugconfig")
|
||||
|
||||
require("confformat")
|
||||
|
||||
vim.cmd("source ~/.config/nvim/viml/plugconfig.vim")
|
||||
|
||||
local plugtestbench = require("plugbench")
|
|
@ -0,0 +1,4 @@
|
|||
source ~/.config/nvim/vim/init.vim
|
||||
source ~/.config/nvim/vim/plug.vim
|
||||
|
||||
lua require('plug')
|
|
@ -1,72 +0,0 @@
|
|||
This is LuaHBTeX, Version 1.17.0 (TeX Live 2023/Arch Linux) (format=lualatex 2023.7.21) 16 AUG 2023 18:24
|
||||
restricted system commands enabled.
|
||||
**viml/legacyconf.vim
|
||||
(./viml/legacyconf.vim
|
||||
LaTeX2e <2022-11-01> patch level 1
|
||||
Lua module: luaotfload 2022-10-03 3.23 Lua based OpenType font support
|
||||
Lua module: lualibs 2022-10-04 2.75 ConTeXt Lua standard libraries.
|
||||
Lua module: lualibs-extended 2022-10-04 2.75 ConTeXt Lua libraries -- extended c
|
||||
ollection.
|
||||
luaotfload | conf : Root cache directory is "/home/nick/.texlive/texmf-var/luate
|
||||
x-cache/generic/names".
|
||||
luaotfload | init : Loading fontloader "fontloader-2022-10-03.lua" from kpse-res
|
||||
olved path "/usr/share/texmf-dist/tex/luatex/luaotfload/fontloader-2022-10-03.lu
|
||||
a".
|
||||
Lua-only attribute luaotfload@noligature = 1
|
||||
luaotfload | init : Context OpenType loader version 3.120
|
||||
Inserting `luaotfload.node_processor' in `pre_linebreak_filter'.
|
||||
Inserting `luaotfload.node_processor' in `hpack_filter'.
|
||||
Inserting `luaotfload.glyph_stream' in `glyph_stream_provider'.
|
||||
Inserting `luaotfload.define_font' in `define_font'.
|
||||
Lua-only attribute luaotfload_color_attribute = 2
|
||||
luaotfload | conf : Root cache directory is "/home/nick/.texlive/texmf-var/luate
|
||||
x-cache/generic/names".
|
||||
Inserting `luaotfload.harf.strip_prefix' in `find_opentype_file'.
|
||||
Inserting `luaotfload.harf.strip_prefix' in `find_truetype_file'.
|
||||
Removing `luaotfload.glyph_stream' from `glyph_stream_provider'.
|
||||
Inserting `luaotfload.harf.glyphstream' in `glyph_stream_provider'.
|
||||
Inserting `luaotfload.harf.finalize_vlist' in `post_linebreak_filter'.
|
||||
Inserting `luaotfload.harf.finalize_hlist' in `hpack_filter'.
|
||||
Inserting `luaotfload.cleanup_files' in `wrapup_run'.
|
||||
Inserting `luaotfload.harf.finalize_unicode' in `finish_pdffile'.
|
||||
Inserting `luaotfload.glyphinfo' in `glyph_info'.
|
||||
Lua-only attribute luaotfload.letterspace_done = 3
|
||||
Inserting `luaotfload.aux.set_sscale_dimens' in `luaotfload.patch_font'.
|
||||
Inserting `luaotfload.aux.set_font_index' in `luaotfload.patch_font'.
|
||||
Inserting `luaotfload.aux.patch_cambria_domh' in `luaotfload.patch_font'.
|
||||
Inserting `luaotfload.aux.fixup_fontdata' in `luaotfload.patch_font_unsafe'.
|
||||
Inserting `luaotfload.aux.set_capheight' in `luaotfload.patch_font'.
|
||||
Inserting `luaotfload.aux.set_xheight' in `luaotfload.patch_font'.
|
||||
Inserting `luaotfload.rewrite_fontname' in `luaotfload.patch_font'. L3 programm
|
||||
ing layer <2023-02-22>
|
||||
Inserting `tracingstacklevels' in `input_level_string'.
|
||||
|
||||
! LaTeX Error: Missing \begin{document}.
|
||||
|
||||
See the LaTeX manual or LaTeX Companion for explanation.
|
||||
Type H <return> for immediate help.
|
||||
...
|
||||
|
||||
l.1 "
|
||||
NERDTree remap
|
||||
?
|
||||
! Emergency stop.
|
||||
...
|
||||
|
||||
l.1 "
|
||||
NERDTree remap
|
||||
You're in trouble here. Try typing <return> to proceed.
|
||||
If that doesn't work, type X <return> to quit.
|
||||
|
||||
|
||||
|
||||
Here is how much of LuaTeX's memory you used:
|
||||
21 strings out of 478285
|
||||
100000,1977958 words of node,token memory allocated 333 words of node memory still in use:
|
||||
2 hlist, 1 local_par, 1 dir, 1 glue, 3 kern, 1 glyph, 3 attribute, 39 glue_sp
|
||||
ec, 3 attribute_list, 1 temp nodes
|
||||
avail lists: 2:5,3:3,4:1,5:1,7:1
|
||||
20343 multiletter control sequences out of 65536+600000
|
||||
14 fonts using 591679 bytes
|
||||
13i,0n,12p,58b,15s stack positions out of 10000i,1000n,20000p,200000b,200000s
|
||||
! ==> Fatal error occurred, no output PDF file produced!
|
|
@ -1,106 +0,0 @@
|
|||
-- menuone: show also for just one code suggestion
|
||||
-- noinsert: only insert text when selection confirmed
|
||||
-- noselect: force to select from suggestion
|
||||
-- preview: show more details
|
||||
vim.opt.completeopt = { "menu", "menuone" }
|
||||
|
||||
-- shortmess is used to reduce verbocity
|
||||
-- vim.opt.shortmess = vim.opt.shortmess + { c = true }
|
||||
local cmp = require("cmp")
|
||||
cmp.setup({
|
||||
-- configuration
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["UltiSnips#Anon"](args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
-- Add borders to the windows
|
||||
-- window = {
|
||||
-- completion = cmp.config.window.bordered(),
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
-- },
|
||||
|
||||
-- mapping
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
-- Shift+TAB to go to the Previous Suggested item
|
||||
["<C-k>"] = cmp.mapping.select_prev_item(),
|
||||
-- Tab to go to the next suggestion
|
||||
["<C-j>"] = cmp.mapping.select_next_item(),
|
||||
-- CTRL+SHIFT+f to scroll backwards in description
|
||||
["<C-S-f>"] = cmp.mapping.scroll_docs(-4),
|
||||
-- CTRL+F to scroll forwards in the description
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
-- CTRL+SPACE to bring up completion at current Cursor location
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
-- CTRL+e to exit suggestion and close it
|
||||
["<C-d>"] = cmp.mapping.close(), -- TODO: Search better option
|
||||
-- CR (enter or return) to CONFIRM the currently selection suggestion
|
||||
-- We set the ConfirmBehavior to insert the Selected suggestion
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
}),
|
||||
}),
|
||||
|
||||
-- installed sources for code suggestion
|
||||
sources = cmp.config.sources({
|
||||
{ name = "ultisnips", keyword_length = 1 },
|
||||
{ name = "path" },
|
||||
{ name = "nvim_lsp", keyword_length = 2 },
|
||||
{ name = "nvim_lsp_signature_help" },
|
||||
{ name = "nvim_lua", keyword_length = 4 },
|
||||
{ name = "buffer", keyword_length = 3 },
|
||||
{ name = "calc" },
|
||||
{ name = "lua-latex-symbols", option = { cache = true } },
|
||||
-- { name = "spell", option = { keep_all_entries = false }, keyword_length = 2 },
|
||||
-- { name = "fuzzy_buffer", keyword_length = 2 }, -- Throwing unknown errors
|
||||
}),
|
||||
|
||||
-- add formatting of the different sources
|
||||
formatting = {
|
||||
fields = { "menu", "abbr", "kind" },
|
||||
format = function(entry, item)
|
||||
local menu_icon = {
|
||||
nvim_lsp = "λ",
|
||||
ultisnips = "⋗",
|
||||
path = "🌐",
|
||||
calc = "Σ",
|
||||
buffer = "📚",
|
||||
lualatexsymbols = "𝕋",
|
||||
spell = "📚",
|
||||
fuzzy_buffer = "📄",
|
||||
}
|
||||
item.menu = menu_icon[entry.source.name]
|
||||
return item
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
-- 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" },
|
||||
}),
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ "/", "?" }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
{ name = "cmdline_history", keyword_length = 15 },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
|
@ -1,56 +0,0 @@
|
|||
-- Utilities for creating configurations
|
||||
local util = require("formatter.util")
|
||||
|
||||
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
|
||||
require("formatter").setup({
|
||||
-- Enable or disable logging
|
||||
logging = true,
|
||||
-- Set the log level
|
||||
log_level = vim.log.levels.WARN,
|
||||
-- All formatter configurations are opt-in
|
||||
filetype = {
|
||||
-- Formatter configurations for filetype "lua" go here
|
||||
-- and will be executed in order
|
||||
lua = {
|
||||
-- "formatter.filetypes.lua" defines default configurations for the
|
||||
-- "lua" filetype
|
||||
require("formatter.filetypes.lua").stylua,
|
||||
},
|
||||
|
||||
c = {
|
||||
require("formatter.filetypes.c").astyle,
|
||||
},
|
||||
|
||||
cpp = {
|
||||
require("formatter.filetypes.cpp").astyle,
|
||||
},
|
||||
|
||||
html = {
|
||||
require("formatter.filetypes.html").htmlbeautifier,
|
||||
},
|
||||
|
||||
latex = {
|
||||
require("formatter.filetypes.latex").latexindent,
|
||||
},
|
||||
|
||||
markdown = {
|
||||
require("formatter.filetypes.markdown").prettier,
|
||||
},
|
||||
|
||||
tex = {
|
||||
require("formatter.filetypes.latex").latexindent,
|
||||
},
|
||||
|
||||
rust = {
|
||||
require("formatter.filetypes.rust").rustfmt,
|
||||
},
|
||||
|
||||
-- Use the special "*" filetype for defining formatter configurations on
|
||||
-- any filetype
|
||||
["*"] = {
|
||||
-- "formatter.filetypes.any" defines default configurations for any
|
||||
-- filetype
|
||||
require("formatter.filetypes.any").remove_trailing_whitespace,
|
||||
},
|
||||
},
|
||||
})
|
|
@ -1,23 +0,0 @@
|
|||
-- default config:
|
||||
require("peek").setup({
|
||||
auto_load = true, -- whether to automatically load preview when
|
||||
-- entering another markdown buffer
|
||||
close_on_bdelete = true, -- close preview window on buffer delete
|
||||
|
||||
syntax = true, -- enable syntax highlighting, affects performance
|
||||
|
||||
theme = "dark", -- 'dark' or 'light'
|
||||
|
||||
update_on_change = true,
|
||||
|
||||
app = "webview", -- 'webview', 'browser', string or a table of strings
|
||||
-- explained below
|
||||
|
||||
filetype = { "markdown" }, -- list of filetypes to recognize as markdown
|
||||
|
||||
-- relevant if update_on_change is true
|
||||
throttle_at = 200000, -- start throttling when file exceeds this
|
||||
-- amount of bytes in size
|
||||
throttle_time = "auto", -- minimum amount of time in milliseconds
|
||||
-- that has to pass before starting new render
|
||||
})
|
|
@ -0,0 +1,6 @@
|
|||
local builtin = require("telescope.builtin")
|
||||
--vim.keymap.set("n", "<leader>ff", builtin.find_files, {})
|
||||
--vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
|
||||
--vim.keymap.set("n", "<c-f>", builtin.current_buffer_fuzzy_find, {})
|
||||
--vim.keymap.set("n", "<leader>fh", builtin.help_tags, {})
|
||||
--vim.keymap.set("n", "<leader>fc", builtin.commands, {})
|
|
@ -1,31 +0,0 @@
|
|||
local M = {}
|
||||
|
||||
-- Delete area in between the current and next occurrence of the current symbol under cursor.
|
||||
-- use builtin functionality for opening brackets
|
||||
function M.Delete_interval()
|
||||
-- TODO: Think of something
|
||||
end
|
||||
|
||||
-- resize current window using control + 7,8,9,0
|
||||
function M.Resize_Current_Window(change_width, change_height)
|
||||
local width = vim.api.nvim_win_get_width(0)
|
||||
local height = vim.api.nvim_win_get_height(0)
|
||||
|
||||
if width + change_width > 5 then
|
||||
vim.api.nvim_win_set_width(0, width + change_width)
|
||||
end
|
||||
|
||||
if height + change_height > 5 then
|
||||
vim.api.nvim_win_set_height(0, height + change_height)
|
||||
end
|
||||
end
|
||||
|
||||
-- Keybindings
|
||||
-- 7/8 change width
|
||||
-- 9/0 change height
|
||||
--vim.keymap.set("n", "<C-7>", Resize_Current_Window(-1, 0))
|
||||
--vim.keymap.set("n", "<C-8>", Resize_Current_Window(1, 0))
|
||||
--vim.keymap.set("n", "<C-9>", Resize_Current_Window(0, -1))
|
||||
--vim.keymap.set("n", "<C-0>", Resize_Current_Window(0, 1))
|
||||
|
||||
return M
|
|
@ -1,69 +0,0 @@
|
|||
-- UltiSnips Configuration
|
||||
vim.g.UltiSnipsExpandTrigger = "<tab>"
|
||||
vim.g.UltiSnipsJumpForwardTrigger = "<c-l>"
|
||||
vim.g.UltiSnipsJumpBackwardTrigger = "<c-h>"
|
||||
vim.g.UltiSnipsEditSplit = "vertical"
|
||||
vim.g.UltiSnipsSnippetDirectories = { "~/.config/nvim/UltiSnips" }
|
||||
|
||||
-- NERDTree Config
|
||||
vim.g.NERDTreeShowHidden = 1
|
||||
|
||||
-- Lexima
|
||||
vim.g.lexima_enable_basic_rules = 1
|
||||
vim.g.lexima_enable_newline_rules = 1
|
||||
|
||||
-- Telescope snippet
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>ff", builtin.find_files, {})
|
||||
vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
|
||||
vim.keymap.set("n", "<c-f>", builtin.current_buffer_fuzzy_find, {})
|
||||
vim.keymap.set("n", "<leader>fh", builtin.help_tags, {})
|
||||
vim.keymap.set("n", "<leader>fc", builtin.commands, {})
|
||||
|
||||
-- Telescope + Ultisnips
|
||||
require("telescope").load_extension("ultisnips")
|
||||
vim.keymap.set("n", "<leader>fs", require("telescope").extensions.ultisnips.ultisnips, {})
|
||||
|
||||
-- NERDTree Config
|
||||
vim.g.NERDTreeDirArrowExpandable = "▸"
|
||||
vim.g.NERDTreeDirArrowCollapsible = "▾"
|
||||
|
||||
-- Git-Blame configuration
|
||||
vim.g.gitblame_message_template = " => <author> • <date> • <summary>"
|
||||
vim.g.gitblame_date_format = "%r"
|
||||
|
||||
-- Intendation basics
|
||||
require("ibl").setup()
|
||||
|
||||
-- Code completion
|
||||
require("code-completion")
|
||||
|
||||
-- Mason setup
|
||||
require("mason").setup(require("mason").setup({
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
}))
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
-- ensure_installed = { "clangd", "cmake", "jdtls", "texlab", "pylsp" },
|
||||
})
|
||||
|
||||
require("mason-lspconfig").setup_handlers({
|
||||
function(clangd)
|
||||
require("lspconfig")[clangd].setup({})
|
||||
end,
|
||||
["als"] = function()
|
||||
require("lspconfig").als.setup({
|
||||
settings = {
|
||||
ada = {
|
||||
projectFile = "default.gpr",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
|
@ -1,66 +0,0 @@
|
|||
return {
|
||||
"preservim/nerdtree",
|
||||
"Xuyuanp/nerdtree-git-plugin",
|
||||
"SirVer/UltiSnips",
|
||||
"tpope/vim-surround",
|
||||
"vim-airline/vim-airline",
|
||||
"vim-airline/vim-airline-themes",
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
local configs = require("nvim-treesitter.configs")
|
||||
|
||||
configs.setup({
|
||||
-- ensure_installed = { "c", "vim", "ada", "html", "python" },
|
||||
sync_install = false,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
})
|
||||
end,
|
||||
},
|
||||
"f-person/git-blame.nvim",
|
||||
"p00f/nvim-ts-rainbow",
|
||||
"cohama/lexima.vim",
|
||||
"ryanoasis/vim-devicons",
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.5",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
},
|
||||
"fhill2/telescope-ultisnips.nvim",
|
||||
"hiroakis/cyberspace.vim",
|
||||
"tpope/vim-speeddating",
|
||||
"yannickreiss/nvim-doxyscan",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
{ "romgrk/barbar.nvim", wants = "nvim-web-devicons" },
|
||||
{ "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} },
|
||||
"dstein64/vim-startuptime",
|
||||
"mhinz/vim-startify",
|
||||
"folke/tokyonight.nvim",
|
||||
"patstockwell/vim-monokai-tasty",
|
||||
"hrsh7th/nvim-cmp",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-calc",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"dmitmel/cmp-cmdline-history",
|
||||
"amarakon/nvim-cmp-lua-latex-symbols",
|
||||
"f3fora/cmp-spell",
|
||||
{ "petertriho/cmp-git", requires = "nvim-lua/plenary.nvim" },
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
"mfussenegger/nvim-dap",
|
||||
"mhartington/formatter.nvim",
|
||||
"mg979/vim-visual-multi",
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", run = "make" },
|
||||
{ "tzachar/fuzzy.nvim", requires = { "nvim-telescope/telescope-fzf-native.nvim" } },
|
||||
{ "tzachar/cmp-fuzzy-buffer", requires = { "hrsh7th/nvim-cmp", "tzachar/fuzzy.nvim" } },
|
||||
"quangnguyen30192/cmp-nvim-ultisnips",
|
||||
"mihaifm/bufstop",
|
||||
"https://git.nickr.eu/yannickreiss/nvim-sourcer.git",
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
-- in tools.lua
|
||||
local api = vim.api
|
||||
|
||||
local M = {};
|
||||
|
||||
function M.makeScratch()
|
||||
vim.bo[0].buftype=nofile -- set the current buffer's (buffer 0) buftype to nofile
|
||||
vim.bo[0].bufhidden=hide
|
||||
vim.bo[0].swapfile=false
|
||||
end;
|
||||
|
||||
|
||||
|
||||
return M;
|
|
@ -1,15 +0,0 @@
|
|||
vim.opt.number = true
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.showmatch = true
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.hlsearch = true
|
||||
vim.opt.encoding = "UTF-8"
|
||||
vim.g.tex_flavor = "latex"
|
||||
vim.opt.conceallevel = 2
|
||||
vim.opt.guifont = "DroidSansMono Nerd Font 11"
|
||||
vim.g.mapleader = ","
|
||||
|
||||
-- set color scheme
|
||||
vim.opt.termguicolors = true
|
|
@ -1,177 +0,0 @@
|
|||
import os
|
||||
import os.path
|
||||
import fnmatch
|
||||
import logging
|
||||
import ycm_core
|
||||
import re
|
||||
|
||||
BASE_FLAGS = [
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-Werror',
|
||||
'-Wno-long-long',
|
||||
'-Wno-variadic-macros',
|
||||
'-fexceptions',
|
||||
'-ferror-limit=10000',
|
||||
'-DNDEBUG',
|
||||
'-std=c++11',
|
||||
'-xc++',
|
||||
'-I/usr/lib/',
|
||||
'-I/usr/include/'
|
||||
]
|
||||
|
||||
SOURCE_EXTENSIONS = [
|
||||
'.cpp',
|
||||
'.cxx',
|
||||
'.cc',
|
||||
'.c',
|
||||
'.m',
|
||||
'.mm'
|
||||
]
|
||||
|
||||
SOURCE_DIRECTORIES = [
|
||||
'src',
|
||||
'lib'
|
||||
]
|
||||
|
||||
HEADER_EXTENSIONS = [
|
||||
'.h',
|
||||
'.hxx',
|
||||
'.hpp',
|
||||
'.hh'
|
||||
]
|
||||
|
||||
HEADER_DIRECTORIES = [
|
||||
'include'
|
||||
]
|
||||
|
||||
def IsHeaderFile(filename):
|
||||
extension = os.path.splitext(filename)[1]
|
||||
return extension in HEADER_EXTENSIONS
|
||||
|
||||
def GetCompilationInfoForFile(database, filename):
|
||||
if IsHeaderFile(filename):
|
||||
basename = os.path.splitext(filename)[0]
|
||||
for extension in SOURCE_EXTENSIONS:
|
||||
# Get info from the source files by replacing the extension.
|
||||
replacement_file = basename + extension
|
||||
if os.path.exists(replacement_file):
|
||||
compilation_info = database.GetCompilationInfoForFile(replacement_file)
|
||||
if compilation_info.compiler_flags_:
|
||||
return compilation_info
|
||||
# If that wasn't successful, try replacing possible header directory with possible source directories.
|
||||
for header_dir in HEADER_DIRECTORIES:
|
||||
for source_dir in SOURCE_DIRECTORIES:
|
||||
src_file = replacement_file.replace(header_dir, source_dir)
|
||||
if os.path.exists(src_file):
|
||||
compilation_info = database.GetCompilationInfoForFile(src_file)
|
||||
if compilation_info.compiler_flags_:
|
||||
return compilation_info
|
||||
return None
|
||||
return database.GetCompilationInfoForFile(filename)
|
||||
|
||||
def FindNearest(path, target, build_folder):
|
||||
candidate = os.path.join(path, target)
|
||||
if(os.path.isfile(candidate) or os.path.isdir(candidate)):
|
||||
logging.info("Found nearest " + target + " at " + candidate)
|
||||
return candidate;
|
||||
|
||||
parent = os.path.dirname(os.path.abspath(path));
|
||||
if(parent == path):
|
||||
raise RuntimeError("Could not find " + target);
|
||||
|
||||
if(build_folder):
|
||||
candidate = os.path.join(parent, build_folder, target)
|
||||
if(os.path.isfile(candidate) or os.path.isdir(candidate)):
|
||||
logging.info("Found nearest " + target + " in build folder at " + candidate)
|
||||
return candidate;
|
||||
|
||||
return FindNearest(parent, target, build_folder)
|
||||
|
||||
def MakeRelativePathsInFlagsAbsolute(flags, working_directory):
|
||||
if not working_directory:
|
||||
return list(flags)
|
||||
new_flags = []
|
||||
make_next_absolute = False
|
||||
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
|
||||
for flag in flags:
|
||||
new_flag = flag
|
||||
|
||||
if make_next_absolute:
|
||||
make_next_absolute = False
|
||||
if not flag.startswith('/'):
|
||||
new_flag = os.path.join(working_directory, flag)
|
||||
|
||||
for path_flag in path_flags:
|
||||
if flag == path_flag:
|
||||
make_next_absolute = True
|
||||
break
|
||||
|
||||
if flag.startswith(path_flag):
|
||||
path = flag[ len(path_flag): ]
|
||||
new_flag = path_flag + os.path.join(working_directory, path)
|
||||
break
|
||||
|
||||
if new_flag:
|
||||
new_flags.append(new_flag)
|
||||
return new_flags
|
||||
|
||||
|
||||
def FlagsForClangComplete(root):
|
||||
try:
|
||||
clang_complete_path = FindNearest(root, '.clang_complete')
|
||||
clang_complete_flags = open(clang_complete_path, 'r').read().splitlines()
|
||||
return clang_complete_flags
|
||||
except:
|
||||
return None
|
||||
|
||||
def FlagsForInclude(root):
|
||||
try:
|
||||
include_path = FindNearest(root, 'include')
|
||||
flags = []
|
||||
for dirroot, dirnames, filenames in os.walk(include_path):
|
||||
for dir_path in dirnames:
|
||||
real_path = os.path.join(dirroot, dir_path)
|
||||
flags = flags + ["-I" + real_path]
|
||||
return flags
|
||||
except:
|
||||
return None
|
||||
|
||||
def FlagsForCompilationDatabase(root, filename):
|
||||
try:
|
||||
# Last argument of next function is the name of the build folder for
|
||||
# out of source projects
|
||||
compilation_db_path = FindNearest(root, 'compile_commands.json', 'build')
|
||||
compilation_db_dir = os.path.dirname(compilation_db_path)
|
||||
logging.info("Set compilation database directory to " + compilation_db_dir)
|
||||
compilation_db = ycm_core.CompilationDatabase(compilation_db_dir)
|
||||
if not compilation_db:
|
||||
logging.info("Compilation database file found but unable to load")
|
||||
return None
|
||||
compilation_info = GetCompilationInfoForFile(compilation_db, filename)
|
||||
if not compilation_info:
|
||||
logging.info("No compilation info for " + filename + " in compilation database")
|
||||
return None
|
||||
return MakeRelativePathsInFlagsAbsolute(
|
||||
compilation_info.compiler_flags_,
|
||||
compilation_info.compiler_working_dir_)
|
||||
except:
|
||||
return None
|
||||
|
||||
def FlagsForFile(filename):
|
||||
root = os.path.realpath(filename);
|
||||
compilation_db_flags = FlagsForCompilationDatabase(root, filename)
|
||||
if compilation_db_flags:
|
||||
final_flags = compilation_db_flags
|
||||
else:
|
||||
final_flags = BASE_FLAGS
|
||||
clang_flags = FlagsForClangComplete(root)
|
||||
if clang_flags:
|
||||
final_flags = final_flags + clang_flags
|
||||
include_flags = FlagsForInclude(root)
|
||||
if include_flags:
|
||||
final_flags = final_flags + include_flags
|
||||
return {
|
||||
'flags': final_flags,
|
||||
'do_cache': True
|
||||
}
|
|
@ -2,42 +2,36 @@ set nocompatible
|
|||
filetype on
|
||||
filetype plugin on
|
||||
syntax on
|
||||
set number
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set showmatch
|
||||
set hlsearch
|
||||
set cursorline
|
||||
colorscheme desert
|
||||
set splitright
|
||||
set splitbelow
|
||||
set completeopt=menuone,preview
|
||||
set clipboard+=unnamedplus
|
||||
set expandtab
|
||||
set conceallevel=2
|
||||
set termguicolors
|
||||
let g:mapleader=","
|
||||
let g:tex_flavor="latex"
|
||||
|
||||
colorscheme vim-monokai-tasty
|
||||
|
||||
" open builtin terminal
|
||||
function OpenTerm()
|
||||
10 split
|
||||
terminal
|
||||
endfunction
|
||||
nnoremap <C-t> :call OpenTerm()<CR>
|
||||
|
||||
set splitright
|
||||
set splitbelow
|
||||
|
||||
set clipboard+=unnamedplus
|
||||
|
||||
" set spellcheck according to Filetype
|
||||
autocmd VimEnter * set spell spelllang=en_us
|
||||
|
||||
function Litde()
|
||||
set spell spelllang=de_de
|
||||
endfunction
|
||||
|
||||
function Liten()
|
||||
set spell spelllang=en_us
|
||||
endfunction
|
||||
|
||||
nnoremap <M-e> :call Liten()<CR>
|
||||
nnoremap <M-g> :call Litde()<CR>
|
||||
|
||||
" Theme
|
||||
nnoremap <M-+> :colo tokyonight-day<CR>
|
||||
nnoremap <M--> :colo tokyonight-night<CR>
|
||||
|
||||
" Try transparent nvim
|
||||
highlight Normal guibg=none
|
||||
highlight NonText guibg=none
|
||||
highlight Normal ctermbg=none
|
||||
highlight NonText ctermbg=none
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
call plug#begin('~/.vim/plugged')
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'preservim/nerdtree'
|
||||
Plug 'Xuyuanp/nerdtree-git-plugin'
|
||||
Plug 'nvim-lua/plenary.nvim'
|
||||
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.5' }
|
||||
Plug 'tpope/vim-surround'
|
||||
Plug 'tpope/vim-speeddating'
|
||||
Plug 'mhinz/vim-startify'
|
||||
Plug 'dstein64/vim-startuptime'
|
||||
Plug 'hiroakis/cyberspace.vim'
|
||||
Plug 'mhinz/vim-startify'
|
||||
Plug 'dstein64/vim-startuptime'
|
||||
Plug 'SirVer/ultisnips'
|
||||
call plug#end()
|
||||
|
||||
function Update_sys()
|
||||
PlugUpdate
|
||||
endfunction
|
||||
nmap <C-u> :call Update_sys()<CR>
|
||||
|
||||
" NERDTree config
|
||||
let g:NERDTreeShowHidden = 1
|
||||
let g:NERDTreeDirArrowExpandable = "▸"
|
||||
let g:NERDTreeDirArrowCollapsible = "▾"
|
||||
nmap <C-e> :NERDTreeToggle<CR>
|
||||
|
||||
" UltiSnips config
|
||||
let g:UltiSnipsExpandTrigger = "<tab>"
|
||||
let g:UltiSnipsJumpForwardTrigger = "<c-l>"
|
||||
let g:UltiSnipsJumpBackwardTrigger = "<c-h>"
|
||||
let g:UltiSnipsEditSplit = "vertical"
|
||||
let g:UltiSnipsSnippetDirectories = [ "~/.config/nvim/UltiSnips" ]
|
|
@ -1,103 +0,0 @@
|
|||
" NERDTree remap
|
||||
let g:NERDTreeDirArrowExpandable = '▸'
|
||||
let g:NERDTreeDirArrowCollapsible = '▾'
|
||||
nmap <C-e> :NERDTreeToggle<CR>
|
||||
|
||||
" open builtin terminal
|
||||
function OpenTerm()
|
||||
vsplit
|
||||
terminal
|
||||
endfunction
|
||||
nnoremap <C-t> :call OpenTerm()<CR>
|
||||
|
||||
" open new files right/below
|
||||
set splitright
|
||||
set splitbelow
|
||||
|
||||
set clipboard+=unnamedplus
|
||||
|
||||
" Autoformat on save
|
||||
augroup FormatAutogroup
|
||||
autocmd!
|
||||
autocmd BufWritePost * FormatWrite
|
||||
augroup END
|
||||
|
||||
" set spellcheck according to Filetype
|
||||
autocmd VimEnter * set spell spelllang=en_us
|
||||
|
||||
function Litde()
|
||||
set spell spelllang=de_de
|
||||
endfunction
|
||||
|
||||
function Liten()
|
||||
set spell spelllang=en_us
|
||||
endfunction
|
||||
|
||||
nnoremap <M-e> :call Liten()<CR>
|
||||
nnoremap <M-g> :call Litde()<CR>
|
||||
|
||||
" Theme
|
||||
nnoremap <M-+> :colo github_light_high_contrast<CR>
|
||||
nnoremap <M--> :colo default<CR>
|
||||
|
||||
" Fuzzy finder
|
||||
nnoremap <C-f> :Lines<CR>
|
||||
|
||||
function RestoreSession()
|
||||
if @% == ""
|
||||
source ~/.config/nvim/lastSession.vim
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Git-Blame configuration
|
||||
let g:gitblame_message_template = ' => <author> • <date> • <summary>'
|
||||
let g:gitblame_date_format = '%r'
|
||||
|
||||
if executable('vhdl-tool')
|
||||
au User lsp_setup call lsp#register_server({
|
||||
\ 'name': 'vhdl-tool',
|
||||
\ 'cmd': {server_info->['vhdl-tool', 'lsp']},
|
||||
\ 'whitelist': ['vhdl'],
|
||||
\ 'root_uri':{server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'vhdltool-config.yaml'))},
|
||||
\ })
|
||||
endif
|
||||
|
||||
autocmd FileType vhdl setlocal omnifunc=lsp#complete
|
||||
|
||||
nnoremap <silent> <C-0> <Cmd>BufferNext<CR>
|
||||
|
||||
" update function and call
|
||||
function Update_Sys()
|
||||
PackerSync
|
||||
TSUpdate
|
||||
MasonUpdate
|
||||
endfunction
|
||||
|
||||
nnoremap <M-u> :call Update_Sys()<CR>
|
||||
|
||||
" Call build function
|
||||
function! Build()
|
||||
let l:filetype = &filetype
|
||||
|
||||
if l:filetype == 'c' || l:filetype == 'cpp' || l:filetype == 'h' || l:filetype == 'hpp'
|
||||
execute 'make'
|
||||
elseif l:filetype == 'py' || l:filetype == 'python'
|
||||
execute '!python3 %'
|
||||
elseif l:filetype == 'tex'
|
||||
execute '!lualatex % < /dev/null'
|
||||
elseif l:filetype == 'rs'
|
||||
execute 'cargo run'
|
||||
elseif l:filetype == 'S'
|
||||
execute 'make'
|
||||
elseif l:filetype == 'verilog'
|
||||
execute 'verilator --binary %'
|
||||
elseif l:filetype == 'rust'
|
||||
execute 'cargo run'
|
||||
else
|
||||
echo "Unsupported file type: " . l:filetype
|
||||
endif
|
||||
endfunction
|
||||
|
||||
nnoremap <C-b> :call Build()<CR>
|
||||
nnoremap <M-w> :bdelete<CR>
|
||||
nnoremap <C-y> :b#<CR>
|
|
@ -1,47 +0,0 @@
|
|||
" NERDTree remap
|
||||
nmap <C-e> :NERDTreeToggle<CR>
|
||||
|
||||
" Autoformat on save
|
||||
augroup FormatAutogroup
|
||||
autocmd!
|
||||
autocmd BufWritePost * FormatWrite
|
||||
augroup END
|
||||
|
||||
nnoremap <silent> <C-0> <Cmd>BufferNext<CR>
|
||||
|
||||
" update function and call
|
||||
function Update_Sys()
|
||||
Lazy sync
|
||||
TSUpdate
|
||||
endfunction
|
||||
|
||||
nnoremap <M-u> :call Update_Sys()<CR>
|
||||
|
||||
" Call build function
|
||||
function! Build()
|
||||
let l:filetype = &filetype
|
||||
|
||||
if l:filetype == 'c' || l:filetype == 'cpp' || l:filetype == 'h' || l:filetype == 'hpp'
|
||||
execute '!make'
|
||||
elseif l:filetype == 'py' || l:filetype == 'python'
|
||||
execute '!python3 %'
|
||||
elseif l:filetype == 'tex'
|
||||
execute '!lualatex % < /dev/null'
|
||||
elseif l:filetype == 'rs'
|
||||
execute 'cargo run'
|
||||
elseif l:filetype == 'S'
|
||||
execute '!make'
|
||||
elseif l:filetype == 'verilog'
|
||||
execute '!verilator --binary %'
|
||||
elseif l:filetype == 'rust'
|
||||
execute '!cargo run'
|
||||
elseif l:filetype == 'markdown'
|
||||
execute '!okular %&'
|
||||
else
|
||||
echo "Unsupported file type: " . l:filetype
|
||||
endif
|
||||
endfunction
|
||||
|
||||
nnoremap <C-b> :call Build()<CR>
|
||||
nnoremap <M-w> :bdelete<CR>
|
||||
nnoremap <C-y> :BufstopFast<CR>
|
Loading…
Reference in New Issue