From b2b1f661e55c2a1139aef1f8f8aa4a11b10d3b01 Mon Sep 17 00:00:00 2001 From: Andrew Guschin Date: Mon, 16 Oct 2023 15:50:52 +0400 Subject: Initial commit --- lua/filetype-config.lua | 8 +++++++ lua/keybindings.lua | 44 ++++++++++++++++++++++++++++++++++++++ lua/plugins.lua | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 lua/filetype-config.lua create mode 100644 lua/keybindings.lua create mode 100644 lua/plugins.lua (limited to 'lua') 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", "s", ":vsplit") +vim.keymap.set("n", "vs", ":split") + +-- Splits shortcuts +vim.keymap.set("n", "j", "") +vim.keymap.set("n", "k", "") +vim.keymap.set("n", "l", "") +vim.keymap.set("n", "h", "") + +-- Horizontal window resizing +vim.keymap.set("n", ".", ">") +vim.keymap.set("n", ",", "<") + +-- Copy to system clipboard +vim.keymap.set("n", "y", '"+y') +vim.keymap.set("v", "y", '"+y') +vim.keymap.set("n", "d", '"+d') +vim.keymap.set("v", "d", '"+d') + +-- Terminal mode +-- au TerminalOpen * setlocal nospell +vim.keymap.set('t', "", "") +vim.keymap.set('t', "", "") + +-- Tabs +vim.keymap.set("n", "tn", ":tabnew") +vim.keymap.set("n", "tt", ":tabnew | term") +vim.keymap.set("n", "th", ":tabprevious") +vim.keymap.set("n", "tl", ":tabnext") +vim.keymap.set("n", "tc", ":tabclose") +vim.keymap.set("n", "t,", ":tabmove -1") +vim.keymap.set("n", "t.", ":tabmove +1") + +-- 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", "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", +}) + -- cgit v1.2.3