diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 0d35fa18c..4ab827914 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -1708,7 +1708,11 @@ function! SpaceVim#begin() abort else call SpaceVim#logger#info('Startup with argv: ' . string(s:status[1]) ) endif - call SpaceVim#default#options() + if has('nvim-0.7') + lua require('spacevim.default').options() + else + call SpaceVim#default#options() + endif call SpaceVim#default#layers() call SpaceVim#commands#load() endfunction diff --git a/autoload/SpaceVim/default.vim b/autoload/SpaceVim/default.vim index 03bd8c3b6..14d522313 100644 --- a/autoload/SpaceVim/default.vim +++ b/autoload/SpaceVim/default.vim @@ -20,7 +20,6 @@ function! SpaceVim#default#options() abort set guioptions-=L " Hide left-hand scrollbar set guioptions-=r " Hide right-hand scrollbar set guioptions-=b " Hide bottom scrollbar - set showtabline=0 " Hide tabline set guioptions-=e " Hide tab try if s:SYSTEM.isWindows diff --git a/lua/spacevim/default.lua b/lua/spacevim/default.lua new file mode 100644 index 000000000..43d1fc7bb --- /dev/null +++ b/lua/spacevim/default.lua @@ -0,0 +1,154 @@ +--============================================================================= +-- default.lua --- default option +-- Copyright (c) 2016-2019 Wang Shidong & Contributors +-- Author: Wang Shidong < wsdjeg@outlook.com > +-- URL: https://spacevim.org +-- License: GPLv3 +--============================================================================= + + +local M = {} + +local SYSTEM = require('spacevim.api').import('system') +local guifont = '' +local function set_font(font) + vim.o.guifont = font +end + +function M.options() + + if vim.fn.has('gui_running') == 1 then + vim.opt.guioptions:remove( + { + 'm', -- hide menu bar + 'T', -- hide toolbar + 'L', -- hide left-hand scrollbar + 'r', -- hide right-hand scrollbar + 'b', -- hide bottom scrollbar + 'e', -- hide tab + } + ) + if SYSTEM.isWindows then + guifont = 'DejaVu_Sans_Mono_for_Powerline:h11:cANSI:qDRAFT' + elseif SYSTEM.isOSX then + guifont = 'DejaVu Sans Mono for Powerline:h11' + else + guifont = 'DejaVu Sans Mono for Powerline 11' + end + local ok, errors = pcall(set_font, guifont) + + if not ok then + print(errors) + end + end + + -- indent use backspace delete indent, eol use backspace delete line at + -- begining start delete the char you just typed in if you do not use set + -- nocompatible ,you need this + vim.o.backspace = 'indent,eol,start' + vim.opt.nrformats:remove({'octal'}) + vim.o.listchars = 'tab:→ ,eol:↵,trail:·,extends:↷,precedes:↶' + vim.o.fillchars = 'vert:│,fold:·' + vim.o.laststatus = 2 + + vim.o.showcmd = false + + vim.o.autoindent = true + + vim.o.linebreak = true + + vim.o.wildmenu = true + + vim.o.linebreak = true + + vim.o.number = true + + vim.o.autoread = true + + + vim.o.backup = true + + vim.o.undofile = true + + vim.o.undolevels = 1000 + + if vim.fn.has('nvim-0.5.0') == 1 then + + vim.g.data_dir = vim.g.spacevim_data_dir .. 'SpaceVim/' + + else + + vim.g.data_dir = vim.g.spacevim_data_dir .. 'SpaceVim/old/' + + end + + vim.g.backup_dir = vim.g.data_dir .. 'backup//' + vim.g.swap_dir = vim.g.data_dir .. 'swap//' + vim.g.undo_dir = vim.g.data_dir .. 'undofile//' + vim.g.conf_dir = vim.g.data_dir .. 'conf' + + if vim.fn.finddir(vim.g.data_dir) == '' then + vim.fn.mkdir(vim.g.data_dir, 'p', 0700) + end + if vim.fn.finddir(vim.g.backup_dir) == '' then + vim.fn.mkdir(vim.g.backup_dir, 'p', 0700) + end + if vim.fn.finddir(vim.g.swap_dir) == '' then + vim.fn.mkdir(vim.g.swap_dir, 'p', 0700) + end + if vim.fn.finddir(vim.g.undo_dir) == '' then + vim.fn.mkdir(vim.g.undo_dir, 'p', 0700) + end + if vim.fn.finddir(vim.g.conf_dir) == '' then + vim.fn.mkdir(vim.g.conf_dir, 'p', 0700) + end + vim.o.undodir = vim.g.undo_dir + vim.o.backupdir = vim.g.backup_dir + vim.o.directory = vim.g.swap_dir + vim.g.data_dir = nil + vim.g.backup_dir = nil + vim.g.swap_dir = nil + vim.g.undo_dir = nil + vim.g.conf_dir = nil + + vim.o.writebackup = false + + vim.o.matchtime = 0 + + vim.o.ruler = true + + vim.o.showmatch = true + + vim.o.showmode = true + + + vim.o.completeopt = 'menu,menuone,longest' + + vim.o.complete = '.,w,b,u,t' + + vim.o.pumheight = 15 + + vim.o.scrolloff = 1 + vim.o.sidescrolloff = 5 + vim.opt.display = vim.opt.display + {'lastline'} + vim.o.incsearch = true + vim.o.hlsearch = true + vim.o.wildignorecase = true + vim.o.mouse = 'nv' + vim.o.hidden = true + vim.o.ttimeout = true + vim.o.ttimeoutlen = 50 + if vim.fn.has('patch-7.4.314') == 1 then + -- don't give ins-completion-menu messages. + vim.opt.shortmess:append('c') + end + vim.opt.shortmess:append('s') + -- Do not wrap lone lines + vim.o.wrap = false + + vim.o.foldtext = 'SpaceVim#default#Customfoldtext()' + + +end + +return M