some changes

This commit is contained in:
jhe 2024-05-22 16:02:16 +02:00
parent 5aeddfdd5d
commit 1d6812e2f0
No known key found for this signature in database
GPG Key ID: 10FFC60F6B8DC9B7
5 changed files with 46 additions and 4 deletions

3
ftplugin/javascript.lua Normal file
View File

@ -0,0 +1,3 @@
vim.o.tabstop = 4
vim.o.shiftwidth = 4
vim.o.expandtab = true

4
ftplugin/main.js Normal file
View File

@ -0,0 +1,4 @@
if (true) {
console.log("Hello world");
}

4
ftplugin/main.py Normal file
View File

@ -0,0 +1,4 @@
if True:
print("Hello world")

3
ftplugin/python.lua Normal file
View File

@ -0,0 +1,3 @@
vim.o.tabstop = 2
vim.o.shiftwidth = 2
vim.o.expandtab = true

View File

@ -99,10 +99,10 @@ vim.g.have_nerd_font = false
-- For more options, you can see `:help option-list` -- For more options, you can see `:help option-list`
-- Make line numbers default -- Make line numbers default
vim.opt.number = true -- vim.opt.number = true
-- You can also add relative line numbers, to help with jumping. -- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it! -- Experiment for yourself to see if you like it!
-- vim.opt.relativenumber = true vim.opt.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example! -- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = 'a' vim.opt.mouse = 'a'
@ -193,6 +193,34 @@ vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper win
-- [[ Basic Autocommands ]] -- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands` -- See `:help lua-guide-autocommands`
-- Restore cursor position
vim.api.nvim_create_autocmd({ 'BufReadPost' }, {
pattern = { '*' },
callback = function()
vim.api.nvim_exec('silent! normal! g`"zv', false)
end,
})
-- Function to set tab width
--[[
local set_tab_width = function(ft, width)
vim.api.nvim_create_autocmd('FileType', {
pattern = ft,
callback = function()
vim.bo.shiftwidth = width
vim.bo.tabstop = width
--vim.bo.expandtab = true
end,
})
end
]]
--
-- Set tabwidth for file types
--set_tab_width('python', 4)
--set_tab_width('c', 4)
--set_tab_width('c++', 2)
-- Highlight when yanking (copying) text -- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode -- Try it with `yap` in normal mode
-- See `:help vim.highlight.on_yank()` -- See `:help vim.highlight.on_yank()`
@ -226,7 +254,7 @@ vim.opt.rtp:prepend(lazypath)
-- NOTE: Here is where you install your plugins. -- NOTE: Here is where you install your plugins.
require('lazy').setup({ require('lazy').setup({
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically --'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
-- NOTE: Plugins can also be added by using a table, -- NOTE: Plugins can also be added by using a table,
-- with the first argument being the link and the following -- with the first argument being the link and the following
@ -784,7 +812,7 @@ require('lazy').setup({
-- Load the colorscheme here. -- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load -- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-night' vim.cmd.colorscheme 'desert'
-- You can configure highlights by doing something like: -- You can configure highlights by doing something like:
vim.cmd.hi 'Comment gui=none' vim.cmd.hi 'Comment gui=none'