Changed tabs to spaces

This commit is contained in:
Ivar Fatland
2023-05-27 00:16:03 +02:00
parent 994f824173
commit da39c4964d
+93 -90
View File
@@ -1,108 +1,111 @@
local keymap = { local keymap = {
search_for_files_in_working_directory = '<c-p>', search_for_files_in_working_directory = '<c-p>',
search_for_previously_opened_files = '<Space><Space>', search_for_previously_opened_files = '<Space><Space>',
search_within_open_file = '<Space>fg', search_within_open_file = '<Space>fg',
search_help_pages = '<Space>fh', search_help_pages = '<Space>fh',
rename_symbol = '<leader>rn', rename_symbol = '<leader>rn',
code_action = '<leader>ca', code_action = '<leader>ca',
go_to_definition = 'gd', go_to_definition = 'gd',
go_to_implementation = 'gi', go_to_implementation = 'gi',
show_references = 'gr', show_references = 'gr',
hovering_documentation = 'K', hovering_documentation = 'K',
toggle_file_explorer ='<c-n>', toggle_file_explorer ='<c-n>',
leader_key = ';', leader_key = ';',
} }
vim.g.mapleader = keymap.leader_key vim.g.mapleader = keymap.leader_key
vim.g.maplocalleader = keymap.leader_key vim.g.maplocalleader = keymap.leader_key
vim.opt.tabstop = 4 -- Chacacter width of a tab vim.opt.tabstop = 4 -- Character width of a tab
vim.opt.shiftwidth = 0 -- Will always be eual to the tabstop vim.opt.shiftwidth = 0 -- Will always be eual to the tabstop
vim.opt.rnu = true -- Shows relative line numbers vim.opt.rnu = true -- Shows relative line numbers
vim.opt.nu = true -- Shows current line number vim.opt.nu = true -- Shows current line number
vim.opt.wrap = false -- Don't wrap the line. Let it go offscreen. vim.opt.wrap = false -- Don't wrap the line. Let it go offscreen.
vim.opt.shiftround = true
vim.opt.expandtab = true
-- Will only run the first time nvim launches to install packer -- Will only run the first time nvim launches to install packer
local ensure_packer = function() local ensure_packer = function()
local fn = vim.fn local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]] vim.cmd [[packadd packer.nvim]]
return true return true
end end
return false return false
end end
local packer_bootstrap = ensure_packer() local packer_bootstrap = ensure_packer()
-- Packages -- Packages
local function packer_startup(use) local function packer_startup(use)
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
use 'lervag/vimtex' -- Latex use 'lervag/vimtex' -- Latex
vim.g.vimtex_view_method = 'zathura' vim.g.vimtex_view_method = 'zathura'
use 'ellisonleao/gruvbox.nvim' -- Theme use 'ellisonleao/gruvbox.nvim' -- Theme
vim.o.termguicolors = true vim.o.termguicolors = true
vim.cmd [[ colorscheme gruvbox ]] vim.cmd [[ colorscheme gruvbox ]]
use 'nvim-tree/nvim-tree.lua' -- File explorer use 'nvim-tree/nvim-tree.lua' -- File explorer
vim.g.loaded_netrw = 1 vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1 vim.g.loaded_netrwPlugin = 1
require('nvim-tree').setup() require('nvim-tree').setup()
vim.keymap.set('n', keymap.toggle_file_explorer, ':NvimTreeFindFileToggle<CR>') vim.keymap.set('n', keymap.toggle_file_explorer, ':NvimTreeFindFileToggle<CR>')
use 'nvim-tree/nvim-web-devicons' -- Icons for file explorer and info bar use 'nvim-tree/nvim-web-devicons' -- Icons for file explorer and info bar
use 'nvim-lualine/lualine.nvim' -- Lower info-bar use 'nvim-lualine/lualine.nvim' -- Lower info-bar
require('lualine').setup {options = {icons_enabled = true, theme = 'gruvbox'}} require('lualine').setup {options = {icons_enabled = true, theme = 'gruvbox'}}
use 'nvim-treesitter/nvim-treesitter' -- Syntax highlighting use 'nvim-treesitter/nvim-treesitter' -- Syntax highlighting
require('nvim-treesitter.configs').setup { require('nvim-treesitter.configs').setup {
ensure_installed = 'all', ensure_installed = 'all',
sync_install = false, sync_install = false,
auto_install = true, auto_install = true,
highlight = { highlight = {
enable = true, enable = true,
additional_vim_regex_highlighting = false, additional_vim_regex_highlighting = false,
} }
} }
use { -- LSP use { -- LSP
'williamboman/mason.nvim', 'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim', 'williamboman/mason-lspconfig.nvim',
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
} require('mason').setup() } require('mason').setup()
require('mason-lspconfig').setup{ require('mason-lspconfig').setup{
ensure_installed = { ensure_installed = {
'clangd', 'golangci_lint_ls', 'kotlin_language_server', 'clangd', 'golangci_lint_ls', 'kotlin_language_server',
'ltex', 'lua_ls', 'marksman', 'pyright', 'zls', 'rust_analyzer' 'ltex', 'lua_ls', 'marksman', 'pyright', 'zls', 'rust_analyzer'
} }
} }
require("mason-lspconfig").setup_handlers { require("mason-lspconfig").setup_handlers {
function (server_name) function (server_name)
require("lspconfig")[server_name].setup {} require("lspconfig")[server_name].setup {}
end, end,
} }
vim.keymap.set('n', keymap.rename_symbol, vim.lsp.buf.rename, {}) vim.keymap.set('n', keymap.rename_symbol, vim.lsp.buf.rename, {})
vim.keymap.set('n', keymap.code_action, vim.lsp.buf.code_action, {}) vim.keymap.set('n', keymap.code_action, vim.lsp.buf.code_action, {})
vim.keymap.set('n', keymap.go_to_definition, vim.lsp.buf.definition, {}) vim.keymap.set('n', keymap.go_to_definition, vim.lsp.buf.definition, {})
vim.keymap.set('n', keymap.go_to_implementation, vim.lsp.buf.implementation, {}) vim.keymap.set('n', keymap.go_to_implementation, vim.lsp.buf.implementation, {})
vim.keymap.set('n', keymap.show_references, require('telescope.builtin').lsp_references, {}) vim.keymap.set('n', keymap.show_references, require('telescope.builtin').lsp_references, {})
vim.keymap.set('n', keymap.hovering_documentation, vim.lsp.buf.hover, {}) vim.keymap.set('n', keymap.hovering_documentation, vim.lsp.buf.hover, {})
use { 'nvim-telescope/telescope.nvim', -- FuzzyFind use { 'nvim-telescope/telescope.nvim', -- FuzzyFind
tag = '0.1.1', tag = '0.1.1',
requires = { requires = {
{'nvim-lua/plenary.nvim'}, {'nvim-lua/plenary.nvim'},
{'BurntSushi/ripgrep'}, {'BurntSushi/ripgrep'},
-- ripgrep might not actually -- ripgrep might not actually
-- be a nvim package -- be a nvim package
} }
}; local builtin = require('telescope.builtin') }; local builtin = require('telescope.builtin')
vim.keymap.set('n', keymap.search_for_files_in_working_directory, builtin.find_files, {}) vim.keymap.set('n', keymap.search_for_files_in_working_directory, builtin.find_files, {})
vim.keymap.set('n', keymap.search_for_previously_opened_files, builtin.oldfiles, {}) vim.keymap.set('n', keymap.search_for_previously_opened_files, builtin.oldfiles, {})
vim.keymap.set('n', keymap.search_within_open_file, builtin.live_grep, {}) vim.keymap.set('n', keymap.search_within_open_file, builtin.live_grep, {})
vim.keymap.set('n', keymap.search_help_pages, builtin.help_tags, {}) vim.keymap.set('n', keymap.search_help_pages, builtin.help_tags, {})
if packer_bootstrap then -- Must be last instruction. if packer_bootstrap then -- Must be last instruction.
require('packer').sync() require('packer').sync()
end end
end end
return require('packer').startup(packer_startup) return require('packer').startup(packer_startup)