Merge installer folder with internal
This commit is contained in:
parent
2ec0d58fab
commit
a7c52c2a9c
@ -1,459 +0,0 @@
|
||||
---
|
||||
IndentWidth: 4
|
||||
TabWidth: 4
|
||||
---
|
||||
Language: Cpp
|
||||
|
||||
# Align parameters on the open bracket, e.g.:
|
||||
# someLongFunction(argument1,
|
||||
# argument2);
|
||||
AlignAfterOpenBracket: Align
|
||||
|
||||
# Align array column and left justify the columns e.g.:
|
||||
# struct test demo[] =
|
||||
# {
|
||||
# {56, 23, "hello"},
|
||||
# {-1, 93463, "world"},
|
||||
# {7, 5, "!!" }
|
||||
# };
|
||||
AlignArrayOfStructures: Left
|
||||
|
||||
# Align assignments on consecutive lines. This will result in formattings like:
|
||||
#
|
||||
# int a = 1;
|
||||
# int somelongname = 2;
|
||||
# double c = 3;
|
||||
#
|
||||
# int d = 3;
|
||||
# /* A comment. */
|
||||
# double e = 4;
|
||||
AlignConsecutiveAssignments: Consecutive
|
||||
AlignConsecutiveBitFields: Consecutive
|
||||
AlignConsecutiveDeclarations: Consecutive
|
||||
AlignConsecutiveMacros: Consecutive
|
||||
|
||||
# Align escaped newlines as far left as possible.
|
||||
# #define A \
|
||||
# int aaaa; \
|
||||
# int b; \
|
||||
# int dddddddddd;
|
||||
AlignEscapedNewlines: Left
|
||||
|
||||
# Horizontally align operands of binary and ternary expressions.
|
||||
# Specifically, this aligns operands of a single expression that needs to be
|
||||
# split over multiple lines, e.g.:
|
||||
#
|
||||
# int aaa = bbbbbbbbbbbbbbb +
|
||||
# ccccccccccccccc;
|
||||
AlignOperands: Align
|
||||
|
||||
# true: false:
|
||||
# int a; // My comment a vs. int a; // My comment a
|
||||
# int b = 2; // comment b int b = 2; // comment about b
|
||||
AlignTrailingComments: true
|
||||
|
||||
# If the function declaration doesn’t fit on a line, allow putting all
|
||||
# parameters of a function declaration onto the next line even if
|
||||
# BinPackParameters is false.
|
||||
#
|
||||
# true:
|
||||
# void myFunction(
|
||||
# int a, int b, int c, int d, int e);
|
||||
#
|
||||
# false:
|
||||
# void myFunction(int a,
|
||||
# int b,
|
||||
# int c,
|
||||
# int d,
|
||||
# int e);
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: Never # "while (true) { continue; }" can be put on a single line.
|
||||
|
||||
# If true, short case labels will be contracted to a single line.
|
||||
#
|
||||
# true: false:
|
||||
# switch (a) { vs. switch (a) {
|
||||
# case 1: x = 1; break; case 1:
|
||||
# case 2: return; x = 1;
|
||||
# } break;
|
||||
# case 2:
|
||||
# return;
|
||||
# }
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortEnumsOnASingleLine: true # enum { A, B } myEnum;
|
||||
|
||||
# Only merge functions defined inside a class. Implies “empty”.
|
||||
#
|
||||
# class Foo {
|
||||
# void f() { foo(); }
|
||||
# };
|
||||
# void f() {
|
||||
# foo();
|
||||
# }
|
||||
# void f() {}
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
|
||||
# Only merge empty lambdas.
|
||||
#
|
||||
# auto lambda = [](int a) {}
|
||||
# auto lambda2 = [](int a) {
|
||||
# return a;
|
||||
# };
|
||||
AllowShortLambdasOnASingleLine: Empty
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
|
||||
# true: false:
|
||||
# aaaa = vs. aaaa = "bbbb"
|
||||
# "bbbb" "cccc";
|
||||
# "cccc";
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
|
||||
# Force break after template declaration only when the following declaration
|
||||
# spans multiple lines.
|
||||
#
|
||||
# template <typename T> T foo() {
|
||||
# }
|
||||
# template <typename T>
|
||||
# T foo(int aaaaaaaaaaaaaaaaaaaaa,
|
||||
# int bbbbbbbbbbbbbbbbbbbbb) {
|
||||
# }
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
|
||||
# If false, a function call’s arguments will either be all on the same line or
|
||||
# will have one line each.
|
||||
#
|
||||
# true:
|
||||
# void f() {
|
||||
# f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa,
|
||||
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
|
||||
# }
|
||||
#
|
||||
# false:
|
||||
# void f() {
|
||||
# f(aaaaaaaaaaaaaaaaaaaa,
|
||||
# aaaaaaaaaaaaaaaaaaaa,
|
||||
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
|
||||
# }
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false # As BinPackArguments but for function definition parameters
|
||||
|
||||
# Add space after the : only (space may be added before if needed for
|
||||
# AlignConsecutiveBitFields).
|
||||
#
|
||||
# unsigned bf: 2;
|
||||
BitFieldColonSpacing: After
|
||||
|
||||
# LooooooooooongType loooooooooooooooooooooongVariable =
|
||||
# someLooooooooooooooooongFunction();
|
||||
#
|
||||
# bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
|
||||
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ==
|
||||
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
|
||||
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa >
|
||||
# ccccccccccccccccccccccccccccccccccccccccc;
|
||||
BreakBeforeBinaryOperators: None
|
||||
|
||||
# Always attach braces to surrounding context, but break before braces on
|
||||
# function, namespace and class definitions.
|
||||
BreakBeforeBraces: Linux
|
||||
|
||||
# true:
|
||||
# template<typename T>
|
||||
# concept ...
|
||||
#
|
||||
# false:
|
||||
# template<typename T> concept ...
|
||||
BreakBeforeConceptDeclarations: false
|
||||
|
||||
# true:
|
||||
# veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription
|
||||
# ? firstValue
|
||||
# : SecondValueVeryVeryVeryVeryLong;
|
||||
#
|
||||
# false:
|
||||
# veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription ?
|
||||
# firstValue :
|
||||
# SecondValueVeryVeryVeryVeryLong;
|
||||
BreakBeforeTernaryOperators: true
|
||||
|
||||
# Break constructor initializers before the colon and commas, and align the
|
||||
# commas with the colon.
|
||||
#
|
||||
# Constructor()
|
||||
# : initializer1()
|
||||
# , initializer2()
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
|
||||
# Break inheritance list only after the commas.
|
||||
#
|
||||
# class Foo : Base1,
|
||||
# Base2
|
||||
# {};
|
||||
BreakInheritanceList: AfterComma
|
||||
|
||||
# true:
|
||||
# const char* x = "veryVeryVeryVeryVeryVe"
|
||||
# "ryVeryVeryVeryVeryVery"
|
||||
# "VeryLongString";
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 100
|
||||
|
||||
# false:
|
||||
# namespace Foo {
|
||||
# namespace Bar {
|
||||
# }
|
||||
# }
|
||||
CompactNamespaces: false
|
||||
|
||||
# true: false:
|
||||
# vector<int> x{1, 2, 3, 4}; vs. vector<int> x{ 1, 2, 3, 4 };
|
||||
# vector<T> x{{}, {}, {}, {}}; vector<T> x{ {}, {}, {}, {} };
|
||||
# f(MyMap[{composite, key}]); f(MyMap[{ composite, key }]);
|
||||
# new int[3]{1, 2, 3}; new int[3]{ 1, 2, 3 };
|
||||
Cpp11BracedListStyle: true
|
||||
|
||||
# Analyze the formatted file for the most used line ending (\r\n or \n). UseCRLF
|
||||
# is only used as a fallback if none can be derived.
|
||||
DeriveLineEnding: true
|
||||
DerivePointerAlignment: true # As per DeriveLineEnding except for pointers and references
|
||||
|
||||
# Add empty line only when access modifier starts a new logical block. Logical
|
||||
# block is a group of one or more member fields or functions.
|
||||
#
|
||||
# struct foo {
|
||||
# private:
|
||||
# int i;
|
||||
#
|
||||
# protected:
|
||||
# int j;
|
||||
# /* comment */
|
||||
# public:
|
||||
# foo() {}
|
||||
#
|
||||
# private:
|
||||
# protected:
|
||||
# };
|
||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
|
||||
# true: false:
|
||||
# namespace a { vs. namespace a {
|
||||
# foo(); foo();
|
||||
# bar(); bar();
|
||||
# } // namespace a }
|
||||
FixNamespaceComments: true
|
||||
|
||||
# false: true:
|
||||
# class C { vs. class C {
|
||||
# class D { class D {
|
||||
# void bar(); void bar();
|
||||
# protected: protected:
|
||||
# D(); D();
|
||||
# }; };
|
||||
# public: public:
|
||||
# C(); C();
|
||||
# }; };
|
||||
# void foo() { void foo() {
|
||||
# return 1; return 1;
|
||||
# } }
|
||||
IndentAccessModifiers: false
|
||||
|
||||
# false: true:
|
||||
# switch (fool) { vs. switch (fool) {
|
||||
# case 1: { case 1:
|
||||
# bar(); {
|
||||
# } break; bar();
|
||||
# default: { }
|
||||
# plop(); break;
|
||||
# } default:
|
||||
# } {
|
||||
# plop();
|
||||
# }
|
||||
# }
|
||||
IndentCaseBlocks: false
|
||||
|
||||
# false: true:
|
||||
# switch (fool) { vs. switch (fool) {
|
||||
# case 1: case 1:
|
||||
# bar(); bar();
|
||||
# break; break;
|
||||
# default: default:
|
||||
# plop(); plop();
|
||||
# } }
|
||||
IndentCaseLabels: true
|
||||
|
||||
# extern "C" {
|
||||
# void foo();
|
||||
# }
|
||||
IndentExternBlock: NoIndent
|
||||
|
||||
# Indents directives before the hash.
|
||||
#
|
||||
# #if FOO
|
||||
# #if BAR
|
||||
# #include <foo>
|
||||
# #endif
|
||||
# #endif
|
||||
IndentPPDirectives: BeforeHash
|
||||
|
||||
# true: false:
|
||||
# if (foo) { vs. if (foo) {
|
||||
# bar();
|
||||
# bar(); }
|
||||
# }
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
|
||||
# The maximum number of consecutive empty lines to keep.
|
||||
#
|
||||
# MaxEmptyLinesToKeep: 1 vs. MaxEmptyLinesToKeep: 0
|
||||
# int f() { int f() {
|
||||
# int = 1; int i = 1;
|
||||
# i = foo();
|
||||
# i = foo(); return i;
|
||||
# }
|
||||
# return i;
|
||||
# }
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
|
||||
# Put all constructor initializers on the current line if they fit. Otherwise,
|
||||
# put each one on its own line.
|
||||
#
|
||||
# Constructor() : a(), b()
|
||||
#
|
||||
# Constructor()
|
||||
# : aaaaaaaaaaaaaaaaaaaa(),
|
||||
# bbbbbbbbbbbbbbbbbbbb(),
|
||||
# ddddddddddddd()
|
||||
PackConstructorInitializers: CurrentLine
|
||||
PointerAlignment: Right
|
||||
|
||||
# false:
|
||||
# // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
|
||||
# /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
|
||||
#
|
||||
# true:
|
||||
# // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
|
||||
# // information
|
||||
# /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
|
||||
# * information */
|
||||
ReflowComments: true
|
||||
|
||||
# false: true:
|
||||
#
|
||||
# if (isa<FunctionDecl>(D)) { vs. if (isa<FunctionDecl>(D))
|
||||
# handleFunctionDecl(D); handleFunctionDecl(D);
|
||||
# } else if (isa<VarDecl>(D)) { else if (isa<VarDecl>(D))
|
||||
# handleVarDecl(D); handleVarDecl(D);
|
||||
# }
|
||||
#
|
||||
# if (isa<VarDecl>(D)) { vs. if (isa<VarDecl>(D)) {
|
||||
# for (auto *A : D.attrs()) { for (auto *A : D.attrs())
|
||||
# if (shouldProcessAttr(A)) { if (shouldProcessAttr(A))
|
||||
# handleAttr(A); handleAttr(A);
|
||||
# } }
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# if (isa<FunctionDecl>(D)) { vs. if (isa<FunctionDecl>(D))
|
||||
# for (auto *A : D.attrs()) { for (auto *A : D.attrs())
|
||||
# handleAttr(A); handleAttr(A);
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# if (auto *D = (T)(D)) { vs. if (auto *D = (T)(D)) {
|
||||
# if (shouldProcess(D)) { if (shouldProcess(D))
|
||||
# handleVarDecl(D); handleVarDecl(D);
|
||||
# } else { else
|
||||
# markAsIgnored(D); markAsIgnored(D);
|
||||
# } }
|
||||
# }
|
||||
#
|
||||
# if (a) { vs. if (a)
|
||||
# b(); b();
|
||||
# } else { else if (c)
|
||||
# if (c) { d();
|
||||
# d(); else
|
||||
# } else { e();
|
||||
# e();
|
||||
# }
|
||||
# }
|
||||
RemoveBracesLLVM: true
|
||||
|
||||
# Never v.s. Always
|
||||
# #include <cstring> #include <cstring>
|
||||
# struct Foo {
|
||||
# int a, b, c; struct Foo {
|
||||
# }; int a, b, c;
|
||||
# namespace Ns { };
|
||||
# class Bar {
|
||||
# public: namespace Ns {
|
||||
# struct Foobar { class Bar {
|
||||
# int a; public:
|
||||
# int b; struct Foobar {
|
||||
# }; int a;
|
||||
# private: int b;
|
||||
# int t; };
|
||||
# int method1() {
|
||||
# // ... private:
|
||||
# } int t;
|
||||
# enum List {
|
||||
# ITEM1, int method1() {
|
||||
# ITEM2 // ...
|
||||
# }; }
|
||||
# template<typename T>
|
||||
# int method2(T x) { enum List {
|
||||
# // ... ITEM1,
|
||||
# } ITEM2
|
||||
# int i, j, k; };
|
||||
# int method3(int par) {
|
||||
# // ... template<typename T>
|
||||
# } int method2(T x) {
|
||||
# }; // ...
|
||||
# class C {}; }
|
||||
# }
|
||||
# int i, j, k;
|
||||
#
|
||||
# int method3(int par) {
|
||||
# // ...
|
||||
# }
|
||||
# };
|
||||
#
|
||||
# class C {};
|
||||
# }
|
||||
SeparateDefinitionBlocks: Always
|
||||
|
||||
# true: false:
|
||||
# int a = 5; vs. int a= 5;
|
||||
# a += 42; a+= 42;
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
|
||||
# Put a space before opening parentheses only after control statement keywords
|
||||
# (for/if/while...).
|
||||
#
|
||||
# void f() {
|
||||
# if (true) {
|
||||
# f();
|
||||
# }
|
||||
# }
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpacesBeforeTrailingComments: 1
|
||||
|
||||
# static_cast<int>(arg);
|
||||
# std::function<void(int)> fct;
|
||||
SpacesInAngles: Never
|
||||
|
||||
Standard: Auto
|
||||
|
||||
# Macros which are ignored in front of a statement, as if they were an
|
||||
# attribute. So that they are not parsed as identifier, for example for Qts
|
||||
# emit.
|
||||
# unsigned char data = 'x';
|
||||
# emit signal(data); // This is parsed as variable declaration.
|
||||
#
|
||||
# vs.
|
||||
#
|
||||
# unsigned char data = 'x';
|
||||
# emit signal(data); // Now it's fine again.
|
||||
StatementAttributeLikeMacros: [emit]
|
||||
---
|
@ -1,377 +0,0 @@
|
||||
" Plugins
|
||||
" ==============================================================================
|
||||
call plug#begin(stdpath('config') . '/plugged')
|
||||
" nerdtree provides a file tree explorer
|
||||
" vim-dispatch allows running async jobs in vim (i.e. builds in the background)
|
||||
Plug 'https://github.com/scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
|
||||
Plug 'https://github.com/tpope/vim-dispatch'
|
||||
Plug 'https://github.com/tpope/vim-fugitive'
|
||||
Plug 'https://github.com/tpope/vim-abolish'
|
||||
|
||||
" TODO: 2022-06-19 Treesitter is too slow on large C++ files
|
||||
" Plug 'https://github.com/nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||
Plug 'https://github.com/bfrg/vim-cpp-modern'
|
||||
|
||||
" FZF
|
||||
Plug 'junegunn/fzf'
|
||||
Plug 'junegunn/fzf.vim'
|
||||
|
||||
" FZF for LSP
|
||||
Plug 'gfanto/fzf-lsp.nvim'
|
||||
Plug 'nvim-lua/plenary.nvim'
|
||||
|
||||
" odin for syntax highlighting
|
||||
Plug 'https://github.com/Tetralux/odin.vim'
|
||||
Plug 'https://github.com/sainnhe/gruvbox-material'
|
||||
|
||||
" Lua cache to speed up load times
|
||||
Plug 'https://github.com/lewis6991/impatient.nvim'
|
||||
|
||||
" lsp-zero begin
|
||||
" LSP Support
|
||||
Plug 'neovim/nvim-lspconfig'
|
||||
Plug 'williamboman/mason.nvim'
|
||||
Plug 'williamboman/mason-lspconfig.nvim'
|
||||
|
||||
" Autocompletion
|
||||
Plug 'hrsh7th/nvim-cmp'
|
||||
Plug 'hrsh7th/cmp-buffer'
|
||||
Plug 'hrsh7th/cmp-path'
|
||||
Plug 'saadparwaiz1/cmp_luasnip'
|
||||
Plug 'hrsh7th/cmp-nvim-lsp'
|
||||
Plug 'hrsh7th/cmp-nvim-lua'
|
||||
|
||||
" Snippets
|
||||
Plug 'L3MON4D3/LuaSnip'
|
||||
|
||||
" Snippet collection (Optional)
|
||||
Plug 'rafamadriz/friendly-snippets'
|
||||
Plug 'VonHeikemen/lsp-zero.nvim'
|
||||
" lsp-zero end
|
||||
call plug#end()
|
||||
|
||||
" Lua Setup
|
||||
" ==============================================================================
|
||||
lua <<EOF
|
||||
require('impatient')
|
||||
|
||||
-- LSP Setup
|
||||
-- ===========================================================================
|
||||
local lsp = require('lsp-zero')
|
||||
lsp.preset('recommended')
|
||||
lsp.setup()
|
||||
|
||||
-- Treesitter
|
||||
-- ===========================================================================
|
||||
-- TODO: 2022-06-19 Treesitter is too slow on large C++ files
|
||||
-- require('nvim-treesitter.configs').setup {
|
||||
-- ensure_installed = { "c", "cpp" }, -- A list of parser names, or "all"
|
||||
-- sync_install = false, -- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
-- ignore_install = { }, -- List of parsers to ignore installing (for "all")
|
||||
|
||||
-- highlight = {
|
||||
-- enable = false, -- `false` will disable the whole extension
|
||||
|
||||
-- -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
||||
-- -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||
-- -- the name of the parser)
|
||||
-- -- list of language that will be disabled
|
||||
-- disable = { },
|
||||
|
||||
-- -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- -- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- -- Instead of true it can also be a list of languages
|
||||
-- additional_vim_regex_highlighting = false,
|
||||
-- },
|
||||
-- }
|
||||
|
||||
-- Vim Options
|
||||
-- ===========================================================================
|
||||
vim.opt.autowrite=true -- Automatically save before cmds like :next and :prev
|
||||
vim.opt.colorcolumn={80, 100} -- Set a 80 and 100 char column ruler
|
||||
vim.opt.completeopt={'menu', 'menuone', 'noselect'}
|
||||
vim.opt.cpoptions:append('$') -- $ as end marker for the change operator
|
||||
vim.opt.cursorline=true -- Highlight current line
|
||||
vim.opt.expandtab=true -- Replace tabs with spaces
|
||||
vim.opt.guifont={'JetBrains_Mono:h9',
|
||||
'Consolas:h9',
|
||||
'InputMonoCondensed:h9'}
|
||||
vim.opt.hlsearch=false -- Highlight just the first match on search
|
||||
vim.opt.ignorecase=true -- Search is not case sensitive
|
||||
vim.opt.linebreak=true -- On wrapped lines, break on the wrapping word intelligently
|
||||
vim.opt.list=true -- Show the 'listchar' characters on trailing spaces, tabs e.t.c
|
||||
vim.opt.listchars:append('tab:>-,trail:■,extends:»,precedes:«')
|
||||
vim.opt.number=true -- Show line numbers
|
||||
vim.opt.relativenumber=true -- Show relative line numbers
|
||||
vim.opt.shiftwidth=4 -- Number of spaces for each autoindent step
|
||||
vim.opt.splitright=true -- Open new splits to the right of the current one
|
||||
vim.opt.swapfile=false -- Disable swapfile (stores the things changed in a file)
|
||||
vim.opt.textwidth=80 -- On format, format to 80 char long lines
|
||||
vim.opt.visualbell=true -- Flash the screen on error
|
||||
vim.opt.wrap=false -- Don't wrap lines of text automatically
|
||||
vim.opt.signcolumn = 'no'
|
||||
|
||||
vim.diagnostic.config({
|
||||
-- Turn off the diagnostics signs on the line number. In LSP mode, editing
|
||||
-- a C++ buffer constantly toggles the sign column on and off as you change
|
||||
-- modes which is very visually distracting.
|
||||
signs = false,
|
||||
})
|
||||
|
||||
-- Check if there were args (i.e. opened file), non-empty buffer, or started in insert mode
|
||||
if vim.fn.argc() == 0 or vim.fn.line2byte("$") ~= -1 and not opt.insertmode then
|
||||
local ascii = {
|
||||
"",
|
||||
" Useful Bindings (Normal Mode)",
|
||||
" --------------------------------------------------",
|
||||
" <Ctrl+n> to open the file tree explorer",
|
||||
" <Ctrl+i> clang format selected lines",
|
||||
" <Ctrl+j> jump to next compilation error",
|
||||
" <Ctrl+k> jump to prev compilation error",
|
||||
" <cd> change working directory to current file",
|
||||
" <\\s> split buffer vertically",
|
||||
"",
|
||||
" Abolish (Text Substitution in Normal Mode)",
|
||||
" --------------------------------------------------",
|
||||
" %S/facilit{y,ies}/building{,s}/g Convert facility->building, facilities->buildings",
|
||||
" %S/action/sleep/g Convert action to sleep, (preserve case sensitivity ACTION->SLEEP, action->sleep) ",
|
||||
"",
|
||||
" FZF (Normal Mode)",
|
||||
" --------------------------------------------------",
|
||||
" <\\h> vim command history",
|
||||
" <\\f> find files",
|
||||
" <\\g> search for text (via ripgrep)",
|
||||
" <\\tt> search for tag (global)",
|
||||
" <\\tb> search for tag (buffer)",
|
||||
" <\\cc> search for commit (global)",
|
||||
" <\\cb> search for commit (buffer)",
|
||||
" <\\b> search for buffer",
|
||||
"",
|
||||
" Autocompletion (nvim-cmp in Normal Mode)",
|
||||
" --------------------------------------------------",
|
||||
" <Enter> Confirms selection.",
|
||||
" <Ctrl-y> Confirms selection.",
|
||||
" <Up> Navigate to previous item on the list.",
|
||||
" <Down> Navigate to the next item on the list.",
|
||||
" <Ctrl-p> Navigate to previous item on the list.",
|
||||
" <Ctrl-n> Navigate to the next item on the list.",
|
||||
" <Ctrl-u> Scroll up in the item's documentation.",
|
||||
" <Ctrl-f> Scroll down in the item's documentation.",
|
||||
" <Ctrl-e> Toggles the completion.",
|
||||
" <Ctrl-d> Go to the next placeholder in the snippet.",
|
||||
" <Ctrl-b> Go to the previous placeholder in the snippet.",
|
||||
" <Tab> Enables completion when the cursor is inside a word. If the completion menu is visible it will navigate to the next item in the list.",
|
||||
" <Shift-Tab> When the completion menu is visible navigate to the previous item in the list.",
|
||||
"",
|
||||
" LSP Bindings (Normal Mode)",
|
||||
" --------------------------------------------------",
|
||||
" <Shift-K> Displays hover information about the symbol under the cursor in a floating window. See help vim.lsp.buf.hover().",
|
||||
" gd Jumps to the definition of the symbol under the cursor. See help vim.lsp.buf.definition().",
|
||||
" gD Jumps to the declaration of the symbol under the cursor. Some servers don't implement this feature. See help vim.lsp.buf.declaration().",
|
||||
" gi Lists all the implementations for the symbol under the cursor in the quickfix window. See help vim.lsp.buf.implementation().",
|
||||
" go Jumps to the definition of the type of the symbol under the cursor. See help vim.lsp.buf.type_definition().",
|
||||
" gr Lists all the references to the symbol under the cursor in the quickfix window. See help vim.lsp.buf.references().",
|
||||
" <Ctrl-k> Displays signature information about the symbol under the cursor in a floating window. See help vim.lsp.buf.signature_help(). If a mapping already exists for this key this function is not bound.",
|
||||
" <F2> Renames all references to the symbol under the cursor. See help vim.lsp.buf.rename().",
|
||||
" <F4> Selects a code action available at the current cursor position. See help vim.lsp.buf.code_action().",
|
||||
" gl Show diagnostics in a floating window. See :help vim.diagnostic.open_float().",
|
||||
" [d Move to the previous diagnostic in the current buffer. See :help vim.diagnostic.goto_prev().",
|
||||
" ]d Move to the next diagnostic. See :help vim.diagnostic.goto_next()."
|
||||
}
|
||||
|
||||
local height = vim.api.nvim_get_option("lines")
|
||||
local width = vim.api.nvim_get_option("columns")
|
||||
local ascii_rows = #ascii
|
||||
local ascii_cols = #ascii[1]
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
local buf = vim.api.nvim_create_buf(true, true)
|
||||
|
||||
local function reset_start_screen()
|
||||
vim.cmd("enew")
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
vim.api.nvim_buf_set_option(buf, "modifiable", true)
|
||||
vim.api.nvim_buf_set_option(buf, "buflisted", true)
|
||||
vim.api.nvim_buf_set_option(buf, "buflisted", true)
|
||||
end
|
||||
|
||||
vim.api.nvim_buf_set_lines(buf, 0, -1, false, ascii)
|
||||
vim.api.nvim_buf_set_option(buf, "modified", false)
|
||||
vim.api.nvim_buf_set_option(buf, "buflisted", false)
|
||||
vim.api.nvim_buf_set_option(buf, "bufhidden", "wipe")
|
||||
vim.api.nvim_buf_set_option(buf, "buftype", "nofile")
|
||||
vim.api.nvim_buf_set_option(buf, "swapfile", false)
|
||||
vim.api.nvim_set_current_buf(buf)
|
||||
|
||||
vim.api.nvim_create_autocmd("InsertEnter,WinEnter", {
|
||||
pattern = "<buffer>",
|
||||
callback = reset_start_screen,
|
||||
})
|
||||
end
|
||||
|
||||
EOF
|
||||
|
||||
" Theme
|
||||
" ==============================================================================
|
||||
let g:gruvbox_material_background='hard'
|
||||
let g:gruvbox_material_foreground='mix'
|
||||
let g:gruvbox_material_disable_italic_comment=1
|
||||
let g:gruvbox_material_enable_italic=0
|
||||
let g:gruvbox_material_enable_bold=0
|
||||
let g:gruvbox_material_diagnostic_virtual_text='colored'
|
||||
let g:gruvbox_material_better_performance=1
|
||||
colorscheme gruvbox-material
|
||||
|
||||
" Vim-cpp-modern customisation
|
||||
" Disable function highlighting (affects both C and C++ files)
|
||||
let g:cpp_function_highlight = 1
|
||||
|
||||
" Enable highlighting of C++11 attributes
|
||||
let g:cpp_attributes_highlight = 1
|
||||
|
||||
" Highlight struct/class member variables (affects both C and C++ files)
|
||||
let g:cpp_member_highlight = 0
|
||||
|
||||
" Put all standard C and C++ keywords under Vim's highlight group 'Statement'
|
||||
" (affects both C and C++ files)
|
||||
let g:cpp_simple_highlight = 1
|
||||
|
||||
" Options
|
||||
" ==============================================================================
|
||||
" Show EOL type and last modified timestamp, right after the filename
|
||||
set statusline=%<%F%h%m%r\ [%{&ff}]\ (%{strftime(\"%H:%M\ %d/%m/%Y\",getftime(expand(\"%:p\")))})%=%l,%c%V\ %P
|
||||
|
||||
" Resize splits when the window is resized
|
||||
au VimResized * :wincmd =
|
||||
|
||||
" File patterns to ignore in command line auto complete
|
||||
set wildignore+=*.class,*.o
|
||||
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe,*.obj,*.vcxproj,*.pdb,*.idb
|
||||
|
||||
" Setup undo file
|
||||
set undofile
|
||||
let &undodir=stdpath('config') . '/undo'
|
||||
|
||||
" Setup backup directory
|
||||
let &backupdir=stdpath('config') . '/backup'
|
||||
|
||||
" Enable mouse support
|
||||
if has('mouse')
|
||||
set mouse=a
|
||||
endif
|
||||
|
||||
" Functions
|
||||
" ==============================================================================
|
||||
" Increase font size using (Ctrl+Up Arrow) or (Ctrl+Down Arrow) if we are using
|
||||
" gvim Otherwise font size is determined in terminal
|
||||
nnoremap <C-Up> :silent! let &guifont = substitute(
|
||||
\ &guifont,
|
||||
\ ':h\zs\d\+',
|
||||
\ '\=eval(submatch(0)+1)',
|
||||
\ 'g')<CR>
|
||||
nnoremap <C-Down> :silent! let &guifont = substitute(
|
||||
\ &guifont,
|
||||
\ ':h\zs\d\+',
|
||||
\ '\=eval(submatch(0)-1)',
|
||||
\ 'g')<CR>
|
||||
|
||||
" Formatting options (see :h fo-table)
|
||||
augroup persistent_settings
|
||||
au!
|
||||
au bufenter * :set formatoptions=q1j
|
||||
augroup end
|
||||
|
||||
" FZF
|
||||
" ==============================================================================
|
||||
" Empty value to disable preview window altogether
|
||||
let g:fzf_preview_window = []
|
||||
|
||||
" Prefix all commands with Fzf for discoverability
|
||||
let g:fzf_command_prefix = 'Fzf'
|
||||
|
||||
" - down / up / left / right
|
||||
let g:fzf_layout = { 'down': '40%' }
|
||||
|
||||
" Add "FzfCustomRG" command which reinitializes
|
||||
function! RipgrepFzf(query, fullscreen)
|
||||
let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case -- %s || true'
|
||||
let initial_command = printf(command_fmt, shellescape(a:query))
|
||||
let reload_command = printf(command_fmt, '{q}')
|
||||
let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
|
||||
call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
|
||||
endfunction
|
||||
|
||||
command! -nargs=* -bang FzfCustomRG call RipgrepFzf(<q-args>, <bang>0)
|
||||
|
||||
" Augment the "FzfCustomFiles" command
|
||||
command! -bang -nargs=? -complete=dir FzfCustomFiles
|
||||
\ call fzf#vim#files(<q-args>, {'options': ['--layout=reverse', '--info=inline', '--preview', 'cat {}']}, <bang>0)
|
||||
|
||||
" General Key Bindings
|
||||
" ==============================================================================
|
||||
" Telescope Bindings
|
||||
nnoremap <leader>h <cmd>FzfHistory<cr>
|
||||
nnoremap <leader>f <cmd>FzfCustomFiles<cr>
|
||||
nnoremap <leader>g <cmd>FzfCustomRG<cr>
|
||||
nnoremap <leader>tt <cmd>FzfTags<cr>
|
||||
nnoremap <leader>tb <cmd>FzfBTags<cr>
|
||||
nnoremap <leader>cc <cmd>FzfCommits<cr>
|
||||
nnoremap <leader>cb <cmd>FzfBCommits<cr>
|
||||
nnoremap <leader>b <cmd>FzfBuffers<cr>
|
||||
|
||||
" Map Ctrl+HJKL to navigate buffer window
|
||||
nmap <silent> <C-h> :wincmd h<CR>
|
||||
nmap <silent> <C-j> :wincmd j<CR>
|
||||
nmap <silent> <C-k> :wincmd k<CR>
|
||||
nmap <silent> <C-l> :wincmd l<CR>
|
||||
|
||||
" Move by wrapped lines instead of line numbers
|
||||
nnoremap j gj
|
||||
nnoremap k gk
|
||||
nnoremap gj j
|
||||
nnoremap gk k
|
||||
|
||||
" Map NERDTree to Ctrl-N
|
||||
map <C-n> :NERDTreeToggle<CR>
|
||||
|
||||
" Change to current buffer's directory
|
||||
nmap cd :cd <C-R>=expand("%:p:h")<CR><CR>
|
||||
|
||||
" Buffer Splitting
|
||||
nnoremap <leader>s :vs<CR>
|
||||
|
||||
" Go to next error
|
||||
" Go to previous error
|
||||
nnoremap <A-j> :cn<CR>
|
||||
nnoremap <A-k> :cp<CR>
|
||||
|
||||
" Clang Format
|
||||
" ==============================================================================
|
||||
map <C-I> :py3file ~/clang-format.py<CR>
|
||||
|
||||
" Compiler Error Formats
|
||||
" ==============================================================================
|
||||
" Error message formats thanks to
|
||||
" https://forums.handmadehero.org/index.php/forum?view=topic&catid=4&id=704#3982
|
||||
set errorformat+=\\\ %#%f(%l\\\,%c):\ %m " MSVC: MSBuild
|
||||
set errorformat+=\\\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %m " MSVC: cl.exe
|
||||
set errorformat+=\\\ %#%t%nxx:\ %m " MSVC: cl.exe, fatal errors is crudely implemented
|
||||
set errorformat+=\\\ %#LINK\ :\ %m " MSVC: link.exe, can't find link library badly implemented
|
||||
set errorformat+=\\\ %#%s\ :\ error\ %m " MSVC: link.exe, errors is badly implemented
|
||||
set errorformat+=\\\ %#%s\ :\ fatal\ error\ %m " MSVC: link.exe, fatal errors is badly implemented
|
||||
set errorformat+=\\\ %#%f(%l\\\,%c-%*[0-9]):\ %#%t%[A-z]%#\ %m " MSVC: HLSL fxc.exe
|
||||
set errorformat+=%\\%%(CTIME%\\)%\\@=%m " ctime.exe -stats
|
||||
|
||||
" Vim Dispatch
|
||||
" ==============================================================================
|
||||
let s:running_windows = has("win16") || has("win32") || has("win64")
|
||||
if s:running_windows
|
||||
set makeprg=build
|
||||
nnoremap <f5> :Make ./build.bat<cr>
|
||||
else
|
||||
" Set vim terminal to enter normal mode using escape like normal vim behaviour
|
||||
tnoremap <Esc> <C-\><C-n>
|
||||
nnoremap <f5> :Make ./build.sh<cr>
|
||||
set makeprg=./build.sh
|
||||
endif
|
@ -1,243 +0,0 @@
|
||||
" ==============================================================================
|
||||
" Plugins
|
||||
" ==============================================================================
|
||||
let s:running_windows = has("win16") || has("win32") || has("win64")
|
||||
silent! call plug#begin('~/.vim/plugged')
|
||||
|
||||
Plug 'https://github.com/ervandew/supertab'
|
||||
Plug 'https://github.com/scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
|
||||
Plug 'https://github.com/tpope/vim-fugitive'
|
||||
Plug 'https://github.com/bfrg/vim-cpp-modern'
|
||||
Plug 'https://github.com/skywind3000/asyncrun.vim'
|
||||
Plug 'https://github.com/junegunn/fzf'
|
||||
Plug 'https://github.com/junegunn/fzf.vim'
|
||||
Plug 'https://github.com/Tetralux/odin.vim'
|
||||
|
||||
" Themes
|
||||
Plug 'https://github.com/tomasr/molokai'
|
||||
Plug 'https://github.com/roosta/vim-srcery'
|
||||
Plug 'https://github.com/morhetz/gruvbox'
|
||||
|
||||
call plug#end()
|
||||
|
||||
" ==============================================================================
|
||||
" Settings
|
||||
" ==============================================================================
|
||||
set nocompatible
|
||||
set autowrite " Automatically save before commands like :next and :make
|
||||
set autoread " Auto reload changed files
|
||||
set backspace=2 " Backspace like most programs in insert mode
|
||||
set hidden " Allow more than one modified buffer to be left without saving
|
||||
set incsearch " Do incremental searching
|
||||
set ignorecase " Search isn't case sensitive
|
||||
set lazyredraw " Redraw the screen less often
|
||||
set nowrap " No softwrapping by default
|
||||
set splitright " Open new v-splits to the right
|
||||
set showcmd " Display incomplete commands
|
||||
set vb " Turn on screen flash which is quieter than audio bell
|
||||
set wildmenu " Allow vim command-line autocompletion
|
||||
set wildmode=full " Specifies option for wildmenu
|
||||
set expandtab " Turn tabs into spaces
|
||||
set noswapfile " Disable swapfile
|
||||
set cscopetag " Search both cscopes db and tags file"
|
||||
|
||||
" Ignore files in commandline autocomplete
|
||||
set wildignore+=*.class,*.o
|
||||
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe,*.obj,*.vcxproj,*.pdb,*.idb
|
||||
|
||||
" Undo Settings
|
||||
silent! set undofile " Save undo history to file
|
||||
set undolevels=1000 " Maximum number of undos that can be done
|
||||
let &undodir=expand("~/.vim/undodir") " Set location to save undo files
|
||||
|
||||
" Create the undo history folder if it doesn't exist
|
||||
if !isdirectory(expand(&undodir))
|
||||
call mkdir(expand(&undodir), "p")
|
||||
endif
|
||||
|
||||
" ==============================================================================
|
||||
" Appearance
|
||||
" ==============================================================================
|
||||
syntax on " syntax highlighting
|
||||
set autoindent " Always use autoindent
|
||||
set background=dark " Some themes use this indicator to theme themselves
|
||||
set colorcolumn=80,100 " Set a 80, 100 char column marker
|
||||
set cpoptions+=$ " $ as end marker for the change operator
|
||||
set cursorline " Highlight current line
|
||||
set encoding=utf-8 " Consistent character encoding
|
||||
set fileformats=unix,dos
|
||||
" <z+o> opens a fold at the cursor.
|
||||
" <z,Shift+o> opens all folds at the cursor.
|
||||
" <z,c> closes a fold at the cursor.
|
||||
" <z,m> increases the foldlevel by one.
|
||||
" <z,Shift+m> closes all open folds.
|
||||
" <z,r> decreases the foldlevel by one.
|
||||
" <z,Shift+r> decreases the foldlevel to zero -- all folds will be open.
|
||||
set foldlevelstart=99 " Initially all folds open
|
||||
set foldmethod=indent " Allow folding of
|
||||
set foldnestmax=20 " Maximum number of nested folds
|
||||
set guioptions=menu " remove extra gui elements
|
||||
set laststatus=2 " always show status bar
|
||||
set linebreak " When wrapping lines, don't break words
|
||||
set list " Show 'listchar' characters
|
||||
set number " Show line numbers
|
||||
set relativenumber " Show relative line numbers
|
||||
set ruler " show the cursor position all the time
|
||||
set shiftwidth=4 " Number of space chars for indentation
|
||||
set showmatch " automatically show matching brackets. works like it does in bbedit.
|
||||
set smartindent
|
||||
set smarttab " Make 'tab' insert indents at the beginning of a line
|
||||
set tabstop=4 " Number of space chars for pressing tab
|
||||
set textwidth=80 " Always format to 80 chars
|
||||
set listchars=tab:>-
|
||||
|
||||
" Show EOL type and last modified timestamp, right after the filename
|
||||
set statusline=%<%F%h%m%r\ [%{&ff}]\ (%{strftime(\"%H:%M\ %d/%m/%Y\",getftime(expand(\"%:p\")))})%=%l,%c%V\ %P
|
||||
|
||||
" Resize splits when the window is resized
|
||||
au VimResized * :wincmd =
|
||||
|
||||
" ==============================================================================
|
||||
" Theme
|
||||
" ==============================================================================
|
||||
let g:gruvbox_contrast_dark='hard'
|
||||
let g:gruvbox_italic=0
|
||||
let g:gruvbox_bold=0
|
||||
colorscheme gruvbox
|
||||
|
||||
" NOTE(doyle): Some list chars in gui don't show correctly in terminal so separate logic
|
||||
" old listchars=tab:>-,eol:¬,trail:■,extends:»,precedes:«
|
||||
set listchars+=trail:■,extends:»,precedes:«
|
||||
if s:running_windows
|
||||
set guifont=JetBrains_Mono:h9,Consolas:h9
|
||||
else
|
||||
set guifont=InputMonoCondensed:h9
|
||||
endif
|
||||
|
||||
" Don't show trailing spaces in insert mode
|
||||
augroup trailing
|
||||
au!
|
||||
au InsertEnter * :set listchars-=trail:■
|
||||
au InsertLeave * :set listchars+=trail:■
|
||||
augroup END
|
||||
|
||||
" Increase font size using (Ctrl+Up Arrow) or (Ctrl+Down Arrow) if we are using
|
||||
" gvim Otherwise font size is determined in terminal
|
||||
nnoremap <C-Up> :silent! let &guifont = substitute(
|
||||
\ &guifont,
|
||||
\ ':h\zs\d\+',
|
||||
\ '\=eval(submatch(0)+1)',
|
||||
\ 'g')<CR>
|
||||
nnoremap <C-Down> :silent! let &guifont = substitute(
|
||||
\ &guifont,
|
||||
\ ':h\zs\d\+',
|
||||
\ '\=eval(submatch(0)-1)',
|
||||
\ 'g')<CR>
|
||||
|
||||
" Formatting options (see :h fo-table)
|
||||
augroup persistent_settings
|
||||
au!
|
||||
au BufEnter * :set formatoptions=q1j
|
||||
augroup END
|
||||
|
||||
" ==============================================================================
|
||||
" Key Bindings
|
||||
" ==============================================================================
|
||||
" Enable mouse support
|
||||
if has('mouse')
|
||||
set mouse=a
|
||||
endif
|
||||
|
||||
" Map Ctrl+HJKL to navigate buffer window
|
||||
nmap <silent> <C-h> :wincmd h<CR>
|
||||
nmap <silent> <C-j> :wincmd j<CR>
|
||||
nmap <silent> <C-k> :wincmd k<CR>
|
||||
nmap <silent> <C-l> :wincmd l<CR>
|
||||
|
||||
" Move by wrapped lines instead of line numbers
|
||||
nnoremap j gj
|
||||
nnoremap k gk
|
||||
nnoremap gj j
|
||||
nnoremap gk k
|
||||
|
||||
" Map NERDTree to Ctrl-N
|
||||
map <C-n> :NERDTreeToggle<CR>
|
||||
|
||||
" Change to current buffer's directory
|
||||
nmap cd :cd <C-R>=expand("%:p:h")<CR><CR>
|
||||
|
||||
" Buffer Splitting
|
||||
nnoremap <leader>s :vs<CR>
|
||||
|
||||
" Go to next error
|
||||
" Go to previous error
|
||||
nnoremap <A-n> :cn<CR>
|
||||
nnoremap <A-p> :cp<CR>
|
||||
|
||||
" ==============================================================================
|
||||
" FZF
|
||||
" ==============================================================================
|
||||
nnoremap <leader>f :FzfFiles
|
||||
nnoremap <leader>t :FzfTags<CR>
|
||||
nnoremap <leader>r :FzfRg
|
||||
nnoremap <leader>b :FzfBuffers<CR>
|
||||
nnoremap <leader>l :FzfLines<CR>
|
||||
|
||||
" Empty value to disable preview window altogether
|
||||
let g:fzf_preview_window = []
|
||||
|
||||
" Prefix all commands with Fzf for discoverability
|
||||
let g:fzf_command_prefix = 'Fzf'
|
||||
|
||||
" - down / up / left / right
|
||||
let g:fzf_layout = { 'down': '40%' }
|
||||
|
||||
" ==============================================================================
|
||||
" Clang Format
|
||||
" ==============================================================================
|
||||
map <C-I> :py3file ~/.vim/clang-format.py<CR>
|
||||
|
||||
" ==============================================================================
|
||||
" Compiling / AsyncRun
|
||||
" ==============================================================================
|
||||
" Asyncrun open quickfix window up to 10 lines
|
||||
let g:asyncrun_open = 10
|
||||
|
||||
" Error message formats thanks to
|
||||
" https://forums.handmadehero.org/index.php/forum?view=topic&catid=4&id=704#3982
|
||||
set errorformat+=\\\ %#%f(%l\\\,%c):\ %m " MSVC: MSBuild
|
||||
set errorformat+=\\\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %m " MSVC: cl.exe
|
||||
set errorformat+=\\\ %#%t%nxx:\ %m " MSVC: cl.exe, fatal errors is crudely implemented
|
||||
set errorformat+=\\\ %#LINK\ :\ %m " MSVC: link.exe, can't find link library badly implemented
|
||||
set errorformat+=\\\ %#%s\ :\ error\ %m " MSVC: link.exe, errors is badly implemented
|
||||
set errorformat+=\\\ %#%s\ :\ fatal\ error\ %m " MSVC: link.exe, fatal errors is badly implemented
|
||||
set errorformat+=\\\ %#%f(%l\\\,%c-%*[0-9]):\ %#%t%[A-z]%#\ %m " MSVC: HLSL fxc.exe
|
||||
set errorformat+=%\\%%(CTIME%\\)%\\@=%m " ctime.exe -stats
|
||||
|
||||
if s:running_windows
|
||||
set makeprg=build
|
||||
nnoremap <f5> :AsyncRun ./build.bat<cr>
|
||||
else
|
||||
" Set vim terminal to enter normal mode using escape like normal vim behaviour
|
||||
tnoremap <Esc> <C-\><C-n>
|
||||
nnoremap <f5> :AsyncRun ./build.sh<cr>
|
||||
set makeprg=./build.sh
|
||||
endif
|
||||
|
||||
" ==============================================================================
|
||||
" Other
|
||||
" ==============================================================================
|
||||
" Reload vimrc when it's edited
|
||||
augroup myvimrc
|
||||
au!
|
||||
au BufWritePost $MYVIMRC so $MYVIMRC
|
||||
augroup end
|
||||
|
||||
" Return to the same line when a file is reopened
|
||||
augroup line_return
|
||||
au!
|
||||
au BufReadPost *
|
||||
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||||
\ execute 'normal! g`"zvzz' |
|
||||
\ endif
|
||||
augroup end
|
@ -1,12 +0,0 @@
|
||||
local wezterm = require 'wezterm';
|
||||
|
||||
if wezterm.target_triple == "x86_64-pc-windows-msvc" then
|
||||
clink_bat = string.format("%s\\..\\binaries\\clink.bat", wezterm.executable_dir)
|
||||
default_prog = {"cmd.exe", "/s", "/k", clink_bat, "inject", "-q"}
|
||||
end
|
||||
|
||||
return {
|
||||
font_size = 10.0,
|
||||
color_scheme = "Peppermint",
|
||||
default_prog = default_prog
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
This downloads standalone 64-bit MSVC compiler, linker & other tools, also headers/libraries from Windows SDK into portable folder, without installing Visual Studio. Has bare minimum components - no UWP/Store/WindowsRT stuff, just files & tools for 64-bit native desktop app development.
|
||||
|
||||
Run `python.exe portable-msvc.py` and it will download output into `msvc` folder. By default it will download latest available MSVC & Windows SDK - currently v14.32.17.2 and v10.0.22621.0.
|
||||
|
||||
You can list available versions with `python.exe portable-msvc.py --show-versions` and then pass versions you want with `--msvc-version` and `--sdk-version` arguments.
|
||||
|
||||
To use cl.exe/link.exe from output folder, first run `setup.bat` - after that PATH/INCLUDE/LIB env variables will be setup to use all the tools as usual. You can also use clang-cl.exe with these includes & libraries.
|
||||
|
||||
To use clang-cl.exe without running setup.bat, pass extra `/winsysroot msvc` argument (msvc is folder name where output is stored).
|
@ -1,288 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import shutil
|
||||
import hashlib
|
||||
import zipfile
|
||||
import tempfile
|
||||
import argparse
|
||||
import subprocess
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
OUTPUT = Path("msvc") # output folder
|
||||
|
||||
# other architectures may work or may not - not really tested
|
||||
HOST = "x64" # or x86
|
||||
TARGET = "x64" # or x86, arm, arm64
|
||||
|
||||
MANIFEST_URL = "https://aka.ms/vs/17/release/channel"
|
||||
|
||||
|
||||
def download(url):
|
||||
with urllib.request.urlopen(url) as res:
|
||||
return res.read()
|
||||
|
||||
def download_progress(url, check, name, f):
|
||||
data = io.BytesIO()
|
||||
with urllib.request.urlopen(url) as res:
|
||||
total = int(res.headers["Content-Length"])
|
||||
size = 0
|
||||
while True:
|
||||
block = res.read(1<<20)
|
||||
if not block:
|
||||
break
|
||||
f.write(block)
|
||||
data.write(block)
|
||||
size += len(block)
|
||||
perc = size * 100 // total
|
||||
print(f"\r{name} ... {perc}%", end="")
|
||||
print()
|
||||
data = data.getvalue()
|
||||
digest = hashlib.sha256(data).hexdigest()
|
||||
if check.lower() != digest:
|
||||
exit(f"Hash mismatch for f{pkg}")
|
||||
return data
|
||||
|
||||
# super crappy msi format parser just to find required .cab files
|
||||
def get_msi_cabs(msi):
|
||||
index = 0
|
||||
while True:
|
||||
index = msi.find(b".cab", index+4)
|
||||
if index < 0:
|
||||
return
|
||||
yield msi[index-32:index+4].decode("ascii")
|
||||
|
||||
def first(items, cond):
|
||||
return next(item for item in items if cond(item))
|
||||
|
||||
|
||||
### parse command-line arguments
|
||||
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--show-versions", const=True, action="store_const", help="Show available MSVC and Windows SDK versions")
|
||||
ap.add_argument("--accept-license", const=True, action="store_const", help="Automatically accept license")
|
||||
ap.add_argument("--msvc-version", help="Get specific MSVC version")
|
||||
ap.add_argument("--sdk-version", help="Get specific Windows SDK version")
|
||||
args = ap.parse_args()
|
||||
|
||||
|
||||
### get main manifest
|
||||
|
||||
manifest = json.loads(download(MANIFEST_URL))
|
||||
|
||||
|
||||
### download VS manifest
|
||||
|
||||
vs = first(manifest["channelItems"], lambda x: x["id"] == "Microsoft.VisualStudio.Manifests.VisualStudio")
|
||||
payload = vs["payloads"][0]["url"]
|
||||
|
||||
vsmanifest = json.loads(download(payload))
|
||||
|
||||
|
||||
### find MSVC & WinSDK versions
|
||||
|
||||
packages = {}
|
||||
for p in vsmanifest["packages"]:
|
||||
packages.setdefault(p["id"].lower(), []).append(p)
|
||||
|
||||
msvc = {}
|
||||
sdk = {}
|
||||
|
||||
for pid,p in packages.items():
|
||||
if pid.startswith("Microsoft.VisualStudio.Component.VC.".lower()) and pid.endswith(".x86.x64".lower()):
|
||||
pver = ".".join(pid.split(".")[4:6])
|
||||
if pver[0].isnumeric():
|
||||
msvc[pver] = pid
|
||||
elif pid.startswith("Microsoft.VisualStudio.Component.Windows10SDK.".lower()) or \
|
||||
pid.startswith("Microsoft.VisualStudio.Component.Windows11SDK.".lower()):
|
||||
pver = pid.split(".")[-1]
|
||||
if pver.isnumeric():
|
||||
sdk[pver] = pid
|
||||
|
||||
if args.show_versions:
|
||||
print("MSVC versions:", " ".join(sorted(msvc.keys())))
|
||||
print("Windows SDK versions:", " ".join(sorted(sdk.keys())))
|
||||
exit(0)
|
||||
|
||||
msvc_ver = args.msvc_version or max(sorted(msvc.keys()))
|
||||
sdk_ver = args.sdk_version or max(sorted(sdk.keys()))
|
||||
|
||||
if msvc_ver in msvc:
|
||||
msvc_pid = msvc[msvc_ver]
|
||||
msvc_ver = ".".join(msvc_pid.split(".")[4:-2])
|
||||
else:
|
||||
exit(f"Unknown MSVC version: f{args.msvc_version}")
|
||||
|
||||
if sdk_ver in sdk:
|
||||
sdk_pid = sdk[sdk_ver]
|
||||
else:
|
||||
exit(f"Unknown Windows SDK version: f{args.sdk_version}")
|
||||
|
||||
print(f"Downloading MSVC v{msvc_ver} and Windows SDK v{sdk_ver}")
|
||||
|
||||
|
||||
### agree to license
|
||||
|
||||
tools = first(manifest["channelItems"], lambda x: x["id"] == "Microsoft.VisualStudio.Product.BuildTools")
|
||||
resource = first(tools["localizedResources"], lambda x: x["language"] == "en-us")
|
||||
license = resource["license"]
|
||||
|
||||
if not args.accept_license:
|
||||
accept = input(f"Do you accept Visual Studio license at {license} [Y/N] ? ")
|
||||
if not accept or accept[0].lower() != "y":
|
||||
exit(0)
|
||||
|
||||
OUTPUT.mkdir(exist_ok=True)
|
||||
total_download = 0
|
||||
|
||||
### download MSVC
|
||||
|
||||
msvc_packages = [
|
||||
# MSVC binaries
|
||||
f"microsoft.vc.{msvc_ver}.tools.host{HOST}.target{TARGET}.base",
|
||||
f"microsoft.vc.{msvc_ver}.tools.host{HOST}.target{TARGET}.res.base",
|
||||
# MSVC headers
|
||||
f"microsoft.vc.{msvc_ver}.crt.headers.base",
|
||||
# MSVC libs
|
||||
f"microsoft.vc.{msvc_ver}.crt.{TARGET}.desktop.base",
|
||||
f"microsoft.vc.{msvc_ver}.crt.{TARGET}.store.base",
|
||||
# MSVC runtime source
|
||||
f"microsoft.vc.{msvc_ver}.crt.source.base",
|
||||
# ASAN
|
||||
f"microsoft.vc.{msvc_ver}.asan.headers.base",
|
||||
f"microsoft.vc.{msvc_ver}.asan.{TARGET}.base",
|
||||
# MSVC redist
|
||||
#f"microsoft.vc.{msvc_ver}.crt.redist.x64.base",
|
||||
]
|
||||
|
||||
for pkg in msvc_packages:
|
||||
p = first(packages[pkg], lambda p: p.get("language") in (None, "en-US"))
|
||||
for payload in p["payloads"]:
|
||||
with tempfile.TemporaryFile() as f:
|
||||
data = download_progress(payload["url"], payload["sha256"], pkg, f)
|
||||
total_download += len(data)
|
||||
with zipfile.ZipFile(f) as z:
|
||||
for name in z.namelist():
|
||||
if name.startswith("Contents/"):
|
||||
out = OUTPUT / Path(name).relative_to("Contents")
|
||||
out.parent.mkdir(parents=True, exist_ok=True)
|
||||
out.write_bytes(z.read(name))
|
||||
|
||||
|
||||
### download Windows SDK
|
||||
|
||||
sdk_packages = [
|
||||
# Windows SDK tools (like rc.exe & mt.exe)
|
||||
f"Windows SDK for Windows Store Apps Tools-x86_en-us.msi",
|
||||
# Windows SDK headers
|
||||
f"Windows SDK for Windows Store Apps Headers-x86_en-us.msi",
|
||||
f"Windows SDK Desktop Headers x86-x86_en-us.msi",
|
||||
# Windows SDK libs
|
||||
f"Windows SDK for Windows Store Apps Libs-x86_en-us.msi",
|
||||
f"Windows SDK Desktop Libs {TARGET}-x86_en-us.msi",
|
||||
# CRT headers & libs
|
||||
f"Universal CRT Headers Libraries and Sources-x86_en-us.msi",
|
||||
# CRT redist
|
||||
#"Universal CRT Redistributable-x86_en-us.msi",
|
||||
]
|
||||
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
dst = Path(d)
|
||||
|
||||
sdk_pkg = packages[sdk_pid][0]
|
||||
sdk_pkg = packages[first(sdk_pkg["dependencies"], lambda x: True).lower()][0]
|
||||
|
||||
msi = []
|
||||
cabs = []
|
||||
|
||||
# download msi files
|
||||
for pkg in sdk_packages:
|
||||
payload = first(sdk_pkg["payloads"], lambda p: p["fileName"] == f"Installers\\{pkg}")
|
||||
msi.append(dst / pkg)
|
||||
with open(dst / pkg, "wb") as f:
|
||||
data = download_progress(payload["url"], payload["sha256"], pkg, f)
|
||||
total_download += len(data)
|
||||
cabs += list(get_msi_cabs(data))
|
||||
|
||||
# download .cab files
|
||||
for pkg in cabs:
|
||||
payload = first(sdk_pkg["payloads"], lambda p: p["fileName"] == f"Installers\\{pkg}")
|
||||
with open(dst / pkg, "wb") as f:
|
||||
download_progress(payload["url"], payload["sha256"], pkg, f)
|
||||
|
||||
print("Unpacking msi files...")
|
||||
|
||||
# run msi installers
|
||||
for m in msi:
|
||||
subprocess.check_call(["msiexec.exe", "/a", m, "/quiet", "/qn", f"TARGETDIR={OUTPUT.resolve()}"])
|
||||
|
||||
|
||||
### versions
|
||||
|
||||
msvcv = list((OUTPUT / "VC/Tools/MSVC").glob("*"))[0].name
|
||||
sdkv = list((OUTPUT / "Windows Kits/10/bin").glob("*"))[0].name
|
||||
|
||||
|
||||
# place debug CRT runtime into MSVC folder (not what real Visual Studio installer does... but is reasonable)
|
||||
|
||||
dst = str(OUTPUT / "VC/Tools/MSVC" / msvcv / f"bin/Host{HOST}/{TARGET}")
|
||||
|
||||
pkg = "microsoft.visualcpp.runtimedebug.14"
|
||||
dbg = packages[pkg][0]
|
||||
payload = first(dbg["payloads"], lambda p: p["fileName"] == "cab1.cab")
|
||||
try:
|
||||
with tempfile.TemporaryFile(suffix=".cab", delete=False) as f:
|
||||
data = download_progress(payload["url"], payload["sha256"], pkg, f)
|
||||
total_download += len(data)
|
||||
subprocess.check_call(["expand.exe", f.name, "-F:*", dst], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
finally:
|
||||
os.unlink(f.name)
|
||||
|
||||
|
||||
### cleanup
|
||||
|
||||
shutil.rmtree(OUTPUT / "Common7", ignore_errors=True)
|
||||
for f in ["Auxiliary", f"lib/{TARGET}/store", f"lib/{TARGET}/uwp"]:
|
||||
shutil.rmtree(OUTPUT / "VC/Tools/MSVC" / msvcv / f)
|
||||
for f in OUTPUT.glob("*.msi"):
|
||||
f.unlink()
|
||||
for f in ["Catalogs", "DesignTime", f"bin/{sdkv}/chpe", f"Lib/{sdkv}/ucrt_enclave"]:
|
||||
shutil.rmtree(OUTPUT / "Windows Kits/10" / f, ignore_errors=True)
|
||||
for arch in ["x86", "x64", "arm", "arm64"]:
|
||||
if arch != TARGET:
|
||||
shutil.rmtree(OUTPUT / "VC/Tools/MSVC" / msvcv / f"bin/Host{arch}", ignore_errors=True)
|
||||
shutil.rmtree(OUTPUT / "Windows Kits/10/bin" / sdkv / arch)
|
||||
shutil.rmtree(OUTPUT / "Windows Kits/10/Lib" / sdkv / "ucrt" / arch)
|
||||
shutil.rmtree(OUTPUT / "Windows Kits/10/Lib" / sdkv / "um" / arch)
|
||||
|
||||
|
||||
### setup.bat
|
||||
|
||||
SETUP = f"""@echo off
|
||||
|
||||
set ROOT=%~dp0
|
||||
|
||||
set MSVC_VERSION={msvcv}
|
||||
set MSVC_HOST=Host{HOST}
|
||||
set MSVC_ARCH={TARGET}
|
||||
set SDK_VERSION={sdkv}
|
||||
set SDK_ARCH={TARGET}
|
||||
|
||||
set MSVC_ROOT=%ROOT%VC\\Tools\\MSVC\\%MSVC_VERSION%
|
||||
set SDK_INCLUDE=%ROOT%Windows Kits\\10\\Include\\%SDK_VERSION%
|
||||
set SDK_LIBS=%ROOT%Windows Kits\\10\\Lib\\%SDK_VERSION%
|
||||
|
||||
set VCToolsInstallDir=%MSVC_ROOT%\\
|
||||
set PATH=%MSVC_ROOT%\\bin\\%MSVC_HOST%\\%MSVC_ARCH%;%ROOT%Windows Kits\\10\\bin\\%SDK_VERSION%\\%SDK_ARCH%;%ROOT%Windows Kits\\10\\bin\\%SDK_VERSION%\\%SDK_ARCH%\\ucrt;%PATH%
|
||||
set INCLUDE=%MSVC_ROOT%\\include;%SDK_INCLUDE%\\ucrt;%SDK_INCLUDE%\\shared;%SDK_INCLUDE%\\um;%SDK_INCLUDE%\\winrt;%SDK_INCLUDE%\\cppwinrt
|
||||
set LIB=%MSVC_ROOT%\\lib\\%MSVC_ARCH%;%SDK_LIBS%\\ucrt\\%SDK_ARCH%;%SDK_LIBS%\\um\\%SDK_ARCH%
|
||||
"""
|
||||
|
||||
(OUTPUT / "setup.bat").write_text(SETUP)
|
||||
|
||||
print(f"Total downloaded: {total_download>>20} MB")
|
||||
print("Done!")
|
Binary file not shown.
0
Installer/unix_build_template.sh → Internal/unix_build_template.sh
Executable file → Normal file
0
Installer/unix_build_template.sh → Internal/unix_build_template.sh
Executable file → Normal file
0
Installer/unix_gcc_build.sh → Internal/unix_gcc_build.sh
Executable file → Normal file
0
Installer/unix_gcc_build.sh → Internal/unix_gcc_build.sh
Executable file → Normal file
Loading…
Reference in New Issue
Block a user