This commit is contained in:
Yannick Reiß 2023-07-31 17:35:26 +02:00
commit c285dd40be
No known key found for this signature in database
GPG Key ID: 5A3AF456F0A0338C
9 changed files with 839 additions and 0 deletions

102
init.lua Normal file
View File

@ -0,0 +1,102 @@
--vim.cmd('source viml/init.vim')
-- Basic setup configuration
vim.cmd([[
set nocompatible
filetype on
filetype plugin on
syntax on
]])
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.g.clipboard = true
vim.opt.conceallevel = 2
vim.opt.guifont = "DroidSansMono Nerd Font 11"
-- set colorscheme
vim.opt.termguicolors = true
vim.cmd([[
colorscheme slate
]])
-- vim.cmd('source ~/.config/nvim/viml/plugins.vim')
require('plugins')
-- UltiSnipsConfig
vim.g.UltiSnipsExpandTrigger="<tab>"
vim.g.UltiSnipsJumpForwardTrigger="<tab>"
vim.g.UltiSnipsJumpBackwardTrigger="<S-Tab>"
vim.g.UltiSnipsEditSplit="vertical"
vim.g.UltiSnipsSnippetDirectories={"/home/nick/.vim/UltiSnips"}
-- indentLine config
vim.g.indentLine_char = ''
-- NERDTree Config
vim.g.NERDTreeShowHidden = 1
-- Vim Lexima
vim.g.lexima_enable_basic_rules = 1
vim.g.lexima_enable_newline_rules = 1
-- YCM config
-- replace tab by crtl-k
-- vim.cmd("let g:ycm_key_list_select_completion = ['<c-k>']")
-- vim.cmd("inoremap <expr> <Tab> pumvisible() ? '\\<c-k>' : 'ᐅ'")
-- vim.g.ycm_global_ycm_extra_conf = '~/.config/nvim/python/.ycm_extra_conf.py'
-- Treesitter config
local configs = require'nvim-treesitter.configs'
configs.setup {
ensure_installed = {'python', 'c', 'cpp', 'lua', 'make', 'markdown'},
highlight = {
enable = true;
},
indent = {
enable = true,
},
rainbow = {
enable = true,
-- disable = {"langtodisable"},
extended_mode = true,
max_file_lines = 50000,
-- colors = {}, -- hex strings
-- termcolors = {}, -- color names
}
}
-- Let Treesitter fold with <zo> and <zc>, but keeps buffers unfolded on enter
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
vim.opt.foldenable = false
-- 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
}
require("code-completion")
vim.cmd('source ~/.config/nvim/viml/legacyconf.vim')

52
lastSession.vim Normal file
View File

@ -0,0 +1,52 @@
let SessionLoad = 1
let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1
let v:this_session=expand("<sfile>:p")
silent only
silent tabonly
cd ~/.config/nvim
if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
let s:wipebuf = bufnr('%')
endif
let s:shortmess_save = &shortmess
if &shortmess =~ 'A'
set shortmess=aoOA
else
set shortmess=aoO
endif
badd +0 ~/Documents/Programming/LaTeX/La/La.tex
argglobal
%argdel
$argadd ~/Documents/Programming/LaTeX/La/La.tex
edit ~/Documents/Programming/LaTeX/La/La.tex
argglobal
setlocal fdm=expr
setlocal fde=nvim_treesitter#foldexpr()
setlocal fmr={{{,}}}
setlocal fdi=#
setlocal fdl=0
setlocal fml=1
setlocal fdn=20
setlocal nofen
let s:l = 1 - ((0 * winheight(0) + 23) / 47)
if s:l < 1 | let s:l = 1 | endif
keepjumps exe s:l
normal! zt
keepjumps 1
normal! 0
tabnext 1
if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
silent exe 'bwipe ' . s:wipebuf
endif
unlet! s:wipebuf
set winheight=1 winwidth=20
let &shortmess = s:shortmess_save
let s:sx = expand("<sfile>:p:r")."x.vim"
if filereadable(s:sx)
exe "source " . fnameescape(s:sx)
endif
let &g:so = s:so_save | let &g:siso = s:siso_save
set hlsearch
nohlsearch
doautoall SessionLoadPost
unlet SessionLoad
" vim: set ft=vim :

94
lua/code-completion.lua Normal file
View File

@ -0,0 +1,94 @@
-- 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 = {'menuone', 'noselect', 'noinsert', 'preview'}
-- 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,
},
-- mapping
mapping = {
-- Shift+TAB to go to the Previous Suggested item
['<C-s-k>'] = cmp.mapping.select_prev_item(),
-- Tab to go to the next suggestion
['<C-k>'] = 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-e>'] = cmp.mapping.close(),
-- 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 = {
{ name = 'path' },
{ name = 'nvim_lsp', keyword_length = 3 },
{ name = 'nvim_lsp_signature_help'},
{ name = 'nvim_lua', keyword_length = 2},
{ name = 'buffer', keyword_length = 2 },
{ name = 'ultisnips', keyword_length = 2 },
{ name = 'calc' },
{ name = "lua-latex-symbols", option = { cache = true } }
},
-- Add borders to the windows
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
-- add formating of the different sources
formatting = {
fields = {'menu', 'abbr', 'kind'},
format = function(entry, item)
local menu_icon ={
nvim_lsp = 'λ',
ultisnips = '',
buffer = 'b',
path = 'p',
calc = 'Σ',
lualatexsymbols = 'L'
}
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 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' }
})
})

44
lua/plugins.lua Normal file
View File

@ -0,0 +1,44 @@
return require('packer').startup(function(use)
-- Configurations will go here soon
use 'wbthomason/packer.nvim'
use 'dense-analysis/ale'
use 'preservim/nerdtree'
use 'Xuyuanp/nerdtree-git-plugin'
use 'tpope/vim-surround'
use 'SirVer/ultisnips'
use 'vim-airline/vim-airline'
use {
'nvim-treesitter/nvim-treesitter',
run = function()
local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
ts_update()
end,
}
use { 'junegunn/fzf', run = ":call fzf#install()" }
use 'junegunn/fzf.vim'
-- use 'Valloric/YouCompleteMe'
use 'williamboman/mason.nvim'
use 'williamboman/mason-lspconfig.nvim'
use 'neovim/nvim-lspconfig'
use 'mfussenegger/nvim-dap'
use 'f-person/git-blame.nvim'
use 'mfussenegger/nvim-lint'
use 'lewis6991/gitsigns.nvim'
use 'p00f/nvim-ts-rainbow'
use 'cohama/lexima.vim'
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-nvim-lua'
use 'hrsh7th/cmp-nvim-lsp-signature-help'
use 'hrsh7th/cmp-path'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-calc'
use 'amarakon/nvim-cmp-lua-latex-symbols'
use 'prabirshrestha/async.vim'
use 'prabirshrestha/vim-lsp'
use 'nvim-tree/nvim-web-devicons'
use {'romgrk/barbar.nvim', wants = 'nvim-web-devicons'}
use({"petertriho/cmp-git", requires = "nvim-lua/plenary.nvim"})
use 'quangnguyen30192/cmp-nvim-ultisnips'
use 'ryanoasis/vim-devicons'
end)

14
lua/tools.lua Normal file
View File

@ -0,0 +1,14 @@
-- 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;

275
plugin/packer_compiled.lua Normal file
View File

@ -0,0 +1,275 @@
-- 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/nick/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/nick/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/nick/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/nick/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/nick/.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 = {
YouCompleteMe = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/YouCompleteMe",
url = "https://github.com/Valloric/YouCompleteMe"
},
ale = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/ale",
url = "https://github.com/dense-analysis/ale"
},
["async.vim"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/async.vim",
url = "https://github.com/prabirshrestha/async.vim"
},
["barbar.nvim"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/barbar.nvim",
url = "https://github.com/romgrk/barbar.nvim",
wants = { "nvim-web-devicons" }
},
["cmp-buffer"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/cmp-buffer",
url = "https://github.com/hrsh7th/cmp-buffer"
},
["cmp-calc"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/cmp-calc",
url = "https://github.com/hrsh7th/cmp-calc"
},
["cmp-git"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/cmp-git",
url = "https://github.com/petertriho/cmp-git"
},
["cmp-nvim-lsp"] = {
loaded = true,
path = "/home/nick/.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/nick/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp-signature-help",
url = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help"
},
["cmp-nvim-lua"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua",
url = "https://github.com/hrsh7th/cmp-nvim-lua"
},
["cmp-nvim-ultisnips"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/cmp-nvim-ultisnips",
url = "https://github.com/quangnguyen30192/cmp-nvim-ultisnips"
},
["cmp-path"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/cmp-path",
url = "https://github.com/hrsh7th/cmp-path"
},
fzf = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/fzf",
url = "https://github.com/junegunn/fzf"
},
["fzf.vim"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/fzf.vim",
url = "https://github.com/junegunn/fzf.vim"
},
["git-blame.nvim"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/git-blame.nvim",
url = "https://github.com/f-person/git-blame.nvim"
},
["gitsigns.nvim"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
url = "https://github.com/lewis6991/gitsigns.nvim"
},
["lexima.vim"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/lexima.vim",
url = "https://github.com/cohama/lexima.vim"
},
["mason-lspconfig.nvim"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
url = "https://github.com/williamboman/mason-lspconfig.nvim"
},
["mason.nvim"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/mason.nvim",
url = "https://github.com/williamboman/mason.nvim"
},
nerdtree = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/nerdtree",
url = "https://github.com/preservim/nerdtree"
},
["nerdtree-git-plugin"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/nerdtree-git-plugin",
url = "https://github.com/Xuyuanp/nerdtree-git-plugin"
},
["nvim-cmp"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-cmp-lua-latex-symbols"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/nvim-cmp-lua-latex-symbols",
url = "https://github.com/amarakon/nvim-cmp-lua-latex-symbols"
},
["nvim-dap"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/nvim-dap",
url = "https://github.com/mfussenegger/nvim-dap"
},
["nvim-lint"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/nvim-lint",
url = "https://github.com/mfussenegger/nvim-lint"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-treesitter"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter"
},
["nvim-ts-rainbow"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/nvim-ts-rainbow",
url = "https://github.com/p00f/nvim-ts-rainbow"
},
["nvim-web-devicons"] = {
loaded = true,
path = "/home/nick/.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/nick/.local/share/nvim/site/pack/packer/start/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
},
["plenary.nvim"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
},
ultisnips = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/ultisnips",
url = "https://github.com/SirVer/ultisnips"
},
["vim-airline"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/vim-airline",
url = "https://github.com/vim-airline/vim-airline"
},
["vim-devicons"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/vim-devicons",
url = "https://github.com/ryanoasis/vim-devicons"
},
["vim-lsp"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/vim-lsp",
url = "https://github.com/prabirshrestha/vim-lsp"
},
["vim-surround"] = {
loaded = true,
path = "/home/nick/.local/share/nvim/site/pack/packer/start/vim-surround",
url = "https://github.com/tpope/vim-surround"
}
}
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

177
python/.ycm_extra_conf.py Normal file
View File

@ -0,0 +1,177 @@
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
}

48
viml/legacyconf.vim Normal file
View File

@ -0,0 +1,48 @@
" NERDTree remap
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
nnoremap <C-a> :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
" Update Plugins and Treesitter languages
autocmd VimLeave * mksession! ~/.config/nvim/lastSession.vim
" autosave for Markdown and Latex
set updatetime=800
autocmd CursorHold *.md w
" autocmd BufAdd *.md !okular %&
"terminator -e "latexmk -pdf -f </dev/null" &
nnoremap <C-y> :!latexmk -pdf -silent -f </dev/null <CR>
function RestoreSession()
if @% == ""
source ~/.config/nvim/lastSession.vim
endif
endfunction
" Git-Blame config
let g:gitblame_message_template = ' => <author> • <summary> • <date>'
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>

33
viml/plugins.vim Normal file
View File

@ -0,0 +1,33 @@
" PLUGINS
call plug#begin('~/.vim/plugged')
Plug 'dense-analysis/ale'
Plug 'preservim/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tpope/vim-surround'
Plug 'SirVer/ultisnips'
Plug 'vim-airline/vim-airline'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'neovim/nvim-lspconfig'
Plug 'junegunn/fzf.vim'
Plug 'Valloric/YouCompleteMe'
Plug 'williamboman/mason.nvim'
Plug 'williamboman/mason-lspconfig.nvim'
Plug 'neovim/nvim-lspconfig'
Plug 'mfussenegger/nvim-dap'
Plug 'f-person/git-blame.nvim'
Plug 'mfussenegger/nvim-lint'
Plug 'lewis6991/gitsigns.nvim'
Plug 'p00f/nvim-ts-rainbow'
Plug 'cohama/lexima.vim'
Plug 'honza/vim-snippets'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-nvim-lua'
Plug 'hrsh7th/cmp-nvim-lsp-signature-help'
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/vim-vsnip'
Plug 'ryanoasis/vim-devicons'
call plug#end()