summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua')
-rw-r--r--.config/nvim/lua/user/autocommds.lua43
-rw-r--r--.config/nvim/lua/user/coderunner.lua23
-rw-r--r--.config/nvim/lua/user/options.lua8
-rw-r--r--.config/nvim/lua/user/plugins.lua5
-rw-r--r--.config/nvim/lua/user/remaps.lua15
-rw-r--r--.config/nvim/lua/user/treesitter.lua21
6 files changed, 85 insertions, 30 deletions
diff --git a/.config/nvim/lua/user/autocommds.lua b/.config/nvim/lua/user/autocommds.lua
new file mode 100644
index 0000000..934cda8
--- /dev/null
+++ b/.config/nvim/lua/user/autocommds.lua
@@ -0,0 +1,43 @@
+
+local reloadgroup = vim.api.nvim_create_augroup("ReloadGroup", { clear = true })
+require'user.remaps'
+
+vim.api.nvim_create_autocmd (
+ "BufWritePost",
+ {
+ group = reloadgroup,
+ pattern = "*.tex",
+ callback = function()
+ vim.system( {'bash',
+ '-c',
+ "latexmk -shell-escape -xelatex " .. vim.fn.expand('%:t') .. " && pkill -HUP mupdf"},
+ {detach = true})
+ end}
+)
+
+vim.api.nvim_create_autocmd (
+ {"BufRead", "BufNewFile"}, {
+ pattern = {"*.tex"},
+ callback = function()
+ if (global_inde == nil) then
+ global_inde = vim.opt.indentexpr:get()
+ end
+ vim.bo.autoindent = false
+ vim.bo.smartindent = false
+ vim.bo.cindent = false
+ vim.bo.indentexpr = nil
+ end,
+})
+
+-- vim.api.nvim_create_autocmd (
+-- "InsertEnter", {
+-- once = true,
+-- group = reloadgroup,
+-- pattern = "*.tex",
+-- callback = function()
+-- vim.system(
+-- {'latexmk', '-xelatex', '-pvc', vim.fn.expand('%:t')},
+-- { detach = true })
+-- end
+-- }
+-- )
diff --git a/.config/nvim/lua/user/coderunner.lua b/.config/nvim/lua/user/coderunner.lua
index 843534f..77330ab 100644
--- a/.config/nvim/lua/user/coderunner.lua
+++ b/.config/nvim/lua/user/coderunner.lua
@@ -1,15 +1,5 @@
local term = require'toggleterm'
-cxx = function()
- local script =
- 'echo $file > /dev/null;' ..
- 'OLDPWD_=\\${PWD};' ..
- 'while [[ ! -f CMakeLists.txt || ! -f compile_commands.json && \\\"\\$PWD\\\" != / ]]; do cd ..; done;' ..
- 'if [[ -f CMakeLists.txt && -f compile_commands.json ]]; then mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. && make -j24 && ' ..
- './\\$(sed -nr \\\"/add_executable/s/.*add_executable\\\\((\\\\S+).+/\\\\1/p\\\" ../CMakeLists.txt); fi;' ..
- 'cd ${OLDPWD_}'
- vim.cmd(string.format("TermExec cmd='%s'", script))
-end
-- Define the code runner configuration
require('code_runner').setup({
mode = "toggleterm",
@@ -17,9 +7,16 @@ require('code_runner').setup({
startinsert = true,
filetype = {
rust = 'cargo check; if [ \\$? -ne 0 ]; then echo cargo check failed; else cargo run || cargo test -- --nocapture --test-threads=1; fi; echo $file > /dev/null',
- cpp = cxx,
- c = cxx,
+ cpp = function()
+ local script =
+ 'echo $file > /dev/null;' ..
+ 'while [[ ! -f CMakeLists.txt && \\\"\\$PWD\\\" != / ]]; do cd ..; done;' ..
+ 'if [[ -f CMakeLists.txt ]]; then mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. && make -j24 && ' ..
+ './\\$(sed -nr \\\"/add_executable/s/.*add_executable\\\\((\\\\S+).+/\\\\1/p\\\" ../CMakeLists.txt); fi;' ..
+ 'cd ..'
+ vim.cmd(string.format("TermExec cmd='%s'", script))
+ end,
python = 'python3 $file',
- tex = "mkdir -p build && if pdflatex -interaction=batchmode -output-directory=build -output-format=pdf $file; then killall -SIGHUP mupdf; else echo -e \\\\\\\\x1b[1\\\\;31mBUILD FAILED\\\\\\\\x1b[0m; fi"
+ tex = 'mkdir -p build && pdflatex -output-directory=build -output-format=PDF $file'
},
})
diff --git a/.config/nvim/lua/user/options.lua b/.config/nvim/lua/user/options.lua
index 7a768ab..efa207a 100644
--- a/.config/nvim/lua/user/options.lua
+++ b/.config/nvim/lua/user/options.lua
@@ -23,7 +23,7 @@ local options = {
expandtab = false, -- !!!!!!!!!
cursorline = false,
number = true,
- relativenumber = true,
+ relativenumber = true,
wrap = false,
-- splitting
splitbelow = true,
@@ -32,9 +32,9 @@ local options = {
completeopt = { 'menuone', 'noselect', 'noinsert' },
-- treesitter
foldlevel = 3,
- spell= true,
- spelllang="en_gb,ru_yo",
- mousemodel="popup",
+ spell = ture,
+ spelllang = "en_gb,ru_yo",
+ mousemodel = "popup",
spellsuggest = "best,5",
undofile = true,
undodir = "/home/main/.vim/undo",
diff --git a/.config/nvim/lua/user/plugins.lua b/.config/nvim/lua/user/plugins.lua
index 06b52d1..e632cff 100644
--- a/.config/nvim/lua/user/plugins.lua
+++ b/.config/nvim/lua/user/plugins.lua
@@ -24,7 +24,6 @@ plugins = {
{
"windwp/nvim-autopairs",
event = { "InsertEnter" }, -- automatically pair brackets and quotes
-
},
{
"tpope/vim-surround", -- replace quotes e.t.c
@@ -46,7 +45,7 @@ plugins = {
{ "simrat39/rust-tools.nvim" }, -- no commments
- -- { "hrsh7th/vim-vsnip" }, -- snippet engine
+ { "hrsh7th/vim-vsnip" }, -- snippet engine
{
"L3MON4D3/LuaSnip", -- better snippet engine
event = { "InsertEnter" },
@@ -111,7 +110,7 @@ plugins = {
-- dependencies = 'nvim-tree/nvim-web-devicons'
-- for more details on how to configure this plugin in details please see `:h bufferline-configuration`
},
- --{ "lvimuser/lsp-inlayhints.nvim" } -- saved for the better times
+ -- { "lvimuser/lsp-inlayhints.nvim" } -- saved for the better times
-- DEBUGGER CONFIGURATION
{
diff --git a/.config/nvim/lua/user/remaps.lua b/.config/nvim/lua/user/remaps.lua
index 8839890..8e9ee26 100644
--- a/.config/nvim/lua/user/remaps.lua
+++ b/.config/nvim/lua/user/remaps.lua
@@ -99,6 +99,21 @@ lmap("n", "d]", vim.diagnostic.goto_next)
map("n", "<F5>", ":RunCode<CR>", opt)
map("n", "<F2>", ":echo 'time: ' . strftime('%c')<CR>", opt)
+lmap("n", "<F8>", function()
+ if (global_inde == nil) then
+ global_inde = vim.opt.indentexpr:get()
+ end
+ inde = vim.opt.indentexpr:get()
+ if inde ~= "" then
+ vim.opt.indentexpr = ""
+ print"indentation disabled"
+ else
+ vim.opt.indentexpr = global_inde
+ print"indentation enabled"
+ end
+ vim.cmd("set si! cin! ai!")
+end)
+
-- language server remaps
-- enable only after attaching language server to buffer
vim.api.nvim_create_autocmd('LspAttach', {
diff --git a/.config/nvim/lua/user/treesitter.lua b/.config/nvim/lua/user/treesitter.lua
index 2f4d6b8..4ba181b 100644
--- a/.config/nvim/lua/user/treesitter.lua
+++ b/.config/nvim/lua/user/treesitter.lua
@@ -3,26 +3,27 @@
local ts = require 'nvim-treesitter'
local tsc = require 'nvim-treesitter.configs'
+
local tsp = require 'nvim-treesitter.parsers'
local tsi = require 'nvim-treesitter.install'
-
+
vim.wo.foldmethod = 'expr'
vim.wo.foldexpr = 'nvim_treesitter#foldexpr()'
-
+
tsi.compilers = { 'clang' }
vim.filetype.add{
- pattern = {[".*/hypr/.*%.conf"] = "hyprlang"},
+ pattern = {[".*/hypr/.*%.conf"] = "hyprlang"},
}
tsp.get_parser_configs().hyprland = {
- install_info = {
- url = "~/src/tree-sitter-hyprlang/",
- files = {"src/parser.c"},
- branch = "master",
- requires_generate_from_grammar = false, --ligma ballse
- },
- filetype = "hyprlang",
+ install_info = {
+ url = "~/src/tree-sitter-hyprlang/",
+ files = {"src/parser.c"},
+ branch = "master",
+ requires_generate_from_grammar = false, --ligma ballse
+ },
+ filetype = "hyprlang",
}