Add teaching script
This commit is contained in:
parent
7f84db5ff1
commit
8869ac7e75
|
@ -6,6 +6,7 @@ require('treesitter_config')
|
|||
require('lualine_config')
|
||||
require('mappings')
|
||||
require('nvim_tree_config')
|
||||
require('teaching')
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", { pattern = "make", command = [[set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab]] })
|
||||
vim.api.nvim_create_autocmd("FileType", { pattern = "vimwiki", command = [[setlocal shiftwidth=2 softtabstop=2 expandtab]] })
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||
"awesomewm-vim-tmux-navigator": { "branch": "master", "commit": "e448723a099a4a702830ffa73791bf5e99b5ef69" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "d24378edc14a675c820a303b4512af3bbc5761e9" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp-snippy": { "branch": "master", "commit": "c4dc31232c510cd32d4708701e6f06746d46df90" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "7e5a85c186027cab1e825d018f07c350177077fc" },
|
||||
"flash.nvim": { "branch": "main", "commit": "967117690bd677cb7b6a87f0bc0077d2c0be3a27" },
|
||||
"formatter.nvim": { "branch": "master", "commit": "44c89f09dcc220dc2a9b056e93c3a87c86e79804" },
|
||||
|
@ -10,21 +15,24 @@
|
|||
"lush.nvim": { "branch": "main", "commit": "a8f0f7b9f837887f13a61d67b40ae26188fe4d62" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "dfdd771b792fbb4bad8e057d72558255695aa1a7" },
|
||||
"mason.nvim": { "branch": "main", "commit": "c811fbf09c7642eebb37d6694f1a016a043f6ed3" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "183f5a7357397260b631d6cccceccc3621b50f78" },
|
||||
"neogit": { "branch": "master", "commit": "f51183aad6afc91e15ff3dde94f17f2f2bea03d5" },
|
||||
"neogit": { "branch": "master", "commit": "800a366b9ecd6adf356503bdae93278018bd7a23" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "ae5b41ce880a6d850055e262d6dfebd362bb276e" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "a27356f1ef9c11e1f459cc96a3fcac5c265e72d6" },
|
||||
"nvim-snippy": { "branch": "master", "commit": "ee3b830787538f259b84867c8971c4284abc4a8d" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "59e65d88db177ad1e6a8cffaafd4738420ad20b6" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "d0b17cc0b9c8c3055530770a9dd4de659232c692" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "d94e1ad9575cc211b5726f09b28ca9454aba22fe" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" },
|
||||
"oil.nvim": { "branch": "master", "commit": "c12a12c34da2a04465308f410095bcbe47996f0b" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "0dbe561ae023f02c2fb772b879e905055b939ce3" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
|
||||
"telescope-undo.nvim": { "branch": "main", "commit": "3dec002ea3e7952071d26fbb5d01e2038a58a554" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "207285ccec21b69996a4d3bcfa59df35d48610e8" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "1dfa66b845673effc8771f9ebe511bb36a09f560" },
|
||||
"trim.nvim": { "branch": "master", "commit": "2df124c2c2844d3143091ebd3ae8b49bbe06bc5e" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "40aad004f53ae1d1ba91bcc5c29d59f07c5f01d3" },
|
||||
"vim-bracketed-paste": { "branch": "master", "commit": "45411da73cc159e4fc2138d930553d247bbfbcdc" },
|
||||
"vim-rooter": { "branch": "master", "commit": "4f52ca556a0b9e257bf920658714470ea0320b7a" },
|
||||
"vim-snippets": { "branch": "master", "commit": "d37486881a0a771b844a235bc3e025046088690d" },
|
||||
"vimtex": { "branch": "master", "commit": "534fd725f2475a9083b032e402c7e73b8a3fc6bb" },
|
||||
"vimwiki": { "branch": "dev", "commit": "f0fe154ede6b11e3db9b058b930005a056a3d1c6" }
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
local teaching = {}
|
||||
|
||||
local function ends_with(path, extension)
|
||||
return string.sub(path, -#extension) == extension
|
||||
end
|
||||
|
||||
local function should_load(path)
|
||||
if string.find(path, "build") or string.find(path, "sfml") then
|
||||
return false
|
||||
elseif ends_with(path, ".h") or ends_with(path, ".cpp") or ends_with(path, ".cpp") or ends_with(path, ".cpp") then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function teaching.load()
|
||||
require("nvim-tree").open()
|
||||
require("trouble").open()
|
||||
local scan = require("plenary.scandir").scan_dir('.')
|
||||
local cwd = vim.fn.getcwd()
|
||||
for _, v in ipairs(scan) do
|
||||
local filename = vim.fs.normalize(v)
|
||||
if should_load(v) then
|
||||
vim.api.nvim_set_current_dir(cwd)
|
||||
local buf_id = vim.fn.bufadd(filename)
|
||||
vim.api.nvim_set_current_buf(buf_id)
|
||||
vim.api.nvim_buf_set_option(buf_id, "buflisted", true)
|
||||
end
|
||||
end
|
||||
vim.api.nvim_set_current_dir(cwd)
|
||||
end
|
||||
|
||||
return teaching
|
Loading…
Reference in New Issue