summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorAndrew Guschin <guschin@altlinux.org>2023-10-16 15:50:52 +0400
committerAndrew Guschin <guschin@altlinux.org>2023-10-16 15:50:52 +0400
commitb2b1f661e55c2a1139aef1f8f8aa4a11b10d3b01 (patch)
tree200094a27a17f2a74f31128786726514181108e1 /lua
Initial commit
Diffstat (limited to 'lua')
-rw-r--r--lua/filetype-config.lua8
-rw-r--r--lua/keybindings.lua44
-rw-r--r--lua/plugins.lua56
3 files changed, 108 insertions, 0 deletions
diff --git a/lua/filetype-config.lua b/lua/filetype-config.lua
new file mode 100644
index 0000000..132913b
--- /dev/null
+++ b/lua/filetype-config.lua
@@ -0,0 +1,8 @@
+vim.api.nvim_create_autocmd("FileType", {
+ pattern = {"tex", "json", "haskell", "markdown", "lua"},
+ callback = function ()
+ vim.opt_local.tabstop = 2
+ vim.opt_local.softtabstop = 2
+ vim.opt_local.shiftwidth = 2
+ end
+})
diff --git a/lua/keybindings.lua b/lua/keybindings.lua
new file mode 100644
index 0000000..e10e458
--- /dev/null
+++ b/lua/keybindings.lua
@@ -0,0 +1,44 @@
+vim.g.mapleader = " "
+
+-- Splits keybindings
+vim.keymap.set("n", "<leader>s", "<ESC>:vsplit<CR>")
+vim.keymap.set("n", "<leader>vs", "<ESC>:split<CR>")
+
+-- Splits shortcuts
+vim.keymap.set("n", "<leader>j", "<C-W><C-J>")
+vim.keymap.set("n", "<leader>k", "<C-W><C-K>")
+vim.keymap.set("n", "<leader>l", "<C-W><C-L>")
+vim.keymap.set("n", "<leader>h", "<C-W><C-H>")
+
+-- Horizontal window resizing
+vim.keymap.set("n", "<leader>.", "<C-W>>")
+vim.keymap.set("n", "<leader>,", "<C-W><")
+
+-- Copy to system clipboard
+vim.keymap.set("n", "<leader>y", '"+y')
+vim.keymap.set("v", "<leader>y", '"+y')
+vim.keymap.set("n", "<leader>d", '"+d')
+vim.keymap.set("v", "<leader>d", '"+d')
+
+-- Terminal mode
+-- au TerminalOpen * setlocal nospell
+vim.keymap.set('t', "<leader><ESC>", "<C-\\><C-n>")
+vim.keymap.set('t', "<S-space>", "<space>")
+
+-- Tabs
+vim.keymap.set("n", "<leader>tn", ":tabnew<CR>")
+vim.keymap.set("n", "<leader>tt", ":tabnew | term<CR>")
+vim.keymap.set("n", "<leader>th", ":tabprevious<CR>")
+vim.keymap.set("n", "<leader>tl", ":tabnext<CR>")
+vim.keymap.set("n", "<leader>tc", ":tabclose<CR>")
+vim.keymap.set("n", "<leader>t,", ":tabmove -1<CR>")
+vim.keymap.set("n", "<leader>t.", ":tabmove +1<CR>")
+
+-- Trailing whitespace trimmer
+function trim_whitespace()
+ local view = vim.fn.winsaveview()
+ vim.cmd.retab()
+ vim.cmd[[keeppatterns %s/\s\+$//e]]
+ vim.fn.winrestview(view)
+end
+vim.keymap.set("n", "<leader>f", trim_whitespace)
diff --git a/lua/plugins.lua b/lua/plugins.lua
new file mode 100644
index 0000000..0a22d75
--- /dev/null
+++ b/lua/plugins.lua
@@ -0,0 +1,56 @@
+local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
+if not vim.loop.fs_stat(lazypath) then
+ vim.fn.system({
+ "git",
+ "clone",
+ "--filter=blob:none",
+ "https://github.com/folke/lazy.nvim.git",
+ "--branch=stable",
+ lazypath,
+ })
+end
+vim.opt.rtp:prepend(lazypath)
+
+-- Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
+-- Plug 'junegunn/fzf.vim'
+-- Plug 'tpope/vim-fugitive'
+-- Plug 'hrsh7th/vim-vsnip'
+--
+-- " Languages
+-- Plug 'prabirshrestha/vim-lsp'
+
+
+require("lazy").setup({
+ { "numToStr/Comment.nvim", lazy = false, opts = {} },
+ {
+ "nvim-lualine/lualine.nvim",
+ lazy = false,
+ opts = {
+ options = {
+ icons_enabled = false,
+ theme = "powerline",
+ },
+ }
+ },
+ {
+ "nvim-treesitter/nvim-treesitter",
+ build = ":TSUpdate",
+ config = function ()
+ local configs = require("nvim-treesitter.configs")
+ configs.setup({
+ ensure_installed = {
+ "c", "cpp", "lua", "vimdoc", "haskell", "bibtex", "markdown_inline",
+ "cmake", "rust", "glsl", "python", "bash", "arduino", "css", "diff",
+ "dockerfile", "json", "vim", "kconfig", "latex", "make", "markdown",
+ "go", "html", "ocaml", "org", "norg", "toml", "vue", "xml", "yaml",
+ },
+ sync_install = false,
+ highlight = { enable = true },
+ indent = { enable = true },
+ })
+ end
+ },
+ "lervag/vimtex",
+ "powerman/vim-plugin-ruscmd",
+})
+