Merge branch 'master' of github.com:Doy-lee/doy-lee

This commit is contained in:
doyle 2023-01-20 09:21:03 +11:00
commit e27ceebe21
11 changed files with 1768 additions and 682 deletions

View File

@ -1,37 +1,459 @@
{
AccessModifierOffset: -4, # 1 tab
AlignAfterOpenBracket: true,
AlignConsecutiveAssignments: true,
AlignConsecutiveDeclarations: true,
AlignTrailingComments: true,
AllowAllParametersOfDeclarationOnNextLine: true,
AllowShortBlocksOnASingleLine: false,
AllowShortIfStatementsOnASingleLine: true,
AllowShortLoopsOnASingleLine: false,
AllowShortCaseLabelsOnASingleLine: true,
AlwaysBreakAfterDefinitionReturnType: false,
AlwaysBreakBeforeMultilineStrings: true,
AlwaysBreakTemplateDeclarations: true,
BinPackArguments: false,
BinPackParameters: false,
BreakBeforeBraces: Allman,
BreakConstructorInitializersBeforeComma: true,
ColumnLimit: 120,
ConstructorInitializerIndentWidth: 0,
Cpp11BracedListStyle: true,
IndentCaseLabels: true,
IndentFunctionDeclarationAfterType: false,
IndentWidth: 4, # 1 tab
MaxEmptyLinesToKeep: 1,
NamespaceIndentation: None,
PointerBindsToType: false,
SpaceBeforeAssignmentOperators: true,
SpaceInEmptyParentheses: false,
SpacesBeforeTrailingComments: 1,
SpacesInAngles: false,
SpacesInCStyleCastParentheses: false,
SpacesInParentheses: false,
SpacesInSquareBrackets: false,
Standard: Cpp11,
TabWidth: 4,
}
---
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 doesnt 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 calls 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]
---

View File

@ -5,30 +5,20 @@ call plug#begin(stdpath('config') . '/plugged')
" 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'
" Telescope file picker, sorter and previewer
Plug 'https://github.com/nvim-lua/plenary.nvim'
Plug 'https://github.com/nvim-telescope/telescope.nvim'
Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
" FZF
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
" nvim-lspconfig sets up sane defaults for LSP servers (i.e. clangd)
" nvim-cmp is a more powerful autocomplete engine
" LuaSnip allow writing snippets into the buffer, we can power the snippets from LSP
" cmp-nvim-lsp preset capability flags to request more powerful autocomplete from LSP server
" cmp_luasnip a LuaSnip addon that provides a completion source to nvim-cmp
" cmp-buffer provides a buffer completion source to nvim-cmp
" cmp-path provides a path completion source to nvim-cmp
Plug 'https://github.com/neovim/nvim-lspconfig'
Plug 'https://github.com/hrsh7th/nvim-cmp'
Plug 'https://github.com/L3MON4D3/LuaSnip'
Plug 'https://github.com/hrsh7th/cmp-nvim-lsp'
Plug 'https://github.com/saadparwaiz1/cmp_luasnip'
Plug 'https://github.com/hrsh7th/cmp-buffer'
Plug 'https://github.com/hrsh7th/cmp-path'
" FZF for LSP
Plug 'gfanto/fzf-lsp.nvim'
Plug 'nvim-lua/plenary.nvim'
" odin for syntax highlighting
Plug 'https://github.com/Tetralux/odin.vim'
@ -36,35 +26,65 @@ call plug#begin(stdpath('config') . '/plugged')
" 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')
require('telescope').load_extension('fzf')
require('telescope').setup {
defaults = {
layout_config = {
horizontal = { width = 0.95 }
},
mappings = {
i = {
["<C-j>"] = require('telescope.actions').move_selection_next,
["<C-k>"] = require('telescope.actions').move_selection_previous,
},
n = {
["<C-j>"] = require('telescope.actions').move_selection_next,
["<C-k>"] = require('telescope.actions').move_selection_previous,
},
},
},
pickers = {
find_files = {
find_command = { "fd", "--unrestricted", "--strip-cwd-prefix" }
},
}
}
-- 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
-- ===========================================================================
@ -90,6 +110,7 @@ lua <<EOF
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
@ -98,123 +119,97 @@ lua <<EOF
signs = false,
})
-- LSP Setup
-- ===========================================================================
-- Load the additional capabilities supported by nvim-cmp
local custom_capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
-- 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()."
}
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local custom_on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
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)
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap=true, silent=true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '<A-n>', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<A-p>', vim.diagnostic.goto_prev, opts)
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
-- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap=true, silent=true, buffer=bufnr }
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gs', vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', 'ga', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', 'gR', vim.lsp.buf.rename, bufopts)
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
-- Request additional completion capabilities from the LSP server(s)
local lspconfig = require('lspconfig')
-- Clangd LSP Setup
-- ===========================================================================
lspconfig.clangd.setup {
on_attach = custom_on_attach,
capabilities = custom_capabilities,
single_file_support = false, --- Don't launch LSP if the directory does not have LSP metadata
}
lspconfig.cmake.setup {
on_attach = custom_on_attach,
capabilities = custom_capabilities,
}
-- Autocomplete Setup
-- ===========================================================================
local luasnip = require 'luasnip'
local cmp = require 'cmp'
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
cmp.setup {
snippet = {
expand = function(args) luasnip.lsp_expand(args.body) end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
completion = { autocomplete = false },
mapping = cmp.mapping.preset.insert({
['<C-d>'] = cmp.mapping.scroll_docs(4),
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-k>'] = cmp.mapping.scroll_docs(-1), -- Scroll the docs up by 1 line
['<C-j>'] = cmp.mapping.scroll_docs(1), -- Scroll the docs down by 1 line
['<CR>'] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, },
['<Tab>'] = cmp.mapping(function(fallback) -- Move down the autocomplete list
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback) -- Move up the autocomplete list
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
}),
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'buffer' },
},
}
-- 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,
-- },
-- }
EOF
" Theme
@ -287,20 +282,43 @@ augroup persistent_settings
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>f <cmd>Telescope find_files<cr>
nnoremap <leader>g <cmd>Telescope live_grep<cr>
nnoremap <leader>ta <cmd>Telescope tags<cr>
nnoremap <leader>te <cmd>Telescope<cr>
nnoremap <leader>b <cmd>Telescope buffers<cr>
nnoremap <leader>h <cmd>Telescope help_tags<cr>
nnoremap gf <cmd>Telescope lsp_dynamic_workspace_symbols<cr>
nnoremap gd <cmd>Telescope lsp_definitions<cr>
nnoremap gt <cmd>Telescope lsp_type_definitions<cr>
nnoremap gr <cmd>Telescope lsp_references<cr>
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>
@ -328,17 +346,6 @@ nnoremap <leader>s :vs<CR>
nnoremap <A-j> :cn<CR>
nnoremap <A-k> :cp<CR>
" 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%' }
" Clang Format
" ==============================================================================
map <C-I> :py3file ~/clang-format.py<CR>

View File

@ -0,0 +1,30 @@
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
compiler_list=(gcc clang)
for compiler in "${compiler_list[@]}"
do
version_list=()
if [[ "${compiler}" == "gcc" ]]; then
version_list+=(12.1.0)
version_list+=(11.3.0)
version_list+=(9.5.0)
cxx_compiler=g++
c_compiler=gcc
elif [[ "${compiler}" == "clang" ]]; then
version_list+=(14.0.0)
cxx_compiler=clang++
c_compiler=clang
fi
for version in "${version_list[@]}"
do
if [[ "${compiler}" == "gcc" ]];then
cmake_flags="-D CMAKE_BUILD_RPATH='/home/doyle/Developer/Tools/gcc-mostlyportable/gcc-mostlyportable-${version}/usr/lib64/'"
fi
build_dir=${script_dir}/build/${compiler}-${version}
done
cp --force ${build_dir}/compile_commands.json .
done

20
Installer/unix_gcc_build.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
for gcc_version in "$@"
do
image_name=mostlyportable-gcc-image
container_name=mostlyportable-gcc
docker build -t ${image_name} --build-arg GCC_VERSION=${gcc_version} . || exit
docker container rm ${container_name} > /dev/null 2>&1
docker create --name ${container_name} ${image_name} || exit
mkdir --parent build || exit
docker cp ${container_name}:/usr/local/docker/mostlyportable-gcc/mostly-built/gcc-mostlyportable-${gcc_version} . || exit
docker container rm ${container_name} || exit
done
if [[ $EUID == 0 ]]; then
chown --recursive ${USER} gcc-mostlyportable-*
fi

View File

@ -0,0 +1,43 @@
FROM ubuntu:16.04 as builder
RUN set -ex \
&& apt-get update \
&& apt-get --no-install-recommends --yes install \
apt-transport-https \
eatmydata \
ca-certificates
# Build tools
RUN set -ex \
&& apt-get update \
&& eatmydata apt-get --no-install-recommends --yes install \
build-essential \
g++-multilib \
git \
libgmp-dev \
libz-dev \
m4 \
schedtool \
texinfo \
texlive \
wget
WORKDIR /usr/local/docker
ARG MOSTLY_PORTABLE_GCC_GIT_BRANCH=master
RUN set -ex \
&& git clone https://github.com/Frogging-Family/mostlyportable-gcc \
&& cd mostlyportable-gcc \
&& git checkout $MOSTLY_PORTABLE_GIT_BRANCH
ARG GCC_VERSION=11.3.0
ARG BIN_UTILS_VERSION=2.38
RUN set -ex \
&& cd mostlyportable-gcc \
&& sed --in-place "s/^_use_gcc_git=\".*\"$/_use_gcc_git=\"false\"/" mostlyportable-gcc.cfg \
&& sed --in-place "s/^_gcc_version=\".*\"$/_gcc_version=\"$GCC_VERSION\"/" mostlyportable-gcc.cfg \
&& sed --in-place "s/^_use_binutils_git=\".*\"$/_use_binutils_git=\"false\"/" mostlyportable-gcc.cfg \
&& sed --in-place "s/^_binutils=.*$/_binutils=$BIN_UTILS_VERSION/" mostlyportable-gcc.cfg \
&& sed --in-place "s/^_use_isl_git=\".*\"$/_use_isl_git=\"false\"/" mostlyportable-gcc.cfg \
&& sed --in-place -E "s/^(\s*)(.*)_ldconfmostlyportable;$/\1_ldconfmostlyportable=\"n\"/" mostlyportable-gcc.sh \
&& ./mostlyportable-gcc.sh gcc

View File

@ -1,6 +1,6 @@
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.31 and v10.0.22000.0.
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.

View File

@ -180,6 +180,7 @@ sdk_packages = [
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",
@ -281,8 +282,7 @@ set INCLUDE=%MSVC_ROOT%\\include;%SDK_INCLUDE%\\ucrt;%SDK_INCLUDE%\\shared;%SDK_
set LIB=%MSVC_ROOT%\\lib\\%MSVC_ARCH%;%SDK_LIBS%\\ucrt\\%SDK_ARCH%;%SDK_LIBS%\\um\\%SDK_ARCH%
"""
with open(OUTPUT / "setup.bat", "w") as f:
print(SETUP, file=f)
(OUTPUT / "setup.bat").write_text(SETUP)
print(f"Total downloaded: {total_download>>20} MB")
print("Done!")

Binary file not shown.

View File

@ -53,6 +53,11 @@ mkdir --parents ${bin_dir}
# Tools
# ------------------------------------------------------------------------------
if ! command -v docker &> /dev/null
then
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
fi
# CMake
# ----------------------------------------------------------------------------
@ -60,15 +65,18 @@ cmake_sha256=aaced6f745b86ce853661a595bdac6c5314a60f8181b6912a0a4920acfa32708
cmake_exe_sha256=95b80ba2b97b619abce1ed6fd28fe189cacba48403e9c69256f2f94e3405e645
cmake_version=3.23.2
cmake_download_name=cmake-${cmake_version}-linux-x86_64
cmake_download_file=${cmake_download_name}.tar.gz
cmake_download_path=${downloads_dir}/${cmake_download_file}
cmake_label=cmake_linux64_${cmake_version}
cmake_download_file=${downloads_dir}/${cmake_label}.tar.gz
cmake_dir=${tools_dir}/${cmake_label}
cmake_exe=${cmake_dir}/bin/cmake
if [[ ! -f "${cmake_exe}" ]]; then
DownloadFile "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-${cmake_version}-linux-x86_64.tar.gz" "${cmake_download_file}" || exit
FileSHA256Check "${cmake_download_file}" "${cmake_sha256}" || exit
mkdir --parents "${cmake_dir}" && tar xf "${cmake_download_file}" --skip-old-files --directory="${cmake_dir}" || exit
DownloadFile "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/${cmake_download_file}" "${cmake_download_path}" || exit
FileSHA256Check "${cmake_download_path}" "${cmake_sha256}" || exit
mkdir --parents "${cmake_dir}" && tar xf "${cmake_download_path}" --skip-old-files --directory="${cmake_dir}" || exit
mv ${cmake_dir}/cmake-${cmake_version}-linux-x86_64/* "${cmake_dir}" || exit
rm --recursive ${cmake_dir}/cmake-${cmake_version}-linux-x86_64 || exit
fi
@ -84,26 +92,79 @@ fd_sha256=a1e72cf4f4fbd1b061387569678f3ab3555ee1cf025280b3ce6b2eee96cd3210
fd_exe_sha256=057bea03a6f17eb99ea3b11c25a110880b012d2d5110988e80b1ce2ee6536342
fd_version=8.4.0
fd_label=fd_linux64_${fd_version}
fd_download_label=fd-v${fd_version}-x86_64-unknown-linux-gnu
fd_download_file=${downloads_dir}/${fd_download_label}.tar.gz
fd_dir=${tools_dir}/${fd_label}
fd_download_name=fd-v${fd_version}-x86_64-unknown-linux-gnu
fd_download_file=${fd_download_name}.tar.gz
fd_download_path=${downloads_dir}/${fd_download_file}
fd_dir=${tools_dir}/fd_linux64_${fd_version}
fd_exe=${fd_dir}/fd
if [[ ! -f "${fd_exe}" ]]; then
DownloadFile "https://github.com/sharkdp/fd/releases/download/v${fd_version}/${fd_download_label}.tar.gz" "${fd_download_file}" || exit
FileSHA256Check "${fd_download_file}" "${fd_sha256}" || exit
mkdir --parents "${fd_dir}" && tar xf "${fd_download_file}" --skip-old-files --directory="${fd_dir}" || exit
mv ${fd_dir}/${fd_download_label}/* "${fd_dir}" || exit
rm --recursive ${fd_dir}/${fd_download_label} || exit
DownloadFile "https://github.com/sharkdp/fd/releases/download/v${fd_version}/${fd_download_file}" "${fd_download_path}" || exit
FileSHA256Check "${fd_download_path}" "${fd_sha256}" || exit
mkdir --parents "${fd_dir}" && tar xf "${fd_download_path}" --skip-old-files --directory="${fd_dir}" || exit
mv ${fd_dir}/${fd_download_name}/* "${fd_dir}" || exit
rm --recursive ${fd_dir}/${fd_download_name} || exit
fi
FileSHA256Check "${fd_exe}" "${fd_exe_sha256}" || exit
ln --force --symbolic --relative "${fd_exe}" "${bin_dir}"
# GCC
# ------------------------------------------------------------------------------
gcc_dir=${tools_dir}/gcc-mostlyportable
gcc_version_list=()
gcc_version_list+=(6.5.0)
gcc_version_list+=(7.5.0)
gcc_version_list+=(8.5.0)
gcc_version_list+=(9.5.0)
gcc_version_list+=(10.4.0)
gcc_version_list+=(11.3.0)
gcc_version_list+=(12.1.0)
mkdir --parents "${gcc_dir}"
cp "${installer_dir}/unix_gcc_build.sh" "${gcc_dir}/build.sh"
cp "${installer_dir}/unix_gcc_dockerfile" "${gcc_dir}/Dockerfile"
cd "${gcc_dir}" || exit
for gcc_version in ${gcc_version_list[@]}; do
gcc_root_dir=${gcc_dir}/gcc-mostlyportable-${gcc_version}
gcc_bin_dir=${gcc_root_dir}/bin
if [[ ! -f "${gcc_bin_dir}/g++" ]]; then
./build.sh ${gcc_version} || exit
fi
# Symbolic link the versioned gcc executables
ln --symbolic --force --relative ${gcc_bin_dir}/g++ ${bin_dir}/g++-${gcc_version} || exit
ln --symbolic --force --relative ${gcc_bin_dir}/gcc ${bin_dir}/gcc-${gcc_version} || exit
# Create script that setups the environment path for building with a versioned GCC
gcc_script_name=g++-${gcc_version}-vars.sh
gcc_script_path=${gcc_dir}/${gcc_script_name}
echo "gcc_mostlyportable_dir=\"${gcc_root_dir}\" \\" > ${gcc_script_path}
echo "PATH=\${gcc_mostlyportable_dir}/bin:\${PATH} \\" >> ${gcc_script_path}
echo "LD_LIBRARY_PATH=\${gcc_mostlyportable_dir}/lib:\${LD_LIBRARY_PATH} \\" >> ${gcc_script_path}
echo "LD_LIBRARY_PATH=\${gcc_mostlyportable_dir}/lib64:\${LD_LIBRARY_PATH} \\" >> ${gcc_script_path}
echo "\$@" >> ${gcc_script_path}
chmod +x ${gcc_script_path}
# Symbolic link the script to load the GCC environment
ln --symbolic --force --relative ${gcc_script_path} ${bin_dir}/gcc-${gcc_version}-vars.sh || exit
done
ln --symbolic --force --relative "${gcc_bin_dir}/g++" "${bin_dir}/g++" || exit
ln --symbolic --force --relative "${gcc_bin_dir}/gcc" "${bin_dir}/gcc" || exit
cd "${root_dir}" || exit
# LLVM/Clang
# ------------------------------------------------------------------------------
llvm_version_list=(11.1.0 12.0.1 13.0.1 14.0.0)
llvm_version_list=()
llvm_version_list+=(11.1.0)
llvm_version_list+=(12.0.1)
llvm_version_list+=(13.0.1)
llvm_version_list+=(14.0.0)
for llvm_version in ${llvm_version_list[@]}; do
llvm_sha256=none
@ -111,37 +172,39 @@ for llvm_version in ${llvm_version_list[@]}; do
if [[ "${llvm_version}" == "14.0.0" ]]; then
llvm_sha256=61582215dafafb7b576ea30cc136be92c877ba1f1c31ddbbd372d6d65622fef5
llvm_exe_sha256=3557c2deadae7e2bc3bffce4afd93ddab6ef50090971c8ce3bf15c80b27134a0
llvm_download_label=clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu-18.04
llvm_download_name=clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu-18.04
elif [[ "${llvm_version}" == "13.0.1" ]]; then
llvm_sha256=84a54c69781ad90615d1b0276a83ff87daaeded99fbc64457c350679df7b4ff0
llvm_exe_sha256=ae47e6cc9f6d95f7a39e4800e511b7bdc3f55464ca79e45cd63cbd8a862a82a1
llvm_download_label=clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu-18.04
llvm_download_name=clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu-18.04
elif [[ "${llvm_version}" == "12.0.1" ]]; then
llvm_sha256=6b3cc55d3ef413be79785c4dc02828ab3bd6b887872b143e3091692fc6acefe7
llvm_exe_sha256=329bba976c0cef38863129233a4b0939688eae971c7a606d41dd0e5a53d53455
llvm_download_label=clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu-16.04
llvm_download_name=clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu-16.04
elif [[ "${llvm_version}" == "11.1.0" ]]; then
llvm_sha256=c691a558967fb7709fb81e0ed80d1f775f4502810236aa968b4406526b43bee1
llvm_exe_sha256=656bfde194276cee81dc8a7a08858313c5b5bdcfa18ac6cd6116297af2f65148
llvm_download_label=clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu-16.04
llvm_download_name=clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu-16.04
fi
llvm_download_file=${downloads_dir}/${llvm_download_label}.tar.xz
llvm_label=llvm_linux64_${llvm_version}
llvm_dir=${tools_dir}/${llvm_label}
llvm_download_file=${llvm_download_name}.tar.xz
llvm_download_path=${downloads_dir}/${llvm_download_name}.tar.xz
llvm_dir=${tools_dir}/llvm_linux64_${llvm_version}
llvm_exe=${llvm_dir}/bin/clang
if [[ ! -f "${llvm_exe}" ]]; then
DownloadFile "https://github.com/llvm/llvm-project/releases/download/llvmorg-${llvm_version}/${llvm_download_label}.tar.xz" "${llvm_download_file}" || exit
FileSHA256Check "${llvm_download_file}" "${llvm_sha256}" || exit
mkdir --parents "${llvm_dir}" && tar xf "${llvm_download_file}" --skip-old-files --directory="${llvm_dir}" || exit
DownloadFile "https://github.com/llvm/llvm-project/releases/download/llvmorg-${llvm_version}/${llvm_download_file}" "${llvm_download_path}" || exit
FileSHA256Check "${llvm_download_path}" "${llvm_sha256}" || exit
mkdir --parents "${llvm_dir}" && tar xf "${llvm_download_path}" --skip-old-files --directory="${llvm_dir}" || exit
if [[ "${llvm_version}" == "12.0.1" ]]; then
# NOTE: There was a distribution bug in v12.0.1 where the folder was misnamed
mv ${llvm_dir}/clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu-/* ${llvm_dir} || exit
rm --recursive ${llvm_dir}/clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu || exit
rm --recursive ${llvm_dir}/clang+llvm-${llvm_version}-x86_64-linux-gnu-ubuntu- || exit
else
mv ${llvm_dir}/${llvm_download_label}/* ${llvm_dir} || exit
rm --recursive ${llvm_dir}/${llvm_download_label} || exit
mv ${llvm_dir}/${llvm_download_name}/* ${llvm_dir} || exit
rm --recursive ${llvm_dir}/${llvm_download_name} || exit
fi
fi
FileSHA256Check "${llvm_exe}" "${llvm_exe_sha256}" || exit
@ -150,6 +213,24 @@ done
cd "${llvm_dir}/bin" && find . -type f,l -exec ln --force --symbolic --relative "{}" "${bin_dir}/" ';' && cd "${root_dir}"
# gf
# ------------------------------------------------------------------------------
gf_dir=${tools_dir}/gf
if [[ ! -d "${gf_dir}" ]]; then
git clone https://github.com/nakst/gf "${tools_dir}/gf" || exit
fi
cd "${tools_dir}/gf" || exit
git checkout master
# Use our custom G++ because I typically run Ubuntu 18.04 which uses G++7
# which is too old to compile GF.
#PATH=${gcc_bin_dir}:${PATH} ./build.sh || exit
#ln --force --symbolic --relative "gf2" "${bin_dir}"
cd "${root_dir}"
# Vim Configuration
# ------------------------------------------------------------------------------
cp --force ${installer_dir}/os_vimrc ~/.vimrc || exit
@ -166,13 +247,39 @@ vim_plug=${vim_plug_dir}/plug.vim
mkdir --parents ${vim_plug_dir}
DownloadFile "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" "${vim_plug}" || exit
# nodejs
# ----------------------------------------------------------------------------
nodejs_sha256=f0867d7a17a4d0df7dbb7df9ac3f9126c2b58f75450647146749ef296b31b49b
nodejs_exe_sha256=8fdc420e870ef9aa87dc8c1b7764fccb8229b6896f112b699afeeefeb0021714
nodejs_version=16.17.0
nodejs_download_name=node-v${nodejs_version}-linux-x64
nodejs_download_file=${nodejs_download_name}.tar.xz
nodejs_download_path=${downloads_dir}/${nodejs_download_file}
nodejs_dir=${tools_dir}/nodejs_linux64_${nodejs_version}
nodejs_exe=${nodejs_dir}/bin/node
if [[ ! -f "${nodejs_exe}" ]]; then
DownloadFile "https://nodejs.org/dist/v${nodejs_version}/${nodejs_download_file}" ${nodejs_download_path} || exit
FileSHA256Check ${nodejs_download_path} ${nodejs_sha256} || exit
mkdir --parents "${nodejs_dir}" && tar xf "${nodejs_download_path}" --skip-old-files --directory="${nodejs_dir}" || exit
mv ${nodejs_dir}/${nodejs_download_name}/* "${nodejs_dir}" || exit
rm --recursive ${nodejs_dir}/${nodejs_download_name}
fi
FileSHA256Check ${nodejs_exe} ${nodejs_exe_sha256} || exit
ln --force --symbolic --relative "${nodejs_exe}" "${bin_dir}/node" || exit
ln --force --symbolic --relative "${nodejs_dir}/bin/npm" "${bin_dir}/npm" || exit
# Nvim
# ------------------------------------------------------------------------------
nvim_sha256=33b5d020c730b6d1b5185b1306ead83b6b8f8fab0239e0580c72b5224a9658e1
nvim_version=0.7.2
nvim_label=nvim_linux64_${nvim_version}
nvim_exe=${tools_dir}/${nvim_label}.appimage
nvim_exe=${tools_dir}/nvim_linux64_${nvim_version}.AppImage
DownloadFile "https://github.com/neovim/neovim/releases/download/v${nvim_version}/nvim.appimage" "${nvim_exe}" || exit
FileSHA256Check "${nvim_exe}" "${nvim_sha256}" || exit
@ -187,16 +294,18 @@ neovide_sha256=684cbcaeb2e67f1d95822ef80e03e1475395d537f2032f47b8202fe48c428b08
neovide_exe_sha256=e4fbc8b56af2e25127938ae2974921e25b4df5722086d7e8c3e517e8ee86e2df
neovide_version=0.9.0
neovide_label=neovide_linux64_${neovide_version}
neovide_download_file=${downloads_dir}/${neovide_label}.tar.gz
neovide_download_name=neovide
neovide_download_file=${neovide_download_name}.tar.gz
neovide_download_path=${downloads_dir}/${neovide_download_name}.tar.gz
neovide_dir=${tools_dir}
neovide_exe=${neovide_dir}/${neovide_label}
neovide_exe=${neovide_dir}/neovide_linux64_${neovide_version}
if [[ ! -f "${neovide_exe}" ]]; then
DownloadFile "https://github.com/neovide/neovide/releases/download/${neovide_version}/neovide.tar.gz" ${neovide_download_file} || exit
FileSHA256Check ${neovide_download_file} ${neovide_sha256} || exit
DownloadFile "https://github.com/neovide/neovide/releases/download/${neovide_version}/${neovide_download_file}" ${neovide_download_path} || exit
FileSHA256Check ${neovide_download_path} ${neovide_sha256} || exit
mkdir --parents "${cmake_dir}" && tar xf ${neovide_download_file} --skip-old-files --directory=${neovide_dir}/neovide-tmp || exit
mkdir --parents ${neovide_dir}/neovide-tmp && tar xf ${neovide_download_path} --skip-old-files --directory=${neovide_dir}/neovide-tmp || exit
mv ${neovide_dir}/neovide-tmp/target/release/neovide "${neovide_exe}" || exit
rm -rf ${neovide_dir}/neovide-tmp
fi
@ -210,16 +319,17 @@ python_sha256=460f87a389be28c953c24c6f942f172f9ce7f331367b4daf89cb450baedd51d7
python_exe_sha256=1400cb8f2cf2f606d1c87c1edb69ea1b3479b4c2bfb5c438a4828903a1d6f9f8
python_version=3.10.5
python_label=python_linux64_${python_version}
python_download_label=cpython-${python_version}+20220630-x86_64-unknown-linux-gnu-install_only
python_download_file=${downloads_dir}/${python_download_label}.tar.gz
python_dir=${tools_dir}/${python_label}
python_download_name=cpython-${python_version}+20220630-x86_64-unknown-linux-gnu-install_only
python_download_file=${python_download_name}.tar.gz
python_download_path=${downloads_dir}/${python_download_file}
python_dir=${tools_dir}/python_linux64_${python_version}
python_exe=${python_dir}/bin/python3
if [[ ! -f "${python_exe}" ]]; then
DownloadFile "https://github.com/indygreg/python-build-standalone/releases/download/20220630/${python_download_label}.tar.gz" "${python_download_file}" || exit
FileSHA256Check "${python_download_file}" "${python_sha256}" || exit
mkdir --parents "${python_dir}" && tar xf "${python_download_file}" --skip-old-files --directory="${python_dir}" || exit
DownloadFile "https://github.com/indygreg/python-build-standalone/releases/download/20220630/${python_download_file}" "${python_download_path}" || exit
FileSHA256Check "${python_download_path}" "${python_sha256}" || exit
mkdir --parents "${python_dir}" && tar xf "${python_download_path}" --skip-old-files --directory="${python_dir}" || exit
mv --force ${python_dir}/python/* "${python_dir}" || exit
rm --recursive ${python_dir}/python || exit
fi
@ -238,18 +348,19 @@ ripgrep_sha256=ee4e0751ab108b6da4f47c52da187d5177dc371f0f512a7caaec5434e711c091
ripgrep_exe_sha256=4ef156371199b3ddac1bf584e0e52b1828279af82e4ea864b4d9c816adb5db40
ripgrep_version=13.0.0
ripgrep_label=ripgrep_linux64_${ripgrep_version}
ripgrep_download_label=ripgrep-${ripgrep_version}-x86_64-unknown-linux-musl
ripgrep_download_file=${downloads_dir}/${ripgrep_download_label}.tar.gz
ripgrep_dir=${tools_dir}/${ripgrep_label}
ripgrep_download_name=ripgrep-${ripgrep_version}-x86_64-unknown-linux-musl
ripgrep_download_file=${ripgrep_download_name}.tar.gz
ripgrep_download_path=${downloads_dir}/${ripgrep_download_file}
ripgrep_dir=${tools_dir}/ripgrep_linux64_${ripgrep_version}
ripgrep_exe=${ripgrep_dir}/rg
if [[ ! -f "${ripgrep_exe}" ]]; then
DownloadFile "https://github.com/BurntSushi/ripgrep/releases/download/${ripgrep_version}/${ripgrep_download_label}.tar.gz" "${ripgrep_download_file}" || exit
FileSHA256Check "${ripgrep_download_file}" "${ripgrep_sha256}" || exit
mkdir --parents "${ripgrep_dir}" && tar xf "${ripgrep_download_file}" --skip-old-files --directory="${ripgrep_dir}" || exit
mv ${ripgrep_dir}/${ripgrep_download_label}/* "${ripgrep_dir}" || exit
rm --recursive ${ripgrep_dir}/${ripgrep_download_label} || exit
DownloadFile "https://github.com/BurntSushi/ripgrep/releases/download/${ripgrep_version}/${ripgrep_download_file}" "${ripgrep_download_path}" || exit
FileSHA256Check "${ripgrep_download_path}" "${ripgrep_sha256}" || exit
mkdir --parents "${ripgrep_dir}" && tar xf "${ripgrep_download_path}" --skip-old-files --directory="${ripgrep_dir}" || exit
mv ${ripgrep_dir}/${ripgrep_download_name}/* "${ripgrep_dir}" || exit
rm --recursive ${ripgrep_dir}/${ripgrep_download_name} || exit
fi
FileSHA256Check "${ripgrep_exe}" "${ripgrep_exe_sha256}" || exit
@ -260,11 +371,11 @@ ln --force --symbolic --relative "${ripgrep_exe}" "${bin_dir}"
wezterm_sha256=4de3cd65b7d7ae0c72a691597bd3def57c65f07fe4a7c98b447b8a9dc4d0adf0
wezterm_version=20220624-141144-bd1b7c5d
wezterm_label=wezterm_linux64_${wezterm_version}
wezterm_download_label=WezTerm-${wezterm_version}-Ubuntu18.04
wezterm_exe=${tools_dir}/${wezterm_label}.AppImage
wezterm_download_name=WezTerm-${wezterm_version}-Ubuntu18.04
wezterm_download_file=${wezterm_download_name}.AppImage
wezterm_exe=${tools_dir}/wezterm_linux64_${wezterm_version}.AppImage
DownloadFile "https://github.com/wez/wezterm/releases/download/${wezterm_version}/${wezterm_download_label}.AppImage" "${wezterm_exe}" || exit
DownloadFile "https://github.com/wez/wezterm/releases/download/${wezterm_version}/${wezterm_download_file}" ${wezterm_exe} || exit
FileSHA256Check "${wezterm_exe}" "${wezterm_sha256}" || exit
chmod +x "${wezterm_exe}"
@ -279,7 +390,7 @@ chmod +x ${bin_dir}/ctags_cpp.sh
# Linux Terminal
# ------------------------------------------------------------------------------
echo \#!/usr/bin/env bash> ${tools_dir}/linux_terminal.sh
echo PATH=${tools_dir}/Binaries>> ${tools_dir}/linux_terminal.sh
echo PATH=${tools_dir}/Binaries:\$\{PATH\}>> ${tools_dir}/linux_terminal.sh
echo PATH=\$\{PATH\}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin>> ${tools_dir}/linux_terminal.sh
echo [[ -d /usr/lib/wsl/lib ]] \&\& PATH=\$\{PATH\}:/usr/lib/wsl/lib>> ${tools_dir}/linux_terminal.sh
echo [[ -d /snap/bin ]] \&\& PATH=\$\{PATH\}:/snap/bin>> ${tools_dir}/linux_terminal.sh

View File

@ -1,6 +1,6 @@
@echo off
setlocal EnableDelayedExpansion
REM Win Helpers - Version 3
REM Win Helpers - Version 11
call %*
goto exit
@ -40,6 +40,7 @@ exit /B 0
:Unzip
REM call win_helpers.bat :Unzip <path/to/7z.exe> <zip_file> <dest>
REM Overwrite mode: "-aos" Skip extracting of existing files
REM ------------------------------------------------------------------------------------------------
set zip7_exe=%~1
set zip_file=%~2
@ -55,13 +56,9 @@ if not exist "!zip_file!" (
exit /B 1
)
if exist !dest! (
echo - [Unzip/Cached] !zip_file! to !dest!
) else (
echo - [Unzip] !zip_file! to !dest!
call !zip7_dir!\7z.exe x -y -spe -o!dest! !zip_file!
)
exit /B 0
echo - [Unzip] !zip_file! to !dest!
call !zip7_dir!\7z.exe x -y -aos -spe -o!dest! !zip_file!
exit /B %ERRORLEVEL%
:FileHashCheck
REM call win_helpers.bat :FileHashCheck [sha256|md5|...] <file> <hash>
@ -76,7 +73,7 @@ if not exist "!file!" (
)
REM Calculate hash
for /F "tokens=2 delims= " %%c in ('powershell -NoLogo -NoProfile -NonInteractive Get-FileHash -algorithm !algorithm! \"!file!\" ') do ( set "actual=%%c" )
for /F %%c in ('powershell -NoLogo -NoProfile -NonInteractive "Get-FileHash -algorithm !algorithm! \"!file!\" | Select-Object -ExpandProperty Hash "') do ( set "actual=%%c" )
REM Verify Hash
if /I "!expected!" neq "!actual!" (
@ -90,23 +87,23 @@ if /I "!expected!" neq "!actual!" (
echo - [FileHashCheck] !algorithm! OK [file=!file! hash=!expected!]
exit /B 0
:Move
REM call win_helpers.bat :Move <src> <dest>
:MoveDir
REM call win_helpers.bat :MoveDir <src> <dest>
REM ------------------------------------------------------------------------------------------------
set src=%~1
set dest=%~2
if not exist "!src!" (
echo - [Move] File/path does not exist [file=%src%]
echo - [MoveDir] Directory does not exist [dir=%src%]
exit /B 1
)
echo - [Move] Move "!src!" to "!dest!"
robocopy "!src!" "!dest!" /E /MOVE /NP /NJS /NJS /NS /NC /NFL /NDL
echo - [MoveDir] "!src!" to "!dest!"
robocopy "!src!" "!dest!" /E /MOVE /MT /NP /NJS /NS /NC /NFL /NDL
exit /B 0
:MakeBatchShortcut
REM call win_helpers.bat :MakeBatchShortcut <name> <src> <dest_dir>
REM call win_helpers.bat :MakeBatchShortcut <name> <exe> <dest_dir>
REM ------------------------------------------------------------------------------------------------
REM NOTE we make a batch file instead of a symlink because symlinks require
REM admin privileges in windows ...
@ -115,13 +112,13 @@ set executable=%~2
set dest_dir=%~3
if not exist "!executable!" (
echo - [MakeBatchShortcut] Executable for shortcut does not exist [executable=%executable%]
exit /B %ERRORLEVEL%
echo - [MakeBatchShortcut] Executable for shortcut does not exist [exe=%executable%]
exit /B 1
)
if not exist "!dest_dir!" (
echo - [MakeBatchShortcut] Shortcut destination directory does not exist [dir=%dest_dir%]
exit /B %ERRORLEVEL%
exit /B 1
)
echo - [MakeBatchShortcut] Create [name=!name!, exe=!executable!, dest=!dest_dir!]
@ -129,5 +126,79 @@ echo @echo off> "!dest_dir!\!name!.bat"
echo !executable! %%*>> "!dest_dir!\!name!.bat"
exit /B 0
:MakeRelativeBatchShortcut
REM call win_helpers.bat :MakeRelativeBatchShortcut <name> <exe> <dest_dir>
REM ------------------------------------------------------------------------------------------------
REM NOTE we make a batch file instead of a symlink because symlinks require
REM admin privileges in windows ...
set name=%~1
set executable=%~2
set dest_dir=%~3
if not exist "!dest_dir!\!executable!" (
echo - [MakeRelativeBatchShortcut] Executable for shortcut does not exist [exe=!dest_dir!\%executable%]
exit /B 1
)
if not exist "!dest_dir!" (
echo - [MakeRelativeBatchShortcut] Shortcut destination directory does not exist [dir=%dest_dir%]
exit /B 1
)
echo - [MakeRelativeBatchShortcut] Create [name=!name!, exe=!dest_dir!\!executable!, dest=!dest_dir!]
echo @echo off> "!dest_dir!\!name!.bat"
echo %%~dp0!executable! %%*>> "!dest_dir!\!name!.bat"
exit /B 0
:MakeFileHardLink
REM call win_helpers.bat :MakeFileHardLink dest src
REM ------------------------------------------------------------------------------------------------
set dest=%~1
set src=%~2
if not exist "!src!" (
echo - [MakeFileHardLink] Source file does not exist [src=!src!]
exit /B 1
)
if exist "%dest%" (
del "!dest!"
if exist "!dest!" (
echo - [MakeFileHardLink] Failed to delete destination file [dest=!dest!]
exit /B 1
)
)
mklink /H "!dest!" "!src!"
if not exist "!dest!" (
echo - [MakeFileHardLink] Failed to make hard link at dest [src=!src!, dest=!dest!]
exit /B 1
)
exit /B 0
:MakeDirHardLink
REM call win_helpers.bat :MakeDirHardLink dest src
REM ------------------------------------------------------------------------------------------------
set dest=%~1
set src=%~2
if not exist "!src!" (
echo - [MakeDirHardLink] Source file does not exist [src=!src!]
exit /B 1
)
if exist "%dest%" (
rmdir /S /Q "!dest!"
if exist "!dest!" (
echo - [MakeDirHardLink] Failed to delete destination dir [dest=!dest!]
exit /B 1
)
)
mklink /J "!dest!" "!src!"
if not exist "!dest!" (
echo - [MakeDirHardLink] Failed to make hard link at dest [src=!src!, dest=!dest!]
exit /B 1
)
exit /B 0
:exit
exit /B

File diff suppressed because it is too large Load Diff