summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/user
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/user')
-rw-r--r--.config/nvim/lua/user/coderunner.lua23
-rw-r--r--.config/nvim/lua/user/options.lua9
-rw-r--r--.config/nvim/lua/user/treesitter.lua19
3 files changed, 41 insertions, 10 deletions
diff --git a/.config/nvim/lua/user/coderunner.lua b/.config/nvim/lua/user/coderunner.lua
index 77330ab..843534f 100644
--- a/.config/nvim/lua/user/coderunner.lua
+++ b/.config/nvim/lua/user/coderunner.lua
@@ -1,5 +1,15 @@
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",
@@ -7,16 +17,9 @@ 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 = 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,
+ cpp = cxx,
+ c = cxx,
python = 'python3 $file',
- tex = 'mkdir -p build && pdflatex -output-directory=build -output-format=PDF $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"
},
})
diff --git a/.config/nvim/lua/user/options.lua b/.config/nvim/lua/user/options.lua
index 098277d..7a768ab 100644
--- a/.config/nvim/lua/user/options.lua
+++ b/.config/nvim/lua/user/options.lua
@@ -23,6 +23,7 @@ local options = {
expandtab = false, -- !!!!!!!!!
cursorline = false,
number = true,
+ relativenumber = true,
wrap = false,
-- splitting
splitbelow = true,
@@ -31,6 +32,14 @@ local options = {
completeopt = { 'menuone', 'noselect', 'noinsert' },
-- treesitter
foldlevel = 3,
+ spell= true,
+ spelllang="en_gb,ru_yo",
+ mousemodel="popup",
+ spellsuggest = "best,5",
+ undofile = true,
+ undodir = "/home/main/.vim/undo",
+ -- list = true,
+ -- listchars = "space:*,tab:--"
}
for key, val in pairs(options) do
diff --git a/.config/nvim/lua/user/treesitter.lua b/.config/nvim/lua/user/treesitter.lua
index 74b8f56..2f4d6b8 100644
--- a/.config/nvim/lua/user/treesitter.lua
+++ b/.config/nvim/lua/user/treesitter.lua
@@ -3,10 +3,29 @@
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"},
+}
+
+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",
+}
+
+
tsc.setup{
ensure_installed = { "rust", "cpp", "python" },
auto_install = true,