diff options
| -rw-r--r-- | after/ftplugin/c.lua | 1 | ||||
| -rw-r--r-- | after/ftplugin/cpp.lua | 1 | ||||
| -rw-r--r-- | after/ftplugin/netrw.lua | 6 | ||||
| -rw-r--r-- | after/plugin/colors.lua | 3 | ||||
| -rw-r--r-- | after/plugin/fugitive.lua | 5 | ||||
| -rw-r--r-- | after/plugin/harpoon.lua | 10 | ||||
| -rw-r--r-- | after/plugin/lsp.lua | 125 | ||||
| -rw-r--r-- | after/plugin/telescope.lua | 5 | ||||
| -rw-r--r-- | after/plugin/undotree.lua | 1 | ||||
| -rw-r--r-- | after/plugin/vim-gutentags.lua | 78 | ||||
| -rw-r--r-- | init.lua | 17 | ||||
| -rw-r--r-- | lua/talha/functions.lua | 21 | ||||
| -rw-r--r-- | lua/talha/lazy.lua | 69 | ||||
| -rw-r--r-- | lua/talha/plugins/harpoon.lua | 17 | ||||
| -rw-r--r-- | lua/talha/plugins/lsp.lua | 122 | ||||
| -rw-r--r-- | lua/talha/plugins/telescope.lua | 13 | ||||
| -rw-r--r-- | lua/talha/plugins/treesitter.lua | 21 | ||||
| -rw-r--r-- | lua/talha/plugins/vimFugitive.lua | 12 | ||||
| -rw-r--r-- | lua/talha/remap.lua | 23 | ||||
| -rw-r--r-- | lua/talha/set.lua | 13 | ||||
| -rw-r--r-- | snippets/for.c | 2 | ||||
| -rw-r--r-- | snippets/ifelif.c | 4 | ||||
| -rw-r--r-- | snippets/ifelse.c | 4 | ||||
| -rw-r--r-- | snippets/switch.c | 6 |
24 files changed, 224 insertions, 355 deletions
diff --git a/after/ftplugin/c.lua b/after/ftplugin/c.lua new file mode 100644 index 0000000..f3bcf24 --- /dev/null +++ b/after/ftplugin/c.lua @@ -0,0 +1 @@ +vim.opt.cinoptions = 'l1(0' diff --git a/after/ftplugin/cpp.lua b/after/ftplugin/cpp.lua new file mode 100644 index 0000000..f3bcf24 --- /dev/null +++ b/after/ftplugin/cpp.lua @@ -0,0 +1 @@ +vim.opt.cinoptions = 'l1(0' diff --git a/after/ftplugin/netrw.lua b/after/ftplugin/netrw.lua new file mode 100644 index 0000000..3036211 --- /dev/null +++ b/after/ftplugin/netrw.lua @@ -0,0 +1,6 @@ +vim.opt.number = true +vim.opt.relativenumber = true + +vim.keymap.set('n', "h", "<Plug>NetrwBrowseUpDir", { buffer = true}) +vim.keymap.set('n', "l", "<Plug>NetrwLocalBrowseCheck", { buffer = true}) + diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua deleted file mode 100644 index 6757b21..0000000 --- a/after/plugin/colors.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.o.background = "dark" - -vim.cmd("colorscheme vscode") diff --git a/after/plugin/fugitive.lua b/after/plugin/fugitive.lua deleted file mode 100644 index a8aa35c..0000000 --- a/after/plugin/fugitive.lua +++ /dev/null @@ -1,5 +0,0 @@ -vim.keymap.set("n", "<leader>gs", vim.cmd.Git) -vim.keymap.set("n", "<leader>gb", ":Git blame<CR>") --- see docs for more details -vim.keymap.set("n", "<leader>gk", ":diffget //3<CR>") -- get diff from upstream (merge) -vim.keymap.set("n", "<leader>gj", ":diffget //2<CR>") -- get diff from downstream (target) diff --git a/after/plugin/harpoon.lua b/after/plugin/harpoon.lua deleted file mode 100644 index a24b20d..0000000 --- a/after/plugin/harpoon.lua +++ /dev/null @@ -1,10 +0,0 @@ -local mark = require("harpoon.mark") -local ui = require("harpoon.ui") - -vim.keymap.set("n", "<leader>a", mark.add_file) -vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu) - -vim.keymap.set("n", "<C-f>1", function() ui.nav_file(1) end) -vim.keymap.set("n", "<C-f>2", function() ui.nav_file(2) end) -vim.keymap.set("n", "<C-f>3", function() ui.nav_file(3) end) -vim.keymap.set("n", "<C-f>4", function() ui.nav_file(4) end) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua deleted file mode 100644 index c806032..0000000 --- a/after/plugin/lsp.lua +++ /dev/null @@ -1,125 +0,0 @@ -local lsp = require('lsp-zero').preset({}) - --- @notes on Lsp and Cmp configs here: ---[[ - -# LSP -1. Renamed the keymaps to what I use -2. Added a custom handler for formatting files. - It checks the explicitly defined language servers passed and if they allow formatting, only then will it attempt - to format the buffer -3. Since python lsp does not come with formatting, we need to handle that separately - -## Formatting -1. This is handled in 2 ways: - a. By the lsp using vlf (for vl(LSP)f(Format)) - b. By some tool, then defined in the specific language server by using vcf (for vc(Custom)f(Format) - -# Complete -Completion is done by nvim-cmp. The setup for that does a few things. -1. Defines the sources to use for autocompletion: - a. LSP server - b. nvim-lua: only active in lua file I think - c. buffer: uses the current file for auto-completion (similar to default nvim behavior) -2. By default it pops up a list for auto-completion, we have that disabled. -3. When having auto-complete disabled, it takes extra steps to trigger autocomplete, due - to this we need to have it preselect the first item upon triggering autocomplete. -4. We define some custom mappings ---]] - -local function allow_format(servers) - return function(client) return vim.tbl_contains(servers, client.name) end -end - -lsp.on_attach(function(client, bufnr) - -- see :help lsp-zero-keybindings - -- to learn the available actions - local opts = {buffer = bufnr, remap = false} - vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) - vim.keymap.set("n", "gD", function() vim.lsp.buf.declaration() end, opts) - vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) - vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts) - vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts) - vim.keymap.set("n", "[d", function() vim.diagnostic.goto_prev() end, opts) - vim.keymap.set("n", "]d", function() vim.diagnostic.goto_next() end, opts) - vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts) - vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts) - vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts) - vim.keymap.set("n", "<leader>vlf", function() - vim.lsp.buf.format({ - async = false, - timeout_ms = 10000, - filter = allow_format({'rust_analyzer', 'tsserver', 'gopls', 'clangd', 'html-lsp'}), - }) - end, opts) - vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts) -end) - - --- specific setup for python as it's lsp does not come with formatting -require('lspconfig').pyright.setup({ - single_file_support = false, - on_attach = function(_, bufnr) - local opts = {buffer = bufnr, remap = false} - vim.keymap.set({'n', 'x'}, '<leader>vcf', function() - local filename = GetCurrFileName() - vim.cmd(":silent !autopep8 -i " .. filename) - vim.cmd(":silent !isort " .. filename) - end, opts) - end, -}) - -require('lspconfig').lua_ls.setup({ - settings = { - Lua = { - diagnostics = { - globals = { 'vim' } - } - } - } -}) - -lsp.setup() - --- @todo: Look at luasnip and why I would require it - -local cmp = require('cmp') -local cmp_action = require('lsp-zero').cmp_action() - -cmp.setup({ - sources = { - { name = 'nvim_lsp' }, - { name = 'nvim_lua' }, - { name = 'buffer' }, - }, - preselect = 'item', - completion = { - autocomplete = false, - completeopt = 'menu,menuone,noinsert' - }, - mapping = cmp.mapping.preset.insert({ - -- Ctrl+Space to trigger completion menu - ['<C-Space>'] = cmp.mapping.complete(), - - -- Navigate between snippet placeholder - -- @note: don't know what this is - ['<C-f>'] = cmp_action.luasnip_jump_forward(), - ['<C-b>'] = cmp_action.luasnip_jump_backward(), - - -- Scroll up and down in the completion documentation - ['<C-u>'] = cmp.mapping.scroll_docs(-4), - ['<C-d>'] = cmp.mapping.scroll_docs(4), - }), - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end, - }, -}) - ---cmp.setup.filetype({ 'sql' }, { --- sources = { --- { name = 'vim-dadbod-completion' }, --- { name = 'buffer'}, --- }, ---}) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua deleted file mode 100644 index 5c1ec30..0000000 --- a/after/plugin/telescope.lua +++ /dev/null @@ -1,5 +0,0 @@ -local builtin = require('telescope.builtin') -vim.keymap.set('n', '<leader>pf', builtin.find_files) -vim.keymap.set('n', '<C-p>', builtin.git_files) -vim.keymap.set('n', '<leader>ps', builtin.live_grep) -vim.keymap.set('n', '<leader>gw', builtin.grep_string) diff --git a/after/plugin/undotree.lua b/after/plugin/undotree.lua deleted file mode 100644 index a346462..0000000 --- a/after/plugin/undotree.lua +++ /dev/null @@ -1 +0,0 @@ -vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle) diff --git a/after/plugin/vim-gutentags.lua b/after/plugin/vim-gutentags.lua deleted file mode 100644 index 3a4b4cc..0000000 --- a/after/plugin/vim-gutentags.lua +++ /dev/null @@ -1,78 +0,0 @@ -vim.g.gutentags_ctags_exclude = { - '*.git', - '*.svg', - '*.hg', - '*/tests/*', - 'build', - 'dist', - '*sites/*/files/*', - 'bin', - 'node_modules', - 'bower_components', - 'cache', - 'compiled', - 'docs', - 'example', - 'bundle', - 'vendor', - '*.md', - '*-lock.json', - '*.lock', - '*bundle*.js', - '*build*.js', - '.*rc*', - '*.json', - '*.min.*', - '*.map', - '*.bak', - '*.zip', - '*.pyc', - '*.class', - '*.sln', - '*.Master', - '*.csproj', - '*.tmp', - '*.csproj.user', - '*.cache', - '*.pdb', - 'tags*', - 'cscope.*', - '*.css', - '*.less', - '*.scss', - '*.exe', - '*.dll', - '*.mp3', - '*.ogg', - '*.flac', - '*.swp', - '*.swo', - '*.bmp', - '*.gif', - '*.ico', - '*.jpg', - '*.png', - '*.rar', - '*.zip', - '*.tar', - '*.tar.gz', - '*.tar.xz', - '*.tar.bz2', - '*.pdf', - '*.doc', - '*.docx', - '*.ppt', - '*.pptx', -} - -vim.opt.tags = './tags' -vim.g.gutentags_add_default_project_roots = false -vim.g.gutentags_project_root = { '.git' } - -vim.g.gutentags_generate_on_write = true -vim.g.gutentags_generate_on_new = true -vim.g.gutentags_generate_on_missing = true -vim.g.gutentags_generate_on_write = true -vim.g.gutentags_generate_on_empty_buffer = false -vim.g.gutentags_ctags_extra_args = { '--tag-relative=yes', '--fields=+ailmnS' } -vim.g.gutentags_ctags_exclude_wildignore = true @@ -1,20 +1,3 @@ --- Bootstrap lazy.nvim -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end -end -vim.opt.rtp:prepend(lazypath) - -- setup leader key vim.g.mapleader = " " vim.g.maplocalleader = "\\" diff --git a/lua/talha/functions.lua b/lua/talha/functions.lua index ff320e3..2a26483 100644 --- a/lua/talha/functions.lua +++ b/lua/talha/functions.lua @@ -63,24 +63,3 @@ function SafeCListNav(navdir) return nil end end - -function MakeTags() - local on_exit = function(obj) - print('re-generated tags') - end - - vim.system({'ctags', '-R', '.'}, {text = true}, on_exit) -end - -function LoadSnippet(stype) - local ft = '.lua' - local buft = vim.bo.filetype - if buft == 'cpp' then - ft = '.c' - else - ft = '.' .. vim.bo.filetype - end - vim.cmd.read { - GetHomeDir() .. '/.config/nvim/snippets/' .. stype .. ft - } -end diff --git a/lua/talha/lazy.lua b/lua/talha/lazy.lua index 4d7d798..fc79bae 100644 --- a/lua/talha/lazy.lua +++ b/lua/talha/lazy.lua @@ -1,50 +1,23 @@ -require("lazy").setup({ - { "nvim-lua/plenary.nvim" }, - { - "nvim-telescope/telescope.nvim", version = "0.1.2", - dependencies = { "nvim-lua/plenary.nvim" } - }, - { "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - config = function () - local configs = require("nvim-treesitter.configs") - - configs.setup({ - ensure_installed = { - "c", "cpp", - "vim", "vimdoc", "query", - "javascript", "typescript", - "python" - }, - sync_install = false, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - indent = { enable = true }, - }) - end - }, - "Mofiqul/vscode.nvim", - "theprimeagen/harpoon", - "tpope/vim-fugitive", - { - "VonHeikemen/lsp-zero.nvim", - branch = 'v2.x', - dependencies = { - -- LSP Support - {'neovim/nvim-lspconfig'}, -- Required - {'williamboman/mason.nvim'}, -- Optional - {'williamboman/mason-lspconfig.nvim'}, -- Optional +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) - -- Autocompletion - {'hrsh7th/nvim-cmp'}, -- Required - {'hrsh7th/cmp-nvim-lsp'}, -- Required - {'hrsh7th/cmp-buffer'}, -- Required - {'hrsh7th/cmp-nvim-lua'}, - {'L3MON4D3/LuaSnip'}, -- Required - } - }, - --- @DISABLED - -- "mbbill/undotree", +require("lazy").setup({ + "Mofiqul/vscode.nvim", + { "bluz71/vim-moonfly-colors", name = "moonfly", lazy = false, priority = 1000 }, + { "nvim-lua/plenary.nvim" }, + { import = "talha.plugins" }, }) diff --git a/lua/talha/plugins/harpoon.lua b/lua/talha/plugins/harpoon.lua new file mode 100644 index 0000000..96bbbcd --- /dev/null +++ b/lua/talha/plugins/harpoon.lua @@ -0,0 +1,17 @@ +return { + { + "theprimeagen/harpoon", + config = function() + local mark = require("harpoon.mark") + local ui = require("harpoon.ui") + + vim.keymap.set("n", "<leader>a", mark.add_file) + vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu) + + vim.keymap.set("n", "<C-f>1", function() ui.nav_file(1) end) + vim.keymap.set("n", "<C-f>2", function() ui.nav_file(2) end) + vim.keymap.set("n", "<C-f>3", function() ui.nav_file(3) end) + vim.keymap.set("n", "<C-f>4", function() ui.nav_file(4) end) + end + } +} diff --git a/lua/talha/plugins/lsp.lua b/lua/talha/plugins/lsp.lua new file mode 100644 index 0000000..2ceebde --- /dev/null +++ b/lua/talha/plugins/lsp.lua @@ -0,0 +1,122 @@ +return { + { + "VonHeikemen/lsp-zero.nvim", + branch = 'v2.x', + dependencies = { + -- LSP Support + {'neovim/nvim-lspconfig'}, -- Required + {'williamboman/mason.nvim'}, -- Optional + {'williamboman/mason-lspconfig.nvim'}, -- Optional + + -- Autocompletion + {'hrsh7th/nvim-cmp'}, -- Required + {'hrsh7th/cmp-nvim-lsp'}, -- Required + {'hrsh7th/cmp-buffer'}, -- Required + {'hrsh7th/cmp-nvim-lua'}, + {'L3MON4D3/LuaSnip'}, -- Required + }, + config = function() + +local lsp = require('lsp-zero').preset({}) +-- @notes on Lsp and Cmp configs here: +--[[ + +# LSP +1. Renamed the keymaps to what I use +2. Added a custom handler for formatting files. + It checks the explicitly defined language servers passed and if they allow formatting, only then will it attempt + to format the buffer + +# Complete +Completion is done by nvim-cmp. The setup for that does a few things. +1. Defines the sources to use for autocompletion: + a. LSP server + b. nvim-lua: only active in lua file I think + c. buffer: uses the current file for auto-completion (similar to default nvim behavior) +2. By default it pops up a list for auto-completion, we have that disabled. +3. When having auto-complete disabled, it takes extra steps to trigger autocomplete, due + to this we need to have it preselect the first item upon triggering autocomplete. +4. We define some custom mappings +--]] + + local function allow_format(servers) + return function(client) return vim.tbl_contains(servers, client.name) end + end + + + lsp.on_attach(function(client, bufnr) + -- see :help lsp-zero-keybindings + -- to learn the available actions + local opts = {buffer = bufnr, remap = false} + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) + vim.keymap.set("n", "gD", function() vim.lsp.buf.declaration() end, opts) + vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) + vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts) + vim.keymap.set("n", "[d", function() vim.diagnostic.goto_prev() end, opts) + vim.keymap.set("n", "]d", function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts) + vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts) + vim.keymap.set("i", "<C-s>", function() vim.lsp.buf.signature_help() end, opts) + vim.keymap.set("n", "<leader>vlf", function() + vim.lsp.buf.format({ + async = false, + timeout_ms = 10000, + filter = allow_format({'rust_analyzer', 'tsserver', 'gopls', 'clangd', 'html-lsp'}), + }) + end, opts) + end) + + require('lspconfig').lua_ls.setup({ + settings = { + Lua = { + diagnostics = { + globals = { 'vim' } + } + } + } + }) + + lsp.setup() + + -- @todo: Look at luasnip and why I would require it + + + local cmp = require('cmp') + local cmp_action = require('lsp-zero').cmp_action() + + + cmp.setup({ + sources = { + { name = 'nvim_lsp' }, + { name = 'nvim_lua' }, + { name = 'buffer' }, + }, + preselect = 'item', + completion = { + autocomplete = false, + completeopt = 'menu,menuone,noinsert' + }, + mapping = cmp.mapping.preset.insert({ + -- Ctrl+Space to trigger completion menu + ['<C-Space>'] = cmp.mapping.complete(), + + -- Navigate between snippet placeholder + -- @note: don't know what this is + ['<C-f>'] = cmp_action.luasnip_jump_forward(), + ['<C-b>'] = cmp_action.luasnip_jump_backward(), + + -- Scroll up and down in the completion documentation + ['<C-u>'] = cmp.mapping.scroll_docs(-4), + ['<C-d>'] = cmp.mapping.scroll_docs(4), + }), + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + }) + end + }, +} diff --git a/lua/talha/plugins/telescope.lua b/lua/talha/plugins/telescope.lua new file mode 100644 index 0000000..c380c79 --- /dev/null +++ b/lua/talha/plugins/telescope.lua @@ -0,0 +1,13 @@ +return { + { + "nvim-telescope/telescope.nvim", version = "0.1.2", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local builtin = require('telescope.builtin') + vim.keymap.set('n', '<leader>pf', builtin.find_files) + vim.keymap.set('n', '<C-p>', builtin.git_files) + vim.keymap.set('n', '<leader>ps', builtin.live_grep) + vim.keymap.set('n', '<leader>gw', builtin.grep_string) + end + } +} diff --git a/lua/talha/plugins/treesitter.lua b/lua/talha/plugins/treesitter.lua new file mode 100644 index 0000000..3f1efc7 --- /dev/null +++ b/lua/talha/plugins/treesitter.lua @@ -0,0 +1,21 @@ +return { + { + "nvim-treesitter/nvim-treesitter",build = ":TSUpdate", + config = function () + local configs = require("nvim-treesitter.configs") + + configs.setup({ + ensure_installed = { + "c", "cpp", "python", + "vim", "vimdoc", "query", + }, + sync_install = false, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + indent = { enable = false }, + }) + end + } +} diff --git a/lua/talha/plugins/vimFugitive.lua b/lua/talha/plugins/vimFugitive.lua new file mode 100644 index 0000000..32563ab --- /dev/null +++ b/lua/talha/plugins/vimFugitive.lua @@ -0,0 +1,12 @@ +return { + { + "tpope/vim-fugitive", + config = function() + vim.keymap.set("n", "<leader>gs", vim.cmd.Git) + vim.keymap.set("n", "<leader>gb", ":Git blame<CR>") + -- see docs for more details + vim.keymap.set("n", "<leader>gk", ":diffget //3<CR>") -- get diff from upstream (merge) + vim.keymap.set("n", "<leader>gj", ":diffget //2<CR>") -- get diff from downstream (target) + end, + } +} diff --git a/lua/talha/remap.lua b/lua/talha/remap.lua index f2c714b..9e59dc9 100644 --- a/lua/talha/remap.lua +++ b/lua/talha/remap.lua @@ -1,13 +1,7 @@ --- easier navigation -vim.keymap.set("n", "<C-h>", "<C-w><C-h>") -vim.keymap.set("n", "<C-j>", "<C-w><C-j>") -vim.keymap.set("n", "<C-k>", "<C-w><C-k>") -vim.keymap.set("n", "<C-l>", "<C-w><C-l>") - -- tab navigation -vim.keymap.set("n", "<C-t><C-n>", vim.cmd.tabnew) -vim.keymap.set("n", "<C-t><C-h>", vim.cmd.tabp) -vim.keymap.set("n", "<C-t><C-l>", vim.cmd.tabn) +vim.keymap.set("n", "<A-w><A-c>", ":tabnew ") +vim.keymap.set("n", "<A-[>", vim.cmd.tabp) +vim.keymap.set("n", "<A-]>", vim.cmd.tabn) -- open project view with netrw vim.keymap.set("n", "<leader>pv", vim.cmd.Ex) @@ -16,13 +10,6 @@ vim.keymap.set("n", "<leader>pv", vim.cmd.Ex) vim.keymap.set("n", "<leader>vs", vim.cmd.vsplit) vim.keymap.set("n", "<leader>hs", vim.cmd.split) --- moving selected lines across lines -vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") -vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") - --- not moving cursor when bringing files up -vim.keymap.set("n", "J", "mzJ`z") - -- keep cursor in screen center when moving up and down vim.keymap.set("n", "<C-d>", "<C-d>zz") vim.keymap.set("n", "<C-u>", "<C-u>zz") @@ -58,7 +45,3 @@ vim.keymap.set("n", "<A-n>", function() SafeCListNav(1) end) vim.keymap.set("n", "<A-p>", function() SafeCListNav(-1) end) -- open error list when there are errors vim.keymap.set("n", "<A-w>", vim.cmd.cw) - ----- snippets -vim.keymap.set("n", "<A-s>", [[:lua LoadSnippet('')<Left><Left>]]) - diff --git a/lua/talha/set.lua b/lua/talha/set.lua index 91129ad..508a198 100644 --- a/lua/talha/set.lua +++ b/lua/talha/set.lua @@ -3,12 +3,13 @@ local op = vim.opt op.nu = true op.relativenumber = true -op.softtabstop = 2 -op.shiftwidth = 2 -op.expandtab = false +op.softtabstop = 4 +op.tabstop = 4 +op.shiftwidth = 4 +op.expandtab = true op.cindent = true -op.wrap = true +op.wrap = false op.swapfile = false op.backup = false @@ -27,7 +28,9 @@ op.autoread = true op.updatetime = 50 +op.cursorline = false op.colorcolumn = '80' +vim.cmd[[ colorscheme moonfly ]] if vim.fn.executable('rg') > 0 then op.grepprg = 'rg --vimgrep' @@ -37,6 +40,4 @@ end -- required to allow mm (mark-move) command to move file vim.g.netrw_keepdir = 1 vim.g.netrw_banner = 0 ---vim.g.netrw_browse_split = 4 vim.g.netrw_altv = 1 ---vim.g.netrw_liststyle = 3 diff --git a/snippets/for.c b/snippets/for.c deleted file mode 100644 index 4cc9378..0000000 --- a/snippets/for.c +++ /dev/null @@ -1,2 +0,0 @@ -for( ; ; ) { -} diff --git a/snippets/ifelif.c b/snippets/ifelif.c deleted file mode 100644 index 6f37315..0000000 --- a/snippets/ifelif.c +++ /dev/null @@ -1,4 +0,0 @@ -if (_) { -} else if (_) { -} else { -} diff --git a/snippets/ifelse.c b/snippets/ifelse.c deleted file mode 100644 index 03f9dda..0000000 --- a/snippets/ifelse.c +++ /dev/null @@ -1,4 +0,0 @@ -if (_) { -} -else { -} diff --git a/snippets/switch.c b/snippets/switch.c deleted file mode 100644 index b0b527a..0000000 --- a/snippets/switch.c +++ /dev/null @@ -1,6 +0,0 @@ -switch (_) { - case (_): { - } break; - default: { - } break; -} |
